本文整理汇总了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);
}
示例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));
}
}
示例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();
}
示例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);
}
示例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);
}
示例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());
}
示例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());
}
示例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));
}
}