| CollectionCount method class library developers, exception handling guidelines, 478, 485
classes
defining, 168, 276
generic collection, 125
inheritance, 296
partial, 159
as reference types, 119 sealed, 168
security, 168
static, 158
WinRT, 646
cleanup code, 478. See also catch blocks; finally
blocks; try blocks; garbage collection construction of, 479
Dispose method, 535, 537 exceptions thrown by, 457 guaranteeing, 497
for native resources, 533 Clear method, 337
CLI (Common Language Infrastructure), 24 Clone method, 335
cloneable variables, 301
cloning strings, 335
cloning, via serialization, 615 Close method, 648
closed types, 272
CloseHandle method, 780
CLR (Common Language Runtime) code language vs. behavior, 25 code location for, 554
common language aspect of, 152 compilers for, 4
defined, 3
demonstration of, 104
field layout, 123
functions performed by, 471 headers, 5
hosting, 554
interoperability with unmanaged code, 30 loading, 8, 556
namespaces and, 98 nullable type support, 447
passing blocks of data to WinRT, 656 setting host managers, 555
shutting down, as garbage collection trigger, 519
type references, resolving, 80 type safety, 95
version, checking, 8
versioning in, 161
WinRT, mapping types to, 659 CLR projections, 645
WinRT component type system rules and, 645
CLRCreateInstance function, 554
CLRVer.exe, 8
CLS (Common Language Specification), 26
example code using, 27 exceptions, 458
rules overview, 28
Code Contract Checker (CCCheck.exe), 503 Code Contract Document Generator Tool
(CCDocGen.exe), 504
Code Contract Reference Assembly Generator (CCRefGen.exe), 504
code contracts, 475, 498
checking, 503, 504
Contract class, 498
defining, 501
exceptions, 500
runtime function, 502 tools for maximizing, 499
turning on features for, 500 violation of, 500
code explosion, 183, 277
code optimization, 14, 763 Volatile class and, 765
code pages, specifying, 352 code, program order, 765 code reuse. See generics codeBase elements, 45, 84
Collect method, 519, 522, 523 collection classes
generic, 125, 270
thread-safe, 818
collection initializers, 235
collection objects, serializing/deserializing, 622 collection types, WinRT, 648
CollectionCount method, 524
Collections
collections, 260 adding items to, 236
array implementation of, 381 maximum number in, 821
non-blocking, into blocking, 820 producer/consumer scenario, 821
WinRT, 648
ColorMatrix class, 244
COM Callable Wrappers (CCWs), 644
COM components, WinRT components as, 644 Combine method, 400
command-line switches, response files, 36 Common Language Specification. See CLS (Common Language Specification)
Common Type System. See CTS (Common Type System)
compacting memory in garbage collection, 509, 521
Compare method, comparing strings, 325 CompareExchange method, 769, 776, 810 CompareInfo
class, methods in, 329 object, 326, 327
property, 327
CompareOptions type, 324
CompareTo method, 135, 311, 318
comparing strings, 323
comparisonType argument, 324
CompilationRelaxations attribute, 330
CompilerGenerated attribute, 410 compilers
code optimization by, 763 functions performed by, 470
managed, exception handling by, 492 compiling source code, 3 CompleteAdding method, 821
Component Object Model (COM). See COM objects
Component Software Processing (CSP), 160 components
overview of, 160
servicing, 161
composability of object-oriented programming, 470
compressing, assemblies, 74
compute-bound asynchronous operations, with threads, 678
compute-bound operations, 691, 693
canceling, 696
canceling after set time, 700 cooperative cancellation, 696
initiating, 700
periodic, 720
preventing cancellation of, 698 ComputeResult method, 770
Concat method, 129, 222
concatenating strings, 322
ConcurrentBag class, 818
concurrent classes, 818
ConcurrentDictionary class, 818
ConcurrentExclusiveSchedulerPair class, 815
ConcurrentQueue class, 818
ConcurrentStack class, 818 condition variable pattern, 811 conditional attribute classes, 440 ConditionalWeakTable class, 551
configuration files, 62, 84
components of, 84
locating, 64
publisher policy controls and, 86
as separate assembly files, 87 ConfigureAwait method, 750
Console class, 345, 759 constants
constraints on, 175
defined, 151, 175
metadata and, 175
for non-primitive types, 175 const-ness, unsupported, 224
ConstrainedCopy method, 380
ConstrainedExecution namespace, 528
constrained execution regions (CERs), 475, 494 constraints
constructor, 289
generics and, 285
primary, 287
reference types as, 287 secondary, 288
on type parameters, 287 constructing type instances, 594 constructor constraints, 289
CreateEvent method
constructor method, 43, 181, 184, 187, 396
calling default, 186 creating types without, 182 default, 181
defining multiple, 182 defining on value types, 185 for delegates, 398
inheritance, 181
parameterless, 186 virtual methods and, 182
ConstructorInfo object, 595 constructors
defining, 595
for custom attribute classes, 428 named parameters, 424
parameterless, 235
positional parameters, 424
for serialization/deserialization, 628 Task objects and, 701
thread, 679
context structures, 683
context switching, 672, 683
in asynchronous synchronization, 814 avoiding, 673
I/O operations and, 731 performance issues, 672, 673
contexts, thread, 671
ContinueWhenAll method, 710
ContinueWith method, 705, 707, 729, 733
Contract class, 475
contract reference assemblies, 504 ContractFailed event, 500
ContractInvariantMethod attribute, 502
ContractReferenceAssembly attribute, 504 contra-variant reference types, 395
contra-variant type parameters, 279 in and out keywords, 280
convenient syntax, 183
conversion constructors, 195 conversion operator methods, 195
constructing, 197
implicit and explicit, 196, 197
metadata for, 197
parameters for, 197
support for, 198
conversion operators, defined, 152
Convert class, 628
Convert method, 355
Convert type, 319, 356
ConvertIList method, 289
cooperative cancellation, 696 unhandled exceptions and, 698
Copy method, 335
Array class, 378, 382
vs. BlockCopy method, 380
copy operation, and unboxing types, 127 copying
arrays, 378, 382
strings, 335
CopyTo method, 335, 338, 658
CoreClr.dll, 574
cores, multiple. See multiple cores CorFlags.exe, 9
corrupted memory, 506
object state, avoiding, 228 state exceptions (CSEs), 489
corruption. See state corruption CountdownEvent class, 804
Counter method, 393, 394 delegate chaining and, 403
country identifiers, 326
covariant
in and out keywords, 280 reference types, 395
type parameters, 279
CPU virtualization, 670. See also threads CPUs. See also multiple cores
aggressive utilization of, 682 analyzing usage of, 682
heat dissipation and, 677, 681 high usage, as good thing, 688 hyperthreaded, 677
low usage of, 691 multiple cores, 677
power utilization, optimal, 681 trends for, 677
CreateDelegate method, 417
CreateDomain method, AppDomain overloads of, 563
CreateEvent method, 780
Date: 2016-03-03; view: 697
|