我有public static class MyClass它包含许多public static string参数.
以下我有一些价值
string val = "something";
Run Code Online (Sandbox Code Playgroud)
使用它val我希望能够获得指定的属性 - 比如MyClass.something.我怎样才能做到这一点 ?
Tim*_*son 14
PropertyInfo propertyInfo = typeof(MyClass).GetProperty("something");
string something = (string) propertyInfo.GetValue(null, null);
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
3053 次 |
| 最近记录: |