Ejemplo n.º 1
0
 protected internal virtual void SetProperties(ProviderPropertyList properties)
 {
     foreach (var p in GetType().GetProperties().Where(p => p.CanRead && p.CanWrite))
     {
         var converter = TypeDescriptor.GetConverter(p.PropertyType);
         if (converter.CanConvertFrom(typeof(string)))
         {
             var value = properties.GetStringValue(p.Name, null);
             //if (value != null && converter.IsValid(value))
             if (value != null)
             {
                 p.SetValue(this, converter.ConvertFromInvariantString(value), null);
             }
         }
     }
 }
Ejemplo n.º 2
0
 protected internal virtual void SetProperties(ProviderPropertyList properties)
 {
     foreach (var p in GetType().GetProperties().Where(p => p.CanRead && p.CanWrite))
     {
         var converter = TypeDescriptor.GetConverter(p.PropertyType);
         if (converter.CanConvertFrom(typeof(string)))
         {
             var value = properties.GetStringValue(p.Name, null);
             //if (value != null && converter.IsValid(value))
             if (value != null)
                 p.SetValue(this, converter.ConvertFromInvariantString(value), null);
         }
     }
 }