Created
March 30, 2016 00:47
-
-
Save marcelschmidtdev/8b818cc03a141862fecac7c15aacfcc7 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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