我有一个这样的课:
public class tbl050701_1391_Fields
{
public static readonly string StateName = "State Name";
public static readonly string StateCode = "State Code";
public static readonly string AreaName = "Area Name";
public static readonly string AreaCode = "Area Code";
public static readonly string Dore = "Period";
public static readonly string Year = "Year";
}
Run Code Online (Sandbox Code Playgroud)
我想写一些返回Dictionary<string, string>具有这些值的语句:
Key Value
--------------------------------------------
"StateName" "State Name"
"StateCode" "State Code"
"AreaName" "Area Name"
"Dore" "Period"
"Year" "Year"
Run Code Online (Sandbox Code Playgroud)
我有这个代码来获取一个属性值:
public static string GetValueUsingReflection(object obj, string propertyName) …Run Code Online (Sandbox Code Playgroud)