Skip to content
David Cumps
BitArray Class

BitArray Class

Contains an array of true/false values. Resizable through the Length property. Supports bitwise operations.

Comparer Class

Comparer Class

Default comparer used when sorting, for example with an ArrayList. Implements the IComparer interface.

Delegate Class

Delegate Class

Holds a reference to a method; declared in a single line, with the framework providing the underlying implementation.

EventArgs Class

EventArgs Class

EventArgs carries event data; use it for events without data and derive from it to pass custom data.

EventHandler Delegates

EventHandler Delegates

EventHandler and EventHandler<T> let you define events without declaring your own delegate, plus a pattern for disposing event listeners.

Exception classes

Exception classes

Exception class hierarchy, catch ordering, finally, try/catch/finally scopes and the recommended constructors for custom exceptions.

Generic Types

Generic Types

Generics let the caller fill in type placeholders, giving strongly typed collections with compile-time type checking and optional constraints.

GZipStream Class

GZipStream Class

Compresses and decompresses data in gzip format. Output is slightly larger than DeflateStream because of extra header information.

Hashtable Class

Hashtable Class

Non-generic key-value collection of DictionaryEntry objects, accessed by key rather than by index and stored by hash code.

IComparable Interface

IComparable Interface

IComparable is required for sorting. CompareTo returns less than 0, 0 or greater than 0 to order the current object relative to another.

IConvertible Interface

IConvertible Interface

Enables a class to be converted to a base type such as Boolean, Byte, Double or String, plus widening, narrowing and operator conversions.

IDisposable Interface

IDisposable Interface

Enables users of your class to free the resources an instance has consumed. Implement it for disposable members or native resources.

MemoryStream Class

MemoryStream Class

Provides an in-memory Stream for temporary data, for example to avoid keeping a file locked by a FileStream for long.

Reference Types

Reference Types

Reference type data lives on the heap and is cleaned up by the garbage collector; copying a reference copies only the pointer.

Regex Class

Regex Class

Used to work with regular expressions: anchoring patterns safely, plus examples of matching, replacing and named groups.

Snippets

Snippets

C# snippets: operator overloading on an immutable struct, and a Predicate used with Array.TrueForAll.

SortedList Class

SortedList Class

Key-value pair based collection. Contains DictionaryEntry objects. Accessible by index and key. Sorts items when they are added.

Stream Class

Stream Class

A stream is an abstraction of a sequence of bytes, which helps isolate the programmer from the underlying implementation.

StringBuilder Class

StringBuilder Class

A StringBuilder keeps an internal buffer instead of allocating a new string every time. The default capacity is 16 characters.

Value Types

Value Types

Value types: built-in types, structures, enums and nullable types, how they hold and copy values, and good practices for using them.