static method only contain static data member which is absolutely right. Then Why static method Main() contain non static data member and member function.
static method only contain static data member which is absolutely right. Then Why static method Main() contain non static data member and member function
Hi,
Would you please describle your question again? It will help us to understand your trouble and help you to sovle your issue. Thanks a lot.
Best Regards,
Please mark the replies as answers if they help or unmark if not.
Feedback to us
static method only contain static data member which is absolutely right.
Right.
Neeraj Yadav
Then Why static method Main() contain non static data member and member function.
It does not. If you need to call non static methods/varibales inside the main method, you have to create an instance of the class first and access them.
Neeraj Yadav
Member
45 Points
71 Posts
c#
Dec 15, 2012 02:32 AM|LINK
static method only contain static data member which is absolutely right. Then Why static method Main() contain non static data member and member function.
Nakor
Member
336 Points
60 Posts
Re: c#
Dec 15, 2012 04:26 AM|LINK
Can you provide an example of what you're talking about?
RameshRajend...
Star
7983 Points
2099 Posts
Re: c#
Dec 15, 2012 04:31 AM|LINK
First refer this
http://www.dotnetperls.com/static-method
http://msdn.microsoft.com/en-us/library/79b3xss3(v=vs.80).aspx
Chen Yu - MS...
All-Star
21600 Points
2493 Posts
Microsoft
Re: c#
Dec 19, 2012 04:56 AM|LINK
Hi,
Would you please describle your question again? It will help us to understand your trouble and help you to sovle your issue. Thanks a lot.
Best Regards,
Feedback to us
Develop and promote your apps in Windows Store
Ruchira
All-Star
43068 Points
7045 Posts
MVP
Re: c#
Dec 20, 2012 07:23 AM|LINK
Hello,
Right.
It does not. If you need to call non static methods/varibales inside the main method, you have to create an instance of the class first and access them.
My Tech blog | My YouTube ChannelPlease 'Mark as Answer' if this post helps you.