Created
September 3, 2020 09:55
-
-
Save JVinceW/17f21829282668708b784634b509f9b6 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
/// <summary> | |
/// シングルトンクラス | |
/// </summary> | |
public class Singleton <T> where T : class , new() | |
{ | |
private static T _instance; | |
//インスタンスの取得 | |
public static T instance{ | |
get { | |
if( _instance == null ) | |
{ | |
_instance = new T(); | |
} | |
return _instance; | |
} | |
} | |
protected Singleton() | |
{ | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment