Tài liệu Visual C Sharp Net 2003 Developer's Cookbook

Thảo luận trong 'Lập Trình' bắt đầu bởi Thúy Viết Bài, 5/12/13.

  1. Thúy Viết Bài

    Thành viên vàng

    Bài viết:
    198,891
    Được thích:
    172
    Điểm thành tích:
    0
    Xu:
    0Xu
    Copyright
    About the Authors
    Acknowledgments
    We Want to Hear from You!
    Introduction
    Part I, The C# Language
    Part II, User Interface and Graphics
    Part III, Data Access
    Part IV, Internet and Networking
    Part V, Deployment and Security
    Part VI, Advanced Topics

    Part I: The C# Language
    Chapter 1. Operators, Expressions, and Control Structures

    Section 1.0. Introduction
    Section 1.1. Understanding Visual C# .NET Program Layout
    Section 1.2. Parsing Command-Line Arguments
    Section 1.3. Creating Multiple Application Entry Points
    Section 1.4. Referencing Assemblies and Namespaces
    Section 1.5. Creating Valid Identifier Names
    Section 1.6. Working with Numeric Types
    Section 1.7. Working with Floating-Point Numbers
    Section 1.8. Creating Value Types with struct
    Section 1.9. Converting Data Types
    Section 1.10. Performing Relational Operations
    Section 1.11. Using Logical Expressions
    Section 1.12. Determining Operator Precedence and Associativity
    Section 1.13. Using if Statements
    Section 1.14. Using Looping Control Structures
    Section 1.15. Breaking Out of a Loop Control Body

    Chapter 2. Objects and Components
    Section 2.0. Introduction
    Section 2.1. Creating Classes
    Section 2.2. Defining Class Fields
    Section 2.3. Constructing Class Methods
    Section 2.4. Instantiating and Using Objects
    Section 2.5. Overloading Operators
    Section 2.6. Overloading Class Constructors
    Section 2.7. Constructing Class Properties
    Section 2.8. Inheriting from Other Classes
    Section 2.9. Preventing Object Inheritance
    Section 2.10. String Representation of Objects
    Section 2.11. Abstract Classes and Interfaces
    Section 2.12. Multiple Inheritance Using Interfaces
    Section 2.13. Creating and Using Class Libraries

    Chapter 3. Strings and Regular Expressions
    Section 3.0. Introduction
    Section 3.1. Creating and Using String Objects
    Section 3.2. Formatting Strings
    Section 3.3. Accessing Individual String Characters
    Section 3.4. Analyzing Character Attributes
    Section 3.5. Case-Insensitive String Comparison
    Section 3.6. Working with Substrings
    Section 3.7. Using Verbatim String Syntax
    Section 3.8. Choosing Between Constant and Mutable Strings
    Section 3.9. Optimizing StringBuilder Performance
    Section 3.10. Understanding Basic Regular Expression Syntax
    Section 3.11. Validating User Input with Regular Expressions
    Section 3.12. Replacing Substrings Using Regular Expressions
    Section 3.13. Building a Regular Expression Library

    Chapter 4. Creating and Using .NET Collections
    Section 4.0. Introduction
    Section 4.1. Declaring and Using Arrays
    Section 4.2. Defining Jagged Arrays
    Section 4.3. Enumerating Arrays with the foreach Operator
    Section 4.4. Determining the Current Element Index Within a foreach Loop
    Section 4.5. Using ArrayLists
    Section 4.6. Choosing Between an Array and an ArrayList
    Section 4.7. Using Stacks and Queues
    Section 4.8. Using Hashtables
    Section 4.9. Working with BitArrays
    Section 4.10. Enumerating Collections with IEnumerator
    Section 4.11. Sorting Collections
    Section 4.12. Binary Searching with Arrays
    Section 4.13. Creating New Collection Types
    Section 4.14. Creating Indexers

    Chapter 5. Delegates and Events
    Section 5.0. Introduction
    Section 5.1. Defining and Using Delegates
    Section 5.2. Combining Delegates to Form Multicast Delegates
    Section 5.3. Removing Individual Delegates from Multicast Delegates
    Section 5.4. Accessing Delegate Names Within a Multicast Delegate
    Section 5.5. Calling Delegates Asynchronously
    Section 5.6. Return Values for Multicast Delegates
    Section 5.7. Declaring Events
    Section 5.8. Defining and Registering Event Handlers
    Section 5.9. Packaging Event Arguments

    Chapter 6. Exceptions and Error Handling
    Section 6.0. Introduction
    Section 6.1. Using try/catch blocks
    Section 6.2. Using a finally Block
    Section 6.3. Displaying Exception Information
    Section 6.4. Creating and Throwing Custom Exceptions
    Section 6.5. Accessing Inner Exceptions
    Section 6.6. Overflow Detection Using Checked and Unchecked


    Part II: User Interface and Graphics
    Chapter 7. Windows Forms
    Section 7.0. Introduction
    Section 7.1. Creating a Dialog-Based Windows Form
    Section 7.2. Changing a Form's Properties
    Section 7.3. Creating Modal Dialog Boxes
    Section 7.4. Displaying Message Boxes
    Section 7.5. Handling Form Events
    Section 7.6. Designating the Initial Windows Form
    Section 7.7. Changing a Windows Form Icon
    Section 7.8. Assigning Custom Data to a Windows Form
    Section 7.9. Changing Form Opacity
    Section 7.10. Supporting Drag and Drop Operations
    Section 7.11. Creating MDI Forms
    Section 7.12. Accessing MDI Child Windows
    Section 7.13. Arranging MDI Child Forms

    Chapter 8. Windows Forms Controls
    Section 8.0. Introduction
    Section 8.1. Displaying Text with a Label Control
    Section 8.2. Changing Control Properties
    Section 8.3. Creating a Button and Handling Events
    Section 8.4. Displaying an Open File Dialog Box
    Section 8.5. Creating and Attaching Menus to a Windows Form
    Section 8.6. Creating Context Menus
    Section 8.7. Displaying System Tray Icons
    Section 8.8. Opening Web Pages with a LinkLabel Control
    Section 8.9. Determining Check Box State
    Section 8.10. Creating Grouped Radio Buttons
    Section 8.11. Determining the Selected Radio Button
    Section 8.12. Adding and Removing Items in a ListBox Control
    Section 8.13. Using a ListView Control
    Section 8.14. Using ImageLists in a ListView Control
    Section 8.15. Changing a ListView Mode
    Section 8.16. Creating ListView Columns
    Section 8.17. Using the TreeNode Editor
    Section 8.18. Programmatically Adding Items to a TreeView Control
    Section 8.19. Using Images in a TreeView
    Section 8.20. Selecting Items Using the PathSeparator Property
    Section 8.21. Creating ToolBars
    Section 8.22. Capturing ToolBar Button Clicks
    Section 8.23. Adding StatusBar Panels to Display Application State
    Section 8.24. Adding Tooltips to Controls
    Section 8.25. Anchoring Controls
    Section 8.26. Docking Controls
    Section 8.27. Implementing Control Validation
    Section 8.28. Visual Inheritance

    Chapter 9. User Controls
    Section 9.0. Introduction
    Section 9.1. Extending Common Controls
    Section 9.2. Creating Composite Controls
    Section 9.3. Creating Custom Controls
    Section 9.4. Using Design-Time Attributes
    Section 9.5. Changing a Control's Toolbox Icon
    Section 9.6. Programmatically Adding Controls to the Toolbox
    Section 9.7. Creating Extender Provider Controls
    Section 9.8. Creating a UI Type Editor
    Section 9.9. Utilizing Custom Designers
    Section 9.10. Extending the Design Time Context Menu
    Section 9.11. Removing Control Properties Using Metadata Filtering

    Chapter 10. Programming Graphics with GDI+
    Section 10.0. Introduction
    Section 10.1. Obtaining a Graphics Object
    Section 10.2. Drawing a Rectangle
    Section 10.3. Drawing a Rectangle with a Hatch Brush
    Section 10.4. Filling a Rectangle with a Texture Brush
    Section 10.5. Using Gradient Fills
    Section 10.6. Drawing Connected Lines and Polygons
    Section 10.7. Drawing Arc and Pie Shapes
    Section 10.8. Using Rotation and Translation Transformations
    Section 10.9. Using Graphics Containers
    Section 10.10. Forcing a Repaint
    Section 10.11. Performing Flicker-Free Animation
    Section 10.12. Enumerating System Fonts
    Section 10.13. Displaying Text
    Section 10.14. Enabling Antialiasing
    Section 10.15. Loading and Displaying Images
    Section 10.16. Loading and Displaying Animated GIF's
    Section 10.17. Converting Image File Formats
    Section 10.18. Printing Documents
    Section 10.19. Displaying a Print Preview Dialog

    Chapter 11. Localization and Resources
    Section 11.0. Introduction
    Section 11.1. Determining a User's Culture Information
    Section 11.2. Localizing Windows Forms Controls
    Section 11.3. Programmatically Changing the Current Culture
    Section 11.4. Enumerating Culture Types
    Section 11.5. Using Fallback Resource for Unsupported Regions
    Section 11.6. Formatting Numbers Correctly Based on Culture
    Section 11.7. Displaying Culture Aware Date and Time
    Section 11.8. Formatting Currency for a Specific Culture
    Section 11.9. Creating and Using Satellite Assemblies
    Section 11.10. Using ResourceReader to Display an Image Resource
    Section 11.11. Saving Resource Information Using the ResourceWriter Class


    Part III: Data Access
    Chapter 12. File I/O and Serialization
    Section 12.0. Introduction
    Section 12.1. Creating a New File
    Section 12.2. Verifying the Existence of a File
    Section 12.3. Opening a File for Reading Using the File Class
    Section 12.4. Using the FileInfo Class to Display File Information
    Section 12.5. Copying and Moving a File
    Section 12.6. Making a File Read Only
    Section 12.7. Writing to a File
    Section 12.8. Reading from a File
    Section 12.9. Appending Data to an Existing File
    Section 12.10. Improving Performance with a MemoryStream
    Section 12.11. Monitoring File and Directory Changes
    Section 12.12. Creating a Directory
    Section 12.13. Retrieving Directory Information
    Section 12.14. Enumerating Files and Subdirectories in a Directory
    Section 12.15. Saving Object State with Serialization
    Section 12.16. Recreating Objects with Deserialization
    Section 12.17. Preventing Object Items from Being Serialized
    Section 12.18. Customizing the Serialization Process

    Chapter 13. XML in .NET
    Section 13.0. Introduction
    Section 13.1. Reading XML Documents with XmlTextReader
    Section 13.2. Reading with XmlNodeReader
    Section 13.3. Navigating XML Documents with XPath
    Section 13.4. Using XmlConvert to Convert XML Data Types
    Section 13.5. Validating XML Documents with Schemas
    Section 13.6. Programmatically Generating XML Documents
    Section 13.7. Controlling XmlTextWriter Formatting
    Section 13.8. Working with XML Namespaces
    Section 13.9. Transforming XML Documents with XSLT

    Chapter 14. Database Programming with ADO.NET
    Section 14.0. Introduction
    Section 14.1. Creating a Database Connection
    Section 14.2. Creating and Filling DataSets
    Section 14.3. Generating an XML Schema for an Untyped DataSet
    Section 14.4. Reading Database Records Using SqlDataReader
    Section 14.5. Creating Forms with the Data Form Wizard
    Section 14.6. Using Commands and Stored Procedures
    Section 14.7. Displaying a DataGrid
    Section 14.8. Databinding Windows Form Controls
    Section 14.9. Using CommandBuilder to Automatically Generate Commands
    Section 14.10. Creating Different DataViews of a Table
    Section 14.11. Adding New Tables to a DataSet
    Section 14.12. Creating Unique Constraints
    Section 14.13. Creating ForeignKey Constraints
    Section 14.14. Inserting New Rows into a DataTable
    Section 14.15. Modifying Rows in a DataTable
    Section 14.16. Navigating Tables Using DataRelations
    Section 14.17. Saving DataSet Information to an XML File
    Section 14.18. Restoring a DataSet from an XML File
    Section 14.19. Merging DataSets
    Section 14.20. Modifying Pooling Behavior for SQL Server Connections
    Section 14.21. Ensuring Data Integrity Using Transactions


    Part IV: Internet and Networking
    Chapter 15. Network Programming with Sockets
    Section 15.0. Introduction
    Section 15.1. Creating a Stream-Based Server
    Section 15.2. Determining Connection Client Information
    Section 15.3. Resolving an IP Address or Hostname Using DNS
    Section 15.4. Creating a Stream-Based Client
    Section 15.5. Creating a Connectionless UDP-Based Server
    Section 15.6. Creating a Connectionless UDP-Based Client
    Section 15.7. Controlling Socket Lingering Behavior
    Section 15.8. Using the WebRequest Class for HTTP Communication
    Section 15.9. Requesting Web Documents Through a Proxy Server
    Section 15.10. Creating Asynchronous Web Requests

    Chapter 16. Building ASP.NET Applications
    Section 16.0. Introduction
    Section 16.1. Creating a Simple Web Form
    Section 16.2. Displaying Server-Side Controls
    Section 16.3. Handling Web Control Events
    Section 16.4. Forcing a Post Back from a Web Control Event
    Section 16.5. Redirecting Users to a Different Web Page
    Section 16.6. Validating Input Data and Displaying Errors
    Section 16.7. Databinding Web Controls
    Section 16.8. Using the DataList Web Control
    Section 16.9. Using the DataGrid Control
    Section 16.10. Changing DataGrid Style Information
    Section 16.11. Creating an Editable DataGrid
    Section 16.12. Managing Application and Session State
    Section 16.13. Creating Custom Web Controls
    Section 16.14. Using Page Output Caching
    Section 16.15. Writing and Reading Cookies

    Chapter 17. ASP.NET Web Services
    Section 17.0. Introduction
    Section 17.1. Creating an ASP.NET Web Service
    Section 17.2. Adding Web Service Methods
    Section 17.3. Providing Web Method Descriptions
    Section 17.4. Aliasing Web Method Names
    Section 17.5. Managing Web Service State
    Section 17.6. Publishing and Registering an ASP.NET Web Service
    Section 17.7. Consuming Web Services with a Windows Form Application
    Section 17.8. Consuming Web Services with ASP.NET Applications
    Section 17.9. Calling Web Methods Asynchronously
    Section 17.10. Using Transactions in Web Services

    Chapter 18. .NET Remoting
    Section 18.0. Introduction
    Section 18.1. Creating a Remotable Object
    Section 18.2. Creating Host Applications for Remotable Types
    Section 18.3. Calling Remote Objects from Client Applications
    Section 18.4. Performing Client-Side Activation of Remotable Objects
    Section 18.5. Creating Server-Activated Singleton Objects
    Section 18.6. Using Remoting Configuration Files
    Section 18.7. Hosting Remotable Types with IIS
    Section 18.8. Using Channels and Formatters
    Section 18.9. Controlling Lifetime Leases
    Section 18.10. Performing Asynchronous Remoting Calls
    Section 18.11. Creating Proxies for Message Interception
    Section 18.12. Creating Custom Channel Sinks for Logging


    Part V: Deployment and Security
    Chapter 19. Assemblies
    Section 19.0. Introduction
    Section 19.1. Setting Informational Assembly Attributes
    Section 19.2. Setting the Assembly Version
    Section 19.3. Viewing Assembly Contents with ILDasm
    Section 19.4. Creating a Multifile Assembly
    Section 19.5. Creating a Strong Name Assembly
    Section 19.6. Delay Signing an Assembly
    Section 19.7. Creating a Shared Assembly
    Section 19.8. Securing Satellite Assemblies
    Section 19.9. Explicitly Loading an Assembly Programmatically
    Section 19.10. Reading Assembly Identity Programmatically
    Section 19.11. Identifying the File or URL from Which an Assembly Was Loaded
    Section 19.12. Loading an Assembly into a New Application Domain

    Chapter 20. Setup and Deployment Projects
    Section 20.0. Introduction
    Section 20.1. Creating setup.exe-Based Installations
    Section 20.2. Creating a Windows Setup Project Without Using the Wizard
    Section 20.3. Adding a Shortcut on the User's Desktop
    Section 20.4. Customizing the Appearance of the Setup Dialogs
    Section 20.5. Adding User-Interface Dialogs
    Section 20.6. Setting Launch Conditions on the Installation
    Section 20.7. Conditionally Installing Files
    Section 20.8. Creating a Custom Executable Action
    Section 20.9. Creating Custom Actions as Classes
    Section 20.10. Installing Assemblies into the Global Assembly Cache

    Chapter 21. Securing Code
    Section 21.0. Introduction
    Section 21.1. Requesting Permissions for an Assembly Using Declarative Security
    Section 21.2. Requesting Permissions for a Class or Method Using Declarative Security
    Section 21.3. Requesting Permissions Using Imperative Security Requests
    Section 21.4. Viewing Security Policy Information
    Section 21.5. Creating Code Groups
    Section 21.6. Creating New Permission Sets
    Section 21.7. Determining Whether the Current User Is an Administrator
    Section 21.8. Creating Login Pages with Web Forms Authentication
    Section 21.9. Unsafe Code Using Pointers
    Section 21.10. Calling Native Unmanaged Code Using PInvoke


    Part VI: Advanced Topics
    Chapter 22. Threading and Synchronization
    Section 22.0. Introduction
    Section 22.1. Creating and Starting Threads
    Section 22.2. Pausing and Resuming a Thread
    Section 22.3. Aborting the Execution of a Thread
    Section 22.4. Changing the Priority of a Running Thread
    Section 22.5. Using the ThreadPool to Perform Background Tasks
    Section 22.6. Creating an Application Timer
    Section 22.7. Synchronizing Variable Access Using the Monitor
    Section 22.8. Using Events to Synchronize Threads
    Section 22.9. Using Mutexes to Synchronize Multiple Objects, Avoiding Deadlocks
    Section 22.10. Implementing Interprocess Communication Using a Mutex
    Section 22.11. Synchronizing Resource Access Using Reader/Writer Locks
    Section 22.12. Getting and Setting Thread Data Using Thread Local Storage

    Chapter 23. Reflection
    Section 23.0. Introduction
    Section 23.1. Viewing Assembly Information
    Section 23.2. Examining Module Information
    Section 23.3. Examining Constructor Information
    Section 23.4. Examining Methods Within a Type
    Section 23.5. Displaying Event Information
    Section 23.6. Displaying Property Information
    Section 23.7. Searching Assembly Information Using Filtering
    Section 23.8. Searching Assemblies Using Custom Search Techniques
    Section 23.9. Creating Dynamic Assemblies
    Section 23.10. Performing Dynamic Invocation
    Section 23.11. Creating a Plug-In Architecture

    Chapter 24. COM Interoperability
    Section 24.0. Introduction
    Section 24.1. Creating an ATL-Based COM Component
    Section 24.2. Using COM Objects in .NET
    Section 24.3. Automatically Generating an Interop Assembly
    Section 24.4. Using ActiveX Controls in a Windows Form
    Section 24.5. Viewing the RCW Using ILDasm.exe
    Section 24.6. Handling HRESULT Errors
    Section 24.7. Using .NET Objects in COM
    Section 24.8. Viewing an Exported .NET Type Library
    Section 24.9. Controlling Managed Thread Apartment States

    Chapter 25. Custom Attributes
    Section 25.0. Introduction
    Section 25.1. Creating a Custom Attribute Class Definition
    Section 25.2. Declaring Targets for Custom Attributes
    Section 25.3. Allowing Custom Attributes to Be Applied Multiple Times
    Section 25.4. Defining the Inheritance Model of Custom Attributes
    Section 25.5. Adding Optional Properties to Custom Attributes
    Section 25.6. Displaying Custom Attribute Information Using Reflection
    Section 25.7. Displaying Assembly Custom Attribute Information Using Reflection
    Section 25.8. Displaying Properties of an Applied Attribute at Runtime

    Chapter 26. Smart Device Extensions
    Section 26.0. Introduction
    Section 26.1. Understanding the Differences Between the Compact and .NET Frameworks
    Section 26.2. Creating a Smart Device Solution
    Section 26.3. Creating and Displaying Windows Forms
    Section 26.4. Manipulating the Soft Input Panel
    Section 26.5. Using the MessageWindow Class
    Section 26.6. Creating an IrDA Client
    Section 26.7. Creating an IrDA Server
    Section 26.8. Building CAB Files for Application Distribution
    Section 26.9. Deploying Mobile Applications Using ActiveSync
    Section 26.10. Creating Mobile ASP.NET Pages
    Section 26.11. Using the Mobile ASP.NET ObjectList Control
    Section 26.12. Querying Mobile Device Capabilities
    Section 26.13. Changing Mobile Web Form Output Using the DeviceSpecific Control
    Section 26.14. Creating a SqlServerCE Database
    Section 26.15. Using a SQL Server CE Database


    Part VII: Appendixes
    Appendix A. Visual Studio .NET IDE
    Source Editing
    Tool Windows
    Visual Studio .NET Toolbars

    Appendix B. .NET Debugging .Reference
    Working with Breakpoints
    Debugging an Application


    Index
     

    Các file đính kèm:

Đang tải...