Preprocessor - #pragma

The #pragma directive gives instructions to the compiler. It has the general form

#pragma option

where option is the instruction passed to the compiler.

There are two options supported by #pragma. The first is warning, which allows specific compiler warnings to be enabled or disabled. It has the following two forms:

#pragma warning disable warnings

#pragma warning restore warnings

where warnings is a comma separated list of warning numbers.

The second form of pragma is checksum. It is used to generate checksums for ASP.NET projects. It has the following form:

#pragma checksum "filename" "{GUID}" "check-sum"

where filename is the name of the file, GUID is a globally unique identifier associated with the file name and check-sum is a hexadecimal number that contains the check sum. The check-sum string must contain an even number of digits.