Convert.ChangeType()
There .net webapi see [FromUri] parameter may be received automatically converted into a parameter type field properties
baidu many articles are in themselves create the wheel suddenly under Microsoft provides this method
public static readonly BackArgs _args = new BackArgs(); protected override void OnInit(EventArgs e) { foreach (System.Reflection.PropertyInfo item in typeof(BackArgs).GetProperties()) { if (Request.Params[item.Name] != null) { item.SetValue(_args, Convert.ChangeType(Request.Params[item.Name], Type.GetType(item.PropertyType.FullName))); } } }