Friday, June 22, 2012

When to use Static Classes in C#

Static classes and static class members are used to create functions which can be accessed without creating an instance of it. Static class members can be used to separate data and behavior that is independent. 


Some of the features of the static classes are, 

  • Only contains static members
  • Cannot be instantiated 
  • They are sealed
Static classes cannot be created using new keyword. Static classes are loaded by the .NET CLR when the program containing the class is loaded. 


No comments:

Post a Comment