9 overrides of Length
Microsoft.CodeAnalysis (6)
Microsoft.CodeAnalysis.CSharp.Features (1)
Microsoft.CodeAnalysis.EditorFeatures.Text (1)
Microsoft.CodeAnalysis.Test.Utilities (1)
226 references to Length
CSharpSyntaxGenerator (3)
IdeCoreBenchmarks (1)
Microsoft.AspNetCore.App.Analyzers (1)
Microsoft.CodeAnalysis (74)
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.RemoveWhere(static (s, _, _) => s.Length == 0, default(VoidResult));
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.RemoveWhere(static (s, _, _) => s.Length == 0, default(VoidResult));
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.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 (5)
Diagnostics\DiagnosticAnalyzerDriver\DiagnosticAnalyzerDriverTests.cs (5)
65await DiagnosticProviderTestUtilities.GetAllDiagnosticsAsync(workspace, document, new TextSpan(0, document.GetTextAsync().Result.Length));
93await DiagnosticProviderTestUtilities.GetAllDiagnosticsAsync(ideEngineWorkspace, ideEngineDocument, new TextSpan(0, ideEngineDocument.GetTextAsync().Result.Length));
175await DiagnosticProviderTestUtilities.GetAllDiagnosticsAsync(workspace, sourceDocument, new TextSpan(0, sourceDocument.GetTextAsync().Result.Length));
205var diagnostics = await DiagnosticProviderTestUtilities.GetAllDiagnosticsAsync(workspace, ideEngineDocument, new TextSpan(0, ideEngineDocument.GetTextAsync().Result.Length));
261var 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 (4)
Microsoft.CodeAnalysis.EditorFeatures.Test.Utilities (3)
Microsoft.CodeAnalysis.EditorFeatures.Text (2)
Microsoft.CodeAnalysis.EditorFeatures.UnitTests (1)
Microsoft.CodeAnalysis.EditorFeatures2.UnitTests (1)
Microsoft.CodeAnalysis.Features (14)
Microsoft.CodeAnalysis.LanguageServer.Protocol (2)
Microsoft.CodeAnalysis.LanguageServer.Protocol.UnitTests (1)
Microsoft.CodeAnalysis.Test.Utilities (1)
Microsoft.CodeAnalysis.UnitTests (39)
Text\TextChangeTests.cs (25)
224Assert.Throws<ArgumentOutOfRangeException>(() => newText.CopyTo(newText.Length - 1, destination, 0, 2));
360Assert.Equal(str.Length + n, text.Length);
380Assert.Equal(str.Length, text.Length);
389Assert.Equal(26, text.Length);
393Assert.Equal(10, subtext.Length);
405Assert.Equal(6, newText.Length);
416Assert.Equal(20, newText.Length);
428Assert.Equal(25, newText.Length);
444Assert.Equal(27, textWithSegments.Length);
460Assert.Equal(27, textWithSegments.Length);
465Assert.Equal(24, textWithFewerSegments.Length);
479var textWithSegments = text.Replace(new TextSpan(0, text.Length), "");
480Assert.Equal(0, textWithSegments.Length);
491t = t.Replace(t.Length, 0, b); // add b's
502t = t.Replace(t.Length, 0, "c");
510Assert.Equal(new string('c', t.Segments[2].Length), t.Segments[2].ToString());
521t = t.Replace(t.Length, 0, b); // add b's
532t = t.Replace(t.Length, 0, c); // add c's that are the same segment size as the a's and b's
625Assert.Equal(text.Length + largeText.Length, newText.Length);
969var editedLength = originalText.Length;
973var oldMaxInsertLength = originalText.Length * 2;
976for (int i = 0; i < originalText.Length; i += random.Next(maxSkipLength))
979var 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)