"chandu" <na*************@hotmail.comwrote in message
news:%2****************@TK2MSFTNGP02.phx.gbl...
can any one give advantages and disadvantages to using static methods in a
class.
shall we use complete static methods in a class ?
Read here:
http://msdn2.microsoft.com/en-us/library/79b3xss3.aspx
Without going into details (as it's all a bit app-specific) I have "normal"
classes for each of the objects my app works with. They are normal so I can
create any number of instances of them, and they have their own methods that
work with the data within.
I also have a static class that holds a lot of the logic for the program
that is independant of the objects and their instances... one example is a
method to write information out to a log file.
From within my instanced object methods, I can simply use:
clsMain.WriteLog(Message);
instead of
clsMain MainClassInstance = new clsMain();
MainClassInstance.WriteLog(Message);
so I save a line of code each time... there is more to it than that of
course, and the MS Site gives a good readup.
James