相关疑难解决方法(0)

字符串到变量名称

我有类(Customer),它包含200多个字符串变量作为属性.我正在使用带有键和值参数的方法.我试图从xml文件提供密钥和值.为此,必须使用Customer类的属性(字符串变量)替换值.

Customer
{
  public string Name{return _name};

  public string Address{return _address};
}


CallInput
{
  StringTempelate tempelate = new StringTempelate();
  foreach(item in items)
  tempelate .SetAttribure(item.key, item.Value -->   //Say this value is Name, so it has to substitute Customer.Name
}
Run Code Online (Sandbox Code Playgroud)

可能吗?

c#

15
推荐指数
3
解决办法
4万
查看次数

标签 统计

c# ×1