The static classes and static members can be accessed without creating the object of the specific class. We cannot create the object for the static class. Non static methods only accessed through the instance of the class. if the class declared as a static and that class must contain only static members. By default static classes arce sealed.
Generally the static methods are used to create static utility methods in the project as shown below
public static class GetInfo
public static string GetFormattedDate(string Date)
DateTime dt = Convert.ToDateTime(Date);
catch (Exception ex)
public static string GetUserDetails()
//....return user info
Above is an sample static classes contains two methods that return date format and user details. Below is the way to accessing static methods.
Accessing static methods
string formatdDt = GetInfo.GetFormattedDate(DateTime.Now.ToString());
string Userdet = GetInfo.GetUserDetails();
In this way we can use static classes and utility methods in the projects.