Ejemplo n.º 1
0
 /// <summary>
 /// Adjusts the given value to conform to the parameters specified maximums and minimums
 /// </summary>
 public static IComparable GetClosestValueInBounds(this ParameterAttribute attr, IComparable value)
 {
     if (attr.HasMinValue() && value.CompareTo(attr.MinValue) <= 0)
     {
         return((IComparable)attr.MinValue);
     }
     if (attr.HasMaxValue() && value.CompareTo(attr.MaxValue) >= 0)
     {
         return((IComparable)attr.MaxValue);
     }
     return(value);
 }
Ejemplo n.º 2
0
 /// <summary>
 /// Does the parameter have a non-null maximum value?
 /// </summary>
 public static bool HasMaxValue(this ParameterAttribute attr)
 {
     return(attr.MaxValue != null);
 }
Ejemplo n.º 3
0
 /// <summary>
 /// Does the parameter have a non-null default value?
 /// </summary>
 public static bool HasDefaultValue(this ParameterAttribute attr)
 {
     return(attr.DefaultValue != null);
 }