Skip to content
David Cumps

ArrayList Class

Resizeable, unordered, index-based collection. Suffers from boxing/unboxing when working with value types. Implements IEnumerator, allowing foreach…

BitArray Class

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

Boxing And Unboxing

Boxing is an implicit conversion of a value-type to the object type. Boxing a value-type will copy the value on the heap, and place a pointer to the boxed…

BufferedStream Class

Provides an buffer for another Stream. Used when the underlying stream is not very efficient in handling constant calls.

Comparer Class

Used as the default comparer when sorting with ArrayList for example. Implements the IComparer interface.

DeflateStream Class

Used to compress and decompress data. Slightly smaller result than GZipStream because of lack of header information. Use for internal use in your own…

Delegate Class

Holds a reference to a method. Declared as a single line, the framework provides the underlying implementation.

EventArgs Class

Defines the arguments to pass in an event. The EventArgs class is used to raise an event without any data. Derive from EventArgs when you need to pass…

EventHandler Delegates

Provides an easier way to define events, without having to declare a delegate. The EventHandler delegate is used for events without data, while the…

Exception classes

All .NET exceptions derive from the System.SystemException class. All custom exceptions derive from the System.Exception class. For most applications…

Generic Types

Allows you to use placeholders for parameters, which get defined later by the caller. Allows for strongly typed collections, which enable compile-time…

GZipStream Class

Used to compress and decompress data. Slightly larger result than DeflateStream because of extra header information. Use for files that need to be able to…

HashTable Class

Key-value pair based collection. Contains DictionaryEntry objects. Not accessible by index, only by key. Values are returned based on the hash value when…

ICloneable Interface

Enable objects to be cloned. Does not specify if you need to implement deep-copy or shallow-copy. (Problematic in public APIs)

IComparable Interface

IComparable is required for sorting. CompareTo is used for sorting, Equals is used to compare equality. (IEquatable interface) Returns less than 0, 0 or…

IConvertible Interface

Enables a class to be converted to a base type such as Boolean, Byte, Double, or String. C allows widening conversion without any casting, e.g.: going…

IDisposable Interface

Enable assemblies that create an instance of your class to free up any resources the instance has consumed. Only implement IDisposable when one of your…

IsolatedStorageFile Class

Represents a sandbox location to store application specific data in. Assembly/Machine store for application-level data. Assembly/User store for user-level…

MemoryStream Class

Provides an in-memory implementation of a Stream. Is meant for temporary streams. Possibly to minimize the time you need to hold another stream open…

Reference Types

Data stored on the heap, a pointer to that data is stored on the stack. The heap gets cleaned by the garbage collector, removing items which don't have a…

Regex Class

Used to work with regular expressions. A good free tool to read and create regexs is Expresso. There are many good tutorials around.

Snippets

csharp struct MyPoint { private int x; private int y; public int X { get { return this.x; } } public int Y { get { return this.y; } } public MyPoint(int…

SortedList Class

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

Specialized Dictionary

Special case dictionaries ListDictionary Used as a HashTable for fewer than 10 items. Implemented as a simple linked list behind the scenes. Same…

Specialized String classes

StringCollection Acts as a strongly typed ArrayList of strings. Equivalent to List with generics. StringDictionary Acts as a strongly typed Hashtable of…

Stream Class

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

StringBuilder Class

A StringBuilder maintains an internal buffer instead of allocating a new string every time. Initial buffer size is 16 bytes, but can be passed via the…

TypeForwardTo Attribute

Attribute to indicate a type has moved from one assembly to another. Enables you to update your assemblies without recompiling the clients using them.…

Value Types

Stored on the stack. Contain a value, not a reference. Inherit from System.Value Exists of built-in types, user-defined types and enumerations. Prefer to…