By Ben Albahari, Peter Drayton, Brad Merrill
Cover | Table of Contents | Colophon
[ Symbols ], [ Numbers ], [ A ], [ B ], [ C ], [ D ], [ E ], [ F ], [ G ], [ H ], [ I ], [ J ], [ L ], [ M ], [ N ], [ O ], [ P ], [ Q ], [ R ], [ S ], [ T ], [ U ], [ V ], [ W ], [ X ]
Symbols[ Top ]
@ (identifier prefix)
identifiers, 6
verbatim string literals and, 13
+ (addition) operator, 46
precedence of, 20
relevance to enums, 60
= (assignment) operator
precedence of, 21
relevance to enums, 60
! XML type ID prefix, 79
& (bitwise and) operator
precedence of, 20
relevance to enums, 60
returning a pointer, 72
^ (bitwise for) operator
precedence of, 20
relevance to enums, 60
\' char type, 12
\\ char type, 12
\\" char type, 12
/ * ... * / (comments), 75
// (comments), 75
?: (conditional ternary)
precedence of, 20
using three-state logic operators, 48
-- (decrement) operator
precedence of, 20
relevance to enums, 60
/ (division) operator, precedence of, 20
% (division remainder) operator
precedence of, 20
/// (documentation comments), 75
. (member access) operator
x.y (member access), 20
== (equals) operator, 84
Equals( ) method and, 82
precedence of, 20
preprocess directives and, 75
relevance to enums, 60
> (greater than) operator
precedence of, 20
relevance to enums, 60
++ (increment) operator
precedence of, 20
relevance to enums, 60
[ ] (indexing), 42
arrays, 57
customizing attributes, 123
precedence of, 20
specifying multiple attributes, 71
stackalloc keyword and, 74
+? lazy quantifiers, in regular expressions, 97
*? lazy quantifiers, in regular expressions, 97
?? lazy quantifiers, in regular expressions, 97
< (less than) operator
precedence of, 20
relevance to enums, 60
* (dereference) operator
precedence of, 20
returning value of pointer, 72
! (boolean) operator
precedence of, 20
!= (not equal) operator, 84
Equals ( ) method and, 82
precedence of, 20
preprocessor directives and, 75
relevance to enums, 60
&& (boolean and) operator, 48
preprocessor directives and, 75
+= (addition assignment) operator
delegates, invoking, 62
precedence of, 21
relevance to enums, 60
<< (shift left) operator
precedence of, 20
<= (less than of equal) operator
precedence of, 20
relevance to enums, 60
>= (greater than or equal) operator
precedence of, 20
relevance to enums, 60
>> (shift right) operator
precedence of, 20
|| (boolean of) operator, 48
precedence of, 20
preprocessor directives and, 75
%= operator, precedence of, 21
&= operator, precedence of, 21
*= operator, precedence of, 21
-= operator, precedence of, 21
/= operator, precedence of, 21
<<= operator, precedence of, 21
>>= operator, precedence of, 21
^= operator, precedence of, 21
|= operator, precedence of, 21
( ) (parenthesis)
grouping (x) operators, 20
type cast ((T)x) operators, 20
-> (pointer-to-member) operator, 72
precedence of, 20
; (semicolon)
empty statements and, 23
in expressing statements, 22
- = (subtraction assignment) operator
relevance to enums, 60
removing a delegate from another delegate, 62
- (subtraction) operator
negative value, precedence of, 20
~ (tilde) operator
precedence of, 20
relevance to enums, 60
_ underscore (identifiers), 6
| (bitwise) operator
precedence of, 20
relevance to enums, 60
Numbers[ Top ]
\0 char type, 12
1-dimensional arrays type, 176
A[ Top ]
\a char (alert) escape, 12
abstract classes, 33, 69, 159
interfaces, differences from, 54
streams, 100
TextReader/TextWriter, 101
abstract methods, 43
access modifiers, 35, 50
restrictions on, 37
activation, 120
additive operators, precedence of, 20
addOn_XXX methods, working with .NET runtime, 65
ADepends.exe (assembly dependency list), 154
Al.exe (assembly linking utility), 154
AnsiBStr enum value for UnmanagedType, 137
AppDomains, 117
arguments, passing by reference, 44
arithmetic check off (unchecked) operator, 20
arithmetic check on (checked) operator, 20
array stack allocation (stackalloc) operator, 20
ArrayList class, 92, 144
arrays, 57-59
bounds checking, 59
conversions, 59
foreach loops, using, 26
length of, 58
local/field declarations, 58
multidimensional, 58
rank of, 58
as operator, 32, 159
AsAny enum value for UnmanagedType, 138
assemblies, 111-115, 180-184
BCL (Base Class Libraries) and, 151
building shareable, 177
deployment, 113
elements of, 111
packaging, 112
reflection and, 116
security permissions, 114
type resolution, 114
versioning, 113
working with, 177-179
assembly attribute target, 71
assembly dependency list (ADepends.exe), 154
assembly, deployment in CLR, 3
assembly linking utility (AI.exe), 154
assignment operators, precedence of, 19, 21,
atomic operations, synchronizing threads, 110
atomic types, 18
attributes, 69-71
COM Interop, supporting, 140
custom, 123-129
named parameter, 70
positional parameter, 70
predefined, 124
Interop support for, 135
specifying multiple, 71
targets, 71
AttributeTargets enum, using AttributeUsage attribute, 125
AttributeUsage attribute, 125
defining a new custom attribute, 127
automatic memory management, 2, 129-132
dispose/close methods, 132
finalizers and, 131
garbage collector and, 129
optimization techniques for, 130
B[ Top ]
<build> assembly version numbers, 113
\b (backspace) escape char, 12
backing stores, 99
base class, 31
constructors, 49-51
base keyword, 52, 159
BCL (Base Class Libraries), 4, 81, 152
advanced component services, 151
assemblies for, 151
client applications and, 149
collections for, 144
concrete collection classes and, 91
configuration for, 150
core types and, 144
creating friendly types, 83
diagnostics and debugging for, 151
globalization and, 150
graphics and, 149
I/O framework for, 99-103
native OS facilities, 152
networking, 103-107, 145
overview of, 143-153
runtime facilities for, 152
security and, 146
streams and I/O, 145
text, provided by, 144
threading, 145
unmanaged code and, 151
web-based applications and, 149
XML and, 148
BCL (Base Class Libraries), 144
BCL Monitor, synchronizing threads, 108
binary operators, precedence of, 19
BitArray class, 92, 144
bitwise operators
precedence of, 20
relevance to enums, 60
Bool enum value for UnmanagedType, 137
bool type, 12, 159, 175
conversions, 12
default value of, 18
three-state logic operators and, 48
bounds checking, 59
boxing value types, 17
break statement, 27, 159
using with switch statements, 24
BStr enum value for UnmanagedType, 138
byte integral type, 9, 159, 175
ByValArray enum value for UnmanagedType, 138
ByValTStr enum value for UnmanagedType, 138
C[ Top ]
<c> XML tag, 78
C# keywords, 159-165
C# language, introduction to, 1-5
C# objects
binding with COM, 138
exposing to COM, 139
type, 82
callbacks, from unmanaged code, 135
callconv-enum parameter, for DllImport attribute, 136
CanRead( ) method, 100
CanSeek( ) method, 100
CanWrite( ) method, 100
Capture instances, 98
CaptureCollection class, 98
case statement, 28, 159
catch statement, 66, 159
C/C++-style comments, 75
CCW (COM Callable Wrapper), 139
char conversions, 12
char type, 11, 159, 175
default value of, 18
charset-enum parameter
for DllImport attribute, 136
for StructLayout attribute, 137
checked operator, 20, 160
CheckFastMarshal parameter for StructLayout attribute, 137
class type, 160, 176
classes, 37-54
abstract, 33
base keywords, 52
cloning instances for, 85
concrete collection classes, 91
constant field, 40
conversions, 32
destructors and, 52
fields, 39
finalizers and, 52
indexers, indexing elements in a class, 42
instance constructors, 49
instance vs. static members and, 38
marshaling, 134
math, 87
methods and, 43
nested types and, 53
object, 82-84
operators and, 46-48
properties, 41
static constructors, 50
StringBuilder, 91
structs, differences between, 38
System.Object, definition of, 82
this keyword and, 51
close method, 132
CLR (Common Language Runtime), 81
features of, 3
garbage collectors and, 129
Interop with COM, 138
CLS (Common Language Specification), 4
CLSCompliant attribute, 126
<code> XML tag, 78
collections, 91-97, 144
concrete collection classes, 91
interfaces, 94-97
collections, using foreach loops, 26
COM Callable Wrapper (CCW), 139
COM objects, 138-142
exposing to C#, 139
Interop supporting attributes, 140
mapping in C#, 140
comments (// or / * ... * /), 75
Common Language Runtime (see CLR)
Common Language Specification (see CLS)
Common Type System (CTS), 4
common types, 81
ICloneable interface for, 85
IComparable interface for, 85
IFormattable interface for, 86
marshaling, 133
object classes and, 82-84
compiling
.NET programs, 3
supporting custom attributes, 123
components
orientation (C# language feature), 1
tool support for BCLs, 152
ComRegisterFunction attribute, 142
ComVisible attribute, 141
concrete classes
collections, 91
Stream-derived, 100
StreamReader/StreamWriter, 101
StringReader/StringWriter, 102
Conditional attribute, 126
conditional operators, precedence of, 19
configuration for BCLs, 150
const keyword, 160
constant declaration, 23
constant field, 40
constant width italics, listings of namespaces, 144
constants, 40
constructors
instance, 49
static, 50
continue statement, 27, 160
within switch statements and, 24
conversions
arrays, 59
bool type and, 12
char type and, 11
decimal datatype and, 11
enum, 60
floating-point type and, 10
implicit/explicit, 8
integral types, 9
interfaces, 57
object types and, 13
string types and, 13
Convert type, 144
CopyTo( ) method, 95
CorDbg.exe (runtime debugger), 154
core .NET types, 144
cross language integration in CLR, 4
CrossRefAttribute attribute, defining a new custom attribute, 127
csc.exe (C# compiler), 155
CTS (Common Type System), 4
custom attributes, 123-129
compiler support for, 123
defining, 127
language support for, 123
predefined attributes and, 124
retrieving at runtime, 128
runtime support for, 124
custom implicit/explicit conversions, 47
CustomMarshaler enum value for UnmanagedType, 138
D[ Top ]
data marshaling, 175-176
data members, 38
DateTime
extended type, 144
format specifiers, 173
DbgUrt.exe (GUI debugger), 155
DBNull extended types, 144
deadlocks, synchronizing threads, 109
debugging for BCL, 151
decimal datatype, 11, 160
data marshaling for, 175
for special types and operators, 87
default keyword, 160
default values, 18
#define symbol preprocessor directive, 75
delegate keyword, 160
delegates, 61-63
defining for an event, 63
function pointers, comparing with, 62
interfaces, comparing with, 63
multicast, 61
Delphi closure, comparing with delegates, 62
deployment in CLR, 3
dereference (*) operator, 72
derived class, 31
destructors, 52
development in CLR, 4
diagnostics for BCL, 151
Dictionary data structure, 144
Directory classes, 103
DispId attribute, 141
dispose method, 132
division remainder (%) operator
precedence of, 20
DllImport attribute, 136
dll-name parameter, for DllImport attribute, 136
DLLs (native), 132-138
DNS (Domain Name System), using, 107
do keyword, 160
documentation comments (///), 75
Domain Name System (see DNS)
double type, 175
double floating-point type, 10
double type, 160
using trigonometric and exponential functions, 87
do-while loops, 25
downcasting classes, 32
E[ Top ]
<example> XML tag, 78
<exception> XML tag, 77
E XML type ID prefix, 79
#elif symbol preprocessor directive, 75
#else preprocessor directive, 75
else keyword, 160
empty statements, 23
encoding strings, 90
#end region preprocessor directive, 75
#endif preprocessor directive, 75
Enter methods, 110
synchronizing threads, 108
enum type, 160, 176
core types and, 144
default value of, 18
switch statements, using, 24
enums, 59
conversions, 60
operators relevant to, 60
equality operators, precedence of, 20
Equals( ) method, 82, 84
Error enum value for UnmanagedType, 138
event keyword, 160
EventArgs, storing data for events, 64
events, 63-66
declaring and firing, 64
defining a delegate, 63
EventArgs, storing data for, 64
handlers, acting on, 64
properties, 65
ExactSpelling parameter, for DllImport attribute, 136
Exception type, 144
exceptions, 66-69
catch statement, 67
variables, omitting, 67
exclusive (maximum) value, 88
Exit methods, 110
synchronizing threads, 108
explicit conversions, 8, 47, 160
expressions, 19-21
expression statements and, 22
extern methods, 43, 161
F[ Top ]
\f (form feed) escape, 12
F XML type ID prefix, 79
false keyword, 48, 161
FieldOffset attribute parameter for StructLayout attribute, 137
fields, 39
definite assignment, 18
instance fields, assigning, 51
static fields, assigning, 51
File classes, 103
files, 29-31
FileStream class, 100
Finalize( ) methods, 83
automatic memory management and, 131
finalizers, 52, 131
finally blocks, 161
simplifying program execution, 66
fixed statement, 72, 161
float type, 161, 175
floating-point types, 10
flushing (streams), 100
for loops, 26
for keyword, 161
foreach statement, 26, 161
implementing the IEnumerable interface, 94
Format method, 89
format specifiers, 170-174
picture, 172
FormatString, for formatting strings, 89
function members, 38
function pointers, comparing with delegates, 62
function-name parameter, for DllImport attribute, 136
FunctionPtr enum value for UnmanagedType, 138
G[ Top ]
gacutil utility, working with assemblies, 178
GACUtil.exe (global assembly cache utility), 155
garbage collectors (GCs), 129
cleanup of non-memory resources, 53
GCs (see garbage collectors)
generations, in garbage collecting, 131
generic request/response architecture, 104
get keyword, 161
GetCustomAttribute attribute, retrieving a custom attribute at runtime, 128
GetHashCode( ) method, 82
GetLength method, returning number of elements, 58
GetType( ) method, 83
global assembly cache
GACUtil.exe utility, 155
managing, 178
global namespace, 30
globalization, 150
goto label statement, using switch statements, 24
goto statements, 27, 161
using switch statements, 24
graphics, 149
Group class, 98
GUI debugger (DbgUrt.exe), 155
Guid attribute, 141
H[ Top ]
HasDefaultInterface attribute, 141
Hashtable class, 92, 144
Hejlsberg, Anders (co-creator of C# language), 1
HTTP-specific support, 104
I[ Top ]
I1/I2/I4/I8 enum values for UnmanagedType, 137
ICloneable interface, 85
core types and, 144
ICollection interface, 95
IComparable interface, 85
core types and, 144
IComparer interface, 96
IConvertible interface
core types and, 144
identifiers, 6
IDictionary interface, 96
IDictionaryEnumerator interface, 97
Idispatch enum value for UnmanagedType, 138
IEnumerable interface, 94
foreach loops and, 26
if keyword, 161
#if symbol preprocessor directive, 75
if-else statements, 23
IFormattable interface, 86
core types and, 144
IHashCodeProvider interface, 97
ILAsm.exe
disassembler, for exploring BLC, 144
MSIL assembler, 155
ILDasm.exe (MSIL disassembler), 155
IList interface, 92, 96
implicit conversions, 8, 47
implicit operator, 161
imutable strings, 88
In attribute, 138
in operator, 161
inclusive (minimum) value, 88
indexing strings, 90
inheritance, 31-35
InnerException argument, 69
input/output, 99-103
BCL and, 145
directories and files, 103
InstalUtil.exe (installer utility), 155
instances, 117
constructors, 49
members, 7, 38
int integral type, 9, 161, 175
integral conversions, 10
integral types, 9
Interface enum value for UnmanagedType, 138
interfaces, 54-57, 91
collections, 94-97
conversions, 57
defining, 54
delegates, comparing with, 63
explicitly implementing, 56
extending, 56
ICloneable/IComparable, 85
IFormattable, 86
implementing, 55
reimplementing, 57
types, 161, 176
InterfaceType attribute, 141
internal access modifier, 36, 162
interning (string), 89
Interop
with COM, 138-142
with native DLLs, 132-138
InvalidCastException, downcasting classes, 32
is operator, 32, 162
precedence of, 20
IsReadOnly( ) method, 95
IsSynchronized( ) method, 96
Iunknown enum value for UnmanagedType, 138
IWebRequestCreate interface, adding new protocol handlers, 105
J[ Top ]
jagged arrays, 58
jump statements, 27
L[ Top ]
<list> XML tag, 78
last-in first-out (LIFO) data structure, 93
late binding, 118
layout-enum parameter for StructLayout attribute, 137
lazy quantifiers, in regular expressions, 97
left-associative operator, 19
Legacy code, interoperability with CLR, 4
LIFO (last-in first-out) data structure, 93
#line number preprocessor directive, 75
literals
bool types and, 12
char, 12
decimal types and, 11
floating-point, 10
integer, 9
null keyword, 162
numeric 0, converting to a enum, 60
string, 13
lock statement, 28, 162
thread synchronization and, 108
logical bitwise operator (see bitwise operators)
long integral type, 9, 162, 175
loop statements, 25
LPArray enum value for UnmanagedType, 138
LPStr enum value for UnmanagedType, 137
LPStruct enum value for UnmanagedType, 138
LPTStr enum value for UnmanagedType, 137
LPVoid enum value for UnmanagedType, 138
LPWStr enum value for UnmanagedType, 137
M[ Top ]
<major> assembly version numbers, 113
<minor> assembly version numbers, 113
M XML type ID prefix, 79
make utility (nmake.exe), 155
manifests in assemblies, 112
MarshalAs attribute, 137
marshaler (CLR)
for classes and structs, 134
common types and, 133
in/out attributes, 134
Match class, 98
MatchCollection class, 98
Math class, 87
math-oriented programming, 86-88
random class for, 88
special types/operators for, 87
math-oriented programming and, 87
maximum (exclusive) value, 88
member access operator (x.y), 20
member cross references (XML), 79
members
classes, 33
instance vs. static, 38
operators, 73
reflection and, 116
MemberwiseClone( ) method, 83
memory
automatic management, 129-132
memory for types, 14
Message string, 68
metadata, compiling .NET programs, 3
method call (f(x)) operator, 20
method signatures, in delegate declarations, 61
Microsoft Intermediate Language (MSIL) code, compiling .NET programs, 3
Microsoft .NET Framework (see .NET Framework)
minimum (inclusive) value, 88
MinWidth, for formatting strings, 89
modify operators, precedence of, 21
module attribute target, 71
modules, 112
building, 177
reflection and, 116
monitor class, 110
MSIL assembler (ILAsm.exe), 155
MSIL disassembler (ILDasm.exe), 155
MSIL (Microsoft Intermediate Language) code, complying .NET programs, 3
multicast delegates, 61
multidimensional arrays, 58
multiplicative operators, precedence of, 20
mutable strings, 88
N[ Top ]
<no modifier> modifier, 176
\n (new line) escape char, 12
N XML type ID prefix, 79
named parameter, 70
namespace declaration, 29
aliasing types and, 30
namespace keyword, 162
namespaces, 180-184
native DLLs, 132-138
NativeTypeMax enum value for UnmanagedType, 138
nested types, 53
reflection and, 116
nesting namespaces, 29
.NET Framework
Base Class Libraries (BCL) and, 4
Common Language Runtime (CLR) and, 3
introduction to, 1
programing, 81-142
.NET platform, working in C#, 143
.NET Software Developer Kit (SDK), ix
networking, 103-107
BCL and, 145
DNS, using, 107
generic request/response architecture, 104
HTTP-specific support, 104
programming models, 103
protocol handlers, adding new, 105
using TCP, UDP, and Sockets, 105
NetworkStream class, 100
new keyword, 162
nmake, working with assemblies, 179
nmake.exe (make utility), 155
NoIDispatch attribute, 142
NonSerialized attribute, 127
O[ Top ]
object class, 82-84
BCL-friendly types, 83
object type, 13, 82, 162
COM default datatype mapping, 175
core types and, 144
inheriting from, 31
Object( ) method, 82
Obsolete attribute, 126
compiling custom attributes, 124
operator keyword, 162
operators, 46-48
enums and, 60
implicit/explicit conversions and, 47
math-oriented programming and, 87
three-state logic, 48
Out attribute, 138
out modifier, 44, 162, 176
overloadable operators, 46, 48
overloading methods, 45
override keyword, 162
P[ Top ]
<para> XML tag, 78
<param> XML tag, 77
user-defining, 79
<paramref> XML tag, 78
<permission> XML tag, 77
P XML type ID prefix, 79
pack size, 134
packaging of assemblies, 112
packing-size parameter for StructLayout attribute, 137
ParamIndex, for formatting strings, 89
params parameter modifiers, 162
in delegate declaration, 61
pause time, in garbage collecting, 130
PE (Portable Executable) files, packaging, 112
PEVerify.exe (portable executable verifier), 155
picture format specifiers, 172
PInvoke (Platform Invocation Services), 132
placeholders, 23
Platform Invocation Services (PInvoke), 132
Point class, using types, 30
pointer types, 8, 71-74
pointer-to-member (->) operator, 72
polymorphism, 32
Portable Executable (PE) files, packaging, 112
portable executable verifier (PEVerify.exe), 155
positional parameter, 70
precedence, of operators, 19
predefined types, 9-13
bool, 12
char, 11
decimal, 11
floating-point, 10
integral, 9
object, 13
string, 13
predefined attributes, 124
preprocessor directives, 74
primary operators, precedence of, 20
primitive types, 18
private access modifiers, 36, 162
ProgId attribute, 141
programming, 81-142
assemblies for, 111-115
collections for, 91-97
common types for, 81
custom attributes for, 123-129
input/output for, 99-103
Interop with Native DLLs, 132-138
math, supporting language, 86-88
networking for, 103-107
reflection for, 115-122
regular expressions for, 97
strings for, 88-91
threads for, 107-111
programming models, 103
property field, 41
protected access modifier, 36, 163
protected internal access modifier, 36
protocol handlers
adding new, 105
configuring requests, 104
pseudo-custom attributes, compiling custom attributes, 123
public access modifier, 35, 163
Pulse method, 111
Pulse operation, 109
PulseAll method, 111
R[ Top ]
<remarks> XML tag, 77
<return value> modifier, 176
<returns> XML tag, 77
<revision> assembly version numbers, 113
\r (carriage return) escape char, 12
R4 enum value for UnmanagedType, 138
R8 enum value for UnmanagedType, 138
Random class, 88
RCW (Runtime Callable Wrapper), 139
readonly field modifiers, 40, 163
rectangular arrays, 58
ref modifier, 44, 163, 176
reference types, 8
reflection, 115-122
activation for, 120
advanced uses of, 120
late binding and, 118
retrieving the type for an instance, 117
type hierarchy and, 115-117
RegAsm.exe
binding COM and C# objects, 139
ComRegisterFunction attribute and, 142
register assembly tool, 155
Regex class, 97
#region name preprocessor directive, 75
register assembly tool (RegAsm.exe), 155
register services utility (RegSvcs.exe), 156
regular expressions, 97, 166-169
relational operators, precedence of, 20
ReleaseComObject method, exposing COM objects to C#, 139
removeOn_XXX method, working with .NET runtime, 65
request architecture (generic), 104
resources in assemblies, 112
response architecture (generic), 104
retrieving type for, 117
return statement, 28, 163
right-associative operators, 19
roots, in garbage collections, 130
RPrecise enum value for UnmanagedType, 138
runtime
(CorDbg.exe), debugger, 154
facilities, 152
interactivity (CLR feature), 3
support for custom attributes, 124
Runtime Callable Wrapper (RCW), 139
Runtime.InteropServices.Marshal type, exposing COM objects to C#, 139
S[ Top ]
<see> XML tag, 78
<seealso> XML tag, 78
<summary> XML tag, 77
SafeArray enum value for UnmanagedType, 138
sbyte integral type, 9, 163, 175
SDK (Software Developer Kit), ix
sealed classes, 34, 163
security
of CLR, 3
for BCLs, 146
permissions for assemblies, 114
selection statements, 23
semicolon (;)
empty statements and, 23
in declaration statements, 22
in expression statements, 22
Serializable attribute, 127
compiling custom attributes, 124
retrieving a custom attribute at runtime, 129
set keyword, 163
SetLastError parameter, for DllImport attribute, 136
SetPosition( ) method, 100
shareable assemblies, 177
shared name utility (Sn.exe), 156
shift operators, precedence of, 20
short integral type, 9, 163
COM type mapping and, 175
signature method, 44
signed integers, 9
sizeof operator, 163
precedence of, 20
relevance to enums, 60
snarf utility (Unix), 104
Sn.exe (shared name utility), 156
SoapSuds.exe (SoapSuds utility), 156
Software Developer Kit (SDK), ix
SortedList class, 93
specialized class, 31
specifiers
DateTime, 173
Stack class, 93, 144
stackalloc operator, 20, 163
allocating memory in a block, 73
StackTrace property (Exceptions), 68
statement blocks, 22
static constructors, 50
nondeterminism of, 51
static field initialization order, 51
static members, 7, 38, 163
Stream class, 100
encapsulating raw streams, 101
StreamReader classes, 101
streams (data flow), 99
StreamWriter classes, 101
String class, 88
text for handling immutable strings, 144
string interning, 89
string type, 13, 163, 175
switch statements, using, 24
StringBuilder class, 91
creating a mutable string, 88
text and, 144
StringCollection class, 93
StringReader classes, 102
strings, 88-91
encoding, 90
formatting, 89
immutability of, 88
indexing, 90
interning, 89
StringBuilder class, using to represent, 91
StringWriter classes, 102
Struct enum value for UnmanagedType, 138
struct keyword, 163
struct size retrieval (sizeof) operator, 20
StructLayout attribute, 136
structs, 37-54
base keyword, 52
classes, differences between, 38
cloning instances for, 85
constants, 40
destructors, 52
finalizers, 52
indexers, indexing elements in a class, 42
instance constructors, 49
instance vs. static members and, 38
marshaling, 134
methods and, 43
nested types and, 53
operators and, 46-48
properties, 41
static constructors and, 50
this keyword and, 51
subclass, 31
.SUFFIXES keyword, working with assemblies, 179
superclass, 31
SuppressFinalize method, 132
switch statements, 24, 164
synchronization of threads, 108-110
SyncRoot( ) method, 96
SysInt enum value for UnmanagedType, 138
System namespace
common types, location of, 81
core types, location of, 144
math-oriented types, location of, 86
strings, location of, 88
System.Array
array conversion and, 59
declaring array types, 57
System.Attribute class, 69
compiler support for custom attributes, 123
defining a new attribute, 127
System.Byte system type, 9
System.Char system type, 11
System.Currency type, 176
System.DateTime type, 175
System.Double system type, 10
System.EventArgs, storing data about events, 63
System.Exception class, 67
System.GC type
finalize method, suppressing, 132
initiating a garbage collection, 130
System.Guid type, 175
System.Int16 system type, 9
System.Int32 system type, 9
System.Int64 system type, 9
System.Net.Sockets namespace, providing protocol-level support for TCP and UDP, 105
System.Object class, definition of, 82
System.Object system type, 13
System.ObsoleteAttribute type, compiling custom attributes, 124
System.Reflection.Emit namespace, creating new types at runtime, 121
System.Sbyte system type, 9
System.Single system type, 10
System.String class, 88
System.String system type, 13
System.Text.RegularExpressions namespace, location of regular expressions, 97
System.Threading.Monitor class, using an instance as a monitor, 110
System.Thread-StaticAttribute, 146
System.UInt16 system type, 9
System.UInt32 system type, 9
System.UInt64 system type, 9
SysUInt enum value for UnmanagedType, 138
T[ Top ]
\t (horizontal tag) escape char, 12
T XML type ID prefix, 79
tags (XML), 77-79
user-defined, 79
target-enum, using AttributeUsage attribute, 125
targets (attributes), 71
TBStr enum value for UnmanagedType, 137
TCP (Transmission Control Protocol), 103
using, 105
TCPClient class, providing TCP support, 106
TCPListener class, providing TCP support, 106
Test class, retrieving a custom attribute at runtime, 129
text, supported by BCL, 144
TextReader class (abstract), 101
TextWriter class (abstract), 101
this keyword, 51, 164
Thread InterruptedException, obtaining/releasing a lock on an object, 110
threads, 107-111
common types, 110
monitor class, 110
synchronizing, 108-110
threadsBCL and, 145
three-state logic operators, 48
throw statement, 28, 164
using switch statements, 24
TimeSpan extended type, 144
TlbExp.exe, 156
binding COM and C# objects, 139
TlbImp.exe, 156
binding COM and C# objects, 138
tools
for exploring BCLs, 144
for .NET, 154-157
support for BCLs, 152
ToString( ) method, 83
tracing garbage collector, 130
Transmission Control Protocol (see TCP)
true keyword, 48, 164
try statement, 66-69, 164
TryEnter methods, 111
type ID prefixes (XML), 79
type instances, 7
type library exporter (TlbExp.exe), 156
type library importer (Tlblmp.exe), 156
type members, 38
Type object, gaining access to, 83
typeof (type retrieval) operator, 20, 164
TypeRef identifier, 114
types, 6-17
aliasing namespaces and, 30
categories of, 8
creating at runtime, 121
default values of, 18
explicit conversions, 8
files, organizing, 29-31
implicit conversions, 8, 47
math-oriented programming, 87
memory and, 14
namespace declaration, 29
organizing, 28-31
pointer, 8
predefined, 9-13
reference, 8
reflection and, 116
resolution, 114
retrieving for an instance, 117
type instances, 7
value, 8
U[ Top ]
U1/U2/U4/U8 enum values for UnmanagedType, 137
UDP (User Datagram Protocol), 103
using, 105
uint integral type, 9, 164, 175
ulong integral type, 9, 164, 175
unary operators, precedence of, 19
unboxing value type, 17
unchecked (arithmetic check off) operator, 20, 164
#undef symbol preprocessor directive, 75
underscore ( _ ) (identifiers), 6
Unicode characters
representing char types, 11
representing string types, 13
unified type system, 2, 15-17
Uniform Resource Indicator (URI), 104
Unix snarf utility, 104
unmanaged code, 74
BCL (Base Class Libraries) and, 151
callbacks from, 135
UnmanagedType enum values, 137
unsafe code, 71-74
unsafe modifier, 164
unsigned integers, 9
upcasting classes, 32
URI (Uniform Resource Indicator), 104
User Datagram Protocol (see UDP)
user-defined tags, 79
ushort integral type, 9, 164
ushort type, 175
using keyword, 30, 164
V[ Top ]
<value> XML tag, 78
\v (vertical tab) escape char, 12
value keyword, 164
value types, 8
boxing and unboxing, 17
memory for, 14
simple types and, 15
ValueType type, 144, 176
variables, 17
assigning, 18
default values for, 18
VariantBool enum value for UnmanagedType, 138
VBByRefStr enum value for UnmanagedType, 137
verbatim string literals, 13
version numbers (assembly), 113
versioning
as a C# language feature, 2
as a CLR feature, 4
with constants, 40
virtual function members, 35
virtual function members, 33
versioning, 35
virtual keyword, 164
void keyword, 165
W[ Top ]
Wait methods, 111
Wait operation, 109
#warning text preprocessor directive, 75
web-based applications, 149
WebRequestFactory, creating protocol for requests, 104
WebServiceUtil.exe (web service utility), 156
while loop statement, 25, 48, 165
Wiltamuth, Scott (cocreator of C# language), 1
WinCV.exe, 156
for exploring BCLs, 144
WinDes.exe (windows designer), 156
windows class viewer (WinCV.exe), as a .NET tool, 156
X[ Top ]
XML documentation, 75-79
BCL (Base Class Libraries) and, 148
files, 76
predefined tags, 77-79
type/member cross references, 79
user-defined tags, 79
XML schema definition tool (Xsd.exe), 157
Xsd.exe (XML schema definition tool), 157
Return to C# Essentials