Split - Index was outside the bounds of the array

后端 未结 7 576
野性不改
野性不改 2020-12-18 04:25

Im using the following code to split up a string and store it:

string[] proxyAdrs = linesProxy[i].Split(\':\');
string proxyServer = proxyAdrs[0];
int proxyP         


        
7条回答
  •  半阙折子戏
    2020-12-18 04:57

    Check the length of proxyAdrs before you attempt to subscript a potentially non-existent item.

    if ( proxyAdrs.Length > 1 ) {
      item.Username = proxyAdrs[2];
    }
    

提交回复
热议问题