using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Obj2 { //ОДИНОЧКА class Singleton { private static Singleton test1 = null; // не содержит сыллки на объект //private static string test2; protected Singleton() { } // что бы не присваивалось public static Singleton Metod() { if (test1 == null) // содержит ли она ссылку на объект test1 = new Singleton();// если не содержит, присваиваем новую ссылку return test1;//если содержит , то сразу возрощаем } } class Program { static void Main(string[] args) { Singleton obj1 = Singleton.Metod(); Console.WriteLine(obj1.GetHashCode()); Singleton obj2 = Singleton.Metod(); Console.WriteLine(obj2.GetHashCode()); Console.ReadLine(); } } }