XmlException.LineNumber 屬性

定義

取得行號,指出發生錯誤的位置。 行號從 1 開始。

public:
 property int LineNumber { int get(); };
public int LineNumber { get; }
member this.LineNumber : int
Public ReadOnly Property LineNumber As Integer

屬性值

Int32

指示發生錯誤之位置的行號。

備註

嘗試以 XML 載入字串 "<<foo>\r\nbar</foo>" 時, XmlException 會擲回具有下列訊息的 :

System.Xml.XmlException: 'Name cannot begin with the '<' character, hexadecimal value 0x3C. Line 1, position 2.'

顯示行號是以 1 為基礎, (第一行) 找到錯誤。

適用於