Skip to content

Instantly share code, notes, and snippets.

@JVinceW
Created September 3, 2020 09:55
Show Gist options
  • Save JVinceW/17f21829282668708b784634b509f9b6 to your computer and use it in GitHub Desktop.
Save JVinceW/17f21829282668708b784634b509f9b6 to your computer and use it in GitHub Desktop.
/// <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