I need to suppress a compiler warning in C #. Now I can do it as follows:
#pragma warning disable 0649 private string _field; #pragma warning restore 0649
Is there any way to do this as follows?
[SuppressCompilerWarning("0649")] private string _field;
Because I only need to suppress warnings for this field, not the code.
Note. I want to suppress a compiler warning, not a Code-Analysis warning.
Thanks!
Mouhong lin
source share