コード例 #1
0
 private void SetLoadProperty(IConfigLoader loader, PropertyCollections properties)
 {
     foreach (Property p in properties)
     {
         PropertyInfo pi = loader.GetType().GetProperty(p.Name, BindingFlags.Public | BindingFlags.Instance);
         if (pi != null && pi.CanWrite)
         {
             try
             {
                 object value = Convert.ChangeType(p.Value, pi.PropertyType);
                 pi.SetValue(loader, value, null);
             }
             catch
             {
             }
         }
     }
 }