MSDN .NET API Documentation

Comprehensive reference for .NET framework methods.

.NET API Methods Reference

Explore the vast collection of methods available within the .NET Framework. This section provides detailed information on method signatures, parameters, return types, and usage examples.

Core .NET Methods

  • Console.WriteLine

    public static void WriteLine(string value)

    Writes the specified string value, followed by the current line terminator, to the standard output stream.

    Parameters: string value: The string to write.

    Returns: void

    System.Console.WriteLine("Hello, World!");
  • String.IsNullOrEmpty

    public static bool IsNullOrEmpty(string value)

    Indicates whether the specified string is null or an empty string ("").

    Parameters: string value: The string to test.

    Returns: bool

    if (string.IsNullOrEmpty(myString)) {
        Console.WriteLine("String is null or empty.");
    }
  • List<T>.Add

    public void Add(T item)

    Adds an object to the end of the List<T>.

    Parameters: T item: The object to be added to the List<T>. The value can be null for reference types.

    Returns: void

    List<int> numbers = new List<int>();
    numbers.Add(1);
    numbers.Add(2);
  • File.ReadAllText

    public static string ReadAllText(string path)

    Opens a text file, reads all lines of the file, and then closes the file.

    Parameters: string path: The file to read.

    Returns: string

    string fileContent = System.IO.File.ReadAllText("myFile.txt");
  • DateTime.Now

    public static DateTime Now { get; }

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

    Returns: DateTime

    DateTime currentTime = DateTime.Now;
  • Math.Sqrt

    public static double Sqrt(double d)

    Returns the square root of a specified number.

    Parameters: double d: The number whose square root is to be found.

    Returns: double

    double result = Math.Sqrt(16.0); // result will be 4.0

System.Collections Methods

  • Dictionary<TKey, TValue>.ContainsKey

    public bool ContainsKey(TKey key)

    Determines whether the Dictionary<TKey, TValue> contains the specified key.

    Parameters: TKey key: The key to locate in the Dictionary<TKey, TValue>.

    Returns: bool

    Dictionary<string, int> ages = new Dictionary<string, int>();
    if (ages.ContainsKey("Alice")) {
        Console.WriteLine("Alice is in the dictionary.");
    }

System.IO Methods

  • File.WriteAllText

    public static void 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.

    Parameters: string path: The file to write to.

    Parameters: string contents: The string to write to the file.

    Returns: void

    System.IO.File.WriteAllText("output.txt", "This is some content.");