How i'm declaring the list:
static List<String> ips = new List<String>();
Code with error:
private static String getip()
{
lock (ips)
{
return ips[new Random().Next(0, ips.Count)];
}
}
Error:
An unhandled exception of type 'System.ArgumentOutOfRangeException' occurred in mscorlib.dll
Additional information:
Index was out of range. Must be non-negative and less than the size of the collection.
I'm quite troubled with my code had a enough of this, so i'm here seeking for some help. Answers are extremely appreciated, thank you. I've reviewed it a few times and i honestly don't know why this isn't exactly working.