mirror of
https://github.com/eliasstepanik/OSCADSharpDotnet7.git
synced 2026-01-11 21:48:34 +00:00
31 lines
706 B
C#
31 lines
706 B
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace OSCADSharp.Utility
|
|
{
|
|
/// <summary>
|
|
/// Responsible for creating identifiers for objects
|
|
/// </summary>
|
|
internal static class Ids
|
|
{
|
|
private static int globalId = 0;
|
|
private readonly static object idLockObject = new object();
|
|
|
|
/// <summary>
|
|
/// Gets a unique auto-incrementing integer id
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
internal static int Get()
|
|
{
|
|
lock (idLockObject)
|
|
{
|
|
globalId++;
|
|
return globalId;
|
|
}
|
|
}
|
|
}
|
|
}
|