1 Introduction
1.1 QualitiesofaWell-DesignedFramework
1.1.1 Well-DesignedFrameworksAreSimple
1.1.2 Well-DesignedFrameworksAreExpensivetoDesign
1.1.3 Well-DesignedFrameworksAreFullofTrade-Offs
1.1.4 Well-DesignedFrameworksBorrowfromthePast
1.1.5 Well-DesignedFrameworksAreDesignedtoEvolve
1.1.6 Well-DesignedFrameworksAreIntegrated
1.1.7 Well-DesignedFrameworksAreConsistent
2 FrameworkDesignFundamentals
2.1 ProgressiveFrameworks
2.2 FundamentalPrinciplesofFrameworkDesign
2.2.1 ThePrincipleofScenario-DrivenDesign
2.2.2 ThePrincipleofLowBarriertoEntry
2.2.3 ThePrincipleofSelf-DocumentingObjectModels
2.2.4 ThePrincipleofLayeredArchitecture
3 NamingGuidelines
3.1 CapitalizationConventions
3.1.1 CapitalizationRulesforIdentifiers
3.1.2 CapitalizingAcronyms
3.1.3 CapitalizingCompoundWordsandCommonTerms
3.1.4 CaseSensitivity
3.2 GeneralNamingConventions
3.2.1 WordChoice
3.2.2 UsingAbbreviationsandAcronyms
3.2.3 AvoidingLanguage-SpecificNames
3.2.4 NamingNewVersionsofExistingAPIs
3.3 NamesofAssembliesandDLLs
3.4 NamesofNamespaces
3.4.1 NamespacesandTypeNameConflicts
3.5 NamesofClasses,Structs,andInterfaces
3.5.1 NamesofGenericTypeParameters
3.5.2 NamesofCommonTypes
3.5.3 NamingEnumerations
3.6 NamesofTypeMembers
3.6.1 NamesofMethods
3.6.2 NamesofProperties
3.6.3 NamesofEvents
3.6.4 NamingFields
3.7 NamingParameters
3.7.1 NamingOperatorOverloadParameters
3.8 NamingResources
4 TypeDesignGuidelines
4.1TypesandNamespaces
4.1.1 StandardSubnamespaceNames
4.2 ChoosingBetweenClassandStruct
4.3 ChoosingBetweenClassandInterface
4.4 AbstractClassDesign
4.5 StaticClassDesign
4.6 InterfaceDesign
4.7 StructDesign
4.8 EnumDesign
4.8.1 DesigningFlagEnums
4.8.2 AddingValuestoEnums
4.9 NestedTypes
4.10 TypesandAssemblyMetadata
5 MemberDesign
5.1 GeneralMemberDesignGuidelines
5.1.1 MemberOverloading
5.1.2 ImplementingInterfaceMembersExplicitly
5.1.3 ChoosingBetweenPropertiesandMethods
5.2 PropertyDesign
5.2.1 IndexedPropertyDesign
5.2.2 PropertyChangeNotificationEvents
5.3 ConstructorDesign
5.3.1 TypeConstructorGuidelines
5.4 EventDesign
5.4.1 CustomEventHandlerDesign
5.5 FieldDesign
5.6 ExtensionMethods
5.7 OperatorOverloads
5.7.1 OverloadingOperator==
5.7.2 ConversionOperators
5.8 ParameterDesign
5.8.1 ChoosingBetweenEnumandBooleanParameters
5.8.2 ValidatingArguments
5.8.3 ParameterPassing
5.8.4 MemberswithVariableNumberofParameters
5.8.5 PointerParameters
6 DesigningforExtensibility
6.1 ExtensibilityMechanisms
6.1.1 UnsealedClasses
6.1.2 ProtectedMembers
6.1.3 EventsandCallbacks
6.1.4 VirtualMembers
6.1.5 Abstractions(AbstractTypesandInterfaces)
6.2 BaseClasses
6.3 Sealing
7 Exceptions
7.1 ExceptionThrowing
7.2 ChoosingtheRightTypeofExceptiontoThrow
7.2.1 ErrorMessageDesign
7.2.2 ExceptionHandling
7.2.3 WrappingExceptions
7.3 UsingStandardExceptionTypes
7.3.1 ExceptConandSystemExcept~on
7.3.2 AppL~cat~onExcept~on
7.3.3 InvaL~dOperat~onExceptCon
7.3.4 ArgumentExcept~on,ArgumentNuLLExcept~on,andArgumentOutOfRangeExcept~on
7.3.5 NuLLReferenceExcept~on,IndexOutOfRangeExcept~on,andAccessVCoLatConExcept~on
7.3.6 StackOverfLowExcept~on
7.3.7 utOfMemoryExcept~on
7.3.8 ComExcept~on,SEHExceptCon,andExecut~onEng~ne-Exception
7.4 DesigningCustomExceptions
7.5 ExceptionsandPerformance
7.5.1 Tester-DoerPattern
7.5.2 Try-ParsePattern
8 UsageGuidelines
8.1 Arrays
8.2 Attributes
8.3 Collections
8.3.1 CollectionParameters
8.3.2 CollectionPropertiesandReturnValues
8.3.3 ChoosingBetweenArraysandCollections
8.3.4 ImplementingCustomCollections
8.4 DateTimeandDateTimeOffset
8.5 ICloneable
8.6 IComparableandIEquatable
8.7 IDisposable
8.8 Nuiiable
8.9 Object
8.9.1 Object.EquaLs
8.9.2 Object.GetHashCode
8.9.3 Object.ToStrlng271
8.10 Serialization
8.10.1 ChoosingtheRightSerializationTechnologytoSupport
8.10.2 SupportingDataContractSerialization
8.10.3 SupportingXMLSerialization
8.10.4 SupportingRuntimeSerialization
8.11 UrL283
8.11.1 System.Urn.ImplementationGuidelines
8.12 System.XmlUsage
8.13 EqualityOperators
8.13.1 EqualityOperatorsonValueTypes
8.13.2 EqualityOperatorsonReferenceTypes
9 CommonDesignPatterns
9.1 AggregateComponents
9.1.1 Component-OrientedDesign
9.1.2 FactoredTypes
9.1.3 AggregateComponentGuidelines
9.2 TheAsyncPatterns
9.2.1 ChoosingBetweentheAsyncPatterns
9.2.2 ClassicAsyncPattern
9.2.3 ClassicAsyncPatternBasicImplementationExample
9.2.4 Event-BasedAsyncPattern
9.2.5 SupportingOutandRefParameters
9.2.6 SupportingCancellation
9.2.7 SupportingProgressReporting
9.2.8 SupportingIncrementalResults
9.3 DependencyProperties
9.3.1 DependencyPropertyDesign
9.3.2 AttachedDependencyPropertyDesign
9.3.3 DependencyPropertyValidation
9.3.4 DependencyPropertyChangeNotifications
9.3.5 DependencyPropertyValueCoercion
9.4 DisposePattern
9.4.1 BasicDisposePattern
9.4.2 FinalizableTypes
9.5 Factories
9.6 LINQSupport
9.6.1 OverviewofLINQ
9.6.2 WaysofImplementingLINQSupport
9.6.3 SupportingLINQthroughIEnumerabLe
9.6.4 SupportingLINQthroughIOueryabLe~T~
9.6.5 SupportingLINQthroughtheQueryPattern
9.7 OptionalFeaturePattern
9.8 SimulatingCovariance
9.9 TemplateMethod
9.10 Timeouts
9.11 XAMLReadableTypes
9.12 AndintheEnd...
A C#CodingStyleConventions
A.1 GeneralStyleConventions
A.1.1 BraceUsage
A.1.2 SpaceUsage
A.1.3 IndentUsage
A.1.4 Other367
A.2 NamingConventions
A.3 Comments
A.4 FileOrganization
B UsingFxCoptoEnforcetheFrameworkDesignGuidelines
B.1 WhatIsFxCop?
B.2 TheEvolutionofFxCop
B.3 HowDoesItWork?
B.4 FxCopGuidelineCoverage
B.4.1 FxCopRulesfortheNamingGuidelines
B.4.2 FxCopRulesfortheTypeDesignGuidelines
B.4.3 FxCopRulesforMemberDesign
B.4.4 FxCopRulesforDesigningforExtensibility
B.4.5 FxCopRulesforExceptions
B.4.6 FxCopRulesforUsageGuidelines
B.4.7 FxCopRulesforDesignPatterns
C SampleAPISpecification
Glossary
SuggestedReadingList
Index