string str = "Sell_Price";
this.m_sell_price.text = sellPrice.GetType().GetField(str).GetValue(sellPrice).ToString();
sellPrice是类名
Sell_Price是sellPrice类的变量
本文介绍了如何在C#中通过字段名称获取Sell_Price类的实例变量值,并将其转换为字符串形式,以便于在文本控件中显示。
string str = "Sell_Price";
this.m_sell_price.text = sellPrice.GetType().GetField(str).GetValue(sellPrice).ToString();
sellPrice是类名
Sell_Price是sellPrice类的变量
2004

被折叠的 条评论
为什么被折叠?