Im using the following code to split up a string and store it:
string[] proxyAdrs = linesProxy[i].Split(\':\');
string proxyServer = proxyAdrs[0];
int proxyP
Just check the length of the array returned in your if statement
if( proxyAdrs.Length > 2 && proxyAdrs[2] != null)
{
item.Username = proxyAdrs[2];
}
The reason you are getting the exception is that the split is returning array of size less than the index you are accessing with. If you are accessing the array element 2 then there must be atleast 3 elements in the array as array index starts with 0