111,096
社区成员




public string getData(int index)
{
if (index > 10 || index < 0) { throw new ArgumentOutOfRangeException("index"); }
return dList[index];
}
this.getData(1);
this.getData(3);
this.getData(100);//出错行
this.getData(6);
namespace WindowsApplication20
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
this.getData(1);
this.getData(3);
this.getData(100);//出错行
this.getData(6);
}
[System.Diagnostics.DebuggerHidden()]
public string getData(int index)
{
if (index > 10 || index < 0) { throw new ArgumentOutOfRangeException("index"); }
return "";
}
}
}
try
{
this.getData(100);
}
public string getData(int index)
{
if (index > 10 || index < 0)
{ MessageBox.Show("Index的值不在指定的范围内");
return null;
}
return dList[index];
}