C# 4.0Pocket Reference... THIRD EDITIONC# 4.0 Pocket Reference Joseph Albahari and Ben Albahari Beijing Cambridge Farnham Köln Sebastopol Taipei Tokyo.
Trang 3C# 4.0
Pocket Reference
Trang 5THIRD EDITION
C# 4.0
Pocket Reference
Joseph Albahari and Ben Albahari
Beijing Cambridge Farnham Köln Sebastopol Taipei Tokyo
Trang 6subtract operator (-), 46
Sum operator, LINQ, 150
<summary> XML tag, 185
switch statement, 51–52
System.ArgumentException
class, 123
System.ArgumentNullExcept
ion class, 124
System.ArgumentOutOfRang
eException class, 124
System.Exception class, 123
System.InvalidOperationExc
eption class, 124
System.NotImplementedExc
eption class, 124
System.NotSupportedExcepti
on class, 124
System.ObjectDisposedExce
ption class, 124
T
Take operator, LINQ, 143,
148
TakeWhile operator, LINQ,
148
ternary conditional operator
(?:), 27, 47
ThenBy operator, LINQ, 149
ThenByDescending operator,
LINQ, 149
this keyword (calling another
constructor), 61
this modifier (for extension
methods), 138
this reference (referring to
instance), 63
tilde (~)
bitwise complement operator, 23, 46 finalizers, 68
ToArray operator, LINQ, 146, 151
ToDictionary operator, LINQ, 146, 151 ToList operator, LINQ, 146, 151
ToLookup operator, LINQ,
146, 151 ToLower method, strings, 31 ToString method, object class, 82
ToUpper method, strings, 31 Trim method, strings, 31 TrimEnd method, strings, 31 TrimStart method, strings, 31 true boolean value, 11 try statement, 117–124 type parameter variance, delegates, 106 typeof operator, 45, 80, 95 types, 10–19
anonymous types, 140 conversions between (see conversions) custom, 11–14 generic types, 92 getting, 80 instantiating, 13 members of, 12 nested, 91 numeric types, 19–25 partial types, 68–70 predefined (built-in), 10,
12, 18 primitive types, 19
Index | 203
Trang 7reference types, 15, 16, 18
runtime checking of, 80
static checking of, 80
value types, 15, 18
U
U suffix, numeric literals, 20
uint type, 19
ulong type, 19
unary operators, 43
unbound generic types, 95
unboxing, 79–80, 132
unchecked operator, 23, 45
#undef directive, 183
Unicode characters, escape
sequences for, 28
Union operator, LINQ, 145,
149
unmanaged code, pointers
and, 181
unsafe code, 177–181
unsafe keyword, 178
upcasting, 71
ushort type, 19, 24
using directive (importing
namespaces), 5, 57, 59
using statement (leveraging
IDisposable), 121
V
value types, 15, 18
var keyword, 42
variables, 35–43
assignment, 36
default values, 37
iteration variables,
capturing, 115
local variables, 4, 42
outer variables, capturing, 114
verbatim strings, 29 vertical bar (|) bitwise or operator, 23 logical or operator, 47
|| conditional or operator,
27, 47 vertical tab, escape sequence for, 28
virtual members, 73, 87 void expressions, 43 void return type, 5 void* pointer, 181
W
#warning directive, 182, 183 Where operator, LINQ, 142, 148
while loops, 52 whitespace, adding or removing, 31
X
XML, for documentation comments, 184–187
Y
yield break statement, 128 yield return statement, 127– 128
Z
zero division by, 22 negative, 24
204 | Index