Beispiel #1
0
 /// <summary>
 /// Validates that the specified <see cref="Operation"/> is compatibile with the <see cref="IComparator"/> and also confirms
 /// that the <see cref="PropertyReader"/>'s type is IComparable and IConvertible.
 /// </summary>
 private void Validate()
 {
     if (((int)Operation & (int)PropertyReader.Comparator.SupportedOperations) <= 0)
     {
         throw new InvalidOperationException(
                   string.Format(CultureInfo.CurrentCulture, Resources.OperationNotSupported,
                                 Operation, PropertyReader.Comparator, PropertyReader.Comparator.SupportedOperations));
     }
     if (!typeof(IComparable).IsAssignableFrom(PropertyReader.PropertyType) ||
         !typeof(IConvertible).IsAssignableFrom(PropertyReader.PropertyType))
     {
         throw new InvalidOperationException(
                   string.Format(CultureInfo.CurrentCulture, Resources.DoesNotImplementRightInterfaces,
                                 PropertyReader.GetType(),
                                 PropertyReader.PropertyType));
     }
 }