![]() CATEGORIES: BiologyChemistryConstructionCultureEcologyEconomyElectronicsFinanceGeographyHistoryInformaticsLawMathematicsMechanicsMedicineOtherPedagogyPhilosophyPhysicsPolicyPsychologySociologySportTourism |
CreateFile method, synchronous execution ofCreateFile method, synchronous execution of, 752 CreateInstanceAndUnwrap method, 564 CreateInstanceFrom method, 595 CreateInstance method, 383 Activator class, 594 AppDomain class, 595 Array class, 596 CreateMemoryResource notification, 519 CreateMutex method, 780 CreateProcess function, 557 CreateSemaphore method, 780 critical regions, 577 CriticalFinalizer object, 528 CriticalHandle class, 531 CSC.exe, 36 CSC.rsp, 36 CSP containers for public/private keys, 78 CTS (Common Type System), 24 CUI (Console User Interface) applications, 36 culture setting in assemblies, 59 CultureInfo class, 318 CultureInfo type, 326, 342 CurrentCulture property, 318, 326 CurrentUICulture property, 326 custom attributes, 421. See also attributes applying multiple times, 427 attribute objects, constructing, 431 AttributeUsage attribute, 428 class inheritance, 425, 428 conditional attribute classes, 440 constructors, 428 creating, 425 C# syntax for, 422 data types for, 428 defining attribute class, 425 defining classes for, 428 definition of, 424 derivation of, 424 detecting in code, 430 detecting in code, without executing, 437 detecting specific, 432 discovering, 602 enumerated types, 427 examples of, 422 as logical state containers, 425 matching against each other, 434 multiple, applying, 424 named parameters, 424 positional parameters, 424 prefixes, 423 public constructors, 427 security concerns, 437 serialization and, 429 suffix, omitting, 424, 425 syntax for, 424 targets for, 423 Visual Basic .NET syntax for, 423 CustomAttributeData class, 437 CustomAttributeExtensions class, 430
D data collections, LINQ queries on, 717 data encapsulation, 228 data types, for custom attribute classes, 428. See types DataContractSerializer class, 612 datatips, 339 date formatting, 341 dates and times, in WinRT, 647 DateTime structure, 647 type, 349 DateTimeFormatInfo type, 343 DateTimeOffset structure, 647 deadlocks, 750, 761 debuggable attribute, 511 debuggers generics and, 271 asynchronous I/O operations and, 731 threads and, 673 debugging and garbage collections, 510 asynchronous functions, 745 exceptions, 490 decimal type, 112, 118 declaring delegates, 392 declaring methods, for variable number of arguments, 220 declaring properties, 231 in anonymous types, 238
Display method Decoder class, 356 Decoding bytes, 356 strings, 356 Decrement method, 791 decrypting SecureStrings, 360 dedicated threads, 679 default AppDomain, 556 default properties. See parameterful properties DefaultMember attribute, 246 DefaultParameterValue attribute, 212 defining classes, 168 fields, without initialization, 184 properties, 230 types, 251 definition tables in metadata, 39 Delay method, 722 delayed signing, 76 Delegate class, 397 delegate fields, 257 delegate types extension methods for, 202 serializing, 618 WinRT, 647 delegates, 249. See also callback functions adding/removing, 604 arrays, returning each reference in, 405 callback method, invoking, 399 calling back instance methods, 395 calling back static methods with, 394 calling private members with, 394 chaining, 400, 404 chaining, C# support for, 404 chaining, result variable and, 404 class defined by, 396, 397 constructors, 398 contravariant type parameters, 279 covariant type parameters, 279 creating, 392 defining, 408 definitions for, 407 extension methods and, 203 garbage collection, 401 generic, 278, 407 initialization of, 398 invariant type parameters, 279 invoking dynamically, 417 MulticastDelegate class, 397 reflection and, 416 removing from chains, 403 syntax, 408 syntax shortcuts for, 409, 410, 413 for tasks, passing, 715 unregistering, 260 Delete method, exceptions thrown by, 532 delete operator, 93 DeleteAsync method, 742 deploying assemblies, 60 privately, 79 derived class, 311, 312 derived types, preconditions and, 502 deserialization of application state, 616 of collection objects, 622 controlling, 619 controlling data, 624 definition of, 611 formatter consistency, 615 ISerializable interface, 625 matching serialization method, 628 into object graphs, 615 of objects, as different objects, 633 overriding assembly/type, 640 quick start for, 613 setting up, 628 of singleton types, 633 streaming contexts for, 631 surrogates for, 636 type bindings, 641 of type instances, 624 Deserialize method, 635 DeserializeFromStream method, 615 deserializing objects, 182 diagnostics namespace, 688 dictionary type, serialization, 626 direct memory accesses, 386 DisableOptimizations flag, 511 disambiguating types, 99 DispatcherTimer classes, 723 DispatcherUnhandledException event, 488 Display method, 283
Dispose method Dispose method, 260, 358, 512, 533, 648, 699 avoiding, 535 calling explicitly, 537 in finally block, 535 native resource cleanup and, 534 on Task objects, 708 WaitHandle class, 780 distributed applications, unhandled exceptions in, 488 DllMain method, 671 DLLs interoperability of, 34 performance issues and, 672 thread-attach and thread-detach notifications, 671 double-check locking, 807 double type, 112 downloading assemblies from web, 586 DumpBin.exe, 9 dynamic expressions, as object types, 147 dynamic keyword, 214 dynamic type, 112, 144 example of, 145 vs. var keyword, 146 dynamically extensible applications, 583 building, 588 Managed Extensibility Framework (MEF), 598 DynamicAttribute method, 145 DynamicInvoke method, 417 dynamification, 147
E early binding, 589 encoding explicitly constructing types, 353 methods, 355 stateless, 356 Encoding class, 352 properties, 352 encodings, 350 property values, 354 EndBackgroundProcessing, 755 EndsWith method, comparing strings, 325 EndWaitForConnection method, 743 EndXxx method, 481 EnsureCapacity method, 337 EnsureInitialized method, 811 EnsureSufficientExecutionStack method, 489 Enter method, 790 overloading, discouraged, 476 Monitor class, 795, 797 Enum class, 362 Enum type, 364 enumerated type, 361 bit flags, defining with, 368 classes derived from, 362 converting symbols into, 366 converting values into flags, 370 declaring, 363 defined symbols in, 370 defining, 367 displaying all values for, 365 extension methods for, 202 formatting, 364 IsDefined method and, 371 mapping to strings, 364 methods, adding, 371 with multiple symbols, 364 parameter validation, 366 as primitive types, 363 serializing, 618 structure of, 362 symbols as constant fields, 362, 363 underlying types for, 363 user interface display of, 365 enumerating types, 588 enumeration types, in WinRT, 646 ephemeral garbage collector. See garbage collection epilogue code, 102 equality operators, nullable types and, 444 Equals method, 139, 238, 332, 338, 355 overriding, 140, 141 properties of, 141 System.Object, 92 error messages, 157 errors. See exceptions; exception handling escalation policy, 577 event handlers asynchronous functions and, 741 class naming convention, 251 Exceptions code contract violations and, 500 method signatures, 741 void return type, 253 event log, viewing unhandled exceptions in, 485 EventArgs class, 251 EventAwaiter class, 741 EventDef table, 39 EventHandler delegate type (WinRT), 647 EventHandlersStore type, 262 EventInfo type, 604 events, 249, 782 _add prefix, 257 architecting applications for, 250 auto-reset, 784 compiler implementation of, 256 defined, 24, 152 delegates, 249 delegates, adding/removing, 604 designing types to expose, 250 explicitly implementing, 260 members, defining, 252 metadata on, 604 notification for, 253 notifications, unregistering, 260 Object type, 252 as primitive kernel-mode thread synchronization constructs, 778 raising, in thread-safe way, 254 types for listening, 258 typing the return parameter, 253 typing the sender parameter, 252 unregistering, 260 unregistering interest from objects, 257 WinRT, 647 EventSet class, 262 EventWaitHandle class, 780 Exception class, 460 exception-derived types, hierarchy of, 593 exception handling assuming exceptions will occur, 470 asynchronous functions and, 744 backing out of partial operations, 482 best practices, 478 catch blocks, 455, 480 for class library developers vs. application developers, 478, 485 CLS objects, 458 defined, 453 differing implementations of, 492 example code for, 453 exceptions thrown by, 457 finally blocks, 456, 478 guidelines, 478, 485 for high error rate methods, 493 language for, 457 localizing string messages, 467 managed compilers and, 492 mechanics of, 453 migrating code for, 459 non-CLS objects, 458 notifications for, 456 performance issues, 492 problems with, 477 programming culture and, 473 reflection and, 485 Reliability Monitor problem signatures, 487 reliability vs. productivity, 469 resetting exception starting point, 462 stack tracing, 461, 462, 463 state corruption and, 474 state corruption, mitigating, 475 System.Exception type, 460 testing with Performance Monitor, 493 thread synchronization locks and, 476 try blocks, 454 TryParse method and, 494 viewing exception objects, 455 Windows Error Reporting, 488 Exception objects, avoiding throwing, 466 exceptions adding types to Visual Studio debugger, 491 asynchronous, 495 catching all, when to, 482 catching specific, when to, 483 class derivation of, 469 for code contract violations, 500 in critical regions, 577 debugging, 490 defined, 452 defining custom classes for, 467
Exceptions dialog box (Visual Studio) exceptions (continued) designing for, 453 FCL-defined classes, 463 locating source of, 484 maintaining method contracts after, 483 potential sources of, 471 processing, 573 recovering gracefully from, 481 re-throwing, 480, 482 re-throwing different exception, 483 serializable, 467 System.Exception type properties, 460 throwing, 466 types, 463, 466 unhandled, 474, 480, 485, 488 versioning issues, 466 WinRT and, 647 Exceptions dialog box (Visual Studio), 490 Exchange method, 769 executable applications, AppDomains and, 574 executable files. See also PE (portable executable) files 32-bit vs. 64-bit, 9 compiling, 35 ExecuteCodeWithGuaranteedCleanup method, 497 ExecuteDbDataReaderAsync method, 742 ExecuteNonQueryAsync method, 742 ExecuteReaderAsync method, 742 ExecuteScalarAsync method, 742 ExecuteXmlReaderAsync method, 742 executing assembly code, 11 execution context, 694 controlling, 695 ExecutionContext class, 695 helper threads and, 695 performance issues and, 695 suppressing, 695 Exit method, 574 Monitor class, 795, 813 expanding characters, 327 ExpandoObject class, 242 explicit interface method implementations (EIMIs), 303, 308, 310 explicit methods, state corruption and, 476 explicit type casts, 114 explicitly implementing events, 260 ExportedTypesDef table, 47 exposing events, designing types for, 250 exposing state, 168 expressions, casting to dynamic, 145 Extensible Storage Engine, 477 extension attribute, 203 extension methods, 198, 201, 362 advantages of, 199 declaring, 200 defining, 255 for delegate types, 202 displaying list of, 200 for enumerated types, 202 for interface types, 202 LINQ technology, 202 multiple, avoiding, 201 for passing data between CLR and WinRT, 657 performance issues, 201 rules and guidelines for, 200 versioning and, 201 ExtensionAttribute class, 203
F factories, task, 709 FailFast method, 477, 480 Family and Assembly accessibility, 157 FaxMsg method, 259 FCL (Framework Class Library), 22 exceptions defined by, 463 generics in, 270 hybrid constructs in, 793 thread safety, 759 unhandled exception documentation, 488 WinRT supported types, 645 FCL types vs. primitive types, 113 with corresponding primitive types, 112 FeedbackToConsole method, 394 FeedbackToFile method, 396 FeedbackToMsgBox method, 394 field layout for types, 123 FieldDef table, 39 FieldGetter method, 566 FxCopCmd.exe FieldInfo objects, converting to RunTimeFieldHandle, 609 fields backing, 230 in boxed value types, changing, 136 defined, 24, 151, 177 defining, 178 defining, without initialization, 184 encapsulating, 228 initializing, 182, 187 initializing, with convenient syntax, 183 inline initialization, 179 modifiers for, 177 private, 168, 228, 231 FieldSetter method, 566 file extensions for WinRT components, 644 .winmdobj, 659 file names, WinRT, 645 file versioning, difficulties with, 66 FileAttributes type, 367 FileDef table, 47, 81 FileNotFoundException exception, 584 FileStream class, 532 I/O operations and, 728 objects, asynchronous and synchronous operations with, 753 type, 525, 537 finalization, 525, 542 garbage collection and, 544 list, 542 freachable queue and, 544 Finalize method, 525, 526, 542 CLR thread dedicated to, 544 inherited, 543 memory leaks and, 526 overriding, 479 similarity to destructor, 526 System.Object, 92 finally blocks, 455, 456. See also catch blocks; try blocks as callback methods, 497 constrained execution regions and, 475 Dispose method in, 535 exceptions thrown by, 457 liberal use of, 478 try blocks and, 457 FirstChanceException event, 573 fixed statement, 548 Flags attribute, 368 FlagsAttribute class, 430 Flatten method, 703 float type, 112 FlushAsync method, 742 For method (Parallel class), 713, 714 ForAll method, 718 forcing garbage collection, 522, 539 ForEach method (Parallel class), 713, 714 foreground threads forcing, 679 vs. background, 688 Format method, 344, 364 overloading, 344 vs. ToString method, 364 FormatterConverter type, 628 FormatterServices type, 623, 628 Formatting, strings, 346 Forms namespace, Timer class, 723 Framework Class Library. See FCL (Framework Class Library) asynchronous functions in, 742 types. See FCL types framework projections, 645, 649 freachable queue, 543 finalization list and, 544 naming of, 544 Free method, 548 friend assemblies, 154 modules in, 156 friendly names, 563 FromAsync method, 743 FromBase64String method, 356 FromCurrentSynchronizationContext method, 711 Func delegate, 279, 408 functions, callback. See callback functions FxCopCmd.exe, 480
GAC (global assembly cache) G GAC (global assembly cache), 72 installing into, 72 permissions required for, 73 uninstalling assemblies from, 73 GACUtil.exe, 72 Windows install switch, 73 garbage collection, 507 algorithm, 507 asynchronous I/O operations and, 731 for bitmaps, 538 byte array method and, 548 Collect method, 523 compacting phase, 509 concurrent vs. non-concurrent mode, 521 debugging and, 510 dependency issues, 537 Dispose method, 512 vs. Dispose method, 535 finalized objects and, 544 Finalize method and, 526 forcing, 522, 539 generational, 513 generational, assumptions made by, 514 generations and, 513 handle tables, 545, 547 idle threads and, 517 large objects and, 519 latency modes, 522 lease managers, 567 marking phase, 508 memory budgeting and, 517 memory compacting, 521 memory usage, monitoring, 524 monitoring, 524 native resources and, 538 notifications for, 518, 523 object lifetime and, 510 object lifetime, controlling manually, 545 OutOfMemory exceptions, 510 performance goals, 515 pinning objects, 548
reference counting algorithms, 508 resurrected objects, 544 roots and, 509 server mode, 520 symbols for, 522 threads and, 673 Timer objects and, 721 triggers for, 519 for types wrapping native resources, 525 on unloaded AppDomains, 571 weak references and, 550 workstation mode, 520 GCCollectionMode enumerated type, 523 GCHandle type, 545 explicit, 548 GCHandleType type, 546 GCLatencyMode property, 521 GCNotification class, 518 GCSettings class, 521 GCWatch method, 551 generation,1, 2, 513, 514, 516 growth of, 516 promotions to, 515 generic arguments, limiting types, 285 collection classes, 125, 270 contravariant and covariant type parameters, 281 delegates, 278, 407 interfaces, 277, 278, 297, 303 list algorithm, 266 namespace, 313 vs. non-generic versions, 304 type identity, 275 type parameters, 305 generic methods, 265, 281 example of, 282 overriding, 286 static, 270 type inference and, 283 generic type variables as operands, 292 casting, 290
Date: 2016-03-03; view: 921
|