System.IndexOutOfRangeException: 索引超出了数组界限
ccds 2013-04-29 08:40:06 try
{
string[] OtherPropArray = itemstats.OtherProp.Split('=');
itemstats.OtherProp = "";
foreach (var prop in OtherPropArray)
{
//prop = "abc-123"
string[] stat = prop.Split('-');
//Debug.WriteLine(stat.Length); 2
if (stat[1] != "0")
itemstats.OtherProp += stat[0] + "\t" + stat[1] + "-";
}
Logger.Instance.WriteItem("{0}-{1}-{2}-{3}-{4}-{5}-{6}-{7}-{8}-{9}",
itemstats.CharName,
itemstats.InternalName,
itemstats.ItemQualityLevel,
itemstats.ItemType,
itemstats.Level,
itemstats.RequiredLevel,
itemstats.WeaponHand,
itemstats.ItemLink,
itemstats.OtherProp,
itemstats.Coinage);
Send("ITEMSTATGOT");
return;
}
catch (Exception ex)
{
Send("Internal server error: " + ex.Message);
Logger.Instance.WriteGlobal(ex.ToString());
return;
}
为啥这句
if (stat[1] != "0")开始会提示System.IndexOutOfRangeException: 索引超出了数组界限啊
纠结,一直找不到原因
但其实stat[0],stat[1]都是有正确的值得