VSDiagnostics
VSDiagnostics copied to clipboard
Implement EnumParameterNotValidated
DO validate enum parameters.
https://msdn.microsoft.com/en-us/library/ms229015(v=vs.110).aspx
void Main()
{
M((X) 1574);
}
void M(X x)
{
Console.WriteLine(x); // 1574
Console.WriteLine(Enum.IsDefined(typeof(X), x)); // false
}
enum X
{
ABC = 5
}
Then again, the next rule says not to use Enum.IsDefined()
so we'll have to look into what is the actual appropriate solution.