Team LiB
Previous Section

List of Code Examples

Chapter 1: Common Type System

Code Example: Identifiers and Naming Conventions
Code Example: Using Variables
Code Example: Value Types
Code Example: Using Bool
Code Example: Using Integers
Code Example: Using Char
Code Example: Using Strings
Code Example: Escape Characters
Code Example: Using Floats, Doubles, and Decimals
Code Example: Reference Type
Code Example: Boxing and Unboxing
Code Example: Constants
Code Example: Static
Code Example: Scopes
Code Example: Casting

Chapter 2: Expressions and Operators

Code Example: Expressions
Code Example: Arithmetic Operators
Code Example: Multiple-Function and Unary Operators
Code Example: Relational Operators
Code Example: Logical Operators
Code Example: Bitwise Operators
Code Example: Shift Operators

Chapter 3: Structs, Enums, Arrays, and Collections

Code Example: Struct
Code Example: Enums
Code Example: Arrays
Code Example: ArrayList
Code Example: Hashtables
Code Example: Queue
Code Example: Stacks
Code Example: Iterators

Chapter 4: Program Control

Code Example: if else
Code Example: switch case
Code Example: for and foreach
Code Example: while and do while
Code Example: continue, break, and goto

Chapter 5: Building Your Own Classes

Code Example: Declaring and Defining a Class
Code Example: Constructors and Initialization
Code Example: Destroying Objects
Code Example: Passing by Value and by Reference
Code Example: Declaring Class Instances
Code Example: Overloading
Code Example: Inheritance
Code Example: Virtual Methods
Code Example: Overriding
Code Example: Interfaces
Code Example: Generics
Code Example: Partial Types, Test1.cs
Code Example: Partial Types, Test2.cs

Chapter 6: Strings

Code Example: Creating Strings
Code Example: String Concatenation
Code Example: Nonmutable String
Code Example: Searching for Substrings
Code Example: Extracting Substrings
Code Example: Changing Character Case
Code Example: Replacing Characters
Code Example: Removing Characters
Code Example: Joining Strings
Code Example: Splitting Strings
Code Example: Trimming Spaces
Code Example: Padding Strings

Chapter 7: Memory Management

Code Example: Heap and Stack Memory
Code Example: References and Pointers

Chapter 8: Delegates, Events, and Namespaces

Code Example: Delegates
Code Example: Events
Code Example: Anonymous Methods

Chapter 9: Exception Handling and Application Domains

Code Example: Try/Catch/Finally
Code Example: How to Create an AppDomain

Chapter 10: COM and .NET Interoperability

Code Example: Consuming COM Objects—Early Binding
Code Example: Consuming COM Objects—Late Binding
Code Example: QueryInterface and Casting
Code Example: Consuming .NET Objects from COM Clients
Code Example: Subscribing to Events in COM Objects
Code Example: Publishing .NET Objects to COM with Events
Code Example: Using PInvoke to Call Native DLL Functions
Code Example: Call Native Functions: Array Parameter By Value
Code Example: Call Native Functions: Array Parameter By Reference
Code Example: Call Native Functions: Multidimensional Arrays
Code Example: Call Native Functions: String Arrays
Code Example: Call Native Functions: Array of Struct1
Code Example: Call Native Functions: Array of Struct2
Code Example: Creating COM+ Objects in .NET
Code Example: Using RBS in Managed COM+ Applications
Code Example: Using the IntPtr Class
Code Example: Setting Security on a Specific COM Interface

Chapter 11: Files and Streams

Code Example: Directory Management
Code Example: Creating Files
Code Example: Opening Existing Files
Code Example: Deleting Files
Code Example: Moving Files
Code Example: Copying Files
Code Example: FileSystemWatcher
Code Example: FileStream
Code Example: StreamReader
Code Example: StreamWriter
Code Example: StringReader
Code Example: BinaryFormatter

Chapter 12: Active Directory

Code Example: Binding to Active Directory As a Specific User
Code Example: Binding to Active Directory As the Logged-on User
Code Example: Traversing Objects in Active Directory
Code Example: Reading Object Attributes
Code Example: Writing Objects to Active Directory
Code Example: Writing Attributes to an Object
Code Example: Modifying Object Attributes
Code Example: Changing Passwords
Code Example: Deleting Objects from Active Directory
Code Example: Searching Active Directory
Code Example: Directory Cache

Chapter 13: ADO.NET

Code Example: Creating a SqlClient Connection
Code Example: Creating an ODBC Connection
Code Example: Creating an OleDb Connection Using an Access Database
Code Example: Creating an OleDb Connection Using Another OLE DB-Compliant Database (Such As Oracle)
Code Example: Using Mutiple-Table DataSets
Code Example: Updating a Data Source
Code Example: Persisting a DataSet to an XML File
Code Example: Reading XML into a DataSet
Code Example: Using a DataReader
Code Example: Using ADO.NET Events
Code Example: Creating and Populating DataTables
Code Example: Inserting Data into a Database Using SQL Statements
Code Example: Inserting Data into a Database Using CommandBuilder
Code Example: Updating Data in a Database Using SQL Statements
Code Example: Using Transactions
Code Example: Updating Data in a Database Using CommandBuilder
Code Example: Deleting Data from a Database Using SQL Statements
Code Example: Deleting Data from a Database Using a CommandBuilder
Code Example: Finding Rows in a Database
Code Example: Using DataTableMappings
Code Example: Calling a Stored Procedure
Code Example: Using DataViews to Control the Display of a DataGrid

Chapter 14: Networking and WWW Connections

Code Example: Creating a Socket Connection/Client
Code Example: Listening for Socket Connections
Code Example: DNS Name Resolution
Code Example: WebClient
Code Example: Web Request
Code Example: Displaying Web Pages Using the WebBrowser Control

Chapter 15: Threading

Code Example: Creating Threads
Code Example: Destroying Threads
Code Example: Thread Sleep, Interrupt, Resume, and Suspend
Code Example: Using the WaitHandle Classes to Wait on Threads
Code Example: Using Timers
Code Example: Synchronizing Threads Using lock
Code Example: Synchronizing Threads Using the Monitor Class
Code Example: Synchronizing Threads with Mutex
Code Example: Using ThreadPools and ResetEvent Classes
Code Example: Asynchronous Calls Using Callback
Code Example: Asynchronous Wait Timeout

Chapter 16: Debugging

Code Example: Tracing to a File
Code Example: Tracing to the Event Log
Code Example: Tracing to the Debugger
Code Example: Tracing to the Console
Code Example: Using BooleanSwitch
Code Example: Using TraceSwitch and Config Files
Code Example: Creating and Writing to an Event Log
Code Example: A Simple Profiler
Code Example: Using StopWatch
Code Example: Using Asserts
Code Example: Setting a Breakpoint in Managed Code That Has Been Jitted
Code Example: Setting a Breakpoint in Managed Code That Has Not Been Jitted
Code Example: Writing Data to Performance Monitor

Chapter 17: Remoting

Code Example: Simple Hosting Process Code, Console Application
Code Example: IIS Hosting, Remoted Object Creation
Code Example: IIS Hosting, Configuration File
Code Example: Client XML File
Code Example: Simple Hosting Process Code, Service
Code Example: Creating a MarshalByValue [Serializable] Object
Code Example: Creating a MarshalByRefObject, Server Activated Object (SAO)
Code Example: Creating a MarshalByRefObject, Client Activated Object (CAO)
Code Example: Server Code, Programmatic Design for a SingleCall SAO
Code Example: Server Code, Programmatic Design for a Singleton SAO
Code Example: Server Code, Programmatic Design for a CAO
Code Example: Server Code, Configuration File Design for a SingleCall SAO
Code Example: Server Code, Configuration File Design for a Singleton SAO
Code Example: Server Code, Configuration File Design for a CAO
Code Example: Client Code, Programmatic Design for a SingleCall SAO
Code Example: Client Code, Programmatic Design for a Singleton SAO
Code Example: Client Code, Programmatic Design for a CAO
Code Example: Client Code, Configuration File Design for a SingleCall SAO
Code Example: Client Code, Configuration File Design for a Singleton SAO
Code Example: Client Code, Configuration File Design for a CAO
Code Example: Setting the Lifetime of an Object Programmatically
Code Example: Setting the Lifetime of an Object in an XML Server Configuration File
Code Example: Client Code, Calling a Remoted Method Asynchronously
Code Example: Client Code, Using Callbacks with Delegates
Code Example: Using Call Context, Client Side
Code Example: Using Call Context, Remoted Object
Code Example: Using Dynamic Sinks
Code Example: Programmatically Adding Sinks, Client Side
Code Example: Programmatically Adding Sinks, Server Side
Code Example: Custom Serialization

Chapter 18: Web Services

Code Example: A Simple Hello World Web Service
Code Example: A Web Service Client

Chapter 19: Office Integration

Code Example: Creating an Office Application Instance
Code Example: Using the ROT
Code Example: Using File Monikers
Code Example: Modifying Document Properties
Code Example: Creating Command Bars
Code Example: Using Events
Code Example: Sending E-mail Using CDOEx
Code Example: Sending E-mail Using CDO 1.21
Code Example: Sending E-mail Using System.Web

Chapter 20: Windows Forms

Code Example: Creating a Form with the Wizard
Code Example: XP Bubbles

Chapter 22: XML

Code Example: Reading XML from a File
Code Example: Reading XML from a Stream
Code Example: Reading XML from a URL
Code Example: Writing XML to a File
Code Example: Loading an XML Document

Team LiB
Previous Section