/// <summary> /// 将字符串转换为变量名 /// </summary> public partial class Form1 : Form { string str = "spp"; public string spp = "every good"; public Form1() { InitializeComponent(); MessageBox.Show(this.GetType().GetField(str).GetValue(this).ToString()); } }