XmlException.LineNumber 属性
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
获取指示发生错误的行号。 行号从 1 开始。
public:
property int LineNumber { int get(); };
public int LineNumber { get; }
member this.LineNumber : int
Public ReadOnly Property LineNumber As Integer
属性值
指示发生错误的行号。
注解
尝试加载字符串 "<<foo>\r\nbar</foo>" 时,XML 将引发以下 XmlException 消息:
System.Xml.XmlException: 'Name cannot begin with the '<' character, hexadecimal value 0x3C. Line 1, position 2.'
显示行号是基于 1 的(在第一行中找到错误)。