Is mandatory to mention static member in static class, any reason

Posted by Jitendrasoft09 under C# on 6/27/2013 | Points: 10 | Views : 763 | Status : [Member] [MVP] | Replies : 2
Hi All,
I want to understand Is mandatory to mention static member in static class, any reason, let me know if anybody knows.

Jitendra Kumar
If my post helps you, plz mark as an answer.



Responses

Posted by: Satyapriyanayak on: 6/27/2013 [Member] [MVP] Silver | Points: 25

Up
0
Down
http://msdn.microsoft.com/en-us/library/vstudio/79b3xss3.aspx

If this post helps you mark it as answer
Thanks

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

Posted by: Raj.Trivedi on: 6/30/2013 [Member] [MVP] Starter | Points: 25

Up
0
Down
Hello Jitendra,

Yes it is mandatory to mention static keyword for static member in static class because a static class cannot be instantiated and hence to access member inside static class it has to be mentioned static.

One more thing in order to access non static members inside a class you have to instantiate that class and static class object cannot be created.

I hope this will help

Regard's
Raj.Trivedi
"Sharing is Caring"
Please mark as answer if your Query is resolved

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

Login to post response