I'm not 100% sure what you are getting at, a new Singleton1 variable (in the sense that it creates another singleton) is not really possible, by definition of what a Singleton is supposed to enforce for your system. A new variable which points to a singleton is certainly possible, you can make as many as you want to point to the instance.
Typically Singleton1.Instance just returns a references to the one and only singleton instance, and obTest is simply a variable which references that object. The overhead of doing var x = Singleton1.Instance to get a quicker handle on the instance any time you need it is minimal, and avoids polluting the global namespace.
I would avoid making static var TheInstance = Singleton1.Instance
, since Singleton1.Instance is already presumably in static scope.
If you need a good Singleton implementation, here's mine:
https://stackoverflow.com/a/1010662/18255
public class SingletonBase<T> where T : class
{
static SingletonBase()
{
}
public static readonly T Instance =
typeof(T).InvokeMember(typeof(T).Name,
BindingFlags.CreateInstance |
BindingFlags.Instance |
BindingFlags.Public |
BindingFlags.NonPublic,
null, null, null) as T;
}
Declare your Singleton1 as this and you are done:
public class Singleton1 : SingletonBase<Singleton1> {
}
This is threadsafe (unlike most, including the one given here) and lazily instantiated.