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


C# TextSpan.ToString方法代码示例

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


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

示例1: Equals3

 public void Equals3()
 {
     var s1 = new TextSpan(1, 5);
     var s2 = new TextSpan(1, 40);
     Assert.False(s1.Equals(s2), s1.ToString() + " : " + s2.ToString());
     Assert.False(s1 == s2, s1.ToString() + " : " + s2.ToString());
     Assert.True(s1 != s2, s1.ToString() + " : " + s2.ToString());
     Assert.NotEqual(s1, s2);
 }
开发者ID:modulexcite,项目名称:pattern-matching-csharp,代码行数:9,代码来源:TextSpanTest.cs

示例2: VerifyDiagnosticsArgument

        private static void VerifyDiagnosticsArgument(ImmutableArray<Diagnostic> diagnostics, TextSpan span)
        {
            if (diagnostics.IsDefault)
            {
                throw new ArgumentException(nameof(diagnostics));
            }

            if (diagnostics.Length == 0)
            {
                throw new ArgumentException(WorkspacesResources.DiagnosticsCannotBeEmpty, nameof(diagnostics));
            }

            if (diagnostics.Any(d => d == null))
            {
                throw new ArgumentException(WorkspacesResources.DiagnosticCannotBeNull, nameof(diagnostics));
            }

            if (diagnostics.Any(d => d.Location.SourceSpan != span))
            {
                throw new ArgumentException(string.Format(WorkspacesResources.DiagnosticMustHaveMatchingSpan, span.ToString()), nameof(diagnostics));
            }
        }
开发者ID:GloryChou,项目名称:roslyn,代码行数:22,代码来源:CodeFixContext.cs

示例3: TextSpan01

 public void TextSpan01()
 {
     TextSpan span = new TextSpan(0, 1);
     Assert.Equal(span.Start, 0);
     Assert.Equal(span.End, 1);
     Assert.Equal(span.Length, 1);
     Assert.Equal("[0..1)", span.ToString());
     Assert.False(span.IsEmpty);
     span.GetHashCode();
 }
开发者ID:modulexcite,项目名称:pattern-matching-csharp,代码行数:10,代码来源:TextSpanTest.cs

示例4: TextSpan00

 public void TextSpan00()
 {
     TextSpan span = new TextSpan(0, 0);
     Assert.Equal(span.Start, 0);
     Assert.Equal(span.End, 0);
     Assert.Equal(span.Length, 0);
     Assert.Equal("[0..0)", span.ToString());
     Assert.True(span.IsEmpty);
 }
开发者ID:modulexcite,项目名称:pattern-matching-csharp,代码行数:9,代码来源:TextSpanTest.cs

示例5: TextSpanEquality01

        public void TextSpanEquality01()
        {
            TextSpan span1 = new TextSpan(0, 10);
            TextSpan span2 = new TextSpan(0, 11);
            TextSpan span3 = new TextSpan(1, 11);

            Assert.False(span1.Equals(span2));
            Assert.False(span1.Equals(span3));
            Assert.False(span2.Equals(span3));
            Assert.True(span1 != span2, span1.ToString() + " : " + span2.ToString());
            Assert.True(span1 != span3, span1.ToString() + " : " + span3.ToString());
            Assert.True(span2 != span3, span2.ToString() + " : " + span3.ToString());
            Assert.False(span1 == span2, span1.ToString() + " : " + span2.ToString());

            Assert.NotEqual<object>(new string ('a', 3), span1);
        }
开发者ID:modulexcite,项目名称:pattern-matching-csharp,代码行数:16,代码来源:TextSpanTest.cs

示例6: TextSpanEquality00

        public void TextSpanEquality00()
        {
            TextSpan span1 = new TextSpan(0, 10);
            TextSpan span2 = new TextSpan(0, 10);

            Assert.True(span1.Equals(span2));
            Assert.NotNull(span1);
            Assert.True(span1 == span2, span1.ToString() + " : " + span2.ToString());
            Assert.False(span1 != span2, span1.ToString() + " : " + span2.ToString());

            Assert.True(span2.Equals(span1));
            Assert.NotNull(span2);
            Assert.True(span2 == span1, span2.ToString() + " : " + span1.ToString());
            Assert.False(span2 != span1, span2.ToString() + " : " + span1.ToString());
        }
开发者ID:modulexcite,项目名称:pattern-matching-csharp,代码行数:15,代码来源:TextSpanTest.cs

示例7: TextSpan02

 public void TextSpan02()
 {
     TextSpan span = new TextSpan(15, 1485);
     Assert.Equal(span.Start, 15);
     Assert.Equal(span.End, 1500);
     Assert.Equal(span.Length, 1485);
     Assert.Equal("[15..1500)", span.ToString());
 }
开发者ID:modulexcite,项目名称:pattern-matching-csharp,代码行数:8,代码来源:TextSpanTest.cs

示例8: VerifyDiagnosticsArgument

        private static void VerifyDiagnosticsArgument(ImmutableArray<Diagnostic> diagnostics, TextSpan span)
        {
            if (diagnostics.IsDefault)
            {
                throw new ArgumentException(nameof(diagnostics));
            }

            if (diagnostics.Length == 0)
            {
                throw new ArgumentException(WorkspacesResources.At_least_one_diagnostic_must_be_supplied, nameof(diagnostics));
            }

            if (diagnostics.Any(d => d == null))
            {
                throw new ArgumentException(WorkspacesResources.Supplied_diagnostic_cannot_be_null, nameof(diagnostics));
            }

            if (diagnostics.Any(d => d.Location.SourceSpan != span))
            {
                throw new ArgumentException(string.Format(WorkspacesResources.Diagnostic_must_have_span_0, span.ToString()), nameof(diagnostics));
            }
        }
开发者ID:Rickinio,项目名称:roslyn,代码行数:22,代码来源:CodeFixContext.cs


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