private static bool CompareGuard(ObjectEnum <TEnum> left, ObjectEnum <TEnum> right) { var rightType = right.GetType(); if (!left.IsTypeEquivalent(rightType)) { throw new InvalidOperationException($"Cannot compare an object of Type {left.GetType()} to an object of Type {rightType}"); } return(true); }
/// <summary> /// Indicates whether a specified value exists for this <see cref="ObjectEnum{TEnum}"/>. /// </summary> /// <param name="value">The value to check.</param> /// <returns><see langword="true" /> if <paramref name="value" />is defined and the <c>Type</c> of <paramref name="value"/>is equivalent; otherwise, <see langword="false" />.</returns> public bool IsDefined(ObjectEnum <TEnum> value) => value != null && IsTypeEquivalent(value.GetType()) && IsDefined((TEnum)value);