Programming c sharp 4th 2005

1.2K 112 0
Programming c sharp 4th 2005

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

Thông tin tài liệu

Programming C#, 4th Edition By Jesse Liberty Publisher : O'Reilly Table of Pub Date : February 2005 • Contents ISBN : 0-596-00699-3 • Index Pages : 666 • Reviews Reader • Reviews Programming C#, the top selling book on Microsoft's high• Errata performance C# programming language, is now in its fourth • Academic edition Aimed at experienced programmers and web developers, this comprehensive guide focuses on the features and C# programming patterns that are new to C#, and fundamental to • Iterators the programming of web services and web applications on Microsoft's NET platform C# • Generics Programming C#, 4th Edition Table of By Jesse Liberty • Contents • Index Publisher : O'Reilly • Reviews Pub Date : February 2005 Reader ISBN : 0-596-00699-3 • Reviews Pages : 666 • Errata • Academic C# • Iterators C# • Generics Copyright Preface About This Book What You Need To Use This Book How the Book Is Organized Who This Book Is For C# 2.0 Versus C# 1.1 C# Versus Visual Basic NET C# Versus Java C# Versus C and C++ Conventions Used in This Book Support We'd Like to Hear from You Safari Enabled Acknowledgments Part I: The C# Language Chapter 1 C# and the NET Framework Section 1.1 The NET Platform Section 1.2 The NET Framework Section 1.3 Compilation and the MSIL Section 1.4 The C# Language Chapter 2 Getting Started: "Hello World" Section 2.1 Classes, Objects, and Types Section 2.2 Developing "Hello World" Section 2.3 Using the Visual Studio NET Debugger Chapter 3 C# Language Fundamentals Section 3.1 Types Section 3.2 Variables and Constants Section 3.3 Expressions Section 3.4 Whitespace Section 3.5 Statements Section 3.6 Operators Section 3.7 Preprocessor Directives Chapter 4 Classes and Objects Section 4.1 Defining Classes Section 4.2 Creating Objects Section 4.3 Using Static Members Section 4.4 Destroying Objects Section 4.5 Passing Parameters Section 4.6 Overloading Methods and Constructors Section 4.7 Encapsulating Data with Properties Section 4.8 readonly Fields Chapter 5 Inheritance and Polymorphism Section 5.1 Specialization and Generalization Section 5.2 Inheritance Section 5.3 Polymorphism Section 5.4 Abstract Classes Section 5.5 The Root of All Classes: Object Section 5.6 Boxing and Unboxing Types Section 5.7 Nesting Classes Chapter 6 Operator Overloading Section 6.1 Using the operator Keyword Section 6.2 Supporting Other NET Languages Section 6.3 Creating Useful Operators Section 6.4 Logical Pairs Section 6.5 The Equality Operator Section 6.6 Conversion Operators Chapter 7 Structs Section 7.1 Defining Structs Section 7.2 Creating Structs Chapter 8 Interfaces Section 8.1 Defining and Implementing an Interface Section 8.2 Accessing Interface Methods Section 8.3 Overriding Interface Implementations Section 8.4 Explicit Interface Implementation Chapter 9 Arrays, Indexers, and Collections Section 9.1 Arrays Section 9.2 The foreach Statement Section 9.3 Indexers Section 9.4 Collection Interfaces Section 9.5 Constraints Section 9.6 List Section 9.7 Queues Section 9.8 Stacks Section 9.9 Dictionaries Chapter 10 Strings and Regular Expressions Section 10.1 Strings Section 10.2 Regular Expressions Chapter 11 Handling Exceptions Section 11.1 Throwing and Catching Exceptions Section 11.2 Exception Objects Section 11.3 Custom Exceptions Section 11.4 Rethrowing Exceptions Chapter 12 Delegates and Events Section 12.1 Delegates Section 12.2 Multicasting Section 12.3 Events Section 12.4 Using Anonymous Methods Section 12.5 Retrieving Values from Multicast Delegates Part II: Programming with C# Chapter 13 Building Windows Applications Section 13.1 Creating a Simple Windows Form Section 13.2 Creating a Windows Forms Application Section 13.3 XML Documentation Comments Chapter 14 Accessing Data with ADO.NET Section 14.1 Relational Databases and SQL Section 14.2 The ADO.NET Object Model Section 14.3 Getting Started with ADO.NET Section 14.4 Using OLE DB Managed Providers Section 14.5 Working with Data-Bound Controls Chapter 15 Programming ASP.NET Applications and Web Services Section 15.1 Understanding Web Forms Section 15.2 Creating a Web Form Section 15.3 Adding Controls Section 15.4 Data Binding Section 15.5 Web Services Section 15.6 SOAP, WSDL, and Discovery Section 15.7 Building a Web Service Section 15.8 Creating the Proxy Chapter 16 Putting It All Together Section 16.1 The Overall Design Section 16.2 Creating the Web Services Client Section 16.3 Displaying the Output Section 16.4 Searching by Category Part III: The CLR and the NET Framework Chapter 17 Assemblies and Versioning Section 17.1 PE Files Section 17.2 Metadata Section 17.3 Security Boundary Section 17.4 Manifests Section 17.5 Multimodule Assemblies Section 17.6 Private Assemblies Section 17.7 Shared Assemblies Chapter 18 Attributes and Reflection Section 18.1 Attributes Section 18.2 Reflection Chapter 19 Marshaling and Remoting Section 19.1 Application Domains Section 19.2 Context Section 19.3 Remoting Chapter 20 Threads and Synchronization Section 20.1 Threads Section 20.2 Synchronization Section 20.3 Race Conditions and Deadlocks Chapter 21 Streams Section 21.1 Files and Directories Section 21.2 Reading and Writing Data Section 21.3 Asynchronous I/O Section 21.4 Network I/O Section 21.5 Web Streams Section 21.6 Serialization Section 21.7 Isolated Storage Chapter 22 Programming NET and COM Section 22.1 Importing ActiveX Controls Section 22.2 Importing COM Components Section 22.3 Exporting NET Components Section 22.4 P/Invoke Section 22.5 Pointers Appendix A C# Keywords Colophon Index Copyright © 2005, 2003, 2002, 2001 O'Reilly Media, Inc All rights reserved Printed in the United States of America Published by O'Reilly Media, Inc., 1005 Gravenstein Highway North, Sebastopol, CA 95472 O'Reilly books may be purchased for educational, business, or sales promotional use Online editions are also available for most titles (http://safari.oreilly.com) For more information, contact our corporate/institutional sales department: (800) 998-9938 or corporate@oreilly.com Nutshell Handbook, the Nutshell Handbook logo, and the O'Reilly logo are registered trademarks of O'Reilly Media, Inc Programming C#, the image of an African crowned crane, and related trade dress are trademarks of O'Reilly Media, Inc Many of the designations used by manufacturers and sellers to distinguish their products are claimed as trademarks Where those designations appear in this book, and O'Reilly Media, Inc was aware of a trademark claim, the designations have been printed in caps or initial caps While every precaution has been taken in the preparation of this book, the publisher and authors assume no responsibility for errors or omissions, or for damages resulting from the use of the information contained herein Preface Every 10 years or so, a new technology arrives that changes the way we think about application development In the early 1980s, the new technologies were Unix, which could be run on a desktop, and a powerful new language called C, developed by AT&T The early '90s brought Windows and C++ Each development represented a sea change in the way we approached programming In 2000, NET and C# were the next wave, and NET 2.0 completes the transition Microsoft has "bet the company" on NET When a company of its size and influence spends billions of dollars and reorganizes its entire corporate structure to support a new platform, programmers take notice It turns out that NET represents a major change in the way you'll think about programming It is, in short, a new development platform designed to facilitate object-oriented Internet development The programming language of choice for this platform is C#, which builds on the lessons learned from C (high performance), C++ (objectoriented structure), Java© (garbage collection, high security), and Visual Basic (rapid development) to create a new language ideally suited for developing component-based, n-tier distributed web applications C# 2.0, the language of choice for NET 2005, comes with updated tools and a powerful new development environment It is the crowning achievement of Microsoft's R&D investment It is wicked cool About This Book This book is a tutorial, both on C# and on writing NET applications with C# If you are a proficient C# 1.1 programmer, and all you want to know is what is new in C# 2.0, put this book down, and buy Visual C# 2005: A Developer's Notebook (O'Reilly Media, Inc.) If, on the other hand, you want to brush up on your C# skills, or you are proficient in another programming language like C++ or Java, or even if this is your first programming language, then this book is for you What You Need To Use This Book Starting with the Beta release of Visual Studio Whidbey (2005), Microsoft has made it much easier for you to get access to their works-in-progress There are several options available to you: just as Visual Studio comes in many flavors, the prerelease versions of NET 2.0 and Visual Studio 2005 come in many forms: Download the SDK The Beta SDK, which includes command-line compilers, documentation, and other tools, is available as a free download from http://msdn.microsoft.com/netframework/downloads/updates/default This is a small download, but you'll need to bring your own code editor (anything from Notepad to SharpDevelop will do) Express Editions Microsoft has released stripped-down versions of Visual Studio that are small downloads, so you can get up and running quickly You can download the Express Editions from http://lab.msdn.microsoft.com/vs2005/ Use Visual C# Express for most of the examples in this book You'll need Visual Web Developer Express for some of the examples, and you'll need to install SQL Server Express or MSDE (Microsoft Data Engine) for some of the ADO.NET examples Index [SYMBOL] [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] tables, database constraints on relationships among tabs [See whitespace] targets (attribute) TCP/IP channels, Binary formatter TCP/IP connections streaming network client, creating TcpClient class TcpListener object template field column element Templates, C++ ternary operator (?:) 2nd ternary operator (?\:) Test.cs file text editors, editing programs with text files, working with text read (of a file) text-related properties TextReader class TextWriter class this keyword 2nd indexers and Thread class Abort( ) method Interrupt( ) method Sleep( ) method ThreadAbortException exception threads app domains vs deadlocks joining killing race conditions starting suspending synchronizing deadlocks race conditions using Interlocked using locks using monitors ThreadStart class throw statement 2nd 3rd 4th Time class example TlbImp.exe, importing the type library ToArray( ) method (List) (Queue) (Stack) ToCharArray( ) method (String) tokens (public key) ToLower( ) method (String) ToString( ) method 2nd (System.Array) ToUpper( ) method (String) TP (transparent proxy) transient data transparent proxy (TP) TreeNodeCollection object TreeView controls (example) handling events populating Trim( ) method (String) TrimEnd( ) method (String) TrimStart( ) method (String) TrimToSize( ) method (List class) true keyword try statement/blocks 2nd two-dimensional arrays declaring initializing jagged array of integers rectangular array (example) Type class FilterName field FindMembers( ) method GetMembers( ) method 2nd GetMethods( ) method GetType( ) method 2nd type discovery 2nd type library type-safe collections [See generics] typeof operator 2nd 3rd types 2nd boxing and unboxing built-in [See built-in types] enumerations libraries local variables, displaying in debugger IDE pointer polymorphic reference reflecting on 2nd serialization and strings 2nd 3rd [See also strings] structs [See structs] user-defined value VB6 programmers note Index [SYMBOL] [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] UI (user interface) uint type ulong type UML (Unified Modeling Language) unassigned variables C and C++ programmers note unboxing types unchecked (arithmetic check off) operator unconditional branching 2nd Unicode Unified Modeling Language [See UML] Uniform Resource Identifier (URI) uninitialized variables Unload( ) method (AppDomain) unsafe keyword unsafe modifier 2nd unwinding the call stack Unwrap( ) method (ObjectHandle) updating the database (web services client) URI (Uniform Resource Identifier) 2nd user configuration information user interface (UI) user-defined types serialization ushort type using directive (in code examples) using statement 2nd 3rd assembly attributes after Index [SYMBOL] [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] value keyword value parameters value types accessing allocation on the stack arrays of boxing and unboxing built-in, listing of objects as passing into methods structs as 2nd uninitialized Values property (Dictionary) values, returning in parameters variables assigning without initializing constants and defined definite assignment, requirement of initializing and assigning a value looping uninitialized VB6 programmers note VB programmers note, end-of-line VB6 CDbl function VB6 programmers notes NET Windows Forms ADO.NET arrays case statements event handlers, naming of looping variables moving to ADO.NET new keyword object variables object-oriented technology optional arguments static keyword types variables verbatim string literals 2nd Directory Info object, creating indicated by @ symbol version numbers for shared assemblies versioning 2nd [See also assemblies] abstract classes vs interfaces with new and override keywords ViewState property virtual keyword 2nd virtual machine, NET CLR virtual methods 2nd [See also methods, polymorphic] Object class overriding 2nd visibility of a class and its members [See access modifiers] Visual Studio NET ActiveX controls, importing 2nd advantages for software development creating console applications debuggers, using importing ActiveX control into namespace creation Web Forms, creating web service class generated by Visual Studio NET Designer Properties window Toolbox using to create Windows Forms void keyword 2nd volatile keyword Index [SYMBOL] [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] Wait( ) method (Monitor) 2nd web applications advantages of 2nd events RAD techniques applied to state web controls 2nd [See also ASP controls] Web Forms adding controls server controls creating code-behind files data binding for controls overview divisions of user interface events life cycle Web Service Description Language [See WSDL] web services NET client-side support server-side support building NET service viewing WSDL contract building a NET service calculator (example) testing client application (example) creating the client displaying output searching by category proxy, creating testing the service web site, author_ s web streams reading web page as HTML stream Web.config file WebRequest object WebRequestFactory class WebResponse object GetResponseStream( ) method well-known server objects registering RegisterWellKnownServiceType( ) singleton and single-call while loop 2nd while statements whitespace 2nd Wiltamuth, Scott Win32 API calling method with P/Invoke declaring methods for import into C# program Window class, DrawWindow( ) method Windows Forms adding controls to application, creating basic UI form delete button event getting files into directory handling TreeView events implementing Copy button event recursing through subdirectories TreeView controls TreeView event handler creating simple Visual Studio Designer, using Windows.Forms namespace Write( ) method (Console) (Stream) WriteLine( ) method 2nd (Console class) (StreamReader class) (StreamWriter class) 2nd writing output to screen writing output to screen WSDL (Web Service Description Language) contract, viewing files, creating a proxy XML namespace for WSDL documents wsdl tool Index [SYMBOL] [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] XML (Extensible Markup Language) classes in NET Framework documentation comments namespace for WSDL document SOAP, advantages of being based on XOR operator (^) Index [SYMBOL] [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] yield keyword ... Section 3.4 Whitespace Section 3.5 Statements Section 3.6 Operators Section 3.7 Preprocessor Directives Chapter 4 Classes and Objects Section 4.1 Defining Classes Section 4.2 Creating Objects... Conversion Operators Chapter 7 Structs Section 7.1 Defining Structs Section 7.2 Creating Structs Chapter 8 Interfaces Section 8.1 Defining and Implementing an Interface Section 8.2 Accessing Interface Methods... together, and C# provides extensive support for collections Chapter 9, explores the collection classes provided by the Framework Class Library, the new Generic collections, and how to create your own collection types using Generics Chapter 10, discusses how you can use C# to manipulate text

Ngày đăng: 25/03/2019, 16:45

Từ khóa liên quan

Mục lục

  • Programming C#, 4th Edition

  • Table of Contents

  • Copyright

  • Preface

    • About This Book

    • What You Need To Use This Book

    • How the Book Is Organized

    • Who This Book Is For

    • C# 2.0 Versus C# 1.1

    • C# Versus Visual Basic .NET

    • C# Versus Java

    • C# Versus C and C++

    • Conventions Used in This Book

    • Support

    • We'd Like to Hear from You

    • Safari Enabled

    • Acknowledgments

    • Part I:  The C# Language

      • Chapter 1.  C# and the .NET Framework

        • Section 1.1.  The .NET Platform

        • Section 1.2.  The .NET Framework

        • Section 1.3.  Compilation and the MSIL

        • Section 1.4.  The C# Language

Tài liệu cùng người dùng

Tài liệu liên quan