Training
Certifications
Books
Special Offers
Community




 
Inside C#
Author Tom Archer
Pages 432
Disk 1 Companion CD(s)
Level All Levels
Published 05/09/2001
ISBN 9780735612884
ISBN-10 0-7356-1288-9
Price(USD) $49.99
To see this book's discounted price, select a reseller below.
 

More Information

About the Book
Table of Contents
Sample Chapter
Index
Related Series
Related Books
About the Author

Support: Book & CD

Rate this book
Barnes Noble Amazon Quantum Books

 

Table of Contents


    Forewordxv
    Introductionxix
PART I   LAYING THE GROUNDWORK 
1   Fundamentals of Object-Oriented Programming3
    Everything Is an Object5
        Objects vs. Classes9
        Instantiation9
    The Three Tenets of Object-Oriented Programming Languages11
        Encapsulation11
        Inheritance14
        Polymorphism17
2   Introducing Microsoft .NET23
    The Microsoft .NET Platform23
    The .NET Framework24
        Windows DNA and .NET24
        The Common Language Runtime25
        The .NET Framework Class Libraries26
        Microsoft Intermediate Language and the JITters28
        Unified Type System30
        Metadata and Reflection30
        Security31
        Deployment32
        Interoperability with Unmanaged Code32
3   Hello, C#35
    Writing Your First C# Application35
        Choosing an Editor35
        "Hello, World"38
        Using the Command-Line Compiler38
        Running the Application39
    Code Walk-Through40
        One-Stop Programming40
        Classes and Members 41
        The Main Method41
        The System.Console.WriteLine Method42
        Namespaces and the using Directive42
        Skeleton Code43
    Something Went Wrong!45
        Compile-Time Errors45
    Spelunking with ILDASM46
        "Hello, World" in MSIL47
    C# Programming Guidelines50
        When to Define Your Own Namespaces 50
        Naming Guidelines50
        Naming Convention Standards51
PART II   C# CLASS FUNDAMENTALS 
4   The Type System57
    Everything Is an Object57
    Value Types and Reference Types58
        Value Types58
        Reference Types59
    Boxing and Unboxing59
    The Root of All Types: System.Object60
    Types and Aliases61
    Casting Between Types62
    Namespaces64
        The using Keyword65
    CTS Benefits66
        Language Interoperability66
        Singly Rooted Object Hierarchy67
        Type Safety67
5   Classes69
    Defining Classes69
    Class Members70
    Access Modifiers71
    The Main Method72
        Command-Line Arguments73
        Return Values74
        Multiple Main Methods74
    Constructors75
        Static Members and Instance Members77
        Constructor Initializers79
    Constants vs. Read-Only Fields82
        Constants82
        Read-Only Fields83
    Object Cleanup and Resource Management85
        A Bit of History86
        Deterministic Finalization87
        Performance88
        The Perfect Solution94
        The (Almost) Perfect Solution95
        The Dispose Design Pattern96
    Inheritance97
        Multiple Interfaces99
        Sealed Classes100
6   Methods103
    ref and out Method Parameters103
    Method Overloading108
    Variable Method Parameters111
    Virtual Methods112
        Method Overriding112
        Polymorphism114
    Static Methods120
        Access to Class Members122
7   Properties, Arrays, and Indexers123
    Properties as Smart Fields123
        Defining and Using Properties124
        What the Compiler Is Really Doing126
        Read-Only Properties128
        Inheriting Properties128
        Advanced Use of Properties129
    Arrays130
        Declaring Arrays130
        Single-Dimensional Array Example131
        Multidimensional Arrays132
        Querying for Rank134
        Jagged Arrays135
    Treating Objects Like Arrays by Using Indexers136
        Defining Indexers137
        Indexer Example138
        Design Guidelines140
8   Attributes143
    Introducing Attributes 144
    Defining Attributes145
    Querying About Attributes146
        Class Attributes146
        Method Attributes149
        Field Attributes151
    Attribute Parameters153
        Positional Parameters and Named Parameters153
        Common Mistakes with Named Parameters155
        Valid Attribute Parameter Types155
    The AttributeUsage Attribute156
        Defining an Attribute Target156
        Single-Use and Multiuse Attributes158
        Specifying Inheritance Attribute Rules159
    Attribute Identifiers159
9   Interfaces161
    Interface Use162
    Declaring Interfaces163
    Implementing Interfaces164
        Querying for Implementation by Using is 166
        Querying for Implementation by Using as 170
    Explicit Interface Member Name Qualification173
        Name Hiding with Interfaces173
        Avoiding Name Ambiguity176
    Interfaces and Inheritance180
    Combining Interfaces183
PART III   WRITING CODE 
10   Expressions and Operators189
    Operators Defined189
    Operator Precedence190
        How C# Determines Precedence191
        Left and Right Associativity191
        Practical Usage192
    C# Operators193
        Primary Expression Operators193
        Mathematical Operators198
        Relational Operators206
        Simple Assignment Operators209
11   Program Flow Control215
    Selection Statements215
        The if Statement215
        The switch Statement220
    Iteration Statements225
        The while Statement225
        The do/while Statement227
        The for Statement229
        The foreach Statement232
    Branching with Jump Statements234
        The break Statement234
        The continue Statement237
        The Infamous goto Statement238
        The return Statement243
12   Error Handling with Exceptions245
    Overview of Exception Handling245
    Basic Exception-Handling Syntax247
        Throwing an Exception247
        Catching an Exception247
        Rethrowing an Exception248
        Cleaning Up with finally249
    Comparing Error-Handling Techniques250
        The Benefits of Exception Handling Over Return Codes251
        Handling Errors in the Correct Context253
        Improving Code Readability254
        Throwing Exceptions From Constructors256
    Using the System.Exception Class256
        Constructing an Exception Object256
        Using the StackTrace Property259
        Catching Multiple Exception Types260
        Deriving Your Own Exception Classes261
    Designing Your Code with Exception Handling263
        Design Issues with the try Block263
        Design Issues with the catch Block265
13   Operator Overloading and User-Defined Conversions267
    Operator Overloading267
        Syntax and Example268
        Overloadable Operators271
        Restrictions on Operator Overloading271
        Design Guidelines272
    User-Defined Conversions272
        Syntax and Example273
14   Delegates and Event Handlers281
    Using Delegates as Callback Methods281
    Defining Delegates as Static Members285
    Creating Delegates Only When Needed287
    Delegate Composition289
    Defining Events with Delegates295
PART IV   ADVANCED C# 
15   Multithreaded Programming303
    Threading Basics303
        Threads and Multitasking304
        Context Switching304
    A Multithreaded Application in C#305
    Working with Threads306
        AppDomain306
        The Thread Class307
        Scheduling Threads310
    Thread Safety and Synchronization314
        Protecting Code by Using the Monitor Class315
        Using Monitor Locks with the C# lock Statement319
        Synchronizing Code by Using the Mutex Class321
        Thread Safety and the .NET Classes323
    Threading Guidelines323
        When to Use Threads323
        When Not to Use Threads324
16   Querying Metadata with Reflection327
    The Reflection API Hierarchy327
    The Type Class328
        Retrieving the Type of an Instance328
        Retrieving the Type from a Name329
        Interrogating Types329
    Working with Assemblies and Modules332
        Iterating Through the Types of an Assembly 332
        Listing an Assembly’s Modules335
    Late Binding with Reflection337
    Creating and Executing Code at Run Time340
17   Interoperating with Unmanaged Code345
    Platform Invocation Services346
        Declaring the Exported DLL Function346
        Using Callback Functions with C#349
        Marshalling and PInvoke350
    Writing Unsafe Code351
        Using Pointers in C#352
        The fixed Statement353
    COM Interoperability355
        A Brave New World355
        Getting Started356
        Generating Metadata from a COM typelib357
        Early Binding to COM Components360
        Using Dynamic Type Discovery to Select COM Interfaces362
        Late Binding to COM Components363
        COM Threading Models365
18   Working with Assemblies369
    Assembly Overview369
        Manifest Data370
    Benefits of Assemblies371
        Assembly Packaging371
        Assembly Deployment371
        Assembly Versioning372
    Building Assemblies372
        Creating Assemblies that Have Multiple Modules373
    Creating Shared Assemblies375
    Working with the Global Assembly Cache377
        Viewing the Cache377
    Versioning Assemblies379
        QFEs and the Default Version Policy382
        Creating a Safe Mode Configuration File382
INDEX385




Top of Page


Last Updated: Saturday, July 7, 2001