Skip to content

Instantly share code, notes, and snippets.

@marcelschmidtdev
Created March 30, 2016 00:47
Show Gist options
  • Save marcelschmidtdev/8b818cc03a141862fecac7c15aacfcc7 to your computer and use it in GitHub Desktop.
Save marcelschmidtdev/8b818cc03a141862fecac7c15aacfcc7 to your computer and use it in GitHub Desktop.
public abstract class Singleton<T> where T : new()
{
private static T mInstance;
public static T Instance
{
get
{
if (mInstance == null)
{
return mInstance = new T();
}
else
{
return mInstance;
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment