By Jay Hilyard, Stephen Teilhet
Book Price: $54.99 USD
£34.50 GBP
PDF Price: $43.99
[ Symbols ], [ A ], [ B ], [ C ], [ D ], [ E ], [ F ], [ G ], [ H ], [ I ], [ J ], [ K ], [ L ], [ M ], [ N ], [ O ], [ P ], [ Q ], [ R ], [ S ], [ T ], [ U ], [ V ], [ W ], [ X ], [ Y ], [ Z ],
Symbols[ Top ]
- character, 80-82, 112, 390
$ character, 391, 392
& bitwise AND operator, 82-85, 813, 816-818
&& operator, 82-85
* operator, 80-82
*= operator, 80-82
+ character, 80-82, 390, 501
+= operator, 80-82
, (comma), 63, 572
/ character, 80-82, 112
/= operator, 80-82
: (colon), 63
; character, 468, 469
-= operator, 80-82
== operator, 87
=> operator, 345
? type modifier, 158
?: operator, 82-85
\ character, 113
^ character, 113, 392
{ } (curly braces), 348
| bitwise OR operator, 82-85, 813, 816-818
|| operator, 82-85
~ bitwise complement operator, 193, 796, 797
A[ Top ]
Abrams, Brad, 124
access control
across data repositories, 16-19
changing privileges, 693-696
local variable information, 512-514
order of XML data, 548-552
read-mostly, 757-769
runtime settings, 540
semaphores and, 734-738
tables and, 18
thread-safe, 719-725
types in assemblies, 651-661
Access Control Entries (ACE), 692, 693
accessor functions, 719-725
ACE (Access Control Entries), 692, 693
Action<T> delegate, 203, 364
actions (see events)
Activator class, 510
addition operator, 80-82
AddNode method, 429
AddProxyInfoToRequest method, 526
AddUniqueNode method, 429
ADO.NET
Command object, 18, 24
Connection object, 18, 24
LINQ to ADO.NET, 1, 24
LINQ to Entities, 1, 2, 24
algorithms
calculated hash, 398
contained object cache, 396
CryptoHash method, 396, 397
DES, 669
DSA, 670
folding hash, 395
Rijndael, 663, 665-670
rounding, 800
RSA, 670
SHA-256, 672-676
shift and add hash, 397
simple hash, 395, 400
storing objects in binary trees, 428
string-concatenation hash, 399
TripleDES, 665-670
aliases, data types, 793, 794
Allocation Profiler tool, 136
AllowPartiallyTrustedCallers attribute, 687
anonymous functions, 317
anonymous methods
defined, 6, 316
depicted, 317
lambda expressions and, 344, 348
App.xaml file, 281-283
AppDomain class
CreateDomain method, 789, 791
CreateInstance method, 789
FriendlyName property, 790
isolated storage and, 682
PrintCurrentAppDomainName method, 789, 790
proxy design pattern and, 659
ReaderWriterLockSlim and, 760
running code, 789-791
safer file handles, 714
semaphores and, 738
signaling events, 754, 755
silent thread termination, 727
synchronizing processes, 738
UnhandledException handler, 282
Unload method, 790
Unwrap method, 790
appending lines to strings, 67
AppEvents class
ClearLog method, 296
CloseLog method, 296
constructing multiple classes, 297
DeleteLog method, 296
event logs and, 292-299
GetEntries method, 296
WriteToLog method, 296, 297
Application class, 280, 282
ApplicationException class, 261, 262
applications
AppDomain class and, 789-791
ArrayList equivalents, 147
collections persistence, 199-200
configuration files, 539-541
controlling debugging output, 287-290
debugging, 272-274
displaying HTML in WinForms, 528-530
dynamically invoking members, 507-511
event logs and, 292-299
locking objects and, 721
named pipes support, 621-629
parsing parameters, 106-117
storing data securely, 676-683
unhandled exceptions and, 279-283
Argument class, 106-117
ArgumentDefinition class, 106-117
ArgumentException exception
converting between types, 96
converting strings, 62
event logs and, 298
invalid parameters and, 246
regular expressions and, 374
sending information with, 277
thread-specific data and, 732
Unicode encoding and, 713
ArgumentNullException exception
converting strings, 61
parsing URIs, 520
recommendations, 246
regular expressions and, 375
ArgumentOutOfRangeException exception, 246, 272
arguments (see parameters)
ArgumentSemanticAnalyzer class, 106-117
Array class
actions on elements, 202-204
AsReadOnly method, 204
Copy method, 189
ForEach method, 202, 203
manipulating array items, 188-190
predicates and, 364
Reverse method, 178-180
testing elements, 201-202
ArrayList class
Adapter method, 147
Add method, 147
AddRange method, 147
BinarySearch method, 147
Capacity property, 147, 148
Clear method, 132, 147
Clone method, 147, 150
collection persistence, 199-200
Contains method, 148
CopyTo method, 148
Count property, 147, 148
FixedSize method, 148
generic counterparts, 137, 146-150
GetRange method, 148, 150
IndexOf method, 148
Insert method, 148
InsertRange method, 148
IsFixedSize property, 147
IsReadOnly property, 147
IsSynchronized property, 147
Item property, 147, 148
LastIndexOf method, 148
ReadOnly method, 148, 149
registering assemblies, 787
Remove method, 148
RemoveAt method, 148
RemoveRange method, 148
Repeat method, 148, 149
Reverse method, 148
SetRange method, 148
snapshots of lists, 198
Sort method, 148
Synchronized method, 148
SyncRoot property, 147
ToArray method, 148
TrimToSize method, 148
arrays
actions on elements, 202-204
calculated hash, 398
creating, 176
hash codes and, 401
jagged, 177, 417
manipulating items, 188-190
multidimensional arrays, 176
read-only, 204-205
reversing quickly, 178-180
search sort order, 463
snapshots of lists, 198, 199
StackTrace class and, 182
styles, 176, 177
swapping elements, 177-178
testing elements, 201-202
two-dimensional, 177
as operator, 97-101
ASCII characters, 56
ASCIIEncoding class, 56-58
ASP.NET
prebuilding web sites, 532-534
State Service, 775-778
web.config file, 289
ASPNET user account, 305
ASPX pages, 620
assemblies
controlling access to types, 651-661
dynamically invoking members, 509
finding members, 499-500
finding subclasses, 504, 505
inheritance hierarchies, 502-504
listing, 490-492
listing processes loaded with, 778-780
minimizing attack surface, 687
nested types within, 500
reflection and, 489
serializable, 505-507
user-defined exceptions, 264
verifying permissions, 685, 686
Assembly Binding Log Viewer, 787
Assembly class
determining if type is generic, 511
GetExportedTypes method, 492, 493
GetReferencedAssemblies method, 490-492
GetType method, 501
isolated storage and, 682
ReflectionOnlyLoad* methods, 492
AssemblyName class, 711
Association attribute, 27
AsymmetricAlgorithm class, 670-672
AsyncAction class, 728, 729
asynchronous delegates
completion notification, 727-730
converting to, 327-330
exception handling, 275, 277
AsyncInvoke delegate, 728
attachments, email, 631
attributes
manipulating directory, 455-457
manipulating file, 450-452
authentication, 526, 704-708
AutoResetEvent class
notifying threads, 750-752
signaling events, 752
Start method, 751
B[ Top ]
BackgroundWorker class, 775
Banker's Rounding, 800
Bar class, 308, 310
BarTraceBehavior class, 308, 310
BarTraceInst class, 308, 310
base2 number system, 798
base8 number system, 798
base10 number system, 797, 798
base16 number system, 798
base64 representation
decoding binary data, 54-55, 675
encoding binary data, 53-54, 679
BaseOverrides class, 496-497, 503, 505
big-endian encoding, 58
binary data
decoding base64, 54-55, 675
encoding as base64, 53-54
encoding base64, 679
binary functions, 364
binary predicates, 364
binary trees, 418-432
BinaryFormatter class, 4
BinaryMessageFormatter class, 781, 782
BinaryPredicate<T> delegate, 364
BinaryReader class, 648
BinarySearchCountAll method, 183, 185
BinarySearchGetall method, 185-188
BinaryTree<T> class
AddNode method, 424
constructors and, 424
creating binary trees, 418-432
overview, 429
Print method, 424
Root property, 424
SearchDepthFirst method, 424
solution code example, 425-428
TreeSize property, 424
BinaryTreeNode<T> class
AddNode method, 425
AddUniqueNode method, 425
Children property, 425
constructors, 425
DepthFirstSearch method, 425
GetValue method, 425
Left property, 425
nodeValue property, 429
overview, 429
PrintDepthFirst method, 425
RemoveLeftNode method, 425
RemoveRightNode method, 425
Right property, 425
solution code example, 425-428
BinaryWriter class, 648
bit masks, enumerations in, 812-815
bitmap files, 53-55
bitwise operators
AND operator, 82-85, 813, 816-818
complement operator, 193, 796, 797
OR operator, 82-85, 813, 816-818
bmpAsString string, 54
Boolean (bool) data type
bitwise complement operator, 797
calculated hash, 398
converting, 91, 93, 95
converting strings to, 59
FalseString property, 61
listed, 793
Parse method support, 60
structures and, 69
TrueString property, 61
Boolean logic
Boolean theorems, 88-91
error-free, 85-88
overloading operators and, 82-85
setting bit flags, 815-818
BooleanSwitch class
configuration files and, 287
Enabled property, 287, 289
tracing and, 289
box command, 134
boxing operations
as operator and, 98
casting operator and, 98
defined, 70
determining occurrences, 133-136
generics and, 138, 144
structures and, 69
break statement, 222
browsers (see web browsers)
BuildManager class, 534
business entities, adding hooks, 237-239
Byte (byte) data type
bitwise complement operator, 796, 797
converting, 91, 93, 95, 96
listed, 793
Parse method support, 60
byte[]
converting to strings, 56-57
decoding strings, 54-55
encoding binary data, 53-54
passing strings to methods, 57-59
Unicode encoding and, 713
C[ Top ]
C# language
automatic properties, 142, 156
closures, 356-361
command-line format, 112
functionality, xvii
web site resources, xvii
cache
performance and, 541-543
tying database tables to, 530-531
CacheDependency class, 531
calculated hash, 398
CallSecureFunctionSafelyAndEfficiently function, 683, 684
carriage-return character, 383, 578
CAS (Code Access Security), 651
case sensitivity
comparing characters, 40-41
comparing strings, 48
controlling for string comparisons, 46, 47
finding all string occurrences, 42-46
MultiMap<T> class methods, 418
String.Split method, 64
StringCollection class, 176
CaseInsensitiveComparer.Default value, 176
cast operator
converting between types, 92
usage recommendations, 97, 98
Cast<T> method, 33-35
casting
as operator and, 99-101
cast operator and, 97, 98
IDictionary interface and, 166, 167
IList interface, 148
is operator and, 101-103
narrowing conversions, 91-97
narrowing values, 802-804
CategorizeResponse method, 525, 527
CategoryType enumeration, 295, 298
CDATA section, 552, 570-572
Celsius temperature scale, 801, 802
Certificate Import Wizard, 704-705
certificates
creating, 704-705
self-signed, 704
X.509, 704, 704-708
Char (char) data type
built-in static methods, 37
calculated hash, 398
case sensitivity, 40-41
converting, 91, 93, 95
converting strings to, 59
determining kinds of characters, 36-40
IsControl method, 37, 38
IsDigit method, 37, 38, 39
IsHighSurrogate method, 39
IsLetter method, 37, 38, 39
IsLetterOrDigit method, 39
IsLower method, 39
IsLowSurrogate method, 39
IsNumber method, 37, 38
IsPunctuation method, 37, 38
IsSeparator method, 37, 38
IsSurrogate method, 37, 39
IsSymbol method, 37, 39
IsUpper method, 39
IsWhitespace method, 37, 39
listed, 793
characters
determining for Char structures, 36-40
iterating in strings, 64-65
pruning from strings, 65, 66
removing within strings, 51-53
(see also Char data type)
CharKind enumeration, 37
CheapoPortScanner class
ClosedPorts property, 638
OpenPortFound event, 636, 640
OpenPorts property, 638
PortScan method, 640
ReportToConsole method, 639, 640
Scan method, 639, 640
scanning ports, 636-641
checked keyword, 97, 802-804
child nodes
defined, 428
multiple XML documents, 591
storing in n-ary trees, 432-444
class keyword, 135
classes
accessor functions, 719-725
boxing and, 135
cloneable, 120-124
collection, 175-176
controlling access to types, 651-661
custom debugging displays, 313-315
delegates and, 316
generics and, 138
interfaces and, 69
multiple return values and, 104
nested foreach loops, 224-229
networking functionality, 606
partial, 207, 229-234, 234-236, 238
partial types and, 206
passing by value, 68
polymorphism and, 69
serializing, 263
structures and, 68, 69
unmanaged resources and, 126-133
usage recommendations, 69
className attribute, 510
cleanup, resource (see garbage collection)
ClientBuildManager class, 532-534
ClientBuildManagerCallback class, 533
ClientBuildManagerParameter class, 533
cloneable classes, 120-124
closures, 356-361
CLR (common language runtime)
assembly attack surface, 687
asserting security, 685
enumeration support, 795
exception handling, 254, 255
initializing constants, 117-120
isolated storage and, 682
ReaderWriterLockSlim and, 760
reflection and, 489
resource cleanup in, 329
security and, 651
CLS (Common Language Specification), 794
cmd.exe application, 469
Code Access Security (CAS), 651
CodeAccessSecurity class
Assert method, 683-685
asserting permissions, 683-685
Demand method, 683-685
RevertAssert method, 685
collections
actions on elements, 202-204
boxing and, 135
calculated hash, 398
Clear method and, 132
containing elements, 175
defined, 175
dictionaries and, 175
dictionaries with boundaries, 194-198
Exception.Data property and, 278
extension methods and, 12-16
IEnumerable<T> interface and, 33-35
item occurrences in lists, 182-185
List<T> class and, 191-193
manipulating arrays, 188-190
multiple operations on, 361-365
persisting between sessions, 199-200
read-only, 162-163, 204-205
retrieving list items, 185-188
reversing arrays, 178-180
sorting keys/values, 193-194
StackTrace class and, 181-182
storing list snapshots in arrays, 198, 199
swapping array elements, 177-178
System.Collections.Specialized namespace, 175-176
testing array elements, 201-202
CollectionsUtil class, 176
colon (:), 63
Column attribute, 26
COM objects
Dispose method and, 132
exceptions and, 262
proxy design pattern and, 659
comma (,), 63, 572
Command object (ADO.NET), 18, 24
command-line parameters, 106-117
comments, 392
common language runtime (see CLR)
Common Language Specification (CLS), 794
CompareFileVersions method, 477-479
CompareHeight class, 75, 78
CompareLen class, 408, 408-410
Comparison<T> delegate, 364
CompiledQuery.Compile method, 8-10
compilers
CS1525 compiler error, 354
CS1628 compiler error, 355
CS1670 compiler error, 354
outer variables and, 348
ComplexReplace method, 377, 378
CompressFile method, 482-488
compressing files, 482-488
CompressionType enumeration, 486
conditional processing
conditional methods, 239
loops and, 65
narrowing casts and, 802
setting bit flags, 816-818
Configuration class
encrypting information, 709
GetSection method, 709
modifying settings, 539-541
Save method, 710
configuration files
diagnostics and, 287-290
encrypting, 708-710
modifying, 539-541
querying, 19-22
ConfigurationElementCollection class, 21
ConfigurationSection class
encrypting information, 709
ProtectSection method, 709
UnprotectSection method, 710
ConfigurationSectionCollection class, 22
Connection object (ADO.NET), 18, 24
Console class
OpenStandardOutput method, 788
SetOut method, 787-789
WriteLine method, 454, 788, 798
console utilities, 469-471
const field, 117-120
constructors
BinaryTree<T> class and, 424
BinaryTreeNode<T> class, 425
MaxMinValueDictionary class and, 197
NTree<T> class, 433
NTreeNode<U> class, 438
NTreeNodeFactory<T> class, 438
readonly fields and, 118
structures and, 69
type arguments and, 172
user-defined exceptions, 261-264
Contact structure, 738-740
contained object cache algorithm, 396
ContainedObjHash method, 401
Container<T> class
creating enumerators, 211-214
GetEnumerator method, 213, 214
GetForwardStepEnumerator method, 213
GetReverseOrderEnumerator method, 213
GetReverseStepEnumerator method, 213
Control class, 775
ControlID_* line, 378
conversion
as operator and, 99
to base10, 797, 798
between data types, 91-97
byte[] into strings, 56-57
cast operator and, 98
between degrees and radians, 795
delegates and, 327-330
is operator and, 103
narrowing, 91, 803
numeric promotion, 797
plain text to enumerations, 807, 808
strings to other types, 59-62
between temperature scales, 801, 802
Convert class
ChangeType method, 508, 510
converting data types, 91-97
FromBase64CharArray Method, 54-55
FromBase64String method, 676
ToBase64CharArray Method, 53-54
ToBase64String method, 675
ToBoolean method, 93
ToByte method, 93, 798
ToChar method, 93
ToDateTime method, 93
ToDecimal method, 93
ToDouble method, 93
ToInt16 method, 93, 798
ToInt32 method, 92, 93, 798
ToInt64 method, 93, 798
ToSByte method, 93
ToSingle method, 93
ToString method, 93
ToUInt16 method, 93
ToUInt32 method, 93
ToUInt64 method, 93
Converter<T> delegate, 364
copying
deep, 121-124
shallow, 120-122
CountAll method, 183, 184
CounterCreationData class, 305
CounterCreationDataCollection class, 305
CounterDelta32 performance counter, 306
CounterDelta64 performance counter, 306
CounterSample class, 306
CounterTimer performance counter, 306
CounterTimerInverse performance counter, 306
CountPerTimeInterval32 performance counter, 306
CountPerTimeInterval64 performance counter, 306
CRC (cyclic redundancy check), 675
CreateFileMapping API, 740
CreateInstance method, 510
CreateMultiMap method, 515
CreatePoint method, 102
CreateSqlCacheDependency method, 530
CriticalFinalizerObject class, 714
cross-process, 738, 744
cross-site scripting, 392
CryptoAPITransform class, 131
cryptography
cleaning up information, 670-672
CryptoHash method, 396, 397
encrypting/decrypting files, 665-670
encrypting/decrypting strings, 661-665
FCL support, 54
protecting string data, 696-699
securing stream data, 703
web.config file, 708-710
CryptoHash method, 396, 397
CryptoStream class, 131, 672
CryptoString class
Decrypt method, 664
Encrypt method, 664
encrypting/decrypting strings, 661-665
RdGenerateSecretInitVector method, 664
RdGenerateSecretKey method, 664
CS1525 compiler error, 354
CS1628 compiler error, 355
CS1670 compiler error, 354
CSharpRecipes namespace, 503
CSV format, 572, 573, 574, 577
CultureInfo class, 10-12, 41
curly braces { }, 348
Cwalina, Krzysztof, 124
cyclic redundancy check (CRC), 675
D[ Top ]
DACL (Discretionary Access Control List), 692, 693
Data Protection API (DPAPI), 709
data structures (see structures)
data types
aliases, 793, 794
bitwise complement operator and, 796, 797
converting between, 91-97
creating hash code, 394-402
determining for variables, 101-103
floating-point, 794
generics and, 137
overloading operators, 80-85
Parse method support, 60
partial types, 206
searching, 77-80
simple types, 793, 794
sorting, 72-77
DatabaseNotEnabledForNotificationException exception, 531
databases
creating XML from, 22-30
tying tables to cache, 530-531
DataContext class
accessing multiple data domains, 18-19
creating XML from databases, 24, 26
Log property, 29
DataSet
LINQ to DataSet, 1, 18
partial classes and, 236
partial types and, 207
dates, matching patterns, 390
DateTime data type
converting, 91, 93, 95
Parse method, 451
DeadLock class, 721-722
Debug class
controlling output, 287-290
overview, 286
WriteLine method, 454
DebuggerDisplayAttribute, 313-315
debugging
controlling output, 287-290
creating custom displays, 313-315
enabling/disabling, 307-310
forcing breaks, 272-274
turning on, 286
Decimal (decimal) data type
calculated hash, 398
converting, 91, 93, 95
finding integer portion, 819
listed, 793, 794
narrowing conversions and, 804
Parse method support, 60
decoding binary data, 54-55, 675
DeCompress method, 482-488
DeCompressFile method, 482-488
decompressing files, 482-488
decryption (see cryptography)
DecryptWebConfigData method, 710
deep copying, 121-124
default keyword, 173-174
defense in depth principle, 676
DeflateStream class, 482-488
degrees, converting, 795
Delegate class
BeginInvoke method, 329, 727-730
DelegateCallback method, 329
DynamicInvoke method, 510
EndInvoke method, 329, 330, 729, 730
GetInvocationList method, 318-327
DelegateCallback method, 728, 729, 730
delegates
asynchronous, 275, 277, 327-330
controlling invocation, 318-322
declaring, 344
defined, 316
lambda expressions and, 345, 346
multicast, 318-322
multiple operations by, 361-365
obtaining return values, 322-324
parameter modifiers and, 352-356
parameters and, 328, 345
predicates and, 364
synchronous, 327-330
delimiters
creating delimited strings, 62
extracting items from strings, 63
namespaces and, 501
strings and, 63
types and, 501
DepthFirstSearch method, 429
DerivedOverrides class, 496-497, 503
DES encryption algorithm, 669
Deserialize method, 123
design patterns
dispose, 126-133
factory, 308-310
observer, 339-343
proxy, 651-661
DetectXMLChanges method, 566-569
diagnostics
capturing process output, 311-313
controlling output, 287-290
custom debugging displays, 313-315
enabling/disabling tracing, 307-310
event logs, 292-299
monitoring event logs, 302-304
nonresponsive processes, 290-292
overview, 286
performance counters, 304-307
searching event logs, 299-302
(see also debugging; exception handling; tracing)
dictionaries
collections and, 175
creating with boundaries, 194-198
defined, 175
observing manipulations, 332-344
sorting keys/values, 193-194
Dictionary<T> class
Add method, 165
Clear method, 165
collection persistence, 199-200
Comparer property, 165
ContainsKey method, 165, 166
ContainsValue method, 165
Count property, 165, 166
creating hash codes, 400, 401, 402
creating with boundaries, 194-198
extracting groups, 372
foreach loops and, 168-169
Hashtable class and, 164-167
Hashtable equivalents, 165-167
Item property, 165, 166
Keys property, 165, 166, 193
one-to-many maps, 410, 416-418
Remove method, 165
sorting keys/values, 193-194
TryGetValue method, 165
Values property, 165, 166, 193
DictionaryEntry structure, 168
difference operation, 446, 447
directories
manipulating attributes, 455-457
renaming, 457, 458
searching with wildcards, 459-463
waiting for events, 474-477
Directory class
Exists method, 468
GetCreationTime method, 455
GetDirectories method, 459, 461, 463
GetFiles method, 459, 461, 463, 785
GetFileSystemEntries method, 459, 461, 462
GetLastAccessTime method, 455
GetLastWriteTime method, 455
manipulating attributes, 455-457
Move method, 458
MoveTo method, 458
rights/audit information, 692
SetCreationTime method, 456
SetLastAccessTime method, 456
SetLastWriteTime method, 456
directory trees, 464-466
DirectoryEntry class
Children property, 543, 546
HttpErrors property, 543
SchemaClassName property, 543
web server error pages, 543-547
DirectoryInfo class
Attributes property, 456
CreationTime property, 455, 456
DisplayTimestamps method, 455
FileSystemInfo class and, 463
GetDirectories method, 460, 462, 463
GetFiles method, 461
GetFileSystemInfos method, 460, 462, 464-466
LastAccessTime property, 455, 456
LastWriteTime property, 455, 456
manipulating attributes, 455-457
ModifyTimestamps method, 456
MoveTo method, 457
Rename method, 458
rights/audit information, 692
Discretionary Access Control List (DACL), 692, 693
DispatcherUnhandledException exception, 282
DisplayDirectoryHiddenAttribute method, 456
DisplayDirs method, 459
DisplayException method, 258
DisplayFileHiddenAttribute method, 451
DisplayInheritanceChain method, 501-504
DisplayNestedTypes method, 500, 501
DisposableList class, 171, 172
disposal (see garbage collection)
dispose design pattern, 126-133
Distinct method, 5-6
division operator, 80-82, 180
DLL file format, 784, 787
Dns.GetHostEntry method, 516, 517
do loops, 45
Document Object Model (DOM), 548
document type definition (DTD), 558-563, 569
document( ) XSLT function, 602
DOM (Document Object Model), 548
DoReversal method, 178-179
DoSomething method, 721, 722
dot operator, 501
DOTRACE preprocessor symbol, 660
Double (double) data type
converting, 91, 93, 95
finding integer portion, 819
listed, 793, 794
narrowing conversions, 804
Parse method support, 60
DPAPI (Data Protection API), 709
DpapiProtectedConfigurationProvider class, 709
DriveInfo class
AvailableFreeSpace property, 480, 481
DriveType property, 481
GetDrives method, 481
IsReady property, 480
querying information, 479-482
DriveInfo classTotalFreeSpace property, 481
drives, querying information for, 479-482
DriveType enumeration
CDRom value, 481
Fixed value, 481
Network value, 481
NoRootDirectory value, 481
overview, 481
Ram value, 481
Removable value, 481
Unknown value, 481
DSA algorithm, 670
DTD (document type definition), 558-563, 569
DynamicInvoke method, 507-511
E[ Top ]
eCalc lambda expression, 359
ElapsedTime performance counter, 306
elements
collections containing, 175
defined, 175
determining occurrences, 182-185
difference operation, 447
difference operations, 446
equivalence operation, 447
hash codes and, 401
intersection operation, 446, 447
manipulating in arrays, 188-190
performing actions on, 202-204
retrieving all instances, 185-188
reversing in arrays, 178-180
subset operation, 446, 447
superset operation, 446, 447
swapping in arrays, 177-178
testing, 201-202
union operation, 446, 447
email
sending via SMTP, 631-636
verifying addresses, 390
empty strings, 66
EnableRaisingEvents property, 303
encoding binary data, 53-54, 679
Encoding class
GetBytes method, 57, 615, 713
GetChars method, 713
GetString method, 56
UTF8 property, 528
encryption (see cryptography)
EncryptWebConfigData method, 709
EndInvoke method, 275, 276
Entity Classes
accessing tables, 18
creating XML from databases, 24-27
Table attribute, 26
EntitySet<T> class, 27
EntryWrittenEventHandler delegate, 303
Enum class
boxing and, 69
CheckLanguageEnumValue method, 809
Flags attribute, 806, 810-815
HandleEnum method, 809
inheritance and, 794
IsDefined method, 809
Parse method, 62, 807, 808
ToString method, 805-807, 813
Enumerable class
Distinct method, 6
GroupJoin method, 33
OfType method, 21-22
SkipWhile method, 31, 32
TakeWhile method, 31, 32
enumerations
in bit masks, 812-815
bitwise complement operator, 796, 797
converting plain text to, 807, 808
creating enumerators, 211-214
exception handling, 246
functionality, 794, 795
inheritance and, 794
setting bit flags, 815-818
as string values, 804-807
testing for valid values, 808-810
Environment class
CommandLine property, 113
ExpandEnvironmentVariables method, 469
GetCommandLineArgs method, 113
GetStackTraceInfo method, 270
NewLine constant, 453-455
OSVersion property, 791
StackTrace method, 270, 272
StackTrace property, 269-272
environment variables, 468, 469
EOL characters, 383, 453-455, 578
Equals method
case sensitivity and, 40, 41
hash codes and, 401
reversing sorted order, 162
set operations, 6, 7
equivalence operation, 447
error handling (see exception handling)
escape sequence character, 113
escaping data, 535-536, 571
event handlers
detecting document changes, 566-569
dictionary manipulation, 340
exception handling and, 254-256
setting up, 348-352
event logs
applications and, 292-299
searching entries, 299-302
watching for specific entries, 302-304
EventArgs class
dictionary manipulations, 332
EventHandler delegate and, 348, 352
functionality, 316
KeepChanges property, 332
EventHandler delegate, 316, 348-352
EventHandler<T> delegate, 350-352
EventIDType enumeration, 295, 298
EventLog class
DeleteLog method, 298
Entries property, 302
exceptions and, 298
WriteEntry method, 298
EventLogEntry class
IEnumerable<T> and, 34
monitoring event logs, 303
searching entries, 302
EventLogEntryCollection collection, 296, 302
EventLogSearch class
FindCategory method, 301
FindEntryType method, 301, 302
FindInstanceID method, 301, 302
FindMachineName method, 301
FindMessage method, 301
FindSource method, 301
overview, 299-302
events
defined, 316
delegates and, 316
dictionary manipulations, 332-344
exception handling and, 279-280
extension methods and, 14
observer design pattern and, 339
partial methods and, 207
SystemEvents class, 774
terminal sessions and, 755
threads and, 750-752, 752-755
waiting for, 474-477
EventWaitHandle class
EventResetMode parameter, 752
GetAccessControl method, 754
OpenExisting method, 754
overview, 752-755
rights/audit information, 692
EventWaitHandleAccessRule class, 692
EveryNthItem method, 213
Everything permission set, 489
Except method, 5
Exception class
creating exception classes, 261-269
Data property, 277-279
exception handling and, 241, 253
GetBaseException method, 260-261
GetNestedExceptionList method, 283-285
HelpLine property, 258
InnerException property, 258, 262
Message property, 257, 262, 263, 374
ParamName property, 374
Source property, 258
StackTrace property, 257
ToFullDisplayString method, 256, 259, 266
ToShortDisplayString method, 253
ToString method, 256-259
exception handling
analyzing errors, 283-285
asynchronous delegates and, 275, 277
bitwise complement operator, 796
catching/rethrowing exceptions, 247-248
coarse-grained approach, 241, 244
creating exception type, 261-269
CS1525 compiler error, 354
CS1628 compiler error, 355
CS1670 compiler error, 354
event logs, 298
Exception.Data property, 277-279
executable module versions, 478
fine-grained approach, 240, 241, 244
firing delegates, 322
forcing breaks, 272-274
getting information, 256-259
hash codes and, 401
identifying problems quickly, 260-261
invalid characters, 569-572
iterators and, 218
methods invoked via reflection, 251-253
multicast delegates and, 324-327
obtaining stack traces, 269-272
overview, 240-246
performance and, 244
ReaderWriterLockSlim and, 760
ReadOnlyCollection<T> class and, 325
security and, 685, 710-712
silent thread termination, 725-727
source/destination conversions, 95-96
StackTrace class and, 182
try/finally blocks and, 248-251
unhandled exceptions, 254-256
web server errors, 522-523
WinForms applications and, 279-280
WPF applications and, 281-283
(see also specific exceptions)
EXE file format, 784, 787
executable modules, 477-479
ExecuteCSharp2_0 method, 317
ExecutionEngineException exception, 246
explicit dot notation, 546, 547
explicit keyword, 100
Expression lambda, 348
expression trees, 8-10
expressions, error-free, 85-88
Extensible Markup Language (see XML)
extension methods
adding, 12-16
Standard Query Operators, 5-8
WeightedMovingAverage, 12-16
Extensions class, 15-16
ExternalException exception, 243
F[ Top ]
factory design pattern, 308-310
Fahrenheit temperature scale, 801, 802
false operator, 82-85
Fast User switching, 755
FCL (Framework Class Library)
Clear method, 131
Close method, 131
collection types, 175
cryptography algorithms, 54
diagnostics and, 286
exception handling and, 246
regular expressions and, 366
reserved classes, 261
simple data types, 793
string support, 36
Fibonacci sequence, 206
FieldOffsetAttribute class, 70, 71
fields, initializing at runtime, 117-120
File class
Exists method, 468
GetAccessControl method, 688
GetCreationTime method, 450
GetLastAccessTime method, 450
GetLastWriteTime method, 450
manipulating attributes, 450
ModifyFileTimestamps method, 450
Move method, 452-453
rights/audit information, 692
SetCreationTime method, 450
SetLastAccessTime method, 450
SetLastWriteTime method, 450
file extensions, patterns and, 463
file handles, 713-715
FILE protocol, 578
File Transfer Protocol (see FTP)
FileAttributes enumeration
Archive value, 452, 457
Compress value, 457
Compressed value, 452
Device value, 452
Directory value, 452, 457
Encrypted value, 452, 457
Hidden value, 452, 457
manipulating attributes, 451, 457
Normal value, 452, 457
NotContentIndexed value, 452, 457
Offline value, 452, 457
ReadOnly value, 452, 457
ReparsePoint value, 452, 457
SparseFile value, 452, 457
System value, 452, 457
Temporary value, 452, 457
FileComparison enumeration, 477-479
FileInfo class
Attributes property, 451
CreationTime property, 450, 451
DisplayFileInfoTimestamps method, 450
FileSystemInfo class and, 463
GetFiles method, 462, 463
LastAccessTime property, 450, 451
LastWriteTime property, 450, 451
manipulating attributes, 450
ModifyTimestamps method, 451
MoveTo method, 452-453
Rename method, 453
rights/audit information, 692
files
bitmap, 53-55
compressing, 482-488
decompressing, 482-488
directory trees and, 464-466
encrypting/decrypting, 665-670
granting/revoking access, 693-696
locking subsections, 471-474
manipulating attributes, 450-452
renaming, 452-453
rights/audit information, 688-693
searching with wildcards, 459-463
timestamps, 450, 451
transferring via FTP, 648-650
waiting for events, 474-477
FileSecurity class, 688-693
FileStream class
Close method, 131, 714
counting lines of text, 381
finalizers and, 714
Lock method, 471, 472
Open method, 472
returning lines from matches, 383
rights/audit information, 692
schemas and, 599-600
transferring files, 648
Unlock method, 472
filesystem I/O
comparing version information, 477-479
compressing files, 482-488
console utilities, 469-471
decompressing files, 482-488
directory attributes, 455-457
directory trees, 464-466
environment variables and, 468, 469
file attributes, 450-452
locking file subsections, 471-474
outputting EOL characters, 453-455
overview, 449
parsing paths, 466-468
querying drive information, 479-482
renaming directories, 457, 458
renaming files, 452-453
searching with wildcards, 459-463
waiting for events, 474-477
FileSystemAccessRule class, 692, 695, 696
FileSystemInfo class, 460, 463
FileSystemWatcher class, 474-477
FileVersionInfo class
FileBuildPart property, 478
FileMajorPart property, 478
FileMinorPart property, 478
FilePrivatePart property, 478
GetVersionInfo method, 478
registered assemblies, 785
filtering
lambda expressions and, 6
messages, 4
regular expressions and, 392
finalizers
assuring object disposal, 126
categories of, 714
unmanaged resource disposal, 130-131
finally blocks (see try/finally blocks)
FindAll method, 42, 43, 45
FindAny method, 44
FindEachOccurrenceOf method, 389
FindMethodOverrides method, 493, 494, 498
FindOccurrenceOf method, 389
FindSpecificInterfaces method, 331
first-chance exceptions, 273
FixedSizeCollection type
AddItem method, 140, 142
generic comparison, 138-140, 142-146
GetItem method, 140, 142, 144
InstanceCount property, 140, 146
ItemCount property, 140
ToString method, 140, 146
FixedSizeCollection<T> type
AddItem method, 142
GetItem method, 142, 144
InstanceCount property, 140, 146
Items property, 140, 142
ToString method, 140, 146
type comparison, 140-146
float data type (see Single data type)
floating-point numbers
precision and, 794
rounding values, 799
(see also Single data type)
folding hash algorithm, 395
FoldingHash method, 401
for loops
controlling delegates, 319
CountAll method, 184
iterating characters in strings, 64-65
List<T> class and, 148
reversing arrays, 180
foreach loops
assuring object disposal, 126
controlling delegates, 319
creating enumerators, 211, 212, 213
event logs and, 297
EveryNthItem method, 213
generics and, 168-169
Hashtable class and, 167
iterating characters in strings, 64-65
iterators and, 206-208, 209-210, 222
nesting, 224-229
one-to-many maps, 417
parameterized queries, 9
parsing paths, 469
priority queues, 408
regular expressions and, 367
reversing sorted order, 162
terminating, 219
unmanaged resource disposal, 130
FormatException exception, 61, 246
forms, 615-618
(see also Windows Forms)
Framework Class Library (see FCL)
from keyword
description, 3, 557
solution code example, 35
FTP (File Transfer Protocol)
transferring files, 648-650
verifying URLs, 391
WinInet API, 648
FtpWebRequest class
GetRequestStream method, 649
GetResponse method, 649
StatusDescription property, 649
transferring files, 648-650
FullTrust permission set, 489, 779
Func<int> delegate, 319
functions
accessor, 719-725
binary, 364
closures and, 356-361
functors and, 361-365
generators and, 364
unary, 364
functors (function objects), 361-365
FUSLOGVW.exe, 787
G[ Top ]
GAC (Global Assembly Cache)
creating exception types, 264
determining versions, 784-787
interface searches, 330, 331
GameOver event, 736
garbage collection
assuring object disposal, 124-126
CLR resources, 329
outer variables and, 347
protecting string data, 698
safer file handles and, 714
structures and, 68, 69
unmanaged resources and, 126-133
GC.SuppressFinalize method, 131
Generated Entity class, 237-239
GenerateHttpWebRequest method, 527
GenerateSchemasForDirectory method, 600
GenerateSchemasForFile method, 599-600
generators, 364
generic types
constraining arguments, 169-173
creating, 514-515
creating iterators, 207-208
foreach loops and, 168-169
Hashtable class and, 164-167
initializing to null, 158-160
initializing variables, 173-174
linked lists and, 155-158
overview, 137-146
Queue counterparts, 150-154
read-only collections, 162-163
replacing ArrayList, 146-150
reversing sorted list, 160-162
Stack counterparts, 150-154
usage recommendations, 137-138
GetAll method, 185-188
GetBaseException( ).ToString method, 260
GetBaseTypeDisplay method, 502, 503
GetBaseTypeList method, 504
GetBaseTypes method, 502
GetBeginningOfLine method, 387
GetCharKind method, 38
GetEnumerator iterator, 220-224
GetErrata method, 595-599
GetFilteredValues iterator, 216-218
GetFirstHalf iterator, 216-218
GetHashCode method
creating hash codes, 394-402
set operations, 6, 7
GetHtmlFromUrl method, 527
GetLines method, 386, 387
GetLocalVars method, 513
GetNestedExceptionList method, 253
GetNonFilteredValues iterator, 216
GetOSAndServicePack method, 791, 792
GetProcessesAssemblyIsLoadedIn method, 778-780
GetReverseFilteredValues iterator, 216-218
GetSecondHalf iterator, 216-218
GetSerializableTypeNames method, 506
Global Assembly Cache (see GAC)
Global namespace, 755
GlobalProxySelection class, 526
Gopher protocol, 648
Group class
Add method, 227
Count property, 227
CreateNestedObjects method, 228
extracting groups, 370
GetEnumerator method, 227
GetGroup method, 227
nested foreach loops, 225, 227, 229
Group<T> class, 226, 227
GZipStream class, 482-488
H[ Top ]
HandleClass class, 731
hash code/value
creating for data types, 394-402
salting, 676-683
securing stream data, 703
verifying uncorrupted strings, 673-676
HASH_LENGTH constant, 676
HashOps class
CreateStringHash method, 673-675
IsStringCorrupted method, 674, 676
HashSet<T> class
Add method, 444
Contains method, 445
creating hash codes, 400
ExceptWith method, 445
IntersectionWith method, 445
IsProperSubsetOf method, 445
IsProperSupersetOf method, 446
IsSubsetOf method, 445
IsSupersetOf method, 445
Overlaps method, 446
overview, 444-448
Remove method, 444
RemoveWhere method, 444
SetEquals method, 445
SymmetricExceptWith method, 445
UnionWith method, 445
Hashtable class
Add method, 165
Clear method, 132, 165
Clone method, 165, 166
collection classes and, 176
collection persistence, 199-200
Contains method, 165, 166
ContainsKey method, 165, 166
ContainsValue method, 165
CopyTo method, 165, 166, 167
Count property, 165, 166
creating hash codes, 400, 401, 402
Dictionary<T> equivalents, 165-167
generic counterparts, 137, 164-167
IsFixedSize property, 165
IsReadOnly property, 165
IsSynchronized property, 165
Item property, 165, 166
Keys property, 165, 166
Remove method, 165
Synchronized method, 165
SyncRoot property, 165
Values property, 165, 166
Hidden attribute, 451
hostnames
converting IP addresses to, 516, 517
converting to IP addresses, 517, 518
UriFormatException, 520
HRESULT value, 262
HTML
displaying in Windows Forms, 528-530
matching patterns, 391
obtaining from URLs, 527, 528
reformatting output, 313
XML transformation, 572, 574, 575
HTTP GET request
base64-encoded data, 53
communicating with web servers, 524, 525
HTTP POST request
base64-encoded data, 53
communicating with web servers, 524, 525
simulating form execution, 618
HTTP protocol
cached results and, 541-543
common patterns, 391
transferring data via, 619-621
web server error pages, 543-547
WinInet API, 648
XML transformation, 578
HTTP responses, 523
HttpResponse class, 523
HTTPS protocol, 391, 578
HttpStatusCode enumeration, 523
HttpWebRequest class
cached results and, 541
CachePolicy property, 542
DefaultCachePolicy property, 542
web servers and, 524, 525, 527
HttpWebResponse class
communicating with web servers, 525
GetResponseStream method, 528
IsFromCache property, 542
ResponseStream property, 527, 528
StatusCode property, 522
HybridDictionary class, 176
I[ Top ]
ICloneable interface
building cloneable classes, 120-122
Clone method, 122
List<T> class and, 150
Queue class and, 153
Stack class and, 153
ICMP (Internet Control Message Protocol), 630
ICollection interface
collections not supporting, 33
CopyTo method, 165
Exception.Data property and, 278
sorting keys/values, 194
IComparable interface, 195
IComparable<T> interface
binary trees and, 429
CompareTo method, 78, 418, 429
n-ary trees and, 442, 443
searching data types, 77-80
sortable data types, 72-77
IComparer interface, 75, 176
IComparer<T> interface
application-specific sorting, 10-12
priority queues, 404, 405, 408, 410
searching data types, 77-80
IConvertible interface, 230-233
ICryptoTransform interface, 665, 672
IdentityNotMappedException exception, 695
IDictionary interface
casting and, 166, 167
Exception.Data property and, 278
IsFixedSize property, 165, 166
IsReadOnly property, 165, 166
IsSynchronized property, 165, 166
SecurityException and, 711
SyncRoot property, 165, 166
IDictionary<T> interface
foreach loops and, 168-169
Hashtable and, 166
MakeObservableDictionary method, 332-339
observing manipulations, 332-344
IDictionaryEnumerator interface, 278
IDisposable interface
constraining type arguments, 169-173
Dispose method, 130, 131, 133
signaling events, 754
unmanaged resources and, 130-133
IDispose interface, 126
Idle processes, 291, 780
IEEE Standard 754, 799
IEnumerable interface
Cast method, 35
ConfigurationElementCollection class, 21
creating enumerators, 211
GetEnumerator method, 168
iterators and, 206, 209-210
lambda expressions and, 6
nested foreach loops, 227
querying message queues, 3, 4
Standard Query Operators and, 6
web server error pages, 546, 547
IEnumerable<T> interface
collections not supporting, 33-35
ConfigurationElementCollection class, 21
creating enumerators, 214
exception handling, 284
iterators and, 206, 208
messageQueue collection, 4
nested foreach loops, 224-229
OrderBy method, 363
Queue class and, 153, 154
Reverse method, 213, 319
Stack class and, 153, 154
ToArray method, 198, 199
IEnumerator interface
Current property, 213
GetEnumerator method, 210, 213, 226
iterators and, 206
MoveNext method, 213
nested foreach loops, 226, 227
IEnumerator<T> interface
creating enumerators, 214
GetEnumerator method, 208
GetNext method, 208
iterators and, 206, 208
nested foreach loops, 227
if statement, 45, 184
if-else statement, 87, 245
IIS (Internet Information Server), 543-547, 632
Ildasm disassembler tool, 134
IList interface
casting, 148
IsFixedSize property, 147, 149
IsReadOnly property, 147, 148
IsSynchronized property, 147, 149
LocalVariableInfo objects and, 512
ReadOnlyCollection class and, 163
SyncRoot property, 147, 149
IList<T> interface, 163, 205
implicitly typed local variables, 3
indexer
exception handling, 246
MultiMap<T> class, 413, 417
set method, 340
IndexOutOfRangeException exception, 246
inheritance
enumerations and, 794
exception handling and, 263
hierarchy for types, 501-504
IDisposable interface and, 133
partial types and, 233
structures and, 70
type arguments, 172
initialization vectors
Rijndael algorithm and, 663, 664
TripleDES algorithm and, 670
initializer expressions, 65
inline statements, 6
INotifyPropertyChanged interface, 26
INotifyPropertyChanging interface, 26
InsertIntoArray method, 188-190
instance methods, 14
int data type (see Int32 data type)
Int16 (short) data type
Average method and, 15
converting, 91, 93, 95, 96
listed, 793
Parse method support, 60
Int32 (int) data type
bitwise complement operator, 796, 797
converting, 91, 93, 94, 95, 96
hash codes and, 401
listed, 793
MaxSize property, 802
narrowing conversions, 804
Parse method support, 4, 60
type arguments and, 152
Int64 (long) data type
bitwise complement operator, 796, 797
converting, 91, 93, 95, 96
listed, 793
narrowing conversions, 804
Parse method support, 60
integer division, 180
interfaces
boxing and, 135
classes and, 69
organizing implementations, 229-234
partial methods and, 239
proxies and, 652-656
searching, 330-332
structures and, 69, 135
Interlocked class
Add method, 756
CompareExchange method, 756
Decrement method, 755
Exchange method, 756
Increment method, 755
thread support, 757
Internet (see Web)
Internet Control Message Protocol (ICMP), 630
Internet Information Server (IIS), 543-547, 632
Internet Protocol (IP), 611
InternetQueryOption function (WinInet), 646
InternetSettingsReader class
current connection settings, 641-648
GetInternetConnectionOption method, 643, 646
GetInternetSettings method, 647
InternetConnectionOption structure, 643, 646
Intersect method, 5, 8
intersection operation, 446, 447
IntersectWith method, 447
IntPtr data type, 401
INullableValue interface
HasValue property, 158
initializing value types, 158
Value property, 158
InvalidCastException exception, 95, 98-100
InvalidDataException exception, 487
InvalidEnumArgumentException exception, 246
InvalidOperationException exception, 158, 159, 246, 697
invocation lists, 322, 323
InvokeEveryOtherOperation method, 319
IOException exception, 472, 473, 481
IP (Internet Protocol), 611
IP addresses
converting hostnames to, 517, 518
converting to hostnames, 516, 517
IPAddress data type
Parse method support, 60
ScopeId property, 517
writing TCP servers, 611
IPHostEntry class
AddressList property, 518
HostName property, 516, 517
IPv4 addresses, 390
is operator
data type of variables, 101-103
lambda expressions and, 348
usage recommendations, 97, 98
IsCharEqual method, 41
ISerializable interface, 263
isolated storage, 676-682
IsolatedStorageFile class, 682
IsolatedStorageStream class, 683
IsSubsetOf method, 447
IsSupersetOf method, 447
Item class, 228
iterators
creating on nongeneric types, 209-210
defined, 206
examining strings, 64-65
foreach loops and, 213
generic types and, 207-208
implementing logic, 215-218
nested foreach loops and, 227
recursive, 465
stopping, 218-220
try/finally blocks and, 220-224
J[ Top ]
jagged arrays, 177, 417
Java language, xvii
join keyword, 16-19
JoinIn method, 736
K[ Top ]
Kelvin temperature scale, 801, 802
kernel objects, 755
key/value pairs
binary trees and, 428
collection classes and, 176
dictionaries and, 175, 340, 341
one-to-many maps and, 410, 416-418
reversing sorted order, 162
sorting, 193-194
KeyValuePair structure
foreach loops and, 168
Hashtable class and, 167
reversing sorted lists, 162
L[ Top ]
lambda expressions
closures and, 356-361
defined, 6, 317, 344
delegate signatures, 9
depicted, 317, 318
interface search mechanisms, 330-332
OrderBy method and, 363
overview, 344-348
parameter modifiers, 352-356
selective query results, 32
types of, 348
Where query operator, 6
Language enumeration
converting plain text, 807, 808
setting bit flags, 815-818
testing values, 808, 809, 810
Language Integrated Query (see LINQ)
lexers, 379-380
line-feed character, 383, 578
lines
appending to strings, 67
counting in text, 380-383
returning for matches, 383-387
LinkedList<T> class
Contains method, 157
Find method, 157
FindLast method, 157
Next property, 157
overview, 155-158
Previous property, 157
LINQ (Language Integrated Query)
accessing multiple data domains, 16-19
adding functional extensions, 12-16
application-specific sorting, 10-12
IEnumerable<T> interface and, 33-35
overview, 1, 2
querying configuration files, 19-22
querying message queues, 2-4
selective query results, 31-33
Standard Query Operators, 5-8
LINQ to ADO.NET, 1, 24
LINQ to Amazon, 2
LINQ to DataSet, 1, 18
LINQ to Entities, 1, 2, 24
LINQ to LDAP, 2
LINQ to Objects, 1, 160-162, 206
LINQ to SharePoint, 2
LINQ to SQL
creating XML from databases, 22-27
parameterized queries, 8-10
selective query results, 32-33
support for, 1
LINQ to XML
accessing multiple data domains, 18
creating XML from databases, 27-30
data in document order, 551
extending transformations, 595-599
querying document contents, 554-558
support for, 1, 548
transformation parameters, 601-605
transforming XML, 572-579
LinqExtensions class, 13
List<T> class
actions on elements, 202-204
Add method, 147, 148
AddRange method, 147
ArrayList class and, 146-150
AsReadOnly method, 147, 148, 149, 204
BinarySearch method, 77-78, 147, 157, 182, 184-185, 191-193
Capacity property, 147, 148
Clear method, 147
collection persistence, 199-200
Contains method, 148
ConvertAll method, 148
CopyTo method, 148
Count property, 147, 148
creating enumerators, 211
Exists method, 148
extracting groups, 372
Find method, 148
FindAll method, 148
FindIndex method, 148
FindLast method, 148
FindLastIndex method, 148
ForEach method, 148, 202, 203
GetEnumerator method, 208
GetRange method, 147, 148, 150
IndexOf method, 148
Insert method, 148, 193
InsertRange method, 148
Item property, 147, 148
LastIndexOf method, 148
LinkedList<T> class and, 157, 158
manipulating array items, 188-190
ModifySorted method, 193
nested foreach loops, 225, 227
number of item occurrences, 182-185
one-to-many maps, 410, 416-418
predicates and, 364
priority queues, 404, 405
read-only, 204-205
Remove method, 148
RemoveAll method, 148
RemoveAt method, 148
RemoveRange method, 148
retrieving item instances, 185-188
Reverse method, 148
searching data types, 78-80
snapshots of, 199
Sort method, 78, 148
sorting, 191-193
sorting data types, 72-77
testing elements, 201-202
ToArray method, 148
TrimExcess method, 148
TrimToSize method, 148
TrueForAll method, 148
ListDictionary class
AppEvents class and, 296, 297
description, 176
ListSubClassesForType method, 504
little-endian encoding, 58
Local namespace, 755
local variables
accessing information, 512-514
implicitly typed, 3
LocalIntranet permission set, 489
LocalService system account, 778
LocalSystem system account, 778
lock keyword, 720
lock statement
Dictionary<T> class and, 165, 166
List<T> class and, 148
locking
file subsections, 471-474
objects, 721-725
LockRecursionException exception, 759
LockRecursionPolicy enumeration, 759
logins, determining, 5, 6
long data type (see Int64 data type)
M[ Top ]
machine.config file
caching policy and, 542
querying, 22
TraceSwitch class and, 290
MACTripleDES class, 396, 397
MailAttachment class, 631
MailMessage class, 631-636
Main method, 254, 255
makecert.exe utility, 704, 705
MakeDirectoryHidden extension method, 456
MakeFileHidden method, 451
managed execution environment, xvii
ManualResetEvent class
semaphores and, 735, 736, 752
signaling events, 752
maps, one-to-many, 410-418
MapViewOfFile API, 740
Marshal class
PtrToStringBSTR method, 698
PtrToStructure method, 646
ReleaseComObject method, 132
SecureStringToBSTR method, 698
SizeOf property, 646
ZeroFreeBSTR method, 698
MarshalByRefObject class, 754, 790
Match class
FindSubstrings method, 367-370
Match method, 366, 373
obtaining stack traces, 271
MatchCollection class
Count property, 271
extracting groups, 373
Matches method, 367
MatchesCollection class, 366
MatchEvaluator delegate, 376-378
Math class
converting degrees/radians, 795
Floor method, 800
PI field, 796
Round method, 799, 800
Truncate method, 819
maximum values, dictionary, 194-198
MaxMinValueDictionary class, 195-197
MediaTypeNames class, 633
MemberAccess privilege, 489, 652
MemberInfo class, 500
MemberTypes enumeration
All value, 500
Constructor value, 500
Custom value, 500
Event value, 500
Field value, 500
Method value, 500
NestedType value, 500
overview, 500
Property value, 500
TypeInfo value, 500
MemoryStream class, 665, 672
Message class
Formatter property, 4
Receive method, 782
Recoverable property, 782
message queues
local workstations and, 780-783
querying, 2-4
MessageQueue class
Close method, 131
local workstations and, 783
querying message queues, 2-4
MethodBase.Invoke method, 508
MethodBody class, 512-514
MethodImpl attribute, 721
MethodImplOption enumeration, 721
MethodInfo class
GetBaseDefinition method, 493-498
GetParameters method, 510
Invoke method, 252, 510
IsGenericMethod method, 511-512
ParameterInfo method, 508
SecurityException and, 711
methods
accepting byte[], 57-59
anonymous, 6, 316, 317, 344, 348
conditional, 239
delegates and, 316
exception handling, 246, 251-253
extension, 5-8, 12-16
finding within types, 499
generics and, 145
instance, 14
multiple return values, 104-105
overridden, 493-498
partial, 26, 207, 237-239
passing by value, 68
methodToInvoke.Invoke method, 253
Microsoft intermediate language (MSIL), 207, 232
MIME standard, 54
minimum values, dictionary, 194-198
Modules collection, 780
Monitor.TryEnter method, 723-724
MonitorMethodAccess class
ModifyNumericField method, 724
ReadNumericField method, 724, 725
MQWorker class
overview, 780-783
ReadMessage method, 782, 783
SendMessage method, 781, 783
SetUpQueue method, 780
MSDN Magazine, 722
MSIL (Microsoft intermediate language), 207, 232
MSMQ, 783
multicast delegates
controlling firing order, 318-322
exception handling, 324-327
return values and, 322-324
MulticastDelegate class, 322, 323
MulticastInvocationException class, 325-327
multidimensional arrays, 176
MultiInstance enumeration value, 305
MultiMap<T> class
Add method, 413, 416
Clear method, 413, 417
Clone method, 413
ContainsKey method, 413, 418
ContainsValue method, 414, 418
Count method, 413
creating one-to-many maps, 410-418
indexer, 413
Remove method, 414, 417
RemoveSingleMap method, 417
multiplication operator, 80-82
Mutex class
rights/audit information, 692
synchronizing processes, 738-750
MutexAccessRule class, 692
MyTcpClient class, 612-615
MyTcpServer class, 606-611
N[ Top ]
named groups, 373
named Mutex, 738-750
named pipes, 621-629
NamedPipeClientStream class
Connect method, 626
Flush method, 626
overview, 621-629
WaitForPipeDrain method, 626
Write method, 626
NamedPipeServerStream class
IsConnected method, 626, 627
overview, 621-629
WaitForConnection method, 626
namespaces
delimiters in, 501
extension methods and, 14
interface search mechanisms, 331
name-value pairs, 615-618
NameValueCollection class, 176, 618
naming conventions, exceptions, 261
narrowing conversion, 91, 803
Navigated event, 529
nesting
foreach loops, 224-229
queries, 29
types within assemblies, 500
.NET Framework
current version, 783, 784
Design Guidelines, 120, 122
NetworkCredential class, 526
networking
class support, 606
current Internet settings, 641-648
named pipes and, 621-629
pinging programmatically, 629-630
scanning ports, 636-641
sending SMTP mail, 631-636
simulating form execution, 615-618
transferring data via HTTP, 619-621
transferring files via FTP, 648-650
writing TCP clients, 612-615
writing TCP servers, 606-611
NetworkService system account, 778
NetworkStream class
Close method, 611
GetStream method, 615
securing stream data, 699
writing TCP servers, 609
nodes
child, 428, 432-444, 591
defined, 428
non-nullable numeric type, 13
NoSafeMemberAccess class
IncrementNumericField method, 719, 720
ModifyNumericField method, 719
overview, 719-725
ReadNumericField method, 719
notification
delegate completion, 727-730
partial methods and, 237-239
power management, 770-775
session changes, 770-775
shutdown, 770-775
threads and, 750-752
NotifyFilters enumeration
Attributes value, 476
CreationTime value, 476
DirectoryName value, 476
FileName value, 476
LastAccess value, 476
LastWrite value, 476
overview, 476
Security value, 476
Size value, 476
NotSupportedException exception, 9, 204
NTAccount class, 695
NTree<T> class
AddRoot method, 433, 443
constructors, 433
creating n-ary trees, 432-444
MaxChildren property, 433
solution code example, 439-443
NTreeNode<U> class
AddNode method, 439, 443
BreadthFirstSearch method, 439, 443
childNodes property, 443
Children property, 438
constructor, 438
CountChildren property, 438
CountImmediateChildren property, 438
DepthFirstSearch method, 439, 443
GetChild method, 438
NumOfChildren property, 438
overview, 433
PrintDepthFirst method, 439
RemoveNode method, 439, 443
solution code example, 439-443
Value method, 438
NTreeNodeFactory<T> class
constructors, 438
CreateNode method, 438
MaxChildren property, 438
solution code example, 433-438, 439-443
null coalescing operator, 160
null strings, 66
Nullable class, 158-160
nullable numeric type
initializing, 158-160
LinqExtensions class, 13
type arguments and, 174
NullReferenceException exception
casting and, 99
creating exception types, 261
recommendations, 244, 246
NumberOfItems32 performance counter, 307
NumberOfItems64 performance counter, 307
NumberOfItemsHEX32 performance counter, 307
NumberOfItemsHEX64 performance counter, 307
numbers
bitwise complement operator, 796, 797
converting degrees/radians, 795
converting temperature scales, 801, 802
converting to base10, 797, 798
determining validity in strings, 798, 799
finding integer portions of, 819
floating-point data types, 794
narrowing numeric cast, 802-804
rounding algorithms, 800
rounding values, 799
simple data types, 793, 794
NumberStyles enumeration
AllowCurrencySymbol value, 60
AllowDecimalPoint value, 60
AllowExponent value, 60
AllowHexSpecifier value, 60
AllowLeadingSign value, 60
AllowLeadingWhite value, 60
AllowParentheses value, 61
AllowThousands value, 61
AllowTrailingSign value, 61
AllowTrailingWhite value, 61
Any value, 61
Currency value, 61
defined, 60, 61
Float value, 61
HexNumber value, 61
Integer value, 61
None value, 61
Number value, 61
numeric promotion, 797
numeric types
calculated hash, 398
converting base types, 798
MaxValue property, 802, 804
MinValue property, 802
narrowing casts, 802-804
narrowing conversions, 91, 92
nullable types and, 159
structures and, 69
ToString method, 798
TryParse method, 798
O[ Top ]
Object class, 69, 122
ObjectDisposedException exception, 126, 132, 246
objects
assuring disposal, 124-126
collections and, 175
controlling access to types, 651-661
delegates as, 316
dispose design pattern for, 126-133
exception handling, 246
function, 361-365
kernel, 755
LINQ to Objects, 1
locking, 721-725
serializing, 123, 199-200
storing in binary trees, 428
value equality, 401
ObservableDictionary class
Add method, 340, 341
AddedEntry event, 339, 340
AddingEntry event, 339, 340
ChangedEntry event, 339, 340
ChangingEntry event, 339, 340
observing manipulations, 332-344
OnAdded method, 339, 340
OnAdding method, 339, 340, 341
OnAddingListener method, 341
OnChanged method, 339
OnChanging method, 339, 341
OnChangingListener method, 341
solution code example, 332-339, 341-343
ObservableDictionaryEventArgs class
keepChanges property, 340, 341
key property, 340
solution code example, 332-339
value property, 340
ObservableDictionaryObserver class
ApproveAdd event, 341
ApproveChange event, 341
object observer defined, 340
observing manipulations, 332-344
OnAddedListener event handler, 340
OnAddingListener event handler, 340
OnChangedListener event handler, 340
OnChangingListener event handler, 340
Register method, 340
solution code example, 341-343
observer design pattern, 339-343
OfType<T> method, 33-35
OnEntryWritten callback method, 303
operating systems
determining versions, 791, 792
shutdown notifications, 770-775
OperatingSystem class, 791
operators
error-free expressions, 85-88
extension methods and, 14
overloading, 80-85
reducing Boolean logic, 88-91
for sets, 446-447
Standard Query Operators, 5-8
(see also specific operators)
orderby keyword, 3, 557
OrderBy query operator
application-specific sorting, 10-12
reversing sort order, 161
out keyword
lambda expressions and, 352-356
returning multiple items, 104, 105
Outer class, 493
outer variables, 347, 348
OutOfMemoryException exception, 246
OverflowException exception, 261
converting strings, 61
narrowing conversions, 93, 802, 803, 804
type conversions and, 96-97
overloading operators, 80-85
overridden methods, 493-498
P[ Top ]
P/Invoke method
current Internet settings, 641-648
usage recommendations, 69
ParameterizedThreadStart delegate, 736, 751
parameters
catch blocks and, 241
constraining, 169-173
delegates and, 328, 345
exception handling, 246
Expression lambda and, 348
generators and, 364
lambda expression modifiers, 352-356
lambda expressions and, 344, 345
multicast delegates and, 324
parsing command-line, 106-117
partial methods and, 239
XML transformation, 601-605
params modifier, 352-356
parentheses
error-free expressions, 85-88
regular expressions and, 373
Parse method, 59-62
ParsePathEnvironmentVariable method, 468
ParseURI method, 518-520
parsing
command-line parameters, 106-117
paths, 466-468
paths in environment variables, 468, 469
URIs, 518-521
partial classes
code generation and, 234-236
interface implementations, 229-234
partial methods and, 207, 238
partial keyword, 230
partial methods
functionality, 26, 207
notification via, 237-239
partial types, 206, 233
PartialClassAddin add-in, 234-236
passing by reference, 68
passing by value, 68, 69
passwords
defense in depth principle, 676
matching patterns, 391
protecting string data, 697
storing securely, 676-683
UriFormatException, 520
Path class
GetDirectoryName method, 467
GetExtension method, 467
GetFileName method, 467
GetFileNameWithoutExtension method, 467
GetPathRoot method, 467
parsing paths, 466-468
PathSeparator property, 468, 469
PATH environment variable, 468, 470
paths
parsing, 466-468
parsing in environment variables, 468, 469
patterns
common, 389-393
enumerating matches, 367-370
file extensions and, 463
finding last match, 375
regular expressions and, 366
returning entire lines, 383-387
searching files/directories, 461
string replacement, 376-378
(see also design patterns)
PauseAndCreateFile method, 474, 475
PE (Portable Executable) file, 478
performance
ArrayList class and, 147
boxing and, 70, 133-136
cached results and, 541-543
exception handling and, 244
generics and, 138
hash codes and, 401
Queue class, 152
Stack class, 152
structures and, 68, 70
unboxing and, 133-136
performance counters, 304-307
PerformanceCounter class
CreateSimpleCounter method, 304, 305
functionality, 305
NextSample method, 306
RawValue property, 307
permissions
assembly attack surface and, 687
asserting, 683-685
proxies testing, 659
reflection, 489
SecurityException and, 711
verifying for assemblies, 685, 686
persistence, collection, 199-200
phone numbers, matching patterns, 391
Ping class
DisplayPingReplyInfo method, 629, 630
PingCompleted event, 629, 630
pinging programmatically, 629-630
Send method, 629
SendAsync method, 629, 630
PingCompletedEventArgs class, 630
pinging, 629-630
PingReply class
Cancelled property, 630
Error property, 630
pinging programmatically, 629, 630
PInvoke class, 744-750
PipeOptions enumeration
Asynchronous value, 628
None value, 628
WriteThrough value, 628
polymorphism
classes and, 69
structures and, 69, 70
Portable Executable (PE) file, 478
ports, scanning, 636-641
power management, 770-775
PowerMode enumeration, 772
PowerModeChangedEventArgs class, 775
PowerModeEventChangedArgs class, 772
precision, floating-point, 794
PrecompilationFlags enumeration
AllowPartiallyTrustedCallers value, 532
Clean value, 532
CodeAnalysis value, 532
Default value, 532
DelaySign value, 532
FixedNames value, 532
ForceDebug value, 533
OverwriteTarget value, 533
Updateable value, 533
PrecompileApplication method, 533
Predicate delegate, 201
Predicate<T> delegate, 364
pred