Why and when should I make a class 'static'? What is the purpose of 'static' keyword on classes? [Resolved]

Posted by Kasani007 under C# on 7/17/2014 | Points: 10 | Views : 440 | Status : [Member] | Replies : 1
Why and when should I make a class 'static'? What is the purpose of 'static' keyword on classes with example ?




Responses

Posted by: Goud.Kv on: 7/17/2014 [Member] [MVP] Gold | Points: 50

Up
0
Down

Resolved
Hi Kiran,

static is a modifier which is used with classes, methods, fields, operators, constructors and events.These modifiers/keywords cannot be used as types other than classes like destructors, indexers etc.

One basic difference between static and non-static class is that, you cannot instantiate static class which means you can't use any new keywords for creating variables of that class.



Thanks & Regards,
Krishna

Kasani007, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response