Export (0) Print
Expand All

.NET Framework (How Do I in C#) 

This page links to Help on widely used .NET Framework tasks. To view other categories of popular tasks covered in Help, see How Do I in C#.

Introduction to the C# Language and the .NET Framework

Describes the relationship between the C# language and the .NET Framework class libraries and run-time execution engine.

Overview of the .NET Framework

Provides conceptual overviews of the key features of the .NET Framework, including the common language runtime, the .NET Framework class library, and cross-language interoperability.

Quick Technology Finder

Provides a quick reference to the major technology areas of the .NET Framework.

How to: Create a Directory Listing

Create a new directory.

How to: Read and Write to a Newly Created Data File

Read and write to a newly created data file.

How to: Open and Append to a Log File

Open and append to a log file.

How to: Write Text to a File

Write text to a file.

How to: Read Text from a File

Read text from a file.

How to: Read Characters from a String

Read characters from a string.

How to: Write Characters to a String

Write characters to a string.

How to: Add or Remove Access Control List Entries

Add or remove Access Control List (ACL) entries for enhanced security.

Creating New Strings

How to create a new string.

Trimming and Removing Characters

How to remove characters from the beginning or end of a string.

Padding Strings

How to add tabs or spaces to the beginning or end of strings.

Comparing Strings

How to compare two strings for equality.

Changing Case

How to change upper-case letters to lower-case, and the reverse.

Using the StringBuilder Class

Efficient string manipulation techniques.

How to: Perform String Manipulations by Using Basic String Operations

How to split strings, append one string to another, and more.

How to: Convert Data Types Using System.Convert

Contains an example that uses the Convert class to transform a string value into a Boolean value.

How to: Strip Invalid Characters from a String

Contains an example that uses the static Regex.Replace method to strip invalid characters from a string.

How to: Verify That Strings are in Valid E-Mail Format

Contains an example that uses the static Regex.IsMatch method to verify that a string is in valid e-mail format.

Collections and Data Structures

Overview of .NET Framework collection classes.

Selecting a Collection Class

How to choose which type of collection to use.

When to Use Generic Collections

Explains the advantages of generic over non-generic collection classes.

System.Collections.Generic

Portal page to the generic collection classes.

List

Provides example code showing how to add and remove items from a List<T> collection.

SortedDictionary

Provides example code showing how to add and remove key/value pairs from a SortedDictionary<K,V> collection.

How to: Use Specific Exceptions in a Catch Block

Contains an example that uses a try/catch block to catch an InvalidCastException.

How to: Use the Try/Catch Block to Catch Exceptions

Contains an example that uses a try/catch block to catch a possible exception.

How to: Create User-Defined Exceptions

Contains an example where a new exception class, EmployeeListNotFoundException, is derived from Exception.

How to: Use Finally Blocks

Contains an example that uses a try/catch block to catch an ArgumentOutOfRangeException exception.

How to: Explicitly Throw Exceptions

Contains an example that uses a try/catch block to catch a possible FileNotFoundException exception.

How to: Consume Events in a Windows Forms Application

Contains examples to show how to handle a button click event on a Windows Form.

How to: Connect Event Handler Methods to Events

Contains examples to show how to add an event handler method for an event.

How to: Raise and Consume Events

Contains an example that uses concepts described in detail in Events and Delegates and Raising an Event.

How to: Handle Multiple Events Using Event Properties

Contains an example to show how to handle multiple events using event properties.

How to: Implement Events in Your Class

Contains procedures that describe how to implement an event in a class.

How to: Create a Compensating Resource Manager (CRM)

Includes code examples to show you how to create a Compensating Resource Manager

How to: Create a Serviced Component

Contains a procedure that describes how to create a new serviced component.

How to: Apply the Description Attribute to an Assembly

Shows how to apply the DescriptionAttribute attribute to set the description of an assembly.

How To: Use the SetAbort and SetComplete Methods

Shows how to use the static SetComplete and SetAbort methods of the ContextUtil class.

How to: Apply the ApplicationID Attribute to an Assembly

Shows how to apply the ApplicationID attribute to an assembly.

How to: Create a Pooled Object and Set Its Size and Time-out Limits

Shows how to create a pooled object and set its size and time-out limits.

How to: Create a Web Service Method that Uses Automatic Transactions

Describes how to create a Web service method that uses automatic transactions.

How to: Set the SoapRoot Property for an Application

Shows how to set the SoapVRoot property to "MyVRoot".

How to: Set the Transaction Time-out

Shows how to set the transaction time-out to 10 seconds.

How to: Set the Application Name by Using the ApplicationName Attribute

Shows how to supply the application name by using the assembly-level ApplicationName attribute.

How to: Use the BYOT (Bring Your Own Transaction) Feature of COM+

Contains procedures that show how a class derived from the ServicedComponent class can use the BYOT feature of COM+ to access a Distributed Transaction Coordinator (DTC).

How to: Create a Private Component

Shows how to use the PrivateComponentAttribute attribute on a class.

How to: Set the Activation Type of an Application

Shows how to set the activation type to "server."

How to: Enable Synchronization on Instances of a Class

Shows how to enable synchronization on instances of the TestSync class.

How to: Use Automatic Transactions in a .NET Framework Class

Describes how to prepare a class to participate in an automatic transaction.

How to: Enable JIT Activation

Shows how to enable JIT activation and deactivation on and off a class.

How To: Set the AutoComplete Attribute on a Transaction-Aware Class

Shows the placement of the AutoComplete attribute on a transaction-aware class.

How to: Implement a Queued Component that Displays a Message Asynchronously

Demonstrates how to implement a queued component that displays a message asynchronously.

How to: Implement Loosely Coupled Events

Contains procedures that show how to implement an event class and event sink that implement a common event interface, plus a publisher to fire an event.

How to: Configure Object Construction

Contains a procedure and an example that describe how to configure object construction and set the default initialization string of the TestObjectConstruct class to the string "Initial Catalog=Northwind;Data Source=.\\SQLServerInstance;Trusted_Connection=yes".

How to: Obtain Type and Member Information from an Assembly

Contains an example that obtains type and member information from an assembly.

How to: Build a Single-File Assembly

Contains a procedure that shows how to create single-file assemblies using command-line compilers.

How to: Create an Application Domain

Creates a new application domain, assigns it the name MyDomain, and then prints the name of the host domain and the newly created child application domain to the console.

How to: Determine an Assembly's Fully Qualified Name

Shows how to display the fully qualified name of an assembly containing a specified class to the console.

How to: Configure an Application Domain

Creates an instance of the AppDomainSetup class, uses this class to create a new application domain, writes the information to console, and then unloads the application domain.

How to: View Assembly Contents

Contains an example that starts with a basic "Hello, World" program and shows how to use Ildasm.exe to disassemble the Hello.exe assembly and view the assembly manifest.

How to: Reference a Strong-Named Assembly

Creates an assembly called myAssembly.dll that references a strong-named assembly called myLibAssembly.dll from a code module called myAssembly.cs.

How to: Unload an Application Domain

Creates a new application domain called MyDomain, prints some information to the console, and then unloads the application domain.

How to: Remove an Assembly from the Global Assembly Cache

Contains an example that removes an assembly named hello.dll from the global assembly cache.

How to: Install an Assembly into the Global Assembly Cache

Contains an example that installs an assembly with the file name hello.dll into the global assembly cache.

How to: Build a Multifile Assembly

Describes the procedure used to create a multifile assembly and provides a complete example that illustrates each of the steps in the procedure.

How to: Load Assemblies into an Application Domain

Contains an example that loads an assembly into the current application domain and then executes the assembly.

How to: Sign an Assembly with a Strong Name

Contains an example that signs the assembly MyAssembly.dll with a strong name using the key file sgKey.snk.

How to: View the Contents of the Global Assembly Cache

Shows how to use the Global Assembly Cache tool (Gacutil.exe) to view the contents of the global assembly cache.

How to: Create a Public/Private Key Pair

Shows how to sign an assembly with a strong name, and how to create a key pair using the Strong Name tool (Sn.exe).

How to: Embed Type Libraries as Win32 Resources in .NET-Based Applications

Shows how to embed a type library as a Win32 resource in a .NET Framework-based application.

How to: Generate Primary Interop Assemblies Using Tlbimp.exe

Provides examples that generate primary interop assemblies using Tlbimp.exe.

How to: Create Primary Interop Assemblies Manually

Provides an example to create primary interop assemblies manually.

How to: Generate Interop Assemblies from Type Libraries

Provides examples to generate an interop assembly from a type library.

How to: Raise Events Handled by a COM Sink

Provides an example that shows a managed server as the event source and a COM client as the event sink.

How to: Customize Runtime Callable Wrappers

Shows how to customize runtime callable wrappers by modifying the IDL source or modifying an imported assembly.

How to: Configure .NET-Based Components for Registration-Free Activation

Explains how to configure .NET Framework-based components for registration-free activation.

How to: Implement Callback Functions

Demonstrates how a managed application, using platform invoke, can print the handle value for each window on the local computer

How to: Map HRESULTs and Exceptions

Contains an example to create a new exception class called NoAccessException and map it to the HRESULT E_ACCESSDENIED.

How to: Edit Interop Assemblies

Demonstrates how to specify marshaling changes in Microsoft intermediate language (MSIL).

How to: Add References to Type Libraries

Explains the steps to add a reference to a type library.

How to: Handle Events Raised by a COM Source

Includes an example to demonstrate how to open an Internet Explorer window and wire events raised by the InternetExplorer object to event handlers implemented in managed code.

How to: Create Wrappers Manually

Shows an example of the ISATest interface and SATest class in IDL and the corresponding types in C# source code.

How to: Register Primary Interop Assemblies

Includes an example to register the CompanyA.UtilLib.dll primary interop assembly.

How to: Wrap Multiple Versions of Type Libraries

Explains how to wrap more than one version of a type library.

How to: Deserialize an Object

Provides an example that deserializes an object into a file.

How to: Use the XML Schema Definition Tool to Generate Classes and XML Schema Documents

Provides procedures to show how to use the XML schema definition tool to generate classes and XML schema documents.

How to: Specify an Alternate Element Name for an XML Stream

Shows how you can generate more than one XML stream with the same set of classes.

How to: Control Serialization of Derived Classes

Provides an example to show how to control serialization of derived classes.

How to: Serialize an Object as a SOAP-Encoded XML Stream

Provides a procedure and an example to serialize an object as a SOAP-encoded XML stream.

How To: Chunk Serialized Data

Provides a procedure and an example to implement server-side chunking and

client-side processing.

How to: Serialize an Object

Provides a procedure to serialize an object.

How to: Qualify XML Element and XML Attribute Names

Provides a procedure and an example to create qualified names in an XML document.

How to: Override Encoded SOAP XML Serialization

Provides a procedure and an example to override serialization of objects as SOAP messages.

How to: Parse Unicode Digits

Provides an example that uses the Decimal.Parse method to parse strings of Unicode code values that specify digits in different scripts.

How to: Create Custom Cultures

Provides a procedure to define and create a custom culture.

How to: Define and Execute Dynamic Methods

Shows how to define and execute a simple dynamic method and a dynamic method bound to an instance of a class.

How to: Examine and Instantiate Generic Types with Reflection

Provides procedures to show how to discover and manipulate generic types.

How to: Define a Generic Method with Reflection Emit

Provides procedures to show how to define a generic method with reflection emit.

How to: Use Full Signing to Give a Dynamic Assembly a Strong Name

Demonstrates using full signing to give a dynamic assembly a strong name.

How to: Load Assemblies into the Reflection-Only Context

Provides a procedure and a code example to show how to load assemblies into the reflection-only context.

How to: Define a Generic Type with Reflection Emit

Shows how to create a simple generic type with two type parameters, how to apply class constraints, interface constraints, and special constraints to the type parameters, and how to create members that use the type parameters of the class as parameter types and return types.

Walkthrough: Adding Smart Tags to a Windows Forms Component

Demonstrates how to add smart tags using code from a simple example control, ColorLabel, which is derived from the standard Windows Forms Label control.

Walkthrough: Altering the SOAP Message Using SOAP Extensions

Shows how to build and run a SOAP extension.

Walkthrough: Building a Basic XML Web Service Using ASP.NET

Demonstrates building a basic XML Web service using ASP.NET.

Walkthrough: Customizing ASP.NET Mobile Web Pages for Specific Devices

Demonstrates customizing for specific devices.

Walkthrough: Customizing the Generation of Service Descriptions and Proxy Classes

Demonstrates customizing the generation of Service Descriptions and proxy classes.

Walkthrough: Deploying a ClickOnce Application Manually

Describes the steps required to create a full ClickOnce deployment using the command-line or graphical version of the Manifest Generation and Editing tool (Mage).

Walkthrough: Downloading Assemblies on Demand with the ClickOnce Deployment API

Demonstrates how to mark certain assemblies in your application as "optional," and how to download those using classes in the System.Deployment.Application namespace when the common language runtime (CLR) demands them.

Walkthrough: Implementing a UI Type Editor

Explains how to author your own UI type editor for a custom type and display the editing interface by using a PropertyGrid.

Visual Studio 2005 Developer Center

Contains many articles and resources on developing applications using Visual Studio 2005. This site is updated regularly with new content.

Visual C# Developer Center

Contains many articles and resources on developing C# applications. This site is updated regularly with new content.

Microsoft .NET Framework Developer Center

Contains many articles and resources on developing and debugging .NET Framework applications. This site is updated regularly with new content.

Community Additions

ADD
Show:
© 2015 Microsoft