作者:empty 页数:896 出版社:empty |
ACIP eat a logue record for this book is available front the Bri is hLi beary.Microsoft Press books are available through ba ok sellers and distributors worldwide.For further information aboutinternational editions, contact your local Microsoft Car poration office or contact Micra softPress International dire et ly atfax 4425]936-7329.VisitourWebsiteatwww.microsoft.com/mspress.Sendcommentstomsinputgimicrosoft.com.Micro saf, Microsoft Press.Active Accessibility, Active Directory.ActiveX.Authen i code, Dire etX, Excel.In tell Sense,Internet Expl are r, MSDN, Outlook, SideShow, Silver light, SQLServer, VisualBasic, VisualStudio, Win 32.Windows,Windows Live.WindowsMedia.WindowsNT.Windows Server and Windows Vista are either registered trademarksor trademarks of the Microsoft group of companies.Other product and camp any names mentioned her c in maybe thetrademarks of the irrespective owners.The example com panics, or gantz at ns, pro duets.domain nmes, t-mail addresses, logos.peopl, places, and eventsdepicted herein are fictitious No association with any real company.organization.produc L, domainname, e-mail address,logo, person, place, or event is intended or should be inferred.This ba ok expresses the author's views and opinions.The information contained in this book is provided without anyexpress.statutory, or implied warrant es.Neither the authors, Microsoft Corp uration.nor its resellers, or distributors willbc held h table for any damages caused or alleged to because de the r directly or in dire et ly by this hook.
Part I 1TheCLR's Execution Model.
Foreward.
Introduction.
CLR Basics
Compiling Source Cade into Managed Modules
Combining Managed Modules into Assemblies.
Loading the Common Language Runtime.-
Executing Your Assembly s Code.
The Native Cade Generator Tool NGen.exe
The Framework Class Library-.
The Common Type System.
The Common Language Specification, .
interoperability with Unmanaged Code.
and Types.
NET Framework Deployment Goals
Building Types into a Module
A Brief Look at Metadata.
Combining Modules to For man Assembly.
IL and Verification.
Unsafe Code.
Response Files
2 Building, Packaging, Deploying, and Administering Applications
What do you think of this book?We want to hear from you!
Adding Assemblies to a Project by Using the VisualStudio IDE.
Using the Assembly Linker.
Adding Resource Files to an Assembly.
Version Numbers.
Twa Kinds of Assemblies, Two Kinds of Deployment.
Giving an Assembly a Strong Name.
The Gla bal Assembly Cache.
Building an Assembly That References a Strongly Named Assembly-.
Strangly Named Assemblies Are Tamper-Resistant.
Delayed Signing.
Privately Deploying Strongly Named Assemblies
How the Runtime Resolves Type Ret erences.
Adi vanced Administrative Control(Configuration)
All Types Are Der ved from Systen.0bject
Cast ng Between Types-.
Namespaces and Assemblies-
How Things Relate at Runtime
Programming Language Primitive Types.
Reference Types and Value Types.
Boxing and Unboxing Value Types
Object HashCode s.
The dynamic Primitive Type.
The Different Kinds of Type Members
Type Vsi bit y.
Member Access ibl ty.
Static Classes-.
Partial Classes.Structures, and Interfaces.
Components, Polymorphism, and Versioning.
Constants.-n
Fields.
Assembly Version Resource Informaion.
Culture
Siple Appia tion Deployment(Privately Deployed Assemblies) .
Simple Administrative Control I Configura ton) .
Miros gft is interest din he a ing your feedback so we can con iua y improve our bocks and leaming
resources for you.To participate in a brief online survey, please visit:
TableofContents
3 Shared Assemblies and Strongly Named Assemblies.
Part II Designing Types
4Type Fundamentals.
5 Primitive, Reference, and Value Types.
6 Type and Member Basics.
7 Constants and Fields.
Publisher Policy Control.
Casting with the Cris and as Operators
Checked and Unchecked Primitive Type Operations,
Changing Fields in a Boxed ValueType by Using Interfaces f and Why You
Shouldnt Da This)
Object Equality and Ident ty.
Friend Assemblies.
How the CLR Cals Virtual Methods, Properties, and Events.
Using Type Visibility and Member Accessibility Intelligently
Dealing with Virtual Methods When Versioning Types.
Methods.
9 Parameters.
10 Properties.
11 Events.
TableofContents
12 Generics.
13 Interfaces.
Part II Essential Types
Instance Constructors and Classes(Reference Types l.
Instance Constructors and Structures(Value Types) .
Type Constructors
Operator Overload Methods
Conversion Operator Methods.
Extension Methods.
Partial Methods.
Optional and Named Parameters.
Impl ity Typed Local Variables
Passing Parameters by Reference to a Method.
Passing a Variable Number of Arguments to a Method
Parameter and Ret umn Type Guidelines.
Const-nes 5.
Parameterless Properties.
Parameter ful Proper ies.
The Performance of Calling Property Access or Methods.
Property Access or Accessibility
Generic Pra perty Access or Methods
Designing a Type That Exposes an Event.
How the Compiler Implements an Event.
Type Constructor Performance.
Operators and Programming Language Inter oper abilty.
Rules and Guidelines.
Extending Various Types with Extension Methods.
The Extension Attribute.
Rules and Guide ies.
Rules and Guidelines.
The Default Para neter Value and Optional Attributes.
Automatically Implemented Properties
Det in ing Properties Intelligently.
Object and Collection Initializers,
Anonymous Types.
The Systen.T up la Type.
Step#l:Dene a type that wll hold any add i ional information
that should be sent to receivers of the event notification.
Step#2:Define the event member.
5tep*3.De tinea method responsible for raising the event to
notify registered objects that the event has occurred
Step*4:Deine a method that translates the input into the desired event.
Designing a Type That Listens for an Event.
Explicitly Implemen ingan Event.
Generics in the Framework Class Library.
Wintellect's Power Collections Library.
Generics Infrastructure
Generic Interface 5.
Generic Delegates
Delegate and Interface Contra van ant and Covariant Generic Type Arguments.
Generic Meth ads.
Generics and Other Members
Verifiability and Constraints.
Class and Interface Inheritance
Defining an Interface
Inheriting an Interface-.
More About Calling Interface Methods.
Imp ict and Expl it Interface Method Implement at ians(W has Happening
Behind the Scenes) .
Generic Interfaces.
Generics and Interface Constraints
Imple renting Multiple Interfaces That Have the Same MethodName
Improving Compile-Time Type Safety with Explicit Interface Met had
Be Careful with Explicit Interface Met had Implementations.
Open and Closed Types.
Generic Types and Inheritance
Generic Type Identity
Code Explosion
Generic Methods and Type Inference-
Primary Constraints.
Secondary Constraints.
Constructor Constraints.,
Other Verifiability Issues
and Signature.
Implementations.
Design:BaseClass or Interface?.
Characters.
The Systen.5tring Type
14Chars, Strings, and Working with Text.
Constructing Strings
Strings Are Immutable
Camp a ring Strings
String Interning.
String Pool ng
Examining a String's Characters and Text Elements
Other String Operations.
Constructing a StringBuilder Object.
StringBuilder Members.
Specific Formats and Cultures.
Format tng Multiple Objects into a Single String
Providing Your Own Custom Formatter,
Encoding and Decoding Streams of Characters and Bytes.
Base-64StringEncading and Decoding.
C 4's Support far Delegate Chains
Having More Control over Delegate Chain Invocation
Constructing a String Efficieny.
Obtaining a String Representa ion of an Object ToString.
Parsing a String to Obtain an Object Parse
Encad ings Converting Between Characters and Bytes
Secure Strings.
Enumerated Types.
Bit Flags
Adding Methods to Enumerated Types
Initializing Array Elements.
Casting Arrays i
All Arrays Are Implicitly Der ved from Systen.Array
15 Enumerated Types and Bit Flags.
Arrays.
17 Delegates.
TableofContents
18 Custom Attributes.
19 Nullable Value Types.
Part IV Core Facilities
20 Exceptions and State Management.
All Arrays Implicitly Implement IE nu nerable I Collection, and I List.
Passing and Retu ming Arrays.
Creating Non-Zera-Law erBa und Arrays.
Array Access Performance.-.
Unsafe Array Access and Fixed-Size Array-
A First Look at Delegates.
Us ng Delegates to CallBack Static Meth ads
Using Delegates to CallBack Instance Methods.
Demystifying Delegates
Uing Delegates to CallBack Many Methods{Chaining) .
En augh with the Delegate Definitions Already(Generic Delegates) .
C#s Syntactical Sugar for Delegates.
Delegates and Reflection.
Syntactical Shortcut#1No Need to Construct a Delegate Object.
Syntactical Shortcut#2:No Need to Define a Callback Method
Syntactical Shortcut#3:No Need to Wrap Local Variables in a Class
Manually to Pass Them to a Callback Method.
Using Custom Ati but es.
Defining Your Own Attribute Class.
Attribute Constructor and Field/Property DataTypes.
Detect ng the Use of a Custom Attribute.
Matching Twa Attribute Instances Against EachOther,
Detec ng the Use of a Custom Attr buteWihoutCreatngAttute-Der ved
Objects
Conditional Attribute Classes
Ces Support for Nullable Valu o Types in
C#s Null-Coalescing Operator.
The CLR Has Special Support for Nullable Value Types:
Defining Exception
Exception-Handling Mechanics
The System.Exception Clss
FCL-Defined Exception Classes.
Throwing an Exception
Defining Your Own Exception Class
Trading Reliability for Productivity.
Guidelines and BestPractices.
Unhandled Exceptions,
Debugging Exceptions.-
Exception-Handling Per farm ance Considerations.
Constrained Execution Regions(CERs) :.
Code Contracts,
Boxing Nullable Value Types.
Unboxing Nullable Value Types,
ca lng GetType via a Nullable ValueType-.
Calling Interface Methods via a Nullable ValueType
The try Block
The catch Block
The finally Block
Use final 7y Blocks Liberally-
Don't Catch Everything.
Recovering Gracefully from an Exception.
Backing Out of a Partially Completed Operation When:an Unrecoverable
Exception Occurs一Maintaining State
Hiding an Implementation Detail to Maintain a Contract
Automatic Memory Management(Garbage Collection) .
22CLR Hosting and App Domains.
TableofContents
23 Assembly Loading and Reflection.
24 Runtime Serialization.
Part V Threading
25 Thread Basics.
Understanding the Basis of Working in a Garbage-Colected Platfo mm.
The Garbage Collection Algorithm
Garbage Collections and Debugging.
Uing Final iation to Release Na tie Resources
Using Finalization with Managed Resources.
What Causes Finalize Methods to Be Called?.
Finalization Internals
The Dispose Pattern:Forcing an Object to CleanUp.
Using a Type That Implements the Dispose Pattern.
C#s using Statement
An Interest ng Dependency Issue.
Mon to ring and Control lig the Life te of Objects Manually.
Resurrection.
Generations.
Other Garbage Collection Features for Use with Native Resources
Predicting the Success of an Operation that Ro quires aLot of Memory
Programmatic Control of the Garbage Collector-
Thread Hijacking.
Garbage Collection Modes.
Large Objects
Monitoring Garbage Collections.
CLR Hosting
App Domains.-.
AppDomain Unloading-.
AppDomain Monitoring.
AppDomain First-Chance Exception Notifications
How Hosts Use App Domains
Advanced Host Control
Allocating Resources from the Managed Heap.
Guaranteed Fnz at in Us ng Critical Finalizer Object Types
Interoperating with Unmanaged CadebyUsingSafeHand1e Types.
Accessing Objects Across AppDomain Boundaries
Executable Applications.
Microsoft Silver light Rich Inte met Applications-111
Mi