

- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How do we use a #line directive in C#?
It lets you modify the compiler's line number and (optionally) the file name output for errors and warnings.
Let us see some examples.
#line 100 "demo" int a; // CS0168 on line 100 int b; // CS0168 on line 101 int c; // CS0168 on line 102
As shown above the example reports three warnings associated with line numbers. The #line 100 directive forces the line number to be 100 and until the next #line directive, the filename will be reported as "demo”.
Let’s see another example: The default directive returns the line numbering to its default numbering. This directive then counts the lines that were renumbered by the previous directive.
#line default char a; // CS0168 on line 15 float b; // CS0168 on line 16
- Related Questions & Answers
- How to use #undef directive in C#?
- How do we use runOnUiThread in Android?
- How do we use jQuery selector eq:()?
- How do we use # in jQuery Attribute Selector?
- How do we use Python in interactive mode?
- How do we use Python in script mode?
- How do we use double quotation in Python?
- How do we use throw statement in JavaScript?
- How do we use jQuery Attribute selector with a period?
- Why do we use a volatile qualifier in C++?
- How do we use .not() with jQuery selector?
- How do we use single line comments in JavaScript?
- How do we use multi-line comments in JavaScript?
- How do we use different CSS classes in HTML?
- How do we use radio buttons in HTML forms?
Advertisements