| Type-safe languages type-safe languages, 144
type safety, 219, 267
interfaces and, 308, 309
protecting, 277
reflection and, 589
type variables, generic, 290, 291, 292
TypeDef table, 39
TypeInfo class, 602
TypeInfo object, 592
querying, 593
TypeInfo objects, 592
typeless instructions, 17
typeof operator, 429, 592
TypeRef table, 40
types, 24. See also CTS (Common Type System) across assemblies, 597
as add-ins, 596
aliases, creating, 99
ambiguous references, 99
anonymous, 237, 238, 239
arity, 273
assembly, 25
Backus-Naur Form grammar for, 592 building into modules, 35
casting between, 93
casting with is/as operators, 95 catch, 456
common properties and methods, 602 constructing instance of, 594 converting, 628
converting between, 195 creating objects for, 596 data fields in, 105 declaring, 214
defining, 35, 105, 251
disambiguating, 99
discovering members, 599, 604
dynamically constructing, 590
enumerated, 361
enumerating, 588 example definition of, 28 exception, 463, 466
exception-derived, hierarchy of, 593 exposing events with, 250
external, 35
field layout, 123
general format, 341
generic, 265, 266, 269, 274, 276, 596
generic identity, 275 generic interfaces and, 278 help documentation for, 310 helper, 169
inferring from initializing expression, 212
initializing static fields, 189
invoking members, 603
vs. keywords, 113 limiting, for generics, 285 linked lists, 274
listening for events, 258 literal, 114
locations of, 81
member accessibility, 156
members of, 24, 151
method tables, 301
moving between assemblies, 83 namespaces, 97, 99
naming conventions, 273
nullable, 441, 443, 445
overloading, arity-based, 286
partial, 159
performance issues, 167
primitive, 111
properties, obtaining, 593
public, 25, 154
querying, 600
recognized formats, 340
reference, 118
referenced assemblies, 98
referencing, 35
reflection, 588, 589, 600
resolving, 593
resolving references, 80 restricting access to, 25 returning name of, 339 for runtime handles, 608 safety, 95
serializing, 617, 618, 620, 623
signed, 117
singleton, 633
surrogate, for serialization, 636
Value types
System.Object derivation, 91
Tuple, 237, 240
unique names, 99
unloaded, 191
value, 118, 277
visibility, 154, 156, 166
Visual Studio tooltips for, 214 WinRT, 646
interoperability, 649
without instance constructors, 182
U
UI elements, removing, 682 uint type, 112
ulong type, 112
unary operators, 192 nullable types and, 444
unboxing
nullable types, 448
value methods, 135
unboxing value types, 124, 126
efficiency of, 130
example code, 128
field copying and, 127
unchecked operators, 116
unhandled exceptions, 474, 480, 485 asynchronous functions and, 745 in distributed applications, 488 FCL documentation, 488
from type constructors, 189 UnhandledException event, 488
UnhandledExceptionFilter event, 488
Unicode characters, 333 converting to MBCS, 350
Unicode code values, 317 UnicodeCategory type, 317
Unload method, 566, 570
unloaded types, 191 unloading
AppDomains, 477, 494, 566, 570
assemblies, 587
as garbage collection trigger, 519 unmanaged C++, 224
unmanaged callback functions, 391 unmanaged code
C++ compiler and, 6
CLR interoperability with, 30 performance of, vs. managed, 15
UnobservedTaskException event, 703
Unregister method, 260
unsafe code, 17
unsafe modifier, 388
UnsafeLoadFrom method, 586
Unwrap method, 595
uppercase/lowercase, converting between, 318 Uri type, 648
URIs, WinRT, 648
user-defined attributes. See custom attributes user-mode constructs, 760, 762
vs. kernel-mode constructs, 784 vs. primitive-mode constructs, 778
user-mode stacks, 671
ushort, 112
using directive, generic types and, 276 using statement, 536
UTF-7 encoding, 351
UTF-8 encoding, 351
UTF-16 encoding, 351
UTF-32 encoding, 351
V
value methods, boxing and unboxing, 135 value types, 118, 441
boxing and unboxing, 124, 126, 128 calling virtual methods, 133 changing fields in, 136
complexity of, 138
constructors, 184
converting to reference types, 125 default constructors, 186
defining, 132
defining constructor methods on, 185 defining type constructors in, avoiding, 188 example code, 121
examples of, 119
field layout, 123
immutability of, 138
ValueType class
value types (continued) initializing fields, 187 interface methods for, 319 interfaces and, 301
native code for, 277 nullable, 441, 443, 646
out keyword vs. ref keyword, 215 overlapping with reference types, 124 vs. reference types, 122
serializing, 618
with type constructors, 188 unboxing, and field copying, 127 verifiability, 186
virtual methods, calling, 165 when to use, 121
WinRT, 646
ValueType class, 362
var keyword, 237
vs. dynamic, 146
vs. dynamic keyword, 214 variables
cloneable, 301
implicitly typed, 212, 237 initializing with null, 213 of interface types, 300 temporary, 284
variance, restrictions on, 280 vectors, 375. See also arrays verbatim strings, 322 verification
of generics, 284
generics and, 290
IL and, 16
skipping, 18
verifying assemblies, 76
skipping, 77
VeriSign IDs, 488 version
numbers, 58
resources, 54
attributes, 56
versioning, 161, 167
assemblies and, 587, 597 extension methods and, 201 interfaces and, 313
virtual methods and, 169
virtual instance methods, 108 virtual methods, 163, 165
calling, 133
call instruction for, 165 constructor methods and, 182 interfaces and, 299
minimizing, 166
performance of, 167
security of, 168
versioning and, 169
visibility, type, 154, 166 Visual Studio
debugger, and properties, 234 exception debugging, 490 exceptions, adding to debugger, 491 Exceptions dialog box, 490
IDE, adding assemblies with, 51 Intellisense, 200
partial methods in, 206 publishing applications with, 61
speed of, due to multiple cores, 682 target platform, setting, 8
tooltips, viewing, 214
Windows Runtime Component project, 659 volatile
class, 765, 767, 768, 773, 805, 808
fields, 177
keyword, 767
volatile constructs, 762, 766 C# support for, 767 drawbacks of, 767
Volatile.Read method, 254
W
Wait method, 702
WaitAll method, 703, 779
WaitAny method, 703, 779
WaitAsync method, 815 WaitCallBack delegate type, 693
WaitForConnectionAsync method, 743
WaitHandle class, 778
WaitOne method, 779
Weak flag, 546, 549
weak references, 550, 551
Date: 2016-03-03; view: 1037
|