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


C# TextSpan.ToSpan方法代码示例

本文整理汇总了C#中TextSpan.ToSpan方法的典型用法代码示例。如果您正苦于以下问题:C# TextSpan.ToSpan方法的具体用法?C# TextSpan.ToSpan怎么用?C# TextSpan.ToSpan使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在TextSpan的用法示例。


在下文中一共展示了TextSpan.ToSpan方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: GetSubjectBufferTextSpanInViewBuffer

        // Normally, we could just use a BufferGraph to do the mapping, but our subjectBuffer may be 
        // disconnected from the view when we are asked to do this mapping.
        public ViewTextSpan GetSubjectBufferTextSpanInViewBuffer(TextSpan textSpan)
        {
            switch (SubjectBufferToTextViewDirection)
            {
                // The view and subject buffer are the same
                case BufferMapDirection.Identity:
                    return new ViewTextSpan(textSpan);

                // The subject buffer contains the view buffer.  This happens in debugger intellisense.
                case BufferMapDirection.Down:
                    {
                        var projection = SubjectBufferSnapshot as IProjectionSnapshot;
                        var span = MapDownToSnapshot(textSpan.ToSpan(), projection, ViewSnapshot);
                        return new ViewTextSpan(span.ToTextSpan());
                    }

                // The view buffer contains the subject buffer.  This is the typical Razor setup.
                case BufferMapDirection.Up:
                    {
                        var projection = ViewSnapshot as IProjectionSnapshot;
                        var span = MapUpToSnapshot(textSpan.ToSpan(), SubjectBufferSnapshot, projection);
                        return new ViewTextSpan(span.ToTextSpan());
                    }

                default:
                    Contract.Fail();
                    return default(ViewTextSpan);
            }
        }
开发者ID:GloryChou,项目名称:roslyn,代码行数:31,代码来源:ViewTextSpan.cs

示例2: ConvertToSpan

        public void ConvertToSpan()
        {
            Action<int, int> del = (start, length) =>
            {
                var textSpan = new TextSpan(start, length);
                var span = textSpan.ToSpan();
                Assert.Equal(start, span.Start);
                Assert.Equal(length, span.Length);
            };

            del(0, 5);
            del(15, 20);
        }
开发者ID:GloryChou,项目名称:roslyn,代码行数:13,代码来源:TextSpanExtensionsTest.cs

示例3: GetCurrentSpanInSnapshot

 internal SnapshotSpan GetCurrentSpanInSnapshot(TextSpan originalSpan, ITextSnapshot textSnapshot)
 {
     var trackingSpan = this.TextVersion.CreateTrackingSpan(originalSpan.ToSpan(), SpanTrackingMode.EdgeInclusive);
     return trackingSpan.GetSpan(textSnapshot);
 }
开发者ID:GloryChou,项目名称:roslyn,代码行数:5,代码来源:Model.cs

示例4: IntersectsWith

 public static bool IntersectsWith(this SnapshotSpan snapshotSpan, TextSpan textSpan)
 {
     return snapshotSpan.IntersectsWith(textSpan.ToSpan());
 }
开发者ID:Rickinio,项目名称:roslyn,代码行数:4,代码来源:SnapshotSpanExtensions.cs

示例5: Write

 public override void Write(TextWriter textWriter, TextSpan span, CancellationToken cancellationToken)
 {
     this.RoslynSnapshot.Write(textWriter, span.ToSpan());
 }
开发者ID:CAPCHIK,项目名称:roslyn,代码行数:4,代码来源:Extensions.SnapshotSourceText.cs

示例6: ToString

		public override string ToString(TextSpan span) => TextSnapshot.GetText(span.ToSpan());
开发者ID:manojdjoshi,项目名称:dnSpy,代码行数:1,代码来源:TextSnapshotSourceText.cs


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