Beispiel #1
0
        public static HotelsSet GetHotels()
        {
            lock (locker)
            {
                if (set == null)
                {
                    set            = new HotelsSet();
                    set.HotelNames = new List <string>();
                }
            }

            return(set);
        }
Beispiel #2
0
        static void Main(string[] args)
        {
            HotelsSet set = HotelsSet.GetHotels();

            set.ShowHotels();

            HotelsSet set0 = HotelsSet.GetHotels();

            set0.ShowHotels();

            Console.WriteLine("Add to set");
            AddtoSet("Cheremosh", set);

            set0.ShowHotels();



            Console.WriteLine("Add to set0");
            AddtoSet("Bukovina", set0);

            set.ShowHotels();

            Console.ReadKey();
        }
Beispiel #3
0
 static void AddtoSet(string name, HotelsSet set)
 {
     set.HotelNames.Add(name);
 }