語言

XmlException.LineNumber 屬性

定義

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

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

屬性值

錯誤發生地點的行號。

備註

嘗試以 XML 載入字串 "<<foo>\r\nbar</foo>" 時,會 XmlException 拋出以下訊息:

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

顯示行號以1為基礎(錯誤在第一行)。

適用於