XmlException.LinePosition 屬性

定義

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

public:
 property int LinePosition { int get(); };
public int LinePosition { get; }
member this.LinePosition : int
Public ReadOnly Property LinePosition 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, (第二個字元中找到錯誤) 。

適用於