Skip to content

Instantly share code, notes, and snippets.

@saitocastel1900
Created October 25, 2022 20:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save saitocastel1900/d91026e2aece4c6f1864545b9c3aa8d4 to your computer and use it in GitHub Desktop.
Save saitocastel1900/d91026e2aece4c6f1864545b9c3aa8d4 to your computer and use it in GitHub Desktop.
private static readonly object Lock = new object();
private static Singleton3 _instance;
public static Singleton3 Instance
{
get
{
lock (Lock)
{
return _instance ??= new Singleton3();
}
}
}
public string Name { get; }
private Singleton3()
{
Name = nameof(Singleton3);
Debug.Log("コンストラクターが呼び出されました");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment