System.CodeDom.Compiler.CompilerError Class

Assembly: System.dll
Namespace: System.CodeDom.Compiler
Summary
Represents a compiler error or warning.
C# Syntax:
public class CompilerError
Remarks
CompilerError represents a compiler error or a warning that has been returned by the compiler.
Example
CodeLinePragma pragma = new CodeLinePragma(fileName, lineNumber);
 
 // Code to compile code occurs first.
 
 GenerateCompilerError(
   new CompilerError(fileName, pragma.LineNumber, 0, error_number, error_text[error_type]) );   

    
See also:
System.CodeDom.Compiler Namespace | CompilerErrorCollection

System.CodeDom.Compiler.CompilerError Member List:

Public Constructors
ctor #1 Overloaded:
.ctor()

Default constructor. This constructor is called by derived class constructors to initialize state in this type.
Initializes a new instance of the CompilerError class.
ctor #2 Overloaded:
.ctor(string fileName, int line, int column, string errorNumber, string errorText)

Initializes a new instance of the CompilerError class using the specified file name, line, column, error number, and error text.
Public Properties
Column Read-write

Gets or sets the column number where the source of the error occurs.
ErrorNumber Read-write

Gets or sets the error number.
ErrorText Read-write

Gets or sets the text of the error message.
FileName Read-write

Gets or sets the file name of the source that caused the error.
IsWarning Read-write

Gets or sets a value that indicates whether the error is a warning.
Line Read-write

Gets or sets the line number where the source of the error occurs.
Public Methods
Equals
(inherited from System.Object)
See base class member description: System.Object.Equals

Derived from System.Object, the primary base class for all objects.
GetHashCode
(inherited from System.Object)
See base class member description: System.Object.GetHashCode

Derived from System.Object, the primary base class for all objects.
GetType
(inherited from System.Object)
See base class member description: System.Object.GetType

Derived from System.Object, the primary base class for all objects.
ToString Overridden:
Provides an implementation of Object's Object.ToString method.
Protected Methods
Finalize
(inherited from System.Object)
See base class member description: System.Object.Finalize

Derived from System.Object, the primary base class for all objects.
MemberwiseClone
(inherited from System.Object)
See base class member description: System.Object.MemberwiseClone

Derived from System.Object, the primary base class for all objects.

Hierarchy:


System.CodeDom.Compiler.CompilerError Member Details

Overloaded ctor #1
Summary
Initializes a new instance of the CompilerError class.

Default constructor. This constructor is called by derived class constructors to initialize state in this type.
C# Syntax:
public CompilerError();

Return to top


Overloaded ctor #2
Summary
Initializes a new instance of the CompilerError class using the specified file name, line, column, error number, and error text.
C# Syntax:
public CompilerError(
   string fileName,
   int line,
   int column,
   string errorNumber,
   string errorText
);
Parameters:

fileName

The file name of the file that the compiler was compiling when it encountered the error.

line

The line of the source of the error.

column

The column of the source of the error.

errorNumber

The error number of the error.

errorText

The error message text.

Return to top


Property: Column (read-write)
Summary
Gets or sets the column number where the source of the error occurs.
C# Syntax:
public int Column {get; set;}
Remarks
CompilerError.Column can be set to zero for compilers that don't return column information.

Return to top


Property: ErrorNumber (read-write)
Summary
Gets or sets the error number.
C# Syntax:
public string ErrorNumber {get; set;}
Remarks
CompilerError.ErrorNumber can be a string of any length.

Return to top


Property: ErrorText (read-write)
Summary
Gets or sets the text of the error message.
C# Syntax:
public string ErrorText {get; set;}
Remarks
CompilerError.ErrorText can be a string of any length.

Return to top


Property: FileName (read-write)
Summary
Gets or sets the file name of the source that caused the error.
C# Syntax:
public string FileName {get; set;}

Return to top


Property: IsWarning (read-write)
Summary
Gets or sets a value that indicates whether the error is a warning.
C# Syntax:
public bool IsWarning {get; set;}

Return to top


Property: Line (read-write)
Summary
Gets or sets the line number where the source of the error occurs.
C# Syntax:
public int Line {get; set;}

Return to top


Method: Equals(
   object obj
)
Inherited
See base class member description: System.Object.Equals
C# Syntax:
public virtual bool Equals(
   object obj
);

For more information on members inherited from System.Object click on the link above.

Return to top


Method: Finalize()
Inherited
See base class member description: System.Object.Finalize
C# Syntax:
~CompilerError();

For more information on members inherited from System.Object click on the link above.

Return to top


Method: GetHashCode()
Inherited
See base class member description: System.Object.GetHashCode
C# Syntax:
public virtual int GetHashCode();

For more information on members inherited from System.Object click on the link above.

Return to top


Method: GetType()
Inherited
See base class member description: System.Object.GetType
C# Syntax:
public Type GetType();

For more information on members inherited from System.Object click on the link above.

Return to top


Method: MemberwiseClone()
Inherited
See base class member description: System.Object.MemberwiseClone
C# Syntax:
protected object MemberwiseClone();

For more information on members inherited from System.Object click on the link above.

Return to top


Overridden Method: ToString()
Summary
Provides an implementation of Object's Object.ToString method.
C# Syntax:
public override string ToString();
Return Value:
A string representation of the compiler error.
Remarks
This method is supported so CompilerError objects can be treated as objects for simplified debugging output.

Return to top


Top of page

Copyright (c) 2002 Microsoft Corporation. All rights reserved.