ParserError 類別

定義

表示剖析器 (Parser) 錯誤或警告。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
屬性

範例

下列程式碼範例示範如何將新的剖析器錯誤新增至 ParserErrorCollection 物件。The 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. 如需例外狀況及其處理方式的詳細資訊,請參閱 在 .net 中處理和擲回例外狀況。For more information on exceptions and how to handle them, see Handling and throwing exceptions in .NET.

建構函式

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)

適用於

另請參閱