C#将字符串转为变量名

string str = "spp"; string spp = "very good";

如何由str得到very good?

public partial class Form1 : Form    {        string str = "spp";        public string spp = "very good";        public Form1()        {            InitializeComponent();            MessageBox.Show(this.GetType().GetField(str).GetValue(this).ToString());        }    }
原文出处:http://social.microsoft.com/Forums/zh-CN/visualcshartzhchs/thread/3b7c7d4d-925b-4d72-bee0-6c39c2e2786b


原文地址:https://www.cnblogs.com/ttssrs/p/2396508.html