Example #1
0
 private static void AssignPropertyValue <T>(IValuedArgument argument, PropertyInfo property, T obj)
 {
     if (!argument.Exists())
     {
         return;
     }
     if (property.PropertyType == typeof(string))
     {
         property.SetValue(obj, argument.Value);
     }
     else if (property.PropertyType == typeof(int) || property.PropertyType == typeof(int?))
     {
         property.SetValue(obj, argument.AsInt());
     }
     else if (property.PropertyType == typeof(long) || property.PropertyType == typeof(long?))
     {
         property.SetValue(obj, argument.AsLong());
     }
     else if (property.PropertyType == typeof(bool) || property.PropertyType == typeof(bool?))
     {
         property.SetValue(obj, argument.AsBool());
     }
 }