#warning preprocessor
Description
The #warning
directive produces a warning.
Syntax
The general form of the #warning
directive is
#warning warning-message
Example
Example for #warning
preprocessor
using System;//from ww w . ja va 2 s . co m
class MainClass
{
[STAThread]
static void Main(string[] args)
{
#warning Beware!
}
}
The code above generates the following result.
Example 2
Unused Warning With Warning Suppressed
using System;//w w w.j a va 2s . c o m
using System.Collections.Generic;
using System.Text;
using System.ComponentModel;
class UnusedWarningWithWarningSuppressed{
#pragma warning disable 0169
int x;
#pragma warning restore 0169
}
The code above generates the following result.