C# Tutorials and offshore development in India
    Tutorials   Resources   Forum   Communities   Interview   Jobs   Projects   Offshore Development    
Silverlight Tutorials | Mentor | Code Converter | Articles | Code Factory | Computer Jokes | Members | Peer Appraisal | IT Companies | Bookmarks | Revenue Sharing |


Prizes & Awards
My Profile



Active Members
TodayLast 7 Days more...

New Feature: Community Sites: Create your own .NET community website and start earning from Google AdSense ! It's Free !




Can any one explain me when should I declare a method as static?


Posted Date: 05 Sep 2008      Total Responses: 1

Posted By: Goutham Anand       Member Level: Gold     Points: 1



Can any one explain me when should I declare a method as static?

I know that static method can be called without creating the object for the class. But when should we declare a method to be static? what advantage do we gain technically by declaring a method as static?

Can anyone give me an example where I can do without declaring a method as static?





Responses

Author: mythili d    05 Sep 2008Member Level: SilverRating:     Points: 2

Static methods can be referenced without the object of the class containing the method like you said. At the same time static allows only one instance of the method or the variable with the prefix static.
But a static member in C# can't be marked as override, virtual or abstract.
http://msdn.microsoft.com/en-us/library/ms933455.aspx
Thanks



Post Reply
You must Sign In to post a response.
Next : Run an EXE file by using web application???
Previous : Can any one explain me when should I declare a method as static?
Return to Discussion Forum
Post New Message
Category: ASP.NET

Related Messages



dotNet Slackers   BizTalk Adaptors    Web Design


Contact Us    Privacy Policy    Terms Of Use