Defination
The class which contain only static member and we canot create the instances of that class is called static class.
Features
- They only contain static members.
- They cannot be instantiated.
- They are sealed.
- They cannot contain Instance Constructors
When to Use ?
when we have to separate data and behavior that will be independent of any object identity. The data and functions do not change regardless of what happens to the object.
For Example Connection String of web confi file,mathematics function, or a currency converter class etc.
Advantages
- Compiler makes sure that no instance of static class is created and no instance members are declared within a static class. In previous version of C#, the constructor has to be marked private to avoid this from happening.
- Static class also makes the implementation simpler and faster since we do not have to make instance of the class to call its method.
For more information refer this link
http://msdn.microsoft.com/en-us/library/79b3xss3%28VS.80%29.aspx
I absolutely love your website.. Great colors & theme. Did you create this web site yourself?
Please reply back as I’m trying to create my own personal blog and want to find out where you got this from or just what the theme is called. Thank you!
Hi
Thanks. Its is free theme from wordpress.
I believe everything posted was very logical. However, consider this, what if
you added a little content? I am not saying your information isn’t solid., but suppose you added something that makes people want more? I mean Static Class in C# | Chandradev’s Blog is a little vanilla.
You might peek at Yahoo’s home page and watch how they create article titles to get viewers to open the links. You might add a video or a related pic or two to grab readers interested about what you’ve got to say.
Just my opinion, it would make your posts a little bit more interesting.
Hi
Thanks for giving good suggestion. I will implement this tips in new articals.
My brother recommended I would possibly like
this website. He was totally right. This publish truly made my day.
You can not consider simply how much time I had spent for
this info! Thanks!
Thank you and glad to know that you liked my blog.
Hello my loved one! I wish to say that this post is awesome, great written and come with
approximately all important infos. I would like to look
extra posts like this .
Thanks for your kind word. I will keep on writing nice posts like this.