How to generate array of unique number in VB.net?
I need to implement a function that generates arrays of an unique
combination number? This function will be accessible by a lot of devices
(by using threads), and each device should get an unique address id (array
of sbyte).
I previously used a function in C# to generate an unique number but I
don't know how to implement this new case in VB.net.
public class GetUniqueNumber
{
static private int id = 0;
static private final Object lock = new Object();
public int getId()
{
synchronized (lock)
{
int temp = id;
id++;
return temp;
}
}
}
No comments:
Post a Comment