in src/Microsoft.VisualStudio.Validation/Requires.cs [529:543]
public static void Defined<TEnum>(TEnum value, string parameterName)
where TEnum : struct, Enum
{
if (!Enum.IsDefined(typeof(TEnum), value))
{
if (typeof(int) == typeof(TEnum).GetEnumUnderlyingType())
{
throw new InvalidEnumArgumentException(parameterName, (int)(object)value, typeof(TEnum));
}
else
{
throw new InvalidEnumArgumentException(Format(Strings.Argument_NotEnum, parameterName, value, typeof(TEnum).FullName));
}
}
}