2
0
mirror of synced 2025-01-09 16:15:51 +00:00

25 lines
444 B
C#
Raw Normal View History

2023-04-12 13:53:55 +02:00
namespace Utils
{
public class NumberSource
{
private readonly object @lock = new object();
2023-04-12 13:53:55 +02:00
private int number;
public NumberSource(int start)
{
number = start;
}
public int GetNextNumber()
{
var n = -1;
lock (@lock)
{
n = number;
number++;
}
2023-04-12 13:53:55 +02:00
return n;
}
}
}