Static classes are used when a class provides functionality that is not specific to any unique instance. Here are the features of static classes in C# 2.0.

Advantages

Compiler makes sure that no instance of static class is created. In previous version of C#, the constructor has to be marked private to avoid this from happening.

Also compiler makes sure that no instance members are declared within a static class.

Sample:

Public
static class MyStaticClass
{
Private
static int _staticVariable;
Public
static int staticVariable;
{
Get
{
Return _staticVariable;
}
Set
{
_staticVariable =
value;
}
}
Public
static void Function()
{
}
}