.NET Framework (How Do I in C#)
Updated: September 2008
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, such as 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 start or end of a string.
- Padding Strings
How to add tabs or spaces to the start 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.
- Converting 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 decide which type of collection to use.
- When to Use Generic Collections
Explains the advantages of generic over non-generic collection classes.
Portal page to the generic collection classes.
Provides example code that demonstrates how to add and remove items from a List<T> collection.
- SortedDictionary<TKey, TValue>
Provides example code that demonstrates 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: 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 by 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 that contains 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 named myAssembly.dll that references a strong-named assembly named myLibAssembly.dll from a code module named 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 that is used to create a multifile assembly and provides a complete example that illustrates 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 by 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 that uses 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 named 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: 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: Customizing ASP.NET Mobile Web Pages for Specific Devices
Demonstrates customizing for specific devices.
- Walkthrough: Manually Deploying a ClickOnce Application
Describes the steps that are 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 about how to develop applications by using Visual Studio. This site is updated regularly with new content.
- Visual C# Developer Center
Contains many articles and resources about how to develop C# applications. This site is updated regularly with new content.
- Microsoft .NET Framework Developer Center
Contains many articles and resources about how to develop and debugging .NET Framework applications. This site is updated regularly with new content.