在c#中把字符串轉(zhuǎn)為變量名并獲取變量值的小例子
當(dāng)前位置:點(diǎn)晴教程→知識管理交流
→『 技術(shù)文檔交流 』
public class Program
{ public string str = "spp"; public string spp = "Hello World!"; public static void Main(string[] args) Console.WriteLine(p.GetType().GetField(p.str).GetValue(p).ToString()); 該文章在 2017/4/4 23:57:49 編輯過 |
關(guān)鍵字查詢
相關(guān)文章
正在查詢... |