private static string GetFormStr(CheckPersonInfoInput input)
{
string postString = "";
StringBuilder sb = new StringBuilder();
Type t = input.GetType();//获得该类的Type
foreach (var pi in t.GetProperties())
{
var name = pi.Name;//获得属性的名字,后面就可以根据名字判断来进行些自己想要的操作
var value = pi.GetValue(input, null);//用pi.GetValue获得值
sb.AppendFormat("{0}={1}", name, value);
sb.Append("&");
}
postString = sb.ToString().Trim('&');
return postString;
}