Pragma warning
The #pragma warning directive is used to disable or restore all or a particular set of warning messages during compilation of the subsequent program text. pragma-warning-body: warning-action: warning-list: A #pragma warning directive that omits the warning list affects all warnings. A #pragma warning directive the includes a warning list affects only those warnings that are specified in the list. A #pragma warning disable directive disables all or the given set of warnings. A #pragma warning restore directive restores all or the given set of warnings to the state that was in effect at the beginning of the compilation unit. Note that if a particular warning was disabled externally, a #pragma warning restore (whether for all or the specific warning) will not re-enable that warning. The following example shows use of #pragma warning to temporarily disable the warning reported when obsoleted members are referenced, using the warning number from the Microsoft C# compiler. using System; class Program static void Main() {
|