I haven't looked at Pet Shop in some time so I'm not sure what the current
design looks like. In general static methods will outperform instance methods,
but this is a general statement and has to be tested against specific code.
Really, the decision between an instance or static method should be a design
decision and not based on performance.
If your class represents an object (a Customer, a TextBox, a Message), then
your methods & properties should be instance methods & properties. Static
members are generally used as shortcut or helper methods (like Thread.CurrentThread
or HttpContext.Current). These methods return an object using a static member
as a shortcut.
--
Scott
http://www.OdeToCode.com/blogs/scott/ Is it because of perfomance or something else?
I was confused when to use static methods and when to use instance.
Please give me some points. Thanks.