本文整理汇总了C#中ICSharpCode.NRefactory.Editor.ReadOnlyDocument.GetLineByNumber方法的典型用法代码示例。如果您正苦于以下问题:C# ReadOnlyDocument.GetLineByNumber方法的具体用法?C# ReadOnlyDocument.GetLineByNumber怎么用?C# ReadOnlyDocument.GetLineByNumber使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ICSharpCode.NRefactory.Editor.ReadOnlyDocument
的用法示例。
在下文中一共展示了ReadOnlyDocument.GetLineByNumber方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: EmptyReadOnlyDocument
public void EmptyReadOnlyDocument()
{
IDocument document = new ReadOnlyDocument(string.Empty);
Assert.AreEqual(string.Empty, document.Text);
Assert.AreEqual(0, document.TextLength);
Assert.AreEqual(1, document.LineCount);
Assert.AreEqual(0, document.GetOffset(1, 1));
Assert.AreEqual(new TextLocation(1, 1), document.GetLocation(0));
Assert.AreEqual(0, document.GetLineByNumber(1).Offset);
Assert.AreEqual(0, document.GetLineByNumber(1).EndOffset);
Assert.AreEqual(0, document.GetLineByNumber(1).Length);
Assert.AreEqual(0, document.GetLineByNumber(1).TotalLength);
Assert.AreEqual(0, document.GetLineByNumber(1).DelimiterLength);
Assert.AreEqual(1, document.GetLineByNumber(1).LineNumber);
}
示例2: SimpleDocument
public void SimpleDocument()
{
string text = "Hello\nWorld!\r\n";
IDocument document = new ReadOnlyDocument(text);
Assert.AreEqual(text, document.Text);
Assert.AreEqual(3, document.LineCount);
Assert.AreEqual(0, document.GetLineByNumber(1).Offset);
Assert.AreEqual(5, document.GetLineByNumber(1).EndOffset);
Assert.AreEqual(5, document.GetLineByNumber(1).Length);
Assert.AreEqual(6, document.GetLineByNumber(1).TotalLength);
Assert.AreEqual(1, document.GetLineByNumber(1).DelimiterLength);
Assert.AreEqual(1, document.GetLineByNumber(1).LineNumber);
Assert.AreEqual(6, document.GetLineByNumber(2).Offset);
Assert.AreEqual(12, document.GetLineByNumber(2).EndOffset);
Assert.AreEqual(6, document.GetLineByNumber(2).Length);
Assert.AreEqual(8, document.GetLineByNumber(2).TotalLength);
Assert.AreEqual(2, document.GetLineByNumber(2).DelimiterLength);
Assert.AreEqual(2, document.GetLineByNumber(2).LineNumber);
Assert.AreEqual(14, document.GetLineByNumber(3).Offset);
Assert.AreEqual(14, document.GetLineByNumber(3).EndOffset);
Assert.AreEqual(0, document.GetLineByNumber(3).Length);
Assert.AreEqual(0, document.GetLineByNumber(3).TotalLength);
Assert.AreEqual(0, document.GetLineByNumber(3).DelimiterLength);
Assert.AreEqual(3, document.GetLineByNumber(3).LineNumber);
}