namespace ConsoleApp1
{
public sealed class SingletonConfig
{
private static SingletonConfig _instance;
private static object _lock = new object();
public static string _config;
private void ConfigureSingleton(string config)
{
///do config
}
private SingletonConfig()
{
ConfigureSingleton(_config);
}
public static SingletonConfig GetInstance
{
get
{
if (string.IsNullOrEmpty(_config))
return null;
if(_instance==null)
{
lock(_lock)
{
_instance = new SingletonConfig();
}
}
return _instance;
}
}
}
}
Be the first to comment
You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.