当前位置: 首页>>代码示例>>C#>>正文


C# ReadOnlyDocument.GetLineByNumber方法代码示例

本文整理汇总了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);
		}
开发者ID:Gobiner,项目名称:ILSpy,代码行数:16,代码来源:ReadOnlyDocumentTests.cs

示例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);
		}
开发者ID:Gobiner,项目名称:ILSpy,代码行数:28,代码来源:ReadOnlyDocumentTests.cs


注:本文中的ICSharpCode.NRefactory.Editor.ReadOnlyDocument.GetLineByNumber方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。