System Namespace
The System
namespace is the root namespace for fundamental classes in .NET. It provides base types, essential utility classes, and core functionality for applications.
Key Types
Class | Purpose |
---|---|
Object | Base class for all .NET types. |
String | Immutable text representation. |
Array | Base class for all arrays. |
Math | Common mathematical functions. |
Console | Standard input, output, and error streams. |
DateTime | Represent dates and times. |
Guid | Globally unique identifier. |
Sample: Using System.Console
// Example: A simple console greeting
using System;
class Program
{
static void Main()
{
Console.WriteLine("Enter your name:");
string name = Console.ReadLine();
Console.WriteLine($"Hello, {name}! Welcome to .NET.");
}
}