CodeLinePragma Constructors

Definition

Initializes a new instance of the CodeLinePragma class.

Overloads

CodeLinePragma()

Initializes a new instance of the CodeLinePragma class.

CodeLinePragma(String, Int32)

Initializes a new instance of the CodeLinePragma class.

CodeLinePragma()

Source:
CodeLinePragma.cs
Source:
CodeLinePragma.cs
Source:
CodeLinePragma.cs
Source:
CodeLinePragma.cs
Source:
CodeLinePragma.cs

Initializes a new instance of the CodeLinePragma class.

C#
public CodeLinePragma();

Remarks

If you use this constructor you should also set the LineNumber and FileName properties.

Applies to

.NET 10 (package-provided) and other versions
Product Versions
.NET 8 (package-provided), 9 (package-provided), 10 (package-provided)
.NET Framework 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 2.0 (package-provided)
Windows Desktop 3.0, 3.1, 5, 6, 7, 8, 9, 10

CodeLinePragma(String, Int32)

Source:
CodeLinePragma.cs
Source:
CodeLinePragma.cs
Source:
CodeLinePragma.cs
Source:
CodeLinePragma.cs
Source:
CodeLinePragma.cs

Initializes a new instance of the CodeLinePragma class.

C#
public CodeLinePragma(string fileName, int lineNumber);

Parameters

fileName
String

The file name of the associated file.

lineNumber
Int32

The line number to store a reference to.

Examples

The following code example demonstrates the use of the CodeLinePragma class to reference a specific line of a source file.

C#
// Creates a CodeLinePragma that references line 100 of the file "example.cs".
CodeLinePragma pragma = new CodeLinePragma("example.cs", 100);

Applies to

.NET 10 (package-provided) and other versions
Product Versions
.NET 8 (package-provided), 9 (package-provided), 10 (package-provided)
.NET Framework 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 2.0 (package-provided)
Windows Desktop 3.0, 3.1, 5, 6, 7, 8, 9, 10