System Namespace

Overview

The System namespace is the root namespace for fundamental classes in the .NET Framework. It provides base types, exception handling, and basic utilities that are essential for building applications.

Key Types

ClassDescription
ObjectBase class for all .NET types.
StringRepresents text as a series of Unicode characters.
ExceptionBase class for all exceptions.
DateTimeRepresents date and time.
MathProvides constants and static methods for trigonometric, logarithmic, and other common mathematical functions.

Related Namespaces

Sample Code

using System;

class Program
{
    static void Main()
    {
        Console.WriteLine("Hello, .NET!");
        int[] numbers = {1, 2, 3, 4, 5};
        int sum = 0;
        foreach (int n in numbers)
            sum += n;
        Console.WriteLine($"Sum: {sum}");
    }
}