Interface IIdGenerator
- Namespace
- Utils.Common
- Assembly
- Utils.Common.dll
Issues increasing numeric ids, for example the client ids of orders and requests of a connector. All the Get methods advance the same sequence.
public interface IIdGenerator
- Extension Methods
Properties
Current
The last issued id (or the start id when nothing has been issued yet since the last reset).
Added in ATAS 8.0.15.
long Current { get; }
Property Value
- long
Methods
GetInt()
Issues the next id like GetLong() and casts it to int without an overflow check, so ids above int.MaxValue wrap around.
int GetInt()
Returns
- int
The new id.
GetLong()
Issues the next id: the previous one plus one. IdGenerator is safe to call from several threads.
long GetLong()
Returns
- long
The new id.
GetString()
Issues the next id like GetLong() and formats it with the invariant culture.
string GetString()
Returns
- string
The new id as a decimal string.
GetUint()
Issues the next id like GetLong() and casts it to uint without an overflow check.
uint GetUint()
Returns
- uint
The new id.
Reset(long)
Restarts the sequence: the next issued id is startId plus one. Unlike the constructor of
IdGenerator, it accepts a negative value. Not atomic with respect to concurrent Get calls.
void Reset(long startId)
Parameters
startIdlongThe new value of Current.