PARTIBASICSOFTHEMICROSOFT.NETFRAMEWORK
1TheArchitectureofthe.NETFrameworkDevelopmentPlatform3
CompilingSourceCodeintoManagedModules3
CombiningManagedModulesintoAssemblies7
LoadingtheCommonLanguageRuntime9
ExecutingYourAssembly’sCode11
ILandVerification19
The.NETFrameworkClassLibrary21
TheCommonTypeSystem24
TheCommonLanguageSpecification27
InteroperabilitywithUnmanagedCode31
2Building,Packaging,Deploying,andAdministeringApplicationsandTypes35
.NETFrameworkDeploymentGoals36
BuildingTypesintoaModule37
CombiningModulestoFormanAssembly45
AddingAssembliestoaProjectUsingtheVisualStudio.NETIDE52
UsingtheAssemblyLinker53
IncludingResourceFilesintheAssembly55
AssemblyVersionResourceInformation56
VersionNumbers59
Culture61
SimpleApplicationDeployment(PrivatelyDeployedAssemblies)63
SimpleAdministrativeControl(Configuration)64
3SharedAssemblies71
TwoKindsofAssemblies,TwoKindsofDeployment72
GivinganAssemblyaStrongName73
TheGlobalAssemblyCache79
TheInternalStructureoftheGAC85
BuildinganAssemblyThatReferencesaStronglyNamedAssembly87
StronglyNamedAssembliesAreTamper-Resistant89
DelayedSigning90
PrivatelyDeployingStronglyNamedAssemblies95
Side-by-SideExecution96
HowtheRuntimeResolvesTypeReferences98
AdvancedAdministrativeControl(Configuration)101
PublisherPolicyControl106
RepairingaFaultyApplication109
PARTIIWORKINGWITHTYPESANDTHECOMMONLANGUAGERUNTIME
4TypeFundamentals115
AllTypesAreDerivedfromSystem.Object115
CastingBetweenTypes117
CastingwiththeC#isandasOperators119
NamespacesandAssemblies121
5Primitive,Reference,andValueTypes127
ProgrammingLanguagePrimitiveTypes127
CheckedandUncheckedPrimitiveTypeOperations131
ReferenceTypesandValuesTypes134
BoxingandUnboxingValueTypes141
6CommonObjectOperations153
ObjectEqualityandIdentity153
ImplementingEqualsforaReferenceTypeWhoseBaseClassesDon’tOverrideObject’sEquals154
ImplementingEqualsforaReferenceTypeWhenOneorMoreofItsBaseClassesOverridesObject’sEquals156
ImplementingEqualsforaValueType157
SummaryofImplementingEqualsandthe==/!=Operators160
Identity161
ObjectHashCodes162
ObjectCloning164
PARTIIIDESIGNINGTYPES
7TypeMembersandTheirAccessibility169
TypeMembers169
AccessibilityModifiersandPredefinedAttributes173
TypePredefinedAttributes174
FieldPredefinedAttributes175
MethodPredefinedAttributes175
8ConstantsandFields177
Constants177
Fields178
9Methods181
InstanceConstructors181
TypeConstructors187
OperatorOverloadMethods190
OperatorsandProgrammingLanguageInteroperability193
ConversionOperatorMethods197
PassingParametersbyReferencetoaMethod200
PassingaVariableNumberofParameterstoaMethod206
HowVirtualMethodsAreCalled209
VirtualMethodVersioning210
10Properties215
ParameterlessProperties215
ParameterfulProperties220
11Events227
DesigningaTypeThatExposesanEvent228
DesigningaTypeThatListensforanEvent234
ExplicitlyControllingEventRegistration236
DesigningaTypeThatDefinesLotsofEvents238
DesigningtheEventHandlerSetType243
PARTIVESSENTIALTYPES
12WorkingwithText249
Characters249
TheSystem.StringType253
ConstructingStrings253
StringsAreImmutable255
ComparingStrings256
StringInterning262
StringPooling266
ExaminingaString’sCharacters266
OtherStringOperations270
DynamicallyConstructingaStringEfficiently270
ConstructingaStringBuilderObject271
StringBuilder’sMembers272
ObtainingaStringRepresentationforanObject275
SpecificFormatsandCultures276
FormattingMultipleObjectsintoaSingleString280
ProvidingYourOwnCustomFormatter282
ParsingaStringtoObtainanObject285
Encodings:ConvertingBetweenCharactersandBytes289
Encoding/DecodingStreamsofCharactersandBytes296
Base-64StringEncodingandDecoding298
13EnumeratedTypesandBitFlags299
EnumeratedTypes299
BitFlags305
14Arrays309
AllArraysAreImplicitlyDerivedfromSystem.Array312
CastingArrays315
PassingandReturningArrays316
CreatingArraysThatHaveaNonzeroLowerBound318
FastArrayAccess319
RedimensioninganArray323
15Interfaces325
InterfacesandInheritance325
DesigninganApplicationThatSupportsPlug-InComponents331
ChangingFieldsinaBoxedValueTypeUsingInterfaces333
ImplementingMultipleInterfacesThatHavetheSameMethod336
ExplicitInterfaceMemberImplementations338
16CustomAttributes345
UsingCustomAttributes345
DefiningYourOwnAttribute349
AttributeConstructorandField/PropertyDataTypes353
DetectingtheUseofaCustomAttribute354
MatchingTwoAttributeInstancesAgainstEachOther359
Pseudo-CustomAttributes362
17Delegates365
AFirstLookatDelegates365
UsingDelegatestoCallBackStaticMethods368
UsingDelegatestoCallBackInstanceMethods370
DemystifyingDelegates371
SomeDelegateHistory:System.DelegateandSystem.MulticastDelegate375
ComparingDelegatesforEquality377
DelegateChains377
C#’sSupportforDelegateChains383
HavingMoreControloverInvokingaDelegateChain384
DelegatesandReflection386
PARTVMANAGINGTYPES
18Exceptions393
TheEvolutionofExceptionHandling394
TheMechanicsofExceptionHandling396
ThetryBlock397
ThecatchBlock398
ThefinallyBlock400
WhatExactlyIsanException?401
TheSystem.ExceptionClass406
FCL-DefinedExceptionClasses408
DefiningYourOwnExceptionClass411
HowtoUseExceptionsProperly416
YouCan’tHaveTooManyfinallyBlocks416
Don’tCatchEverything418
GracefullyRecoveringfromanException419
BackingOutofaPartiallyCompletedOperationWhenanUnrecoverableExceptionOccurs420
HidinganImplementationDetail421
What’sWrongwiththeFCL424
PerformanceConsiderations426
CatchFilters429
UnhandledExceptions432
ControllingWhattheCLRDoesWhenanUnhandledExceptionOccurs437
UnhandledExceptionsandWindowsForms439
UnhandledExceptionsandASP.NETWebForms440
UnhandledExceptionsandASP.NETXMLWebServices441
ExceptionStackTraces441
RemotingStackTraces444
DebuggingExceptions445
TellingVisualStudioWhatKindofCodetoDebug448
19AutomaticMemoryManagement(GarbageCollection)451
UnderstandingtheBasicsofWorkinginaGarbage-CollectedPlatform451
TheGarbageCollectionAlgorithm455
Finalization459
WhatCausesFinalizeMethodstoGetCalled467
FinalizationInternals468
TheDisposePattern:ForcinganObjecttoCleanUp471
UsingaTypeThatImplementstheDisposePattern477
C#’susingStatement482
AnInterestingDependencyIssue484
WeakReferences485
WeakReferenceInternals487
Resurrection489
DesigninganObjectPoolUsingResurrection491
Generations493
ProgrammaticControloftheGarbageCollector499
OtherGarbageCollectorPerformanceIssues501
Synchronization-FreeAllocations503
ScalableParallelCollections503
ConcurrentCollections504
LargeObjects505
MonitoringGarbageCollections506
20CLRHosting,AppDomains,andReflection507
Metadata:TheCornerstoneofthe.NETFramework507
CLRHosting508
AppDomains510
AccessingObjectsAcrossAppDomainBoundaries513
AppDomainEvents515
ApplicationsandHowTheyHosttheCLRandManageAppDomains516
"Yukon"517
TheGistofReflection518
ReflectingOveranAssembly’sTypes520
ReflectingOveranAppDomain’sAssemblies523
ReflectingOveraType’sMembers:Binding523
ExplicitlyLoadingAssemblies525
LoadingAssembliesas"DataFiles"527
BuildingaHierarchyofException-DerivedTypes529
ExplicitlyUnloadingAssemblies:UnloadinganAppDomain532
ObtainingaReferencetoaSystem.TypeObject534
ReflectingOveraType’sMembers538
CreatinganInstanceofaType541
CallingaType’sMethod543
BindOnce,InvokeMultipleTimes548
ReflectingOveraType’sInterfaces553
ReflectionPerformance555
INDEX557