.NET API Classes

Explore the comprehensive set of classes available in the .NET framework to build powerful and efficient applications.

System Namespace

System.Collections Namespace

System.Collections.Generic Namespace

System.IO Namespace

System.Net Namespace

System.Threading Namespace

Microsoft Namespace

Microsoft.VisualStudio Namespace

Object

Serves as the ultimate base class for all types in the .NET Framework.

Methods

  • Equals(object obj)
    Determines whether the specified object is equal to the current object.
  • GetHashCode()
    Serves as the default hash function.
  • GetType()
    Gets the Type of the current instance.
  • ToString()
    Returns a string that represents the current object.

String

Represents text as a sequence of UTF-16 code units.

Properties

  • Length
    Gets the number of characters in the current String object.

Methods

  • IsNullOrEmpty(string value)
    Indicates whether the specified string is null or an empty string.
  • Contains(string value)
    Determines whether the specified string contains a specified string.
  • IndexOf(string value)
    Reports the zero-based index of the first occurrence of a specified string within this instance.

Int32

Represents a 32-bit signed integer.

Methods

  • Parse(string s)
    Converts the string representation of a number to its 32-bit signed integer equivalent.
  • ToString()
    Converts the value of this instance to its equivalent string representation.

Boolean

Represents a Boolean value (true or false).

Methods

  • Parse(string s)
    Converts the string representation of a number to its Boolean equivalent.
  • ToString()
    Converts the value of this instance to its equivalent string representation.

DateTime

Represents an instance in time, expressed as a date and time of day.

Properties

  • Now
    Gets a DateTime object that is set to the current date and time on this computer, expressed as the local time.

Methods

  • ToString(string format)
    Converts the value of this instance to its equivalent string representation using the specified format.

Exception

Represents errors that occur during execution.

Properties

  • Message
    Gets a message that describes the current exception.
  • InnerException
    Gets the exception that is the cause of the current exception.

Console

Provides access to the standard input, output, and error streams for console applications.

Methods

  • WriteLine(string value)
    Writes the specified string value, followed by the current line terminator, to the standard output stream.
  • ReadLine()
    Reads the next line of characters from the standard input stream and returns it as a string.

Math

Provides constants and methods for trigonometric, logarithmic, and other common mathematical functions.

Methods

  • Abs(double val)
    Returns the absolute value of a double-precision floating-point number.
  • Sqrt(double val)
    Returns the square root of a specified number.
  • Pow(double x, double y)
    Returns a specified number raised to the specified power.

IEnumerable

Represents the enumerator, or the ability to iterate, over a collection.

Methods

  • GetEnumerator()
    Returns an enumerator that iterates through a collection.

ArrayList

Represents a non-generic collection of objects that can be individually accessed by index.

Methods

  • Add(object value)
    Adds an object to the end of the ArrayList.
  • Remove(object value)
    Removes the first occurrence of a specific object from the ArrayList.
  • Clear()
    Removes all objects from the ArrayList.

Hashtable

Represents a collection of key-value pairs that are organized based on the hash code of the key.

Properties

  • Count
    Gets the number of key-and-value pairs contained in the Hashtable.

Methods

  • Add(object key, object value)
    Adds an element with the specified key and value to the Hashtable.
  • Remove(object key)
    Removes the element with the specified key from the Hashtable.

IList<T>

Represents a strongly typed list of objects that can be accessed by index.

Properties

  • Count
    Gets the number of elements contained in the IList.
  • this[int index]
    Gets or sets the element at the specified index.

Methods

  • Add(T item)
    Adds an item to the IList.
  • RemoveAt(int index)
    Removes the element at the specified index of the IList.

List<T>

Represents a generic collection of objects that can be individually accessed by index.

Properties

  • Count
    Gets the number of elements contained in the List.

Methods

  • Add(T item)
    Adds an object to the end of the List.
  • Remove(T item)
    Removes the first occurrence of a specific object from the List.
  • Clear()
    Removes all elements from the List.

Dictionary<TKey, TValue>

Represents a collection of key-value pairs that are ordered by insertion order.

Properties

  • Count
    Gets the number of key-value pairs contained in the Dictionary.

Methods

  • Add(TKey key, TValue value)
    Adds an element with the specified key and value to the Dictionary.
  • Remove(TKey key)
    Removes the element with the specified key from the Dictionary.
  • ContainsKey(TKey key)
    Determines whether the Dictionary contains an element with the specified key.

Comparer<T>

Provides a default comparer for generic types.

Methods

  • Default
    Gets a default comparer for the type specified by the generic argument.

File

Provides static methods for the creation, copying, deletion, moving, and opening of files.

Methods

  • Exists(string path)
    Determines whether a file exists.
  • ReadAllText(string path)
    Opens a text file, reads all lines of the file, and then closes the file.
  • WriteAllText(string path, string contents)
    Creates a new file, writes the specified string to the file, and then closes the file. If the target file already exists, it is overwritten.

Directory

Provides static methods for the creation, moving, and enumeration of directories and subdirectories.

Methods

  • Exists(string path)
    Determines whether the given path refers to an existing directory on disk.
  • CreateDirectory(string path)
    Creates all the directories and subdirectories in the specified path unless they already exist.
  • GetFiles(string path)
    Returns the names of files (including their paths) in the specified directory.

StreamReader

Implements a TextReader that reads characters from a byte stream in a particular encoding.

Methods

  • ReadToEnd()
    Reads all characters from the current position to the end of the stream and returns them as one string.
  • ReadLine()
    Reads the next line of characters from the current stream and returns it as a string.

StreamWriter

Implements a TextWriter for writing characters to a stream in a particular encoding.

Methods

  • WriteLine(string value)
    Writes a string to the stream and followed by a line terminator.
  • Flush()
    Clears all buffers and causes any buffered data to be written to the underlying stream.

IPAddress

Represents an Internet Protocol (IP) address.

Methods

  • Parse(string ipString)
    Converts an IP address string to an IPAddress instance.

Uri

Represents a Uniform Resource Identifier (URI) reference.

Thread

Represents a thread of execution in the .NET Framework.

Methods

  • Sleep(int millisecondsTimeout)
    Suspends the current thread for the specified number of milliseconds.

CancellationToken

Propagates a notification that operations should be canceled.