Introduction to C# / PDF

Introduction to C# / PDF












Introduction to C# / PDF



















Introduction.
Why Another Language? .
C# Design Goals .
The C# Compiler and Other Resources


Chapter 1: Object-Oriented Basics.........................................
Overview..................................................................................
What Is an Object?..............................................................
Inheritance..............................................................................

Polymorphism and Virtual Functions ...................................................................
Encapsulation and Visibility ........................................................

Chapter 2: The .Net Runtime Environment..................................
Overview................................................................
The Execution Environment ..............................................................
Metadata...............................................................................................................
Assemblies ....................................................................................................
Language Interop ..........................................................................................
Attributes............................................................................................................

Chapter 3: C# Quickstart.......................................................................
Overview......................................................................................
Hello, Universe ......................................................................................................
Namespaces and Using .......................................................................
Namespaces and Assemblies ................................................................
Basic Data Types ...................................................
Classes, Structs, and Interfaces............................................................................

Statements ..............................................................................................

Enums ......................................................................................................
Delegates and Events ...............................................................................
Properties and Indexers.....................................................................................
Attributes.......................................................................................................

Chapter 4: Exception Handling .................................................................
Overview.....................................................................................................
What's Wrong with Return Codes?...................................................
Trying and Catching..............................................................................................
The Exception Hierarchy ........................................................................................
Passing Exceptions on to the Caller......................................................................
User-Defined Exception Classes......................................................................
Finally ..............................................................................................................
Efficiency and Overhead.........................................................................................
Design Guidelines.................................................................................................

Chapter 5: Classes 101...............................................................................................
Overview...............................................................................................................
A Simple Class..........................................................................................................
Member Functions ................................................................................
ref and out Parameters..........................................................................
Overloading...............................................................................................

Chapter 6: Base Classes And Inheritance ...........................................................
Overview...................................................................................................................
The Engineer Class .............................................................................................
Simple Inheritance .......................................................................................
Arrays of Engineers .......................................................................................
Virtual Functions.............................................................................................
Abstract Classes .....................................................................................
Sealed Classes .............................................................................................

Chapter 7: Class Member Accessibility ..................................................
Overview..............................................................................................
Class Accessibility .......................................................................................-
Using internal on Members...............................................................................
The Interaction of Class and Member Accessibility...............................................
Chapter 8: Other Class Stuff .......................................................................................
Overview..................................................................................................................
Nested Classes..................................................................................................
Other Nesting ................................................................................................
Creation, Initialization, Destruction.........................................................................
Overloading and Name Hiding ............................................................................
Static Fields.................................................................................................
Static Member Functions ...................................................................................
Static Constructors ...........................................................................................
Constants.....................................................................................................
readonly Fields.....................................................................................................
Private Constructors..................................................................................
Variable-Length Parameter Lists ...............................................................

Chapter 9: Structs (Value Types) ..................................................................
Overview...................................................................................................................
A Point Struct.....................................................................................................
Boxing and Unboxing ....................................................................................
Structs and Constructors .........................................................................................
Design Guidelines.................................................................................................

Chapter 10: Interfaces ................................................................................
Overview..............................................................................................
A Simple Example ........................................................................................
Working with Interfaces........................................................................................
The as Operator .......................................................................................
Interfaces and Inheritance ..........................................................................
Design Guidelines................................................................................................
Multiple Implementation...................................................................................
Interfaces Based on Interfaces ............................................................

Chapter 11: Versioning Using new and override.............................................
Overview....................................................................................................................
A Versioning Example..............................................................................

Chapter 12: Statements and Flow of Execution................................................
Overview..............................................................................................................
Selection Statements .......................................................................
Iteration Statements..........................................................................................
Jump Statements .............................................................................................
Definite Assignment ..................................................................................................

Chapter 13: Local Variable Scoping.............................................................................
Overview...................................................................................................................

Chapter 14: Operators.............................................................................................
Overview..............................................................................................................
Operator Precedence .............................................................................................
Built-In Operators ..............................................................................................
User-Defined Operators ....................................................................
Numeric Promotions .................................................................................
Arithmetic Operators...................................................................................
Relational and Logical Operators ..........................................................
Assignment Operators........................................................................
Type Operators..................................................................

Chapter 15: Conversions .....................................................................
Overview..............................................................................................................
Numeric Types...........................................................................................................
Conversions of Classes (Reference Types).......................................................
Conversions of Structs (Value Types) ..........................................................

Chapter 16: Arrays .......................................................
Overview..................................................................................................
Array Initialization..........................................................................
Multidimensional and Jagged Arrays ................................................................
Arrays of Reference Types ...........................................................................
Array Conversions ......................................................................................
System.Array Type ................................................................................................

Chapter 17: Strings .....................................................................................
Overview.............................................................................................................
Operations ...............................................................................................................
Converting Objects to Strings.............................................................................
Regular Expressions...................................................................................................

Chapter 18: Properties ........................................................................................
Overview........................................................................................................................
Accessors ......................................................................................................................-
Properties and Inheritance....................................................................................
Use of Properties..........................................................................................................
Side Effects When Setting Values ........................................................................
Static Properties ............................................................................................................
Property Efficiency ................................................................................................

Chapter 19: Indexers .............................................................................................
Overview............................................................................................................
Indexing with an Integer Index .................................................................................
Indexers and foreach .....................................................................................
Design Guidelines......................................................................................

Chapter 20: Enumerators............................................................................................
Overview............................................................................................................
A Line Style Enumeration......................................................................................
Enumerator Base Types ...........................................................................
Initialization ......................................................................................................
Bit Flag Enums.....................................................................................................
Conversions...........................................................................................................

Chapter 21: Attributes.....................................................................................................
Overview...........................................................................................................
Using Attributes .......................................................................................................
An Attribute of Your Own .....................................................................................
Reflecting on Attributes............................................................................................

Chapter 22: Delegates............................................................................................
Overview...................................................................................................................
Using Delegates ...................................................................................................
Delegates as Static Members .................................................................................
Delegates as Static Properties ................................................................................

Chapter 23: Events ...................................................................................................
Overview......................................................................................................................
A New Email Event ......................................................................................................
The Event Field........................................................................................................
Multicast Events.............................................................................
Sparse Events ......................................................................................

Chapter 24: User-Defined Conversions..........................................................
Overview............................................................................................................
A Simple Example ........................................................................................
Pre- and Post- Conversions....................................................................................
Conversions Between Structs..........................................................................
Classes and Pre- and Post- Conversions ...............................................................
Design Guidelines.........................................................................................................
How It Works...........................................................................................................

Chapter 25: Operator Overloading ..............................................................................
Overview...................................................................................................................
Unary Operators..........................................................................................................
Binary Operators.............................................................................................
An Example........................................................................................................
Restrictions...........................................................................................................
Design Guidelines...........................................................................................................

Chapter 26: Other Language Details .............................................................................
Overview..............................................................................................................
The Main Function........................................................................................................
Preprocessing ..................................................................................................................
Preprocessing Directives..............................................................................................
Lexical Details ............................................................................................................

Chapter 27: Making Friends with the .NET Frameworks ........................................
Overview....................................................................................................................
Things All Objects Will Do ......................................................................................
Hashes and GetHashCode().................................................................................

Chapter 28: System.Array and the Collection Classes ........................................
Overview....................................................................................................
Sorting and Searching ................................................................................
Design Guidelines.....................................................................................

Chapter 29: Interop ........................................................................................
Overview...............................................................................................................
Using COM Objects...........................................................................................
Being Used by COM Objects.............................................................................
Calling Native DLL Functions.................................................................................

Chapter 30: .NET Frameworks Overview.............................................................
Overview..........................................................................................................
Numeric Formatting..................................................................................................
Date and Time Formatting ....................................................................
Custom Object Formatting..............................................................................
Numeric Parsing...................................................................................
Using XML in C# ...................................................................................
Input/Output...........................................................................................................
Serialization ......................................................................................................
Threading ..............................................................................................
Reading Web Pages ..............................................................................

Chapter 31: Deeper into C#................................................................................
Overview...............................................................................................................
C# Style..............................................................................................................
Guidelines for the Library Author ......................................................................
Unsafe Code.............................................................................................................
XML Documentation .........................................................................................
Garbage Collection in the .NET Runtime.................................................................
Deeper Reflection ................................................................................................
Optimizations............................................................................................................

Chapter 32: Defensive Programming..........................................................................
Overview....................................................................................................................
Conditional Methods.................................................................................................
Debug and Trace Classes ...................................................................
Asserts......................................................................................................................
Debug and Trace Output .............................................................................
Using Switches to Control Debug and Trace ......................................................

Chapter 33: The Command Line ...........................................................................
Overview................................................................................................................
Simple Usage ..............................................................................................................
Response Files.....................................................................................................
Command-Line Options..........................................................................................

Chapter 34: C# Compared to Other Languages ...............................................
Overview.......................................................................................................................
Differences Between C# and C/C++..........................................................................
Differences Between C# and Java ...............................................................................
Differences Between C# and Visual Basic 6 ...............................................................
Other .NET Languages ...............................................................................................

Chapter 35: C# Futures.......................................................................................
List of Figures ...........................................................................................................














Download Introduction to C# / PDF

















Introduction to C# / PDF

1 commentaire: