10 overrides of Length
CSharpSyntaxGenerator (1)
Microsoft.CodeAnalysis (6)
Microsoft.CodeAnalysis.CSharp.Features (1)
Microsoft.CodeAnalysis.EditorFeatures.Text (1)
Microsoft.CodeAnalysis.Test.Utilities (1)
285 references to Length
CSharpSyntaxGenerator (3)
GenerateDocumentationAndConfigFiles (4)
IdeCoreBenchmarks (1)
Metrics (3)
Metrics.Legacy (3)
Microsoft.AspNetCore.App.Analyzers (1)
Microsoft.CodeAnalysis (73)
Text\CompositeText.cs (17)
44Debug.Assert(_segments[i].Length > 0);
45offset += _segments[i].Length;
100var copyLength = Math.Min(count, segment.Length - segOffset);
158var copyLength = Math.Min(count, segment.Length - segOffset);
211segments.RemoveAll(static (s, _, _) => s.Length == 0, arg: 0);
218if (prevSegment.Length > 0 && prevSegment[^1] == '\r' && curSegment[0] == '\n')
222segments[i - 1] = prevSegment.GetSubText(new TextSpan(0, prevSegment.Length - 1));
224segments[i + 1] = curSegment.GetSubText(new TextSpan(1, curSegment.Length - 1));
233segments.RemoveAll(static (s, _, _) => s.Length == 0, arg: 0);
293if (segments[i].Length <= segmentSize)
299if (segments[j].Length > segmentSize)
326if (segments[i].Length <= segmentSize)
328int combinedLength = segments[i].Length;
334if (segments[j].Length > segmentSize)
340combinedLength += segments[j].Length;
377length += segment.Length;
452Debug.Assert(segment.Length > 0);
Text\SourceText.cs (26)
407get { return this.Length; }
462/// greater than <see cref="Length"/>.</exception>
490if (span.End > this.Length)
508else if (spanLength == this.Length && span.Start == 0)
523if (start < 0 || start > this.Length)
534return this.GetSubText(new TextSpan(start, this.Length - start));
543this.Write(textWriter, new TextSpan(0, this.Length), cancellationToken);
638for (int index = 0, length = this.Length; index < length; index += CharBufferSize)
710return ToString(new TextSpan(0, this.Length));
725int position = Math.Max(Math.Min(span.Start, this.Length), 0);
726int length = Math.Min(span.End, this.Length) - position;
729while (position < this.Length && length > 0)
768if (change.Span.End > this.Length)
819if (position < this.Length)
821var subText = this.GetSubText(new TextSpan(position, this.Length - position));
890return ImmutableArray.Create(new TextChangeRange(new TextSpan(0, oldText.Length), this.Length));
988return TextLine.FromSpanUnsafe(_text, TextSpan.FromBounds(start, _text.Length));
1000if (position < 0 || position > _text.Length)
1048var length = this.Length;
1066if (0 == this.Length)
1073var lineStarts = new SegmentedList<int>(Length / 64)
1180if (this.Length != other.Length)
1192for (int position = 0, length = this.Length; position < length; position += CharBufferSize)
1194var count = Math.Min(this.Length - position, CharBufferSize);
Microsoft.CodeAnalysis.Analyzers (5)
Microsoft.CodeAnalysis.AnalyzerUtilities (3)
Microsoft.CodeAnalysis.BannedApiAnalyzers (4)
Microsoft.CodeAnalysis.CodeStyle (3)
Microsoft.CodeAnalysis.CodeStyle.Fixes (1)
Microsoft.CodeAnalysis.CSharp (9)
Microsoft.CodeAnalysis.CSharp.CodeStyle.Fixes (4)
Microsoft.CodeAnalysis.CSharp.EditorFeatures (2)
Microsoft.CodeAnalysis.CSharp.EditorFeatures.UnitTests (6)
Diagnostics\DiagnosticAnalyzerDriver\DiagnosticAnalyzerDriverTests.cs (6)
67await DiagnosticProviderTestUtilities.GetAllDiagnosticsAsync(workspace, document, new TextSpan(0, document.GetTextAsync().Result.Length));
95await DiagnosticProviderTestUtilities.GetAllDiagnosticsAsync(ideEngineWorkspace, ideEngineDocument, new TextSpan(0, ideEngineDocument.GetTextAsync().Result.Length));
131return await DiagnosticProviderTestUtilities.GetAllDiagnosticsAsync(workspace, document, new TextSpan(0, document.GetTextAsync().Result.Length));
177await DiagnosticProviderTestUtilities.GetAllDiagnosticsAsync(workspace, sourceDocument, new TextSpan(0, sourceDocument.GetTextAsync().Result.Length));
207var diagnostics = await DiagnosticProviderTestUtilities.GetAllDiagnosticsAsync(workspace, ideEngineDocument, new TextSpan(0, ideEngineDocument.GetTextAsync().Result.Length));
263var diagnostics = await DiagnosticProviderTestUtilities.GetAllDiagnosticsAsync(ideEngineWorkspace, ideEngineDocument, new TextSpan(0, ideEngineDocument.GetTextAsync().Result.Length));
Microsoft.CodeAnalysis.CSharp.Features (6)
Microsoft.CodeAnalysis.CSharp.Semantic.UnitTests (1)
Microsoft.CodeAnalysis.CSharp.Symbol.UnitTests (2)
Microsoft.CodeAnalysis.CSharp.Syntax.UnitTests (8)
Microsoft.CodeAnalysis.EditorFeatures (6)
Microsoft.CodeAnalysis.EditorFeatures.Test.Utilities (3)
Microsoft.CodeAnalysis.EditorFeatures.Text (2)
Microsoft.CodeAnalysis.EditorFeatures.UnitTests (1)
Microsoft.CodeAnalysis.EditorFeatures2.UnitTests (1)
Microsoft.CodeAnalysis.Features (18)
Microsoft.CodeAnalysis.LanguageServer.Protocol (2)
Microsoft.CodeAnalysis.LanguageServer.Protocol.UnitTests (1)
Microsoft.CodeAnalysis.PerformanceSensitiveAnalyzers (4)
Microsoft.CodeAnalysis.PublicApiAnalyzers (3)
Microsoft.CodeAnalysis.PublicApiAnalyzers.CodeFixes (6)
Microsoft.CodeAnalysis.ResxSourceGenerator (4)
Microsoft.CodeAnalysis.Test.Utilities (1)
Microsoft.CodeAnalysis.UnitTests (42)
Text\TextChangeTests.cs (28)
69Assert.Equal(0, subSubText.Length);
78var subSubText = subText.GetSubText(subText.Length);
81Assert.Equal(0, subSubText.Length);
247Assert.Throws<ArgumentOutOfRangeException>(() => newText.CopyTo(newText.Length - 1, destination, 0, 2));
383Assert.Equal(str.Length + n, text.Length);
403Assert.Equal(str.Length, text.Length);
412Assert.Equal(26, text.Length);
416Assert.Equal(10, subtext.Length);
428Assert.Equal(6, newText.Length);
439Assert.Equal(20, newText.Length);
451Assert.Equal(25, newText.Length);
467Assert.Equal(27, textWithSegments.Length);
483Assert.Equal(27, textWithSegments.Length);
488Assert.Equal(24, textWithFewerSegments.Length);
502var textWithSegments = text.Replace(new TextSpan(0, text.Length), "");
503Assert.Equal(0, textWithSegments.Length);
514t = t.Replace(t.Length, 0, b); // add b's
525t = t.Replace(t.Length, 0, "c");
533Assert.Equal(new string('c', t.Segments[2].Length), t.Segments[2].ToString());
544t = t.Replace(t.Length, 0, b); // add b's
555t = t.Replace(t.Length, 0, c); // add c's that are the same segment size as the a's and b's
648Assert.Equal(text.Length + largeText.Length, newText.Length);
992var editedLength = originalText.Length;
996var oldMaxInsertLength = originalText.Length * 2;
999for (int i = 0; i < originalText.Length; i += random.Next(maxSkipLength))
1002var newChange = new TextChange(new TextSpan(i, length: random.Next(originalText.Length - i)), newText);
Microsoft.CodeAnalysis.VisualBasic (7)
Microsoft.CodeAnalysis.VisualBasic.Features (1)
Microsoft.CodeAnalysis.VisualBasic.Syntax.UnitTests (3)
Microsoft.CodeAnalysis.Workspaces (19)
Microsoft.CodeAnalysis.Workspaces.MSBuild.UnitTests (1)
Microsoft.CodeAnalysis.Workspaces.Test.Utilities (2)
Microsoft.CodeAnalysis.Workspaces.UnitTests (3)
Microsoft.VisualStudio.LanguageServices (2)
Roslyn.Diagnostics.Analyzers (4)
Test.Utilities (3)
Text.Analyzers (4)