Click here to Skip to main content
15,567,221 members
Please Sign up or sign in to vote.
2.00/5 (1 vote)
See more:
heyy..


I want to known that Why webmethod have to be static?(in ajax jquery),why should be provide

static keyword in methods..?
Posted
Comments
Sergey Alexandrovich Kryukov 12-Oct-13 1:48am    
Who told you that is should be static?
What would be a "WebMethod" and "static" in Ajax, jQuery and JavaScript?
—SA
JoCodes 12-Oct-13 3:54am    
There are numerous answers for your question in the net which you could have searched...

1 solution

A static method is simply one that is disassociated from any instance of its containing class. The more common alternative is an instance method, which is a method whose result is dependent on the state of a particular instance of the class it belongs to.

The key difference to understand is that a static method can be called without setting up a proper instance of the class it belongs to.In a sense, it is a stateless method.

For more info :

Why do ASP.NET AJAX page methods have to be static?

I hope this will help to you.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900