Re: When is it appropriate to use static methods?
From: AlexS (salexru2000NO_at_SPAMsympaticoPLEASE.ca)
Date: 05/10/04
- Next message: Ben Dewey: "Re: Problem deserializing a subclass whose base class has a struct that has a reference type"
- Previous message: anon: "How many man-hours were used in creating .NET 1.0?"
- In reply to: Tom: "When is it appropriate to use static methods?"
- Next in thread: Tom: "Re: When is it appropriate to use static methods?"
- Reply: Tom: "Re: When is it appropriate to use static methods?"
- Messages sorted by: [ date ] [ thread ]
Date: Mon, 10 May 2004 15:12:20 -0700
IMO, statics are simplified equivalents of singletons. They grow from
globals - functions or variables. There is not much more.
I would suggest statics
- when you need global method, property or function
- when you need global variable
- when you need singleton, which exists during whole application lifetime
I found it easier to code singletons using statics. Excellent examples -
such classes like SystemInformation or Environment.
HTH
Alex
"Tom" <nfr@nospam.com> wrote in message
news:%23vNmFSrNEHA.2976@TK2MSFTNGP10.phx.gbl...
> This is not intuitivelly clear.
>
>
- Next message: Ben Dewey: "Re: Problem deserializing a subclass whose base class has a struct that has a reference type"
- Previous message: anon: "How many man-hours were used in creating .NET 1.0?"
- In reply to: Tom: "When is it appropriate to use static methods?"
- Next in thread: Tom: "Re: When is it appropriate to use static methods?"
- Reply: Tom: "Re: When is it appropriate to use static methods?"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|