110,567
社区成员
发帖
与我相关
我的任务
分享
string d1="aa";
string d2="bb";
string d3="cc";
string d4="dd";
string temp = "";
for (int i=1;i<5;i++)
{
temp += ("d" + i.ToString());
MessageBox.Show(temp);
}
public string d1 = "aa";
public string d2 = "bb";
public string d3 = "cc";
public string d4 = "dd";
private void button1_Click(object sender, EventArgs e)
{
string temp = "";
Type type = this.GetType();
for (int i = 1; i < 5; i++)
{
FieldInfo fi = type.GetField("d" + i.ToString());
temp += fi.GetValue(this).ToString();
}
MessageBox.Show(temp);
}