System Namespace
Assembly: mscorlib.dll
Description: Contains fundamental classes and base types that define commonly used value and reference data types, events and event handlers, exceptions, and arithmetic operations. This is the most fundamental namespace in the .NET Framework.
Key Types
Object
Provides functionality for all classes in the .NET Framework class hierarchy, serving as the ultimate base class of all types.
View details →String
Represents text as a sequence of characters. It is an immutable type, meaning that once a String object is created, its value cannot be changed.
View details → }DateTime
Represents an instant in time, typically expressed as a date and time of day.
View details →Commonly Used Classes
The System
namespace includes many essential classes for general-purpose programming. Some of the most frequently used include:
- Value Types:
Int16
,Int32
,Int64
,UInt16
,UInt32
,UInt64
,Single
,Double
,Decimal
,Char
,Boolean
,Byte
,SByte
,IntPtr
,UIntPtr
. - Reference Types:
String
,Object
,Exception
,Array
,Type
,Delegate
. - Utility Classes:
Console
,Math
,Convert
,Environment
,Activator
.
Example Usage
Here's a simple example demonstrating the use of the String
and Console
classes from the System
namespace:
using System;
public class HelloWorld
{
public static void Main(string[] args)
{
string message = "Hello, World!";
Console.WriteLine(message);
int number = 42;
Console.WriteLine("The answer is: " + number.ToString());
}
}