Changing Line Numbers - CSharp Language Basics

CSharp examples for Language Basics:Preprocessor

Description

Changing Line Numbers

Demo Code

using System;//from  w ww . j  av  a2s. c  o m
public class Lines
{
   #line 100
   public static void Main(String[] args)
   {
      #warning In Main...
      Console.WriteLine("In Main....");
      myMethod1();
      myMethod2();
      #warning Done with main
      Console.WriteLine("Done with Main");
   }
   #line 200
   static void myMethod1()
   {
      Console.WriteLine("In Method 1");
      #warning In Method 1...
      int x;   // not used. Will give warning.
   }
   #line 300
   static void myMethod2()
   {
      Console.WriteLine("in Method 2");
      #warning In Method 2...
      int y;  // not used. Will give warning.
   }
}

Related Tutorials