I was wonder before why we need to make some classes as static.The reason is very simple.You can make use of its member without instantiating the object of that class.For example
public static class Name()
{
Name()
{}
public static string PersonNames()
{
//do some stuff here
return stringObject;
}
}
If you want to access the PersonNames() method in another class ,you don't need to do much.Just className.methodname();
ie.
public class CitizenDetails()
{
Name.PersonNames();
//do further stuff
}
public static class Name()
{
Name()
{}
public static string PersonNames()
{
//do some stuff here
return stringObject;
}
}
If you want to access the PersonNames() method in another class ,you don't need to do much.Just className.methodname();
ie.
public class CitizenDetails()
{
Name.PersonNames();
//do further stuff
}
Comments