I am creating a class in C# called \"Robot\", and each robot requires a unique ID property which gives themselves an identity.
Is there any way of creating an auto incr
public static void beAddedTo(this T item, Dictionary dic) where T : m.lib.RandId
{
Random ran = new Random();
var ri = ran.Next();
while (Program.DB.Rooms.ContainsKey(ri)) ri = ran.Next();
item.Id = ri;
dic.Add(item.Id, item);
}
Not incremental but you can add and delete item how many time you want. (Maximum item should be lower than int.Max/2)