ENGLISH

C# 2.0: The Complete Reference: The Complete Reference

Book information

Publisher
McGraw-Hill Education
Year
2005
ISBN
007148373X, 9780071483735
Language
english
Format
PDF
Filesize
4 MB (4384489 bytes)
Pages
890\914
Time added
2022-05-18 14:03:42

Description

This comprehensive volume is fully updated for C# 2.0 -- the newest version of Microsoft's revolutionary programming language.The changes found in C# 2.0 bring Java-like power to millions of Windows programmers worldwide. With expertly crafted explanations, insider tips, and hundreds of examples, this book fully explains every aspect of C# 2.0. Written in the clear, uncompromising style that has made master programming author Herb Schildt the choice of millions, the book covers all the new and existing features of this major programming language. Contents Preface Part I: The C# Language 1 The Creation of C# C#'s Family Tree How C# Relates to the .NET Framework How the Common Language Runtime Works Managed vs. Unmanaged Code 2 An Overview of C# Object-Oriented Programming A First Simple Program Handling Syntax Errors A Small Variation A Second Simple Program Another Data Type Two Control Statements Using Blocks of Code Semicolons, Positioning, and Indentation The C# Keywords Identifiers The C# Class Library 3 Data Types, Literals, and Variables Why Data Types Are Important C#'s Value Types Integers Floating-Point Types The decimal Type Characters The bool Type Some Output Options Literals A Closer Look at Variables The Scope and Lifetime of Variables Type Conversion and Casting Type Conversion in Expressions 4 Operators Arithmetic Operators Relational and Logical Operators The Assignment Operator The Bitwise Operators The ? Operator Spacing and Parentheses Operator Precedence 5 Program Control Statements The if Statement The switch Statement The for Loop The while Loop The do-while Loop The foreach Loop Using break to Exit a Loop Using continue The goto 6 Introducing Classes and Objects Class Fundamentals How Objects Are Created Reference Variables and Assignment Methods Constructors The new Operator Revisited Garbage Collection and Destructors The this Keyword 7 Arrays and Strings Arrays Multidimensional Arrays Jagged Arrays Assigning Array References Using the Length Property The foreach Loop Strings 8 A Closer Look at Methods and Classes Controlling Access to Class Members Pass References to Methods Using ref and out Parameters Using a Variable Number of Arguments Returning Objects Method Overloading Overloading Constructors The Main( ) Method Recursion Understanding static Static Classes 9 Operator Overloading Operator Overloading Fundamentals Handling Operations on C# Built-In Types Overloading the Relational Operators Overloading true and false Overloading the Logical Operators Conversion Operators Operator Overloading Tips and Restrictions Another Example of Operator Overloading 10 Indexers and Properties Indexers Properties Using Access Modifiers with Accessors Using Indexers and Properties 11 Inheritance Inheritance Basics Member Access and Inheritance Constructors and Inheritance Inheritance and Name Hiding Creating a Multilevel Hierarchy When Are Constructors Called? Base Class References and Derived Objects Virtual Methods and Overriding Using Abstract Classes Using sealed to Prevent Inheritance The object Class 12 Interfaces, Structures, and Enumerations Interfaces Using Interface References Interface Properties Interface Indexers Interfaces Can Be Inherited Name Hiding with Interface Inheritance Explicit Implementations Choosing Between an Interface and an Abstract Class The .NET Standard Interfaces An Interface Case Study Structures Enumerations 13 Exception Handling The System.Exception Class Exception Handling Fundamentals The Consequences of an Uncaught Exception Exceptions Let You Handle Errors Gracefully Using Multiple catch Statements Catching All Exceptions Nesting try Blocks Throwing an Exception Using finally A Closer Look at Exception Deriving Exception Classes Catching Derived Class Exceptions Using checked and unchecked 14 Using I/O C#'s I/O Is Built Upon Streams The Stream Classes Console I/O FileStream and Byte-Oriented File I/O Character-Based File I/O Redirecting the Standard Streams Reading and Writing Binary Data Random Access Files Using MemoryStream Using StringReader and StringWriter Converting Numeric Strings to Their Internal Representation 15 Delegates and Events Delegates Events .NET Event Guidelines Using Anonymous Methods with Events Applying Events: A Case Study 16 Namespaces, the Preprocessor, and Assemblies Namespaces The Preprocessor Assemblies and the internal Access Modifier 17 Runtime Type ID, Reflection, and Attributes Runtime Type Identification Reflection Using Reflection Attributes Three Built-in Attributes 18 Generics What Are Generics? A Simple Generics Example A Generic Class with Two Type Parameters The General Form of a Generic Class Constrained Types Creating a Default Object of a Type Parameter Generic Structures Creating a Generic Method Generic Delegates Generic Interfaces Comparing Instances of a Type Parameter Generic Class Hierarchies Overriding Virtual Methods in a Generic Class Overloading Methods That Use Type Parameters How Generic Types Are Instantiated Some Generic Restrictions Final Thoughts on Generics 19 Unsafe Code, Pointers, Nullable Types, and Miscellaneous Topics Unsafe Code Nullable Types Partial Class Definitions Friend Assemblies Miscellaneous Keywords Part II: Exploring the C# Library 20 Exploring the System Namespace The Members of System The Math Class The .NET Structures Corresponding to the Built-in Value Types The Array Class BitConverter Generating Random Numbers with Random Memory Management and the GC Class Object The IComparable and IComparable Interfaces The IConvertible Interface The ICloneable Interface IFormatProvider and IFormattable The IEquatable Interface 21 Strings and Formatting Strings in C# The String Class Formatting Using String.Format( ) and ToString( ) to Format Data Creating a Custom Numeric Format Formatting Date and Time Formatting Enumerations 22 Multithreaded Programming Multithreading Fundamentals The Thread Class Determining When a Thread Ends Pass an Argument to a Thread The IsBackground Property Thread Priorities Synchronization Thread Communication Using Wait( ), Pulse( ), and PulseAll( ) Using MethodImplAttribute Using a Mutex and a Semaphore Using an Event Synchronization Object The Interlocked Class Terminating a Thread Suspending and Resuming a Thread Determining a Thread's State Using the Main Thread Multithreading Tips Starting a Separate Task 23 Collections, Enumerators, and Iterators Collections Overview The Non-Generic Collections Storing Bits with BitArray The Specialized Collections The Generic Collections Storing User-Defined Classes in Collections Implementing IComparable Using an IComparer Accessing a Collection via an Enumerator Implementing IEnumerable and IEnumerator Using Iterators 24 Networking Through the Internet The System.Net Members Uniform Resource Identifiers Internet Access Fundamentals Handling Network Errors The Uri Class Accessing Additional HTTP Response Information MiniCrawler: A Case Study Using WebClient Part III: Applying C# 25 Building Components What Is a Component? What Is a C# Component? IComponent Component A Simple Component Overriding Dispose(bool) Employing the using Statement Containers Are Components the Future of Programming? 26 Creating Form-Based Windows Applications A Brief History of Windows Programming Two Ways to Write a Form-Based Windows Application How Windows Interacts with the User Windows Forms A Skeletal Form-Based Windows Program Adding a Button Handling Messages Using a Message Box Adding a Menu What Next? 27 A Recursive-Descent Expression Parser Expressions Parsing Expressions: The Problem Parsing an Expression Dissecting an Expression A Simple Expression Parser Adding Variables to the Parser Syntax Checking in a Recursive-Descent Parser Some Things to Try A: XML Comment Quick Reference The XML Comment Tags Compiling XML Documentation An XML Documentation Example Index A B C D E F G H I J K L M N O P Q R S T U V W X Y Z

Similar books