Is there a way to suppress warnings in C# similar to Java's @SuppressWarnings annotation?
Failing that, is there another way to suppress warnings in Visual Studio?
Is there a way to suppress warnings in C# similar to Java's @SuppressWarnings annotation?
Failing that, is there another way to suppress warnings in Visual Studio?
You can use the SuppressMessage data annotation which will prevent the warning.
It looks something like this:
[SuppressMessage("Reason #Enter whatever you'd like", "ID, must match what intellsense is showing it looks something like this: IDE0001", Justification = "(optional, your own description")]
Here is a real world example:
[SuppressMessage("IntelliSenseCorrection", "IDE0001", Justification = "Do Not Remove <T> Variable, It's Required For Dapper")]