|
|
 |

 |
|
Applied Microsoft® .NET Framework Programming
|
|
|
Author
|
|
Jeffrey Richter (Wintellect)
|
|
|
Pages
|
632
|
|
Disk
|
N/A
|
|
Level
|
All Levels
|
|
Published
|
01/23/2002
|
|
ISBN
|
9780735614222
|
|
Price
|
$49.99
To see this book's discounted price, select a reseller below.
|
|
|
|
|
 |
|
|
Index
Send feedback about this index to mspindex@microsoft.com.
Symbols and Numbers
-= operator
overloaded for instances of delegate types, 383
unregistering delegates with an event, 236
& (ampersand), suffixing the name of a type in a GetType method, 538
!= operator
comparing two delegate objects, 377
overload provided for, 258
strongly typed operator overloads for, 159
!= symbol for inequality in C#, 191
# Of Exceps Thrown/Sec counter, 428
# Of Exceps Thrown counter, 428
# Of Filters/Sec counter, 428-29
# Of Finallys/Sec counter, 429
@ symbol, identifying a verbatim string, 255
@ sign, prepending response files in the CSC.exe command line, 88
[] operator, overloading in C#, 220, 224
[ ] (square brackets), placing custom attributes within in C#, 346-47
^ symbol in C# and in Visual Basic .NET, 191
{ } (braces), specifying format information within, 281
+ symbol
applying to primitive numbers in C#, 190-91
applying to strings in C#, 191
+= operator
appending objects to a linked list of delegates, 369
in C+, 235
with the checked statement in C#, 133
overloaded for instances of delegate types, 383
+ operator
concatenating strings, 254-55
using on nonliteral strings, 255
<, > (angle brackets), applying custom attributes in Microsoft Visual Basic, 347
<> symbol for inequality in Visual Basic .NET, 191
== operator
overload provided for, 258
in ReferenceEquals, 161
strongly typed operator overloads for, 159
using instead of calling Object's ReferenceEquals method, 161
2-D graphics, 23
32-bit number, advantages over, offered by the .exception handling mechanism, 395
32-bit status values, not returned in the .NET .Framework, 396
64-bit hash of a public key, 76
64-bit PE file format, 11
A
Abort method, 405
abstract C# attribute
for methods, 176
for types, 174
Abstract CLR attribute
for methods, 176
for types, 174
abstract types, inheritance as, 326
abstract Unicode characters, 267, 268-69
abstracted view of an implied assumption, 423
accessibility modifiers, 173-74
accessor methods, 216
explicitly defining for events, 242
name used in C# for, 222
Activator class, 542
add accessor method, 235, 236-38
Add An Application To Configure link, 68
add and remove accessor methods, 242
add and remove methods for events, 233
Add Counters dialog box, 506
add instruction
in CLR, 131-32
in IL, 19
Add Reference dialog box in Visual Studio .NET, 52-53
AddEventHandler method, 549
AddHandler method, 242
/addmodule switch with the C# compiler, 49, 50
add.ovf instruction in CLR, 132
address spaces, 20
AdjustToUniversal bit symbol, 288
administrative control, 64-69, 101-8
/Adv switch with ILDasm, 41
advanced menu items on the View menu, 41
AL.exe, 53-55
/algid switch, 77
/company switch, 59
/copyright switch, 59
/culture switch, 62
/delay switch, 91
/description switch, 59
/fileversion switch, 58
/keyfile switch, 79, 91, 107
/keyname switch, 92
/link switch, 55
/linkresource switches, 107
/main switch, 55
/out switch, 59, 107
/product switch, 59
/productversion switch, 58, 59
/target switch, 58
/target:exe switch, 55
/target:winexe switch, 55
/trademark switch, 59
/version switch, 58, 59, 107
/win32icon switch, 56
/win32res switch, 56
correcting a bug in a version number, 61
creating a publisher policy assembly file, 106-7
algorithms
for garbage collection, 453, 455-59
hash, 76-77, 163
intellectual property protection for, 12
aliases, 124
AllowCurrencySymbol bit symbol, 287
AllowDecimalPoint bit symbol, 286
AllowExponent bit symbol, 286
AllowHexSpecifier bit symbol, 287
AllowInnerWhite bit symbol, 288
AllowLeadingSign bit symbol, 286
AllowLeadingWhite bit symbol, 286, 288
AllowMultiple property, 351-52
AllowParentheses bit symbol, 286
AllowThousands bit symbol, 286
AllowTrailingSign bit symbol, 286
AllowTrailingWhite bit symbol, 286, 288
AllowWhiteSpace bit symbol, 289
AmbiguousMatchException exception, 356
ampersand (&), suffixing the name of a type in a GetType method, 538
angle brackets (<, >), applying custom attributes in Microsoft Visual Basic, 347
ANSI C++, 459. See also C++
Any symbol for a NumberStyle bit combination, 287
APL, 13
App object, 370
App type, 44
AppDomain boundaries, 513-15
AppDomain type, 542
AppDomainRunner sample application, 515, 532-34
AppDomains, 21, 510-13
accessing from multiple, 264
characteristics of, 511
creating additional, 511
events exposed by, 515
explicitly loading assemblies into, 525-32
identifying for a thread's current execution, 514
individually securing and configuring, 511
isolation of, 511
pulling several versions of assemblies into, 333
reflecting over all assemblies in, 523
threads and, 514
unloading, 467, 511, 514, 532
AppDomainSetup class, 511
AppDomainUnloaded Exception exception, 514
AppendFormat method, 274, 281, 282-84
AppendInsert method, 273
application developers, 416, 424, 432
Application SafeMode entry, 111
application-specific namespaces, 24
ApplicationBase configuration for an AppDomain, 511
ApplicationException type, 410, 411
ApplicationHistory subdirectory, 109, 111
ApplicationName configuration setting for an AppDomain, 511
applications
administrative control over, 64-69
architecting to use events, 228
binding to assemblies, 90
building, 37-38, 508
debugging in Visual Studio .NET, 448-50
deployment of, 63-64
design of, 412
designing to support plug-in components, 331-33
hosting the CLR and managing AppDomains, 516-17
installation complexities, 36, 37
performance of managed, 18
recording assemblies loaded for, 109
repairing faulty, 109-12
running multiple, in a single process, 21, 512
running under debuggers, 456
types of, 38
walking reflection's OM, 540-41
Applications node of the Microsoft .NET Framework Configuration tool, 68
apply attribute of the publisherPolicy element, 103
appobj object, 370
appobj.FeedbackToFile, 370
arbitrary arrays, redimensioning, 323-24
arbitrary bounds, 318
architecture of the .NET Framework, 3
args parameter of InvokeMember, 545
ArgumentException exception, 413, 549
ArgumentException type, 410
ArgumentOutOfRangeException exception, 273, 304, 422
ArithmeticException type, 410
array of bytes, 292
array of characters, 292
array of polygons, 311
Array.Copy method, 315
ArrayList object, 141
arrays, 309-12
accessing with nonverifiable (unsafe) code, 319-21, 323
accessing with type-safe code, 321-23
casting, 315-16
containing enumerated type symbolic names, 302-3
copying elements and sections from one to .another, 314
creating, 309, 318
creating instances of, 314, 543
fast access to, 319-23
implicitly derived from System.Array, 312
overhead information associated with, 311
passing and returning, 316-17
redimensioning, 323-24
required to be zero-based, 310
as operator, 120
ASCII encoding, 290
ASCIIEncoding class, 292
_asm keyword, 32
ASP.NET
receiving notification of unhandled exceptions, 440
tracing options offered by, 441
Web applications, 517
ASP.NET ISAPI DLL, 516
ASP.NET Web Forms
configuration files for, 67
garbage collector with, 498
unhandled exceptions and, 440-41
ASP.NET XML Web services, 441
ASPNet_wp.exe, 516
assemblies, 7, 38, 45, 47
adding modules to, 49
adding using the Visual Studio.NET IDE, 52-53
backward compatibility testing and, 108
binding applications to, 90
breaking up the deployment of files, 8
building multifiles, 49-52
building with only a public key, 91
building with reference to other strongly named assemblies, 87-89
characteristics of, 45
combining managed modules into, 7-9
combining modules to form, 45-46
combining types from different programming .languages, 47
consisting of multiple files, 46
containing application types, 332
coordinating the side-by-side execution of, 98
creating with AL.exe, 53
cultures of, 61-62
deploying, 63-64, 71, 73, 95-96
determining types defined by, 520-22
distinguishing by company, 74
dragging and dropping into the Explorer's window, 84
embedding Win32 resources into, 56
executing code for, 11-21
historical record of, 110
identifying, 48, 73, 74
included in the FCL, 21
including resource files in, 55-56
kinds of, 9, 72
loading as data files, 527-29
loading explicitly, 525-32
loading from different Web sites, 517
loading into AppDomains, 512
loading multiple versions into the GAC, 86
locating, 511
packaging, 63
privately deployed, 63-64
programmatically distinguishing between, 125
purpose of, 46
rebasing, 93
referencing MSCorLib.dll, 101
reflecting over all in an AppDomain, 523
registering in the GAC, 83
relationship to namespaces, 126
self-describing, 8-9
signing, 76, 77, 92
strong name for, 73-79
types of, 9
unloading explicitly, 532-34
using types across, 332
version numbers associated with, 60-61
version resource information in, 56-61
assembly, marking methods or fields as, 25
Assembly accessibility in CLR, 173
assembly culture tags, 61
assembly files
installed into the CLR directory and into the GAC, 87
probing for, 66
assembly identity, 526
assembly information, displaying for types, 126
assembly language, writing IL in, 12
Assembly Linker utility. See AL.exe
assembly load information, 109
Assembly type, 526
AssemblyAlgIDAttribute attribute, 77
[assembly:CLSCompliant(true)] attribute, 28
AssemblyCultureAttribute custom attribute, 62
AssemblyDef table, 48
full public key always stored, 79
information for a weakly named assembly, 79
version number stored in, 60-61
AssemblyFileVersion version number, 60
assemblyIdentity element, 102, 103
AssemblyInfo.cs file
automatically created in Visual Studio .NET, 58
correcting an error in, 61
created by Visual Studio .NET, 95
AssemblyInformationalVersionAttribute version .number, 60
AssemblyKeyFileAttribute attribute, 76, 91
AssemblyKeyNameAttribute attribute, 92
AssemblyLoad event, 515
AssemblyName class, 75
AssemblyRef table, 40, 49, 78
referencing assemblies without an extension, 99
version number embedded in, 61
AssemblyResolve event, 515
AssemblyVersion, 58, 60-61
AssemInfo.cs file, 93-95
assumptions
for calling any method, 404
of a generational garbage collector, 493-94, 495
implied, 402-5
Attach to Process dialog box, 449
attribute instances, 359-62
attribute objects, 355
attribute types, 357
attributes. See also custom attributes
applying, 347
applying more than once, 351
applying multiple to a single target, 349
checking fields, 359
defining custom, 345-49, 349-52
inheriting, 352
of strongly named assemblies, 74
AttributeTargets enumerated type, 351
AttributeUsageAttribute type, 350-51
Authenticode technology, 90
AuxFiles subdirectory, 65
B
background thread, 504
backing fields, 218
backslash characters, treatment of, 255
backward compatibility, not having to maintain, 97
backward compatibility testing, assemblies and, 108
base-64 string, 298
base class's constructor, 182
base interface, 553
base types
casting to, 117, 118
inheritance from, 326
vs. interfaces, 330
selecting for exception types, 412
versioning issues when adding or modifying .members of, 210-11
base.Equals, 157
BaseType property, 537
before-field-init semantics, 188
beforefieldinit metadata flag, 188
behavior of types, 26
BinaryReader type, 290
BinarySearch method, 314, 425
BinaryWriter type, 290, 484-85
BindAndInvokeTogether sample code, 549-53
Binder base type, 544
Binder-derived type, 544
binding, performed by InvokeMember, 544
binding policy, 101-8
Binding Policy tab, 105
BindingFlags enumerated type
with DefaultBinder, 546
with InvokeMember, 547
passing the binder's methods to, 545
search symbols defined by, 523-24
bindingRedirect element, 102, 103
bit flag enumerated types, 306
bit flags, 305-7
bit symbols
defined by DateTimeStyles, 288
defined by the NumberStyles type, 285-87
BitArray type, 220-21
bits, emitting pseudo-custom attributes in metadata as, 362
BodyName property of Encoding-derived classes, 293
BOMs. See byte order marks
bool primitive type, 128
Boolean Dispose method, 475, 476
_box operator in C++ with Managed Extensions, 144
boxed form for value types and reference types, 138
boxed value types
changing fields in, 333-36
lifetime compared to an unboxed, 142
boxing, 141-42, 341
effect of unnecessary, on performance and memory usage, 148
examples of, 145-52
getting rid of unwanted, 341
reducing for value types, 341
value types instances, 138
braces { }, specifying format information within, 281
Break Into The Debugger options, 447
bug fixes, deploying, 108
bugs
detecting during development and testing, 394
related to exception handling in the FCL, 424-26
build of an assembly, 60
built-in numeric types, 277
byte order marks (BOMs), 292, 296
byte primitive type, 128
bytes, 296-98
C
C , handling of overflows, 131
C#, 13
applying custom attributes, 346-47
casting with the is and as operators, 119-21
catch block for non-CLS-compliant exceptions, 399
constructing a string object, 253-54
developing a standardized version of, 14
handling of overflows, 132
namespaces in, 125
operators defined by, 190-91, 191-92
primitive types in, 177
requirement for method calls to specify out or ref, 203
rules for casting primitive types, 130
special syntax for entering literal strings into source code, 254
support for conversion operators, 200
support for delegate chains, 383
support of jagged arrays, 311
terms for accessibility modifiers, 173
C# compiler
automatic referencing of MsCorLib.dll, 38
command-line switches producing assemblies, 49
knowledge of primitive types, 129-31
multiple response files supported by, 88
source code constructs for an event, 232-35
treatment of enumerated types, 300
using directive, 122
C format for currency in numeric types, 277
C-runtime heap
compared to the managed heap, 453
memory allocation compared to managed heap allocation, 454
C++. See also unmanaged C++
accessing existing unmanaged code, 7
destructor, 463
Exceptions selection, 445
handling of overflows, 131
unmanaged modules produced by the compiler, 7
C++ with Managed Extensions
_box operator and dynamic_cast operator, 144
throwing non-CLS-compliant exceptions, 399
unboxing without copying fields, 144
cabinet (.cab) files
packaging a strongly named assembly in, 82
packaging and installing assembly files, 63
call IL instruction, 99, 209
callback functions, 365, 366
callback methods
in the .NET Framework, 365
calling, 368
checking for the names of, 373
invoking, 374
registering in ASP.NET, 440, 441
registering with the DomainUnload event, 190
callvirt IL instruction, 209
CAN-DO relationship, 330, 331
"Cannot access a closed file" message, 480
"cannot explicitly call operator or accessor" error, 236
capacity field, 271-72
Capacity property of StringBuilder, 273
carriage returns, hard-coding into strings, 254
case-sensitive comparisons
with Compare, 259
of strings, 257
casting, 251, 252
arrays, 315-16
to base types, 117, 118
to derived types, 118
detected by the C# compiler, 199
exposing to the developer, 117-18
programming patterns supported by compilers, 130
"catch all" filter funclet, 430
catch blocks, 398-400
catching exceptions that shouldn't be caught, 424-25
choices at the end of, 399-400
rethrowing StackOverflowException exceptions, 405
searching from top to bottom, 398
using too often and improperly, 418-19
"catch filter funclet", 429-30, 431
catch filters, 429-32
complex, 430-31
specifying exception variables in C#, 399
.cctor, 189
chain, linking delegates in, 369
chaining, delegate support for, 377-83, 384-86
Change method, 335
ChangeType method, 130
Char instances, converting to numeric types, 251-52
char primitive type, 128
Char type, 249, 250
character array field, 272
character array in StringBuilder, 271
characters, 249-52
converting to lowercase or uppercase equivalents, 250
encoding/decoding streams of, 296-98
examining in a string, 266-69
returning the numeric equivalent of, 250
Chars as the name of String's indexer, 224
Chars method, 266
Chars property of StringBuilder, 273
/checked- command-line switch with the C# .compiler, 133
/checked+ command-line switch with the C# .complier, 132
checked operator in C#, 132, 133
checked statement in C#, 132-33
class constructors. See type constructors
class libraries, reflection used for, 519
class library developers, 416, 424
classes
adhering to the dispose pattern, 475
declaring reference types as, 137
documenting assumptions in the development of, 403
indicating a reference type with documentation, 135
cleanup, forcing at a deterministic time, 480
cleanup code
ensuring the execution of, 393, 417
keeping in a localized location, 393
cleanup operations, 400
Clear method of System.Array, 314
CLI (Common Language Infrastructure), 14
client code, catching an exception thrown by a .server, 433
client-side applications, graceful recovery for, 432
Clone method, 165
for copying strings, 270
implementing, 166
of System.Array, 314
cloning objects, 164-66
Close method
calling explicitly, 482-85
discouraging the use of, 482
not officially part of the dispose pattern, 480
offered by OSHandle, 475
reasons for calling, 482
CloseHandle, calling with Finalize, 460
CLR (common language runtime), 4
accessibility modifiers defined by, 173
accessing all facilities of, 13
allocating an internal data structure, 15-16
arithmetic operations performed by, 131
arrays supported by, 309
assemblies and, 45
assumption of no bugs in, 404
calling type constructors, 188
checking casting operations at runtime, 118-19
checking the registry for DbgJITDebugLaunchSetting value, 437
complex filters supported by, 430, 431
constructing String objects, 254
controls in the layout of a type's fields, 140
default binding policy, overriding, 101-8
detecting internal data structure corruption or bug, 405
detecting the shut down of, 468
deterministic destruction not supported, 463
enumerated types in, 300
events within, 227-28
hijacking threads, 501
historical record of assemblies, 110
hosting, 508-10
IL instructions for calling a method, 209
implemented as a COM server contained inside a DLL, 508
inheritance supported by, 325
interoperability scenarios supported by, 31-32
kinds of properties, 215
language integration permitted by, 27
loading, 9-11
loading the last-known good set of assemblies, 111
locating manifest assemblies, 100
management of exceptions, 432
metadata produced, 171
namespaces and, 122
operators and, 190
overloading methods based on out and ref .parameters, 203
passing parameters by reference, 201
presenting via a language perspective, 13
primitive value types, 316
properties in, 217
resetting the starting points for exceptions, 442
resolving referenced types, 99
resources allocated from the managed heap, 453
response to unhandled exceptions, 437-38
searching up the call stack, 398
shutting down, 467
spawning the debugger, 438
specifying how languages expose operator .overloads, 191
string interning mechanism, 262-66
String type tightly integrated with, 256
System.Decimal type not treated as a primitive type, 134
telling not to use the concurrent collector, 504
terms for accessibility modifiers, 173
threshold selected for generation 1, 495
threshold size for generation 0, 494
throwing exceptions involving implied assumptions, 404
transitioning unmanaged threads into, 434
treatment of parameterless and parameterful .properties, 221-22
unhandled exceptions for different threads, 437, 438
unloading an AppDomain, 467
value types with parameterless constructors .allowed by, 186
verifying the validity of indexes into arrays, 312
version policy settings in the registry, 510
walking up the thread's call stack, 394
CLR COM server
no more than one in a Windows process, 510
two versions of, 509
/clr command-line switch, 32
CLR-compliant programming language, 27
CLR/CTS, set of features offered, 27-28
CLR exceptions, displaying by namespace, 446
CLR header
in a managed module, 5
in a PE file, 38-39
CLS (Common Language Specification), 27-31
C# primitive types compliant with, 128
requirement for zero-based arrays, 310
rules, 28-31
CLS-compliant exceptions, 399, 406
CLS-compliant method names, 191-92
CLS-compliant types, 28
code
debugging different kinds of, 449-50
inlining for accessor methods, 219
leveraging existing with IComparable.CompareTo, 340
reasons for failure, 393
safe, 20
code access security, 37, 547
code explosion, 183
code pages, coding 16-bit characters into arbitrary, 291
code values, comparing characters in the string, 257
code verification process, 6
codeBase element, 46
loading strongly named assembly files from, 90
URL identified by, 96
in the XML configuration file, 102-3
Codebases tab, 105
CodePage property of Encoding-derived classes, 293
COFF header, 5
Collect methods of GC, 467, 499
collection
defining a protected instance field to reference, 241
of event/delegate pairs, 239
implementing via a hash table, 241
collection classes, 331
collection-related interfaces, 331
Collections namespace, types in, 22
COM code, interoperating with unmanaged, 407
COM interface, defined for the CLR, 508-9
COM methods, 394
COM objects, 330
COM tab on the Add Reference dialog box, 53
Combine methods, 233, 376, 378, 383
comma-separated multiple attributes, 349
command-line switches. See also AL.exe; SN.exe
creating a publisher policy assembly file, 107
setting version resource fields, 58
Comments field, 59
common initialization constructor, calling, 183-84
Common Language Infrastructure (CLI), 14
common language runtime. See CLR
Common Language Runtime check box, 449
Common Language Runtime Exceptions node, 448
Common Language Runtime Exceptions selection, 445, 446
Common Language Specification. See CLS
common metadata format, 171
Common Object File Format header, 5
Common Type System. See CTS
/company switch of AL.exe, 59
CompanyName field, 59
Compare method
comparing strings, 256
determining whether two strings are equal, 258
differences with CompareOrdinal, 258-59
sorting strings, 259
CompareInfo class, 262
CompareInfo object, 259
CompareInfo property of CurrentCulture, 259
CompareOptions enumerated type, 259
CompareOrdinal method, 257, 258-59
CompareTo method. See also IComparable.CompareTo method
with Char type, 250
comparing strings, 256
of IComparable, 329
making type-safe, 339
compiler/linker, 10, 11
compiler primitive types, 160. See also primitive types
compiler switch for recompiling C++ code, 32
compilers
behind-the-scenes delegate processing, 371
checking assemblies for type definitions, 123
creating assemblies from modules built by .different, 53
delegate class defined by, 371
producing managed modules, 7
recognition of common programming patterns, 129-31
support of namespaces, 125
as syntax checkers, 4
targeting CLR, 4
treatment of namespaces, 123
turning managed modules into assemblies, 8
compile-time errors, 339
compile-time type checking, 339
complex catch filters, 430-31
component library applications, 22
components, 35. See also types
Concat method, 146
concurrent collections, 504
concurrent garbage collector
configuring an application to use, 505
telling CLR not to use, 504
ConditionalAttribute attribute class, 351
.config extension, 65
configuration files
creating with a gcConcurrent element, 504
for executable applications, 67
opening and parsing information in, 65
placing in application directories, 64-65
configuration settings for an AppDomain, 511
configuration tool, provided in the .NET Framework, 68-69
ConfigurationFile configuration setting for an AppDomain, 511
consistent equality property, 154
consistent implementation, 330
console applications, 22, 516
console user interface. See CUI
constants, 169, 177-78, 301
constructor methods, 44
naming, 187
not required for value types, 184
writing to read-only fields, 179
ConstructorInfo object, 542
ConstructorInfo type, 548, 549
constructors, 181
defined by the Exception base type, 413
initializing all value type fields, 186-87
parameters of, 348
provided by the String type, 254
specifying for custom attributes, 353, 354
constructs, generated for events by the C# compiler, 232-33
containers, offered by CSPs, 92
Continue options in the Visual Studio .NET Exception dialog box, 447-48
control classes, inheritance and, 331
Control type, 238-39
conversion constructors and methods, defining for a type, 197
conversion operator methods, 197-200
conversion operators, 170, 198
conversions
performed by the Copy method, 315-16
supported by DefaultBinder, 545
Convert method of Encoding-derived classes, 296
Convert type, 130, 251, 252
Copy method
converting array elements, 315-16
for copying strings, 270
of System.Array, 314
/copyright switch of AL.exe, 59
CopyTo method, 270, 314
CorBindToRuntimeEx function, 509, 510
_CorDllMain function, 11
core types
converting within, 130
holding an enumerated type's value, 301
in MSCorLib.dll, 38
_CorExeMain function, 10
CorTokenType enumerated type, 52
CPU architecture, independence from, 13
CPU instructions, compiling IL code into native, 16
CPU machine languages, compared to IL, 12
CPUs, optimizing native code for newer, 18
CreateDelegate methods, 387, 543
CreateInstance flag, 547
CreateInstance methods
of Activator, 541-42, 543
of AppDomain, 542
of Array, 314, 318, 323, 543
CreateInstanceAndUnwrap method, 542
CreateInstanceFrom methods
of AppDomain, 542
of System.Activator, 542
CreateInstanceFromAndUnwrap method, 542
Crypto API, 90
cryptographic service providers (CSPs), 92
CSC.exe
/reference command-line switch, 87
automatically incrementing the assembly, 61
combining resources into assemblies, 56
CSC.rsp file, 88
CSPs (cryptographic service providers), 92
.ctor method, 44, 182, 187
Ctrl+M in ILDasm, 41
CTS (Common Type System), 24-26, 27
CUI (console user interface), 38
CUI executable assembly, 49
CUI PE files, 55
culture information associate, 277
culture-neutral assembly, 62
culture-neutral currency, 279
culture parameter of InvokeMember, 546
culture-sensitive information, 277
culture-specific sorting tables, 258
CultureInfo class, 250
CultureInfo object, 256, 257
CultureInfo type, 277, 278
cultures
of assemblies, 61-62
specifying for characters, 250
string sorting and, 259-61
/culture:text switch of AL.exe, 62
currency symbol
international sign for, 279
for a NumberStyle bit combination, 287
in a string, 287
CurrencyDecimalSeparator property, 286
CurrencyGroupSeparator property, 286
CurrencySymbol property, 287
CurrentCell property, 425
CurrentCulture property, 250, 277
CurrentDomain property, 523
custom attribute types, 348
custom attributes, 345, 348. See also attributes
applying, 347
defining, 349-52
detecting the case of, 354-59
as instances of types serialized to a byte stream residing in metadata, 354
for setting version resource fields, 57-59
custom formatter, 282-84
D
D format
for decimal in enumerated and numeric types, 277
for long date in the DateTime type, 276-77
d format for short date in the DateTime type, 276-77
data encapsulation, 216
data files
adding to assemblies, 46-47
loading assemblies as, 527-29
data members, 177
data types
allowed for an attribute type's instance constructor, fields, and properties, 353
catch filters as, 430
directly supported by a compiler, 127
writing complex, 484-85
database connections, opening and closing, 472
DataGrid control, 425
DateTime object, 275
DateTime type
formats recognized by, 276-77
overloads of the Parse method, 289
Parse method offered by, 288
DateTimeFormatInfo type, 277-78, 279
DateTimeStyles type, bit symbols defined by, 288
DbgJITDebugLaunchSetting registry value, 437, 438
DbgManagedDebugger registry value, 438
debug builds, turning on the /checked+ switch, 133
/debug command-line switch
in compilers, 443, 444
preventing garbage collection from collecting .reference objects, 456
debug dialog box, displaying, 438
debug versions, unhandled exception policy for, 432
DebuggableAttribute custom attribute, 444, 456
debugger
CLR spawning, 438
requesting notification from, 447
debugging
both managed and unmanaged code, 450
exceptions, 445-48
decimal primitive type, 128
decimal-separator character in a string, 286
Decimal type, 134, 200, 280
Decimal values, compiling code using, 134
DeclaredOnly flag, 524, 545
DeclaredType property, 538, 539
Decoder class, 297
Decoder-derived classes, 297
decoding, 289
deep copy, 165, 316-17
default AppDomain, 510
default attributes, 352
default constructor, 181, 314
Default flag, defined by the BindingFlags enumerated type, 524, 545
default global CSC.rsp file, 88-89
default properties, 215, 220. See also parameterful properties
Default property of the Encoding class, 292
DefaultBinder internal (undocumented) concrete type, 544, 545
DefaultMemberAttribute attribute, 224
definition language files, 6
definition metadata tables
applying custom attributes to entries in, 347
in module metadata blocks, 39-40
querying, 519
/delay command-line switch of AL.exe, 91
delayed signing, 90-95
DelaySignAttribute attribute, 91
delegate chains, 377-83
C# support for, 383
control over invoking, 384-86
internal representation of, 378, 379
removing delegates from, 381-83
Delegate class, 375
Combine and Remove methods of, 376
merging with MulticastDelegate, 376
static methods defined to manipulate a linked-list chain of delegate objects, 377-78
delegate fields, making private, 233
delegate keyword, 371
delegate objects
calling each in a GetInvocationList array, 384-86
considered to be immutable, 381
invoking, 379-80
returning an array of references to, 384
Delegate references, 378
Delegate type, methods defined by, 387
delegate types
built by the C# compiler, 232
defining, 231, 242, 372
Delegate.Combine, calling, 383
Delegate.Remove, calling, 383
delegates, 227, 366-68
calling back instance methods, 370
calling back static methods, 368-70
chaining, 377-83
code for declaring, creating and using, 366-68
combining into a linked list, 378
comparing for equality, 377
creating instances of, 543
demystifying, 371-75
exposing a callback function mechanism, 365
linking to form a chain, 369
removing from chains, 381-83
types of, 375
delete operator, not available in CLR, 117
delType parameter in CreateDelegate methods, 387
dependentAssembly element in the XML .configuration file, 102, 103
deployment goals for .NET Framework, 36-37
derivation hierarchy, walking up, 355
derived class, overriding the virtual Boolean Dispose method, 476
derived types, 326
casting to, 118
giving control over event firing, 231
/description switch of AL.exe, 59
destination AppDomain, 513-14
destructors, 426, 463
deterministic destruction, 463
developers
application, 416, 424, 432
class library, 416, 424
plug-in, 332
development platform, .NET Framework as, 3
Diagnostics namespace, 23
dimensions in an array, returning the number of, 312
directory entry 14, 11
disambiguating types, 125
Dispose method
calling explicitly, 482-85
discouraging the use of, 482
of IDisposable, 235
implemented as an explicit interface method .implementation, 479
public, parameterless, 475
reasons for calling, 482
sealing, 475
Dispose method of FileStream, 479
dispose pattern, 472
classes adhering to, 475
defining types implementing, 481
implementing in the OSHandle class, 472-76
types implementing, 477-82
disposing parameter, 475-76
DivideByZeroException exception, 422
DLL assembly, 49
DLL file, producing, 54
"DLL hell", 36, 37
DllImportAttribute type, 348
DLLs
ability to execute side by side, 97
managed, 11
from Microsoft or other vendors, 36
updating, 36
domain-neutral assemblies, 512, 513
DomainUnload event, 190, 515
double primitive type, 128
download cache of a user, 96
Drawing namespace, 23
dynamic-link libraries. See DLLs
dynamic memory, 179
dynamic strings, 263
dynamically created strings, 263
dynamic_cast operator, 144
DynamicInvoke method, 245, 387
E
E format in numeric types, 277
early binding, 520
early bound type, 99
East Asian Language files, 261
ECMAScript, 14
ElementIndex property, 269
/embed switch, 55
embedded resources, 48
/embedresource switch, 107
Encoder-derived classes, 297, 298
encoding, 290
Encoding class, 291-92
Encoding-derived classes, 291
methods of, 296
properties of, 293-96
EncodingName property, 293
encodings, converting between characters and bytes, 289-98
EndsWith method, 257
EnsureCapacity method, 273
EnterpriseServices namespace, 23
_EntryPoint function, 55
Enum base type, 301-4
enumerated types, 299-304
applying instances of FlagsAttribute to, 349
declaring multiple symbols with the same numeric value, 302
defining at the same level as the requiring class, 304
defining to identify bit flags, 305
expressing the set of bit flags that can be .combined, 305
formatting supported by, 277
reasons for using, 299-300
enumeration, indicating a value type in the .documentation, 135
ephemeral garbage collector. See generational .garbage collector
equality
comparing delegates for, 377
implementing for types, 160
properties of, 154
Equals method
with Char type, 250
for comparing strings, 257
comparing two delegate objects, 377
of Encoding-derived classes, 296
implementing, 154-62
implementing for a value type, 157-60
implementing for types directly inheriting Object's Equals implementation, 154-56
implementing for types inheriting outside of .Object, 156-60
implementing incorrectly, 418-19
overriden by System.ValueType, 139
static, 155-56
of StringBuilder, 274
of System.Object, 116
of the System.Object type, 153-54
error
CS0106: The modifier ... is not valid for this item, 340
CS0111: ... already defines a member..., 223
CS0117: ... does not contain a definition for ..., 342
CS0123: The signature of method ... does not match this delegate type, 370
CS0165: Use of unassigned local variable ..., 202
CS0171: Field ... must be fully assigned before .control leaves the constructor, 187
CS0515: ... access modifiers are not allowed on static constructors, 188
CS0568: Structs cannot contain explicit parameterless constructors, 185
CS0573: ... cannot have instance field initializers in structs, 186
CS0579: Duplicate ... attribute, 351
CS1533: Invoke cannot be called directly on a .delegate, 374
Error event, 441
error handling, 402. See also exception handling
error report, sending to Microsoft over the Internet, 433
errors, exception handling and, 402
escape mechanism for special characters in C#, 254
European Computer Manufacturer's Association. See ECMAScript
event definition entry, 233
event/delegate pairs, 239
event handlers, 231
event information, types holding, 230
event members, 228-33
event registration, explicitly controlling, 236-38
EventArgs type, 230, 241-42
EventDef table, 39
EventHandler, prototype of, 231
EventHandlerList type, 246
EventHandlerSet type, 241
compared to EventHandlerList, 246
designing, 243-46
implementation of, 245
EventHandlerType read-only property, 549
EventInfo type, 548, 549
events, 25, 170, 227
architecting applications to use, 228
within the CLR, 227-28
defining, 232-33
defining members for, 241-43
defining to translate input into events, 243
designing to define lots of, 238-43
designing types that expose, 228-33
designing types to listen for, 234-36
explicitly defining, 242
exposed by AppDomain, 515
unregistering interest in all, 235
evidence, applied to AppDomains, 511
ExactBinding flag, 546, 549
Exception base type, public constructors defined by, 413
exception classes, 408-11, 411-15
Exception-derived types, 529-32
exception filters, 398, 428-29
exception handling
benefits of, 393-94
bugs in the FCL, 424-26
evolution of, 394-96
impact on performance, 427
learning curve, 394
mechanics of, 396-401
mechanisms, 395, 396-401
misconceptions regarding, 402
overhead added by, 427
performance impact of, 395
performance issues related to, 426-29
performance penalty invoking, 406
of secured files, 406
exception hierarchies, 410
exception information, sending over the Internet, 437
exception-related counters, 427-29
exception situations, 393-94
exception stack traces, 441-44
Exception Tree sample application, 529-32
Exception type
displaying all classes derived from, 529-32
in an exception filter, 398
never throwing for private methods, 411
exception type hierarchy vs. the namespace .hierarchy, 447
exception types
adding your own, 448
defined in the MSCorLib.dll assembly, 408-9
defining, 412, 413-15, 426
making serializable, 413
marking as sealed, 412
naming, 412
exception variables, 399
ExceptionObject property, 437
exceptions, 401-6
AmbiguousMatchException exception, 356
AppDomainUnloaded Exception exception, 514
ArgumentException exception, 413, 549
ArgumentOutOfRangeException exception, 273, 304, 422
can't easily be ignored, 395
catching one and throwing another, 421-24
debugging, 445-48
defined, 402
displaying the number thrown per second, 428
displaying the total number thrown, 428
DivideByZeroException exception, 422
don't have to be detected where they occur, 395
ExecutionEngineException exception, 404, 405, 411
FieldAccessException exception, 176
FileLoadException exception, 90
FileNotFoundException exception, 46, 65, 66, 90, 526
FormatException exception, 276
guidelines for using, 416-24
IndexOutOfRangeException exception, 312, 319
indicating the previous, 407
InvalidCastException exception, 118, 119, 143, 339, 419
IOException exception, 478
IsolatedStorageException, 410
kinds displayed by Visual Studio .NET, 445
MethodAccessException exception, 176
MissingMethodException exception, 544
not used with Win32 and COM APIs, 394
NullReferenceException exception, 139, 143, 156
ObjectDisposedException exception, 480-81, 482
OutOfMemoryException exception, 404-5, 410, 411, 455
OverflowException exception, 132, 134, 251
recovering from gracefully, 419-20
RemotingException exception, 542
rethrowing the same, 421
SecurityException exceptions, 406, 547
StackOverflowException exception, 404, 405, 410, 411
System.Security.VerifierException exception, 20
TargetInvocationException exception, 544
ThreadAbortException exception, 405, 514
throwing in the finally block, 401
thrown by nonprivate methods, 411
TypeInitializationException exception, 188
TypeLoadException exception, 535
unhandled, 432-37
VerifierException exception, 19, 20
Exceptions dialog box, 445
EXE assembly, 9
EXE file, producing, 54
executable applications (EXEs), configuration files for, 67
ExecutionEngineException exception, 404, 405, 411
Exists method, 425
Exit method, 516
ExitProcess function, 516
Expensive objects, managing a pool of, 491-93
explicit casts between primitive types, 130
explicit cleanup, 452-53, 472
explicit conversion operator, 199
explicit interface member implementations, 338-43
explicit interface method implementations, 342, 479
explicit keyword in C#, 199
exponent format, 286
ExportedTypesDef table, 48
extensible applications, 331-33
Next
Last Updated: January 12, 2002
|