using System;
using System.Collections.Generic;
using System.Text;
using System.Threading;

namespace Sync_Ueb01_Counter
{
    class Counter
    {
        private int count = 0;
        private static object syncRoot = new();

        public int NextNumber()
        {
            lock (syncRoot)
            {
                count++;
                return count;
            }
        }
    }
}