ParserError 类

定义

表示分析器错误或警告。Represents a parser error or warning. 此类不能被继承。This class cannot be inherited.

public ref class ParserError sealed
[System.Serializable]
public sealed class ParserError
[<System.Serializable>]
type ParserError = class
Public NotInheritable Class ParserError
继承
ParserError
属性

示例

下面的代码示例演示如何向对象添加新的分析器错误 ParserErrorCollectionThe following code example demonstrates how to add a new parser error to a ParserErrorCollection object.

// Add a ParserError to the collection.
collection.Add(new ParserError("ErrorName", "Path", 1));
' Add a ParserError to the collection.
collection.Add(New ParserError("ErrorName", "Path", 1))

注解

ParserError对象表示在引发异常时创建的错误 HttpParseExceptionA ParserError object represents an error that is created when an HttpParseException exception is thrown. 分析器错误对象可以包含错误消息文本、发生错误的文件的虚拟路径,以及该文件中的错误的后续行号。A parser error object can contain error message text, a virtual path to the file where the error occurred, and the subsequent line number of the error in that file. 如果发生多个分析器错误或要将多个分析器错误存储在一个集中的位置,请使用 ParserErrorCollection 对象。If more than one parser error occurs or you want to store multiple parser errors in a centralized location, use the ParserErrorCollection object.

分析器错误的类型为 HttpExceptionA parser error is of the type HttpException. 有关异常以及如何处理它们的详细信息,请参阅 MSDN LibraryFor more information on exceptions and how to handle them, go to MSDN Library.

构造函数

ParserError()

初始化 ParserError 类的新实例。Initializes a new instance of the ParserError class.

ParserError(String, String, Int32)

使用指定的错误文本、虚拟路径和错误源行号初始化 ParserError 类的新实例。Initializes a new instance of the ParserError class by using the specified error text, virtual path, and source line number.

属性

ErrorText

获取或设置表示 ParserError 对象的错误的字符串。Gets or sets a string that represents the error for the ParserError object.

Line

获取或设置错误源所在的行号。Gets or sets the line number of the source at which the error occurs.

VirtualPath

获取或设置在发生错误时正在分析的文件的虚拟路径。Gets or set the virtual path of the file that was being parsed when the error occurred.

方法

Equals(Object)

确定指定对象是否等于当前对象。Determines whether the specified object is equal to the current object.

(继承自 Object)
GetHashCode()

用作默认哈希函数。Serves as the default hash function.

(继承自 Object)
GetType()

获取当前实例的 TypeGets the Type of the current instance.

(继承自 Object)
MemberwiseClone()

创建当前 Object 的浅表副本。Creates a shallow copy of the current Object.

(继承自 Object)
ToString()

返回表示当前对象的字符串。Returns a string that represents the current object.

(继承自 Object)

适用于

另请参阅