Untitled

mail@pastecode.io avatar
unknown
plain_text
a year ago
959 B
2
Indexable
Never
namespace ConsoleApp3
{
    class ConfigurationSingleton
    {
        private static ConfigurationSingleton singleton;

        public static ConfigurationSingleton GetInstance()
        {
            if (singleton == null)
                singleton = new ConfigurationSingleton("1234", "abc");
            return singleton;
        }

        private ConfigurationSingleton(string code, string address)
        {
            this.code = code;
            this.address = address;
        }

        public string code { get; set; }
        public string address { get; set; }
    }


    class Program
    {
        static void Main(string[] args)
        {
            var config = ConfigurationSingleton.GetInstance();
            Test();

            Console.WriteLine("Hello World!");
        }

        static void Test()
        {
            var config = ConfigurationSingleton.GetInstance();
        }
    }
}