Last active
December 18, 2015 20:48
-
-
Save hagbarddenstore/5842398 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 class StaticResources | |
{ | |
public static IState State | |
{ | |
get { return StateClass.Instance; } | |
} | |
public interface IState | |
{ | |
} | |
private class StateClass : IState | |
{ | |
private static volatile StateClass instance; | |
private static object SyncRoot = new object(); | |
private StateClass() | |
{ | |
} | |
public static StateClass Instance | |
{ | |
get | |
{ | |
if (instance == null) | |
{ | |
lock (SyncRoot) | |
{ | |
if (instance == null) | |
{ | |
instance = new StateClass(); | |
} | |
} | |
} | |
return instance; | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment