Last active
March 21, 2017 03:31
-
-
Save rohinomiya/3144900 to your computer and use it in GitHub Desktop.
C# で シングルトンパターン ref: http://qiita.com/rohinomiya/items/6bca22211d1bddf581c4
This file contains hidden or 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
using System; | |
namespace SampleLog4Net | |
{ | |
/// <summary> | |
/// Description of ClassNullLogger. | |
/// </summary> | |
public sealed class ClassNullLogger | |
{ | |
private static ClassNullLogger instance = new ClassNullLogger(); | |
public static ClassNullLogger Instance { | |
get { | |
return instance; | |
} | |
} | |
private ClassNullLogger() | |
{ | |
} | |
} | |
} |
This file contains hidden or 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
// Singletonパターン | |
public sealed class SingletonClass | |
{ | |
private static SingletonClass _singleInstance = new SingletonClass(); | |
public static SingletonClass GetInstance() | |
{ | |
return _singleInstance; | |
} | |
private SingletonClass() | |
{ | |
//TODO: initialization | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment