NGWS SDK Documentation  

This is preliminary documentation and subject to change.
To comment on this topic, please send us email at ngwssdk@microsoft.com. Thanks!

#line

#line lets you modify the compiler’s line number and (optionally) the file name output for errors and warnings.

#line number "file_name"

where:

number
The number you want to specify for a line in a source code file.
"file_name" (optional)
The file name you want to appear in the compiler output. By default, the actual name of the source code file is used. The file name must be in quotes.

Remarks

#line might be used by an automated, intermediate step in the build process. For example, if the intermediate step removed lines from the original source code file, but if you still wanted the compiler to generate output based on the original line numbering in the file, you could remove lines and then simulate the original line numbering with #line.

A source code file can have any number of #line directives.

Example

using System;
public class MyClass {
   public static void Main() {
      #line 100 "abc.sc"   // change file name in the compiler output
      intt i;   // error will be reported on line 101
   }
}

See Also

C# Preprocessor Directives