You could create a static instance of the class within the instance class.
public class Foo
{
private static Foo globalInstance = new Foo();
public static Foo GlobalInstance
{
get{return globalInstance;}
}
}
The global instance will have the same methods as an instance version (as
it's still an instance, just a static instance)
However it's not a "proper" singleton if you do that. Singletons are
generally defined as objects with only 1 instance EVER and the constructors
are usually private (they return the one instance in the same kind of way).
The Singleton pattern is nicely defined here:
http://www.yoda.arachsys.com/csharp/singleton.html
HTH
Simon
"Kevin Spencer" <uc*@ftc.govwrote in message
news:OB**************@TK2MSFTNGP03.phx.gbl...
Why do you need a static class? An instance class can contain static
methods.
--
HTH,
Kevin Spencer
Microsoft MVP
Chicken Salad Surgery
What You Seek Is What You Get.
"Brett Romero" <ac*****@cygen.comwrote in message
news:11*********************@h48g2000cwc.googlegro ups.com...
I need a static version of a class that can be referenced anywhere as a
singleton and the same class that can be used as instances. Can this
be done without basically creating the same class twice (one with
static methods and one without)?
Thanks,
Brett