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


C# TextSpan.OverlapsWith方法代码示例

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


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

示例1: AddClassification

 private void AddClassification(TextSpan textSpan, string type)
 {
     if (textSpan.Length > 0 && textSpan.OverlapsWith(_textSpan))
     {
         var tuple = new ClassifiedSpan(type, textSpan);
         if (!_set.Contains(tuple))
         {
             _list.Add(tuple);
             _set.Add(tuple);
         }
     }
 }
开发者ID:XieShuquan,项目名称:roslyn,代码行数:12,代码来源:AbstractClassificationService.Worker.cs

示例2: GetMembersInSpan

        private static List<MemberDeclarationSyntax> GetMembersInSpan(
            TextSpan textSpan,
            TypeDeclarationSyntax containingType,
            MemberDeclarationSyntax firstMember)
        {
            List<MemberDeclarationSyntax> selectedMembers = null;

            var members = containingType.Members;
            var fieldIndex = members.IndexOf(firstMember);
            if (fieldIndex < 0)
            {
                return null;
            }

            for (var i = fieldIndex; i < members.Count; i++)
            {
                var member = members[i];
                if (textSpan.Contains(member.Span))
                {
                    selectedMembers = selectedMembers ?? new List<MemberDeclarationSyntax>();
                    selectedMembers.Add(member);
                }
                else if (textSpan.OverlapsWith(member.Span))
                {
                    return null;
                }
                else
                {
                    break;
                }
            }

            return selectedMembers;
        }
开发者ID:GuilhermeSa,项目名称:roslyn,代码行数:34,代码来源:SyntaxTreeExtensions.cs

示例3: TextSpanOverlap04

        public void TextSpanOverlap04()
        {
            TextSpan span1 = new TextSpan(10, 0);   // [10, 10)
            TextSpan span2 = new TextSpan(5, 10);   // [5, 15)

            Assert.False(span1.OverlapsWith(span2));
            Assert.False(span2.OverlapsWith(span1));
            Assert.Null(span1.Overlap(span2));
            Assert.Null(span2.Overlap(span1));
        }
开发者ID:modulexcite,项目名称:pattern-matching-csharp,代码行数:10,代码来源:TextSpanTest.cs

示例4: TextSpanOverlap02

        public void TextSpanOverlap02()
        {
            TextSpan span1 = new TextSpan(10, 10); // 10..20
            TextSpan span2 = new TextSpan(5, 10); // 5..15

            Assert.True(span1.OverlapsWith(span2));
            Assert.True(span2.OverlapsWith(span1));
            Assert.Equal(span1.Overlap(span2), new TextSpan(10, 5));
            Assert.Equal(span2.Overlap(span1), new TextSpan(10, 5));
        }
开发者ID:modulexcite,项目名称:pattern-matching-csharp,代码行数:10,代码来源:TextSpanTest.cs

示例5: TextSpanOverlap01

        public void TextSpanOverlap01()
        {
            TextSpan span1 = new TextSpan(10, 10); // 10..20
            TextSpan span2 = new TextSpan(5, 2); // 5..7

            Assert.False(span1.OverlapsWith(span2));
            Assert.False(span2.OverlapsWith(span1));
            Assert.Null(span1.Overlap(span2));
            Assert.Null(span2.Overlap(span1));
        }
开发者ID:modulexcite,项目名称:pattern-matching-csharp,代码行数:10,代码来源:TextSpanTest.cs

示例6: TextSpan_DoesNotOverlapWithEmpty

 public void TextSpan_DoesNotOverlapWithEmpty()
 {
     var empty = new TextSpan(SourceText.From(""), 1, 0);
     Assert.False(empty.OverlapsWith(empty));
 }
开发者ID:tgjones,项目名称:HlslTools,代码行数:5,代码来源:TextSpanTests.cs

示例7: TextSpan_OverlapsWithSelf

 public void TextSpan_OverlapsWithSelf()
 {
     var textSpan = new TextSpan(SourceText.From(""), 1, 2);
     Assert.True(textSpan.OverlapsWith(textSpan));
 }
开发者ID:tgjones,项目名称:HlslTools,代码行数:5,代码来源:TextSpanTests.cs

示例8: IsInSpan

 private static bool IsInSpan(ref TextSpan span, TextSpan childSpan)
 {
     return span.OverlapsWith(childSpan)
         // special case for zero-width tokens (OverlapsWith never returns true for these)
         || (childSpan.Length == 0 && span.IntersectsWith(childSpan));
 }
开发者ID:riversky,项目名称:roslyn,代码行数:6,代码来源:SyntaxNode.Iterators.cs

示例9: TextSpan_DoesNotOverlapWithEmpty

 public void TextSpan_DoesNotOverlapWithEmpty()
 {
     var empty = new TextSpan(null, 1, 0);
     Assert.False(empty.OverlapsWith(empty));
 }
开发者ID:davidlee80,项目名称:HlslTools,代码行数:5,代码来源:TextSpanTests.cs

示例10: TextSpan_OverlapsWithSelf

 public void TextSpan_OverlapsWithSelf()
 {
     var textSpan = new TextSpan(null, 1, 2);
     Assert.True(textSpan.OverlapsWith(textSpan));
 }
开发者ID:davidlee80,项目名称:HlslTools,代码行数:5,代码来源:TextSpanTests.cs


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