Win Surprise Gifts!!!
Top 5 Contributors of the Month
Post New Question
Subscribe to Forum
StaticMethods And Public Methods
Kannan C S
April 13, 2011
Can you please explain in what situation can I use static methods in my asp.net application.
Now I am in new company,They are using staic methods in classes for all functionalities.I dont think they are using standrds,eventhough I asked to one of the experienced guy,why you using static methods??..and also he is not allowing me to use public methods..I like coding like pure object oriented style...His answer was by using staic method it improves the performance of application...I dont think so....My question is,then why Dot.Net provides object oriented concept..??...his answer for static methods is not enough for me.....please ....
thanks in advance..
Posted Date: April 13, 2011 Points: 20
Though it is right that only one object of static class is created but it will get destroyed as soon as your page processing is done since Web application is stateless hence nothing is preserved and that object belongs to the current user and and not others. Thus each user will have its own instance created and destroyed
If there is any performance difference between a static method and a non-static one, it'll be in the process of calling the method. Once you're into the method, both should execute identically.Static methods do significantly increase performance on repetitive methods done millions of times.but it is advisable to use instance method insted of static method.
for more details go through following link,
To post reply
Related Questions Related Questions
Secure web service methods!
what are methods of response object?
Free Public Class: ASP .NET Interview Preparation
What are the various security methods which IIS Provides apart from .NET
What are the methods available to access the XML
what is METHODS?
Is that mandatory to generate Strong Name for Public Assembly.
ASP.net Public testing
Latest Forum Questions From The Same Category
Slash(/) in Combobox
attaching the report in the web page
How do i get payment status in redirect page using bitpay?
Login with Facebook and Save details in database
Login with facebook account in my website
How to make a nested datalist control?
What class does Icon derive from?
What are the validation controls?
What''s the difference between an interface and abstract class?
Find more Forum Questions on C#, ASP.Net, Vb.Net, SQL Server and more
Quick Links For Forum Categories:
Hall of Fame
Terms of Service
Tell A Friend