in src/nms-api/Util/URISupport.cs [110:146]
public static void SetProperties(object target, StringDictionary map)
{
Type type = target.GetType();
foreach (string key in map.Keys)
{
PropertyInfo prop = type.GetProperty(key,
BindingFlags.FlattenHierarchy
| BindingFlags.Public
| BindingFlags.Instance
| BindingFlags.IgnoreCase);
if (null != prop)
{
prop.SetValue(target, Convert.ChangeType(map[key], prop.PropertyType, CultureInfo.InvariantCulture),
null);
}
else
{
FieldInfo field = type.GetField(key,
BindingFlags.FlattenHierarchy
| BindingFlags.Public
| BindingFlags.Instance
| BindingFlags.IgnoreCase);
if (null != field)
{
field.SetValue(target,
Convert.ChangeType(map[key], field.FieldType, CultureInfo.InvariantCulture));
}
else
{
throw new NMSException(string.Format("No such property or field: {0} on class: {1}", key,
target.GetType().Name));
}
}
}
}