Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

C# Language (How Do I in C#) 

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

What's New in the C# 2.0 Language and Compiler

Contains information regarding the new features, including generics, iterators, anonymous methods, and partial types.

Using C# Starter Kits

Explains how to load and build a Visual C# Starter Kit.

C# Language Specification

Pointers to the latest version of the specification in Microsoft Word format.

Main() and Command Line Arguments (C# Programming Guide)

Explains the Main method, the entry point of your program, where you create objects and invoke other methods. There can only be one entry point in a C# program.

How to: Access Command-Line Arguments Using foreach (C# Programming Guide)

Provides a code example that shows how access the command line parameters.

How to: Display Command Line Arguments (C# Programming Guide)

Explains how to display to the Command Line Arguments through the args string array.

Main() Return Values (C# Programming Guide)

Explains the possible return values of the main method.

base (C# Reference)

Explains how to specify the base-class constructor called when creating instances of a derived class.

How to: Know the Difference Between Passing a Struct and Passing a Class Reference to a Method (C# Programming Guide)

Contains a code example that shows that when a struct is passed to a method, a copy of the struct is passed, but when a class instance is passed, a reference is passed.

Instance Constructors (C# Programming Guide)

Explains class constructors and inheritance.

How to: Write a Copy Constructor (C# Programming Guide)

Contains a code example that demonstrates how a constructor of a class takes another object as an argument.

How to: Implement User-Defined Conversions Between Structs (C# Programming Guide)

Contains a code example that defines two structs and demonstrates conversions between them.

Boxing Conversion (C# Programming Guide)

Contains an example that illustrates that a value type and a boxed object can store different values.

Unboxing Conversion (C# Programming Guide)

Contains a code example that illustrates how to display an error message for a case of invalid boxing.

Arrays as Objects (C# Programming Guide)

Contains a code example that displays the number of dimensions of an array.

Jagged Arrays (C# Programming Guide)

Contains a code example that builds an array whose elements are themselves arrays.

Passing Arrays as Parameters (C# Programming Guide)

Contains code examples that initialize a string array and pass it as a parameter to the PrintArray method, where its elements are displayed.

Passing Arrays Using ref and out (C# Programming Guide)

Contains code examples that demonstrate the difference between out and ref when used in passing arrays to methods.

How to: Declare and Use Read/Write Properties (C# Programming Guide)

Contains an example that shows you how to declare and use read/write properties.

How to: Define Abstract Properties (C# Programming Guide)

Contains a code example that shows how to define abstract properties.

Passing Value-Type Parameters (C# Programming Guide)

Contains code examples that demonstrate the various ways to pass value types.

Passing Reference-Type Parameters (C# Programming Guide)

Contains code examples that demonstrate the various ways to pass reference types.

How to: Subscribe to and Unsubscribe from Events (C# Programming Guide)

Shows how to subscribe to events published by other classes, including Forms, buttons, List Boxes, and so on.

How to: Publish Events that Conform to .NET Framework Guidelines (C# Programming Guide)

Shows how to create events based on EventHandler and EventHandler<T>.

How to: Implement Interface Events (C# Programming Guide)

Shows how to implement events that are declared in interfaces.

How to: Use a Dictionary to Store Event Instances (C# Programming Guide)

Explains how to use a hash table to store the event instances.

How to: Raise Base Class Events in Derived Classes (C# Programming Guide)

Shows how to wrap base class events in protected virtual methods in order to make them callable from derived classes.

How to: Explicitly Implement Interface Members (C# Programming Guide)

Shows how to declare a class that explicitly implements an interface and how to access the members through the interface instance.

How to: Explicitly Implement Interface Members with Inheritance (C# Programming Guide)

Provides an example that displays the dimensions of a box in both metric and English units.

An Introduction to C# Generics

Describes how generics allow you to define type-safe collection classes. You implement the generic class only once, but you can declare and use it with any type.

Generics in the .NET Framework

Explains the features and use of the new set of generic collections in the System.Collections.Generic namespace.

default Keyword in Generic Code (C# Programming Guide)

Provides a code example that demonstrates how to use the default keyword for type parameters.

Generic Methods (C# Programming Guide)

Introduces the syntax to declare a generic method. It also demonstrates an example on using generic methods in an application.

Constraints on Type Parameters (C# Programming Guide)

Shows how to constrain type parameters to enable access to methods and properties of the types used to instantiate the generic class.

Generic Delegates (C# Programming Guide)

Contains the syntax to declare generic delegates. It also includes important remarks on instantiating and using generic delegates as well as code examples.

How to: Use the Namespace Alias Qualifier (C# Programming Guide)

Discusses the ability to access a member in the global namespace when the member might be hidden by another entity of the same name.

How to: Create an Iterator Block for a Generic List (C# Programming Guide)

Provides an example where an array of integers is used to build the list SampleCollection. A for loop iterates through the collection and yields the value of each item. Then a foreach loop is used to display the items of the collection.

How to: Create an Iterator Block for a Generic List (C# Programming Guide)

Provides an example where a generic class Stack<T> implements a generic interface IEnumerator<T>. An array of the type T is declared and assigned values by using the method Push. In the GetEnumerator method, the values of the array are returned using the yield return statement.

How to: Combine Delegates (Multicast Delegates)(C# Programming Guide)

Provides an example that demonstrates how to compose multicast delegates.

How to: Declare, Instantiate, and Use a Delegate (C# Programming Guide)

Provides an example that illustrates how to declare, instantiate, and use a delegate.

How to: Use Operator Overloading to Create a Complex Number Class (C# Programming Guide)

Shows how you can use operator overloading to create a complex number class Complex that defines complex addition.

How to: Use COM Interop to Check Spelling Using Word (C# Programming Guide)

This example illustrates how to use Word's spelling checker from a C# application.

How to: Use COM Interop to Create an Excel Spreadsheet (C# Programming Guide)

This example illustrates how to open an existing Excel spreadsheet in C# using .NET Framework COM interop capability.

How to: Use Managed Code as an Automation Add-In for Excel (C# Programming Guide)

This example illustrates how to create a C# add-in for calculating income tax rate in a cell in an Excel worksheet.

How to: Use Platform Invoke to Play a Wave File (C# Programming Guide)

This example illustrates how to use platform invoke services to play a wave sound file on the Windows platform.

How to: Use Pointers to Copy an Array of Bytes (C# Programming Guide)

Shows how to use pointers to copy bytes from one array to another, using pointers.

How to: Use the Windows ReadFile Function (C# Programming Guide)

Shows how to call the Windows ReadFile function, which requires the use of an unsafe context because the read buffer requires a pointer as a parameter.

Using Threads and Threading

Provides a list of topics that discuss the creation and management of managed threads and how to avoid unintended consequences.

How to: Create and Terminate Threads (C# Programming Guide)

Provides an example that demonstrates how to create and start a thread, and shows the interaction between two threads running simultaneously within the same process.

How to: Synchronize a Producer and a Consumer Thread (C# Programming Guide)

Provides an example that shows how synchronization can be accomplished using the C# lock keyword and the Pulse method of the Monitor object.

How to: Use a Thread Pool (C# Programming Guide)

Explains an example that shows how to use a thread pool.

How to: Search Strings Using Regular Expressions (C# Programming Guide)

Explains how to use the Regex class can be used to search strings. These searches can range in complexity from very simple to making full use of regular expressions.

How to: Join Multiple Strings (C# Programming Guide)

Contains a code example that demonstrates how to join multiple strings.

How to: Search Strings Using String Methods (C# Programming Guide)

Contains a code example that demonstrates how to use String methods to search for a string.

How to: Parse Strings Using the Split Method (C# Programming Guide)

Contains a code example that demonstrates how a string can be parsed using the System.String.Split method.

How to: Modify String Contents (C# Programming Guide)

Contains a code example that extracts the contents of a string into an array and then modifies some elements of the array.

How to: Create a C/C++ Union Using Attributes (C# Programming Guide)

Contains an example that uses the attribute Serializable to apply a specific characteristic to a class.

How to: Create and Use C# DLLs (C# Programming Guide)

Demonstrates building and using a DLL, using an example scenario.

How to: Determine If a File Is an Assembly (C# Programming Guide)

Contains an example that tests a DLL to see if it is an assembly.

How to: Load and Unload Assemblies (C# Programming Guide)

Explains how it is possible to load specific assemblies into the current application domain at runtime.

How to: Share an Assembly with Other Applications (C# Programming Guide)

Explains how to share an assembly with other applications.

Executing Code in Another Application Domain (C# Programming Guide)

Shows how to execute an assembly that has been loaded into another application domain.

How to: Create and Use an Application Domain (C# Programming Guide)

Shows how operator overloading can be used to implement a three-valued logical type.

Visual C# Samples

Contains links to open or copy the sample's files that range from Hello World Sample to Generics Sample (C#).

Was this page helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

Show:
© 2015 Microsoft