2 writes to Length
Microsoft.Extensions.Primitives (2)
StringSegment.cs (2)
32
Length
= buffer?.Length ?? 0;
61
Length
= length;
271 references to Length
Microsoft.AspNetCore.Components (4)
src\Http\Routing\src\Patterns\RoutePatternMatcher.cs (4)
81
if (stringSegment.
Length
== 0)
87
if (pathSegment == null && stringSegment.
Length
> 0)
230
if (stringSegment.
Length
== 0 &&
271
if (requestSegment.
Length
> 0)
Microsoft.AspNetCore.Http (28)
Features\FormFeature.cs (1)
385
if (boundary.
Length
> lengthLimit)
src\Http\Shared\CookieHeaderParserShared.cs (12)
69
if (StringSegment.IsNullOrEmpty(value) || (index == value.
Length
))
81
if (current == value.
Length
)
98
if ((separatorFound && !supportsMultipleValues) || (!separatorFound && (current < value.
Length
)))
110
Contract.Requires(startIndex <= input.
Length
); // it's OK if index == value.Length.
115
if ((current == input.
Length
) || (input[current] != ',' && input[current] != ';'))
129
while ((current < input.
Length
) && ((input[current] == ',') || (input[current] == ';')))
147
if (StringSegment.IsNullOrEmpty(input) || (offset >= input.
Length
))
185
Contract.Ensures((Contract.Result<int>() >= 0) && (Contract.Result<int>() <= (input.
Length
- offset)));
189
if (offset >= input.
Length
)
204
offset = input.
Length
;
213
if (offset == input.
Length
|| input[offset] != '"')
233
if (offset >= input.
Length
|| input[offset] != '=')
src\Shared\HttpRuleParser.cs (15)
56
Contract.Ensures((Contract.Result<int>() >= 0) && (Contract.Result<int>() <= (input.
Length
- startIndex)));
58
if (startIndex >= input.
Length
)
70
Contract.Ensures((Contract.Result<int>() >= 0) && (Contract.Result<int>() <= (input.
Length
- startIndex)));
72
if (startIndex >= input.
Length
)
80
while (current < input.
Length
)
93
if ((current + 2 < input.
Length
) && (input[current + 1] == LF))
108
return input.
Length
- startIndex;
113
Contract.Requires((startIndex >= 0) && (startIndex < input.
Length
));
114
Contract.Ensures((Contract.Result<int>() >= 0) && (Contract.Result<int>() <= (input.
Length
- startIndex)));
133
while (current < input.
Length
)
165
Contract.Requires((startIndex >= 0) && (startIndex < input.
Length
));
175
if ((startIndex + 2 > input.
Length
) || (input[startIndex + 1] > 127))
220
Contract.Requires((startIndex >= 0) && (startIndex < input.
Length
));
230
while (current < input.
Length
)
234
if ((current + 2 < input.
Length
) &&
Microsoft.AspNetCore.Http.Abstractions (8)
HostString.cs (8)
149
var encoded = s_idnMapping.GetAscii(host.Buffer!, host.Offset, host.
Length
);
236
for (int i = 0; i < port.
Length
; i++)
260
if (pattern.StartsWith("*.", StringComparison.Ordinal) && host.
Length
>= pattern.
Length
)
265
var hostRoot = host.Subsegment(host.
Length
- allowedRoot.
Length
);
356
if (index + 2 < value.
Length
&& value[index + 1] == ':')
362
&& index < value.
Length
- 1
Microsoft.AspNetCore.Mvc.Abstractions (5)
ModelBinding\ModelStateDictionary.cs (5)
878
if (subKey.
Length
== 0)
898
if (subKey.
Length
== 0)
938
var result = midKey.
Length
- searchKey.
Length
;
946
searchKey.
Length
,
Microsoft.AspNetCore.Mvc.Core (26)
Formatters\AcceptHeaderParser.cs (1)
158
return result.MediaType.
Length
;
Formatters\MediaType.cs (3)
36
: this(mediaType.Buffer ?? string.Empty, mediaType.Offset, mediaType.
Length
)
221
var restOffset = charsetOffset + charset.
Length
;
222
var restLength = mediaType.
Length
- restOffset;
Routing\ViewEnginePath.cs (3)
63
if (segment.
Length
== 0 ||
80
if (segment.
Length
== 0)
111
builder.Append(segment.Buffer, segment.Offset, segment.
Length
);
src\Shared\HttpRuleParser.cs (15)
56
Contract.Ensures((Contract.Result<int>() >= 0) && (Contract.Result<int>() <= (input.
Length
- startIndex)));
58
if (startIndex >= input.
Length
)
70
Contract.Ensures((Contract.Result<int>() >= 0) && (Contract.Result<int>() <= (input.
Length
- startIndex)));
72
if (startIndex >= input.
Length
)
80
while (current < input.
Length
)
93
if ((current + 2 < input.
Length
) && (input[current + 1] == LF))
108
return input.
Length
- startIndex;
113
Contract.Requires((startIndex >= 0) && (startIndex < input.
Length
));
114
Contract.Ensures((Contract.Result<int>() >= 0) && (Contract.Result<int>() <= (input.
Length
- startIndex)));
133
while (current < input.
Length
)
165
Contract.Requires((startIndex >= 0) && (startIndex < input.
Length
));
175
if ((startIndex + 2 > input.
Length
) || (input[startIndex + 1] > 127))
220
Contract.Requires((startIndex >= 0) && (startIndex < input.
Length
));
230
while (current < input.
Length
)
234
if ((current + 2 < input.
Length
) &&
src\Shared\MediaType\ReadOnlyMediaTypeHeaderValue.cs (4)
29
: this(mediaType.Buffer ?? string.Empty, mediaType.Offset, mediaType.
Length
)
71
SubTypeWithoutSuffix = subType.Subsegment(0, subType.
Length
- subtypeSuffixLength - 1);
72
SubTypeSuffix = subType.Subsegment(subType.
Length
- subtypeSuffixLength, subtypeSuffixLength);
147
var startPos = subType.Offset + subType.
Length
- 1;
Microsoft.AspNetCore.Mvc.TagHelpers (12)
Cache\CacheTagKey.cs (1)
283
if (trimmedValue.
Length
!= 0)
EnvironmentTagHelper.cs (3)
94
if (environment.HasValue && environment.
Length
> 0)
113
if (environment.HasValue && environment.
Length
> 0)
131
if (environment.HasValue && environment.
Length
> 0)
GlobbingUrlBuilder.cs (8)
245
var length = Math.Max(xSegment.
Length
, ySegment.
Length
);
271
if (enumerator.Current.HasValue && enumerator.Current.
Length
> 0)
285
if (!value.HasValue || value.
Length
== 0)
293
value = new StringSegment(value.Buffer, value.Offset + 2, value.
Length
- 2);
299
value = new StringSegment(value.Buffer, value.Offset + 1, value.
Length
- 1);
314
while (offset < value.Offset + value.
Length
)
324
var trimmedEnd = value.Offset + value.
Length
- 1;
Microsoft.AspNetCore.Routing (23)
Patterns\RoutePatternMatcher.cs (4)
81
if (stringSegment.
Length
== 0)
87
if (pathSegment == null && stringSegment.
Length
> 0)
230
if (stringSegment.
Length
== 0 &&
271
if (requestSegment.
Length
> 0)
src\Shared\HttpRuleParser.cs (15)
56
Contract.Ensures((Contract.Result<int>() >= 0) && (Contract.Result<int>() <= (input.
Length
- startIndex)));
58
if (startIndex >= input.
Length
)
70
Contract.Ensures((Contract.Result<int>() >= 0) && (Contract.Result<int>() <= (input.
Length
- startIndex)));
72
if (startIndex >= input.
Length
)
80
while (current < input.
Length
)
93
if ((current + 2 < input.
Length
) && (input[current + 1] == LF))
108
return input.
Length
- startIndex;
113
Contract.Requires((startIndex >= 0) && (startIndex < input.
Length
));
114
Contract.Ensures((Contract.Result<int>() >= 0) && (Contract.Result<int>() <= (input.
Length
- startIndex)));
133
while (current < input.
Length
)
165
Contract.Requires((startIndex >= 0) && (startIndex < input.
Length
));
175
if ((startIndex + 2 > input.
Length
) || (input[startIndex + 1] > 127))
220
Contract.Requires((startIndex >= 0) && (startIndex < input.
Length
));
230
while (current < input.
Length
)
234
if ((current + 2 < input.
Length
) &&
src\Shared\MediaType\ReadOnlyMediaTypeHeaderValue.cs (4)
29
: this(mediaType.Buffer ?? string.Empty, mediaType.Offset, mediaType.
Length
)
71
SubTypeWithoutSuffix = subType.Subsegment(0, subType.
Length
- subtypeSuffixLength - 1);
72
SubTypeSuffix = subType.Subsegment(subType.
Length
- subtypeSuffixLength, subtypeSuffixLength);
147
var startPos = subType.Offset + subType.
Length
- 1;
Microsoft.Extensions.FileProviders.Embedded (1)
Manifest\EmbeddedFilesManifest.cs (1)
43
if (trimmed.
Length
== 0)
Microsoft.Extensions.Primitives (35)
Extensions.cs (1)
21
return builder.Append(segment.Buffer, segment.Offset, segment.
Length
);
InplaceStringBuilder.cs (1)
80
Append(segment.Buffer, segment.Offset, segment.
Length
);
StringSegment.cs (31)
82
public string? Value => HasValue ? Buffer.Substring(Offset,
Length
) : null;
97
/// <paramref name="index"/> is greater than or equal to <see cref="
Length
"/> or less than zero.
103
if ((uint)index >= (uint)
Length
)
117
public ReadOnlySpan<char> AsSpan() => Buffer.AsSpan(Offset,
Length
);
127
/// <paramref name="start"/> is greater than or equal to <see cref="
Length
"/> or less than zero.
133
ThrowInvalidArguments(start,
Length
- start, ExceptionArgument.start);
136
return Buffer.AsSpan(Offset + start,
Length
- start);
149
/// greater than <see cref="
Length
"/>.
153
if (!HasValue || start < 0 || length < 0 || (uint)(start + length) > (uint)
Length
)
165
public ReadOnlyMemory<char> AsMemory() => Buffer.AsMemory(Offset,
Length
);
381
/// <paramref name="offset"/> is greater than or equal to <see cref="
Length
"/> or less than zero.
383
public string Substring(int offset) => Substring(offset,
Length
- offset);
395
/// greater than <see cref="
Length
"/>.
400
if (!HasValue || offset < 0 || length < 0 || (uint)(offset + length) > (uint)
Length
)
416
/// <paramref name="offset"/> is greater than or equal to <see cref="
Length
"/> or less than zero.
418
public StringSegment Subsegment(int offset) => Subsegment(offset,
Length
- offset);
429
/// greater than <see cref="
Length
"/>.
433
if (!HasValue || offset < 0 || length < 0 || (uint)(offset + length) > (uint)
Length
)
451
/// greater than <see cref="
Length
"/>.
460
if ((uint)start > (uint)
Length
)
465
if ((uint)count > (uint)(
Length
- start))
488
/// <paramref name="start"/> is greater than or equal to <see cref="
Length
"/> or less than zero.
490
public int IndexOf(char c, int start) => IndexOf(c, start,
Length
- start);
497
public int IndexOf(char c) => IndexOf(c, 0,
Length
);
514
/// greater than <see cref="
Length
"/>.
523
if ((uint)startIndex > (uint)
Length
)
528
if ((uint)count > (uint)(
Length
- startIndex))
552
/// <paramref name="startIndex"/> is greater than or equal to <see cref="
Length
"/> or less than zero.
556
return IndexOfAny(anyOf, startIndex,
Length
- startIndex);
568
return IndexOfAny(anyOf, 0,
Length
);
648
if (!value.HasValue || value.
Length
== 0)
StringTokenizer.cs (2)
119
if (!_value.HasValue || _index > _value.
Length
)
129
next = _value.
Length
;
Microsoft.Net.Http.Headers (129)
BaseHeaderParser.cs (3)
26
if (StringSegment.IsNullOrEmpty(value) || (index == value.
Length
))
39
if (current == value.
Length
)
60
if ((separatorFound && !SupportsMultipleValues) || (!separatorFound && (current < value.
Length
)))
CacheControlHeaderValue.cs (7)
524
if (StringSegment.IsNullOrEmpty(input) || (startIndex >= input.
Length
))
533
while (current < input.
Length
)
561
return input.
Length
- startIndex;
574
switch (name.
Length
)
723
if ((valueString.
Length
< 3) || (valueString[0] != '\"') || (valueString[valueString.
Length
- 1] != '\"'))
730
var maxLength = valueString.
Length
- 1; // -1 because we don't want to parse the final '"'.
ContentDispositionHeaderValue.cs (18)
280
if (StringSegment.IsNullOrEmpty(input) || (startIndex >= input.
Length
))
299
if ((current < input.
Length
) && (input[current] == ';'))
316
Contract.Requires((input.
Length
> 0) && (startIndex < input.
Length
));
343
if ((dispositionTypeLength == 0) || (tempDispositionType.
Length
!= dispositionType.
Length
))
361
dateString = dateString.Subsegment(1, dateString.
Length
- 2);
472
result = result.Subsegment(1, result.
Length
- 2);
483
else if (!needsQuotes && HttpRuleParser.GetTokenLength(result, 0) != result.
Length
)
508
var builder = new StringBuilder(result.
Length
);
509
for (int i = 0; i < result.
Length
; i++)
529
return value.
Length
> 1 && value.StartsWith("\"", StringComparison.Ordinal)
581
if (!IsQuoted(processedInput) || processedInput.
Length
< 10)
720
unescapedBytes = ArrayPool<byte>.Shared.Rent(dataString.
Length
);
722
for (var index = 0; index < dataString.
Length
; index++)
766
if ((pattern.
Length
- index) < 3)
798
if ((index < 0) || (index >= pattern.
Length
))
803
&& (pattern.
Length
- index >= 3))
ContentRangeHeaderValue.cs (6)
233
if (StringSegment.IsNullOrEmpty(input) || (startIndex >= input.
Length
))
257
if (current == input.
Length
)
270
if ((current == input.
Length
) || (input[current] != '/'))
278
if (current == input.
Length
)
350
if ((current == input.
Length
) || (input[current] != '-'))
359
if (current == input.
Length
)
CookieHeaderValue.cs (3)
172
if (HttpRuleParser.GetTokenLength(name, 0) != name.
Length
)
187
if (result.
Length
!= value.
Length
)
EntityTagHeaderValue.cs (4)
61
(length != tag.
Length
))
216
if (StringSegment.IsNullOrEmpty(input) || (startIndex >= input.
Length
))
239
if ((current + 2 >= input.
Length
) || (input[current] != '/'))
255
if (tagLength == input.
Length
)
HeaderUtilities.cs (18)
78
if (HttpRuleParser.GetTokenLength(value, 0) != value.
Length
)
156
Contract.Requires(startIndex <= input.
Length
); // it's OK if index == value.Length.
161
if ((current == input.
Length
) || (input[current] != ','))
174
while ((current < input.
Length
) && (input[current] == ','))
372
if (string.IsNullOrEmpty(value.Buffer) || value.
Length
== 0)
398
if (string.IsNullOrEmpty(value.Buffer) || value.
Length
== 0)
414
var inputLength = input.
Length
;
593
input = input.Subsegment(1, input.
Length
- 2);
605
return !StringSegment.IsNullOrEmpty(input) && input.
Length
>= 2 && input[0] == '"' && input[input.
Length
- 1] == '"';
626
return string.Create(input.
Length
- backSlashCount, input, (span, segment) =>
630
for (var i = 0; i < segment.
Length
&& (uint)spanIndex < (uint)spanLength; i++)
633
if ((uint)nextIndex < (uint)segment.
Length
&& segment[i] == '\\')
657
for (var i = 0; i < input.
Length
; i++)
659
if (i < input.
Length
- 1 && input[i] == '\\')
696
return string.Create(input.
Length
+ backSlashCount + 2, input, (span, segment) =>
702
for (var i = 0; i < segment.
Length
; i++)
722
for (var i = 0; i < input.
Length
; i++)
HttpHeaderParser.cs (1)
35
Contract.Requires((value == null) || ((index >= 0) && (index <= value.
Length
)));
MediaTypeHeaderValue.cs (7)
566
if (StringSegment.IsNullOrEmpty(input) || (startIndex >= input.
Length
))
584
if ((current < input.
Length
) && (input[current] == ';'))
606
Contract.Requires((input.
Length
> 0) && (startIndex < input.
Length
));
623
if ((current >= input.
Length
) || (input[current] != '/'))
663
if ((mediaTypeLength == 0) || (tempMediaType.
Length
!= mediaType.
Length
))
NameValueHeaderValue.cs (8)
193
if (StringSegment.IsNullOrEmpty(value) || (GetValueLength(value, 0) == value.
Length
))
342
if (StringSegment.IsNullOrEmpty(input) || (startIndex >= input.
Length
))
361
if ((current == input.
Length
) || (input[current] != '='))
396
if ((StringSegment.IsNullOrEmpty(input)) || (startIndex >= input.
Length
))
416
if ((current == input.
Length
) || (input[current] != delimiter))
436
Contract.Requires(name.
Length
> 0);
456
if (startIndex >= input.
Length
)
484
if (!(StringSegment.IsNullOrEmpty(value) || (GetValueLength(value, 0) == value.
Length
)))
RangeConditionHeaderValue.cs (3)
140
if (StringSegment.IsNullOrEmpty(input) || (startIndex + 1 >= input.
Length
))
170
if (current != input.
Length
)
183
current = input.
Length
;
RangeHeaderValue.cs (3)
158
if (StringSegment.IsNullOrEmpty(input) || (startIndex >= input.
Length
))
176
if ((current == input.
Length
) || (input[current] != '='))
192
Contract.Assert(current == input.
Length
, "GetRangeItemListLength() should consume the whole string or fail.");
RangeItemHeaderValue.cs (7)
112
if ((StringSegment.IsNullOrEmpty(input)) || (startIndex >= input.
Length
))
121
if (current == input.
Length
)
142
if ((current < input.
Length
) && !separatorFound)
147
if (current == input.
Length
)
162
if (StringSegment.IsNullOrEmpty(input) || (startIndex >= input.
Length
))
183
if ((current == input.
Length
) || (input[current] != '-'))
196
if (current < input.
Length
)
SetCookieHeaderValue.cs (9)
191
var length = _name.
Length
+ EqualsToken.Length + _value.
Length
;
209
length += SeparatorToken.Length + DomainToken.Length + EqualsToken.Length + Domain.
Length
;
214
length += SeparatorToken.Length + PathToken.Length + EqualsToken.Length + Path.
Length
;
248
length += SeparatorToken.Length + extension.
Length
;
480
if (StringSegment.IsNullOrEmpty(input) || (offset >= input.
Length
))
511
while (offset < input.
Length
)
673
if (offset >= input.
Length
|| input[offset] != '=')
704
end = input.
Length
;
src\Http\Shared\CookieHeaderParserShared.cs (12)
69
if (StringSegment.IsNullOrEmpty(value) || (index == value.
Length
))
81
if (current == value.
Length
)
98
if ((separatorFound && !supportsMultipleValues) || (!separatorFound && (current < value.
Length
)))
110
Contract.Requires(startIndex <= input.
Length
); // it's OK if index == value.Length.
115
if ((current == input.
Length
) || (input[current] != ',' && input[current] != ';'))
129
while ((current < input.
Length
) && ((input[current] == ',') || (input[current] == ';')))
147
if (StringSegment.IsNullOrEmpty(input) || (offset >= input.
Length
))
185
Contract.Ensures((Contract.Result<int>() >= 0) && (Contract.Result<int>() <= (input.
Length
- offset)));
189
if (offset >= input.
Length
)
204
offset = input.
Length
;
213
if (offset == input.
Length
|| input[offset] != '"')
233
if (offset >= input.
Length
|| input[offset] != '=')
src\Shared\HttpRuleParser.cs (15)
56
Contract.Ensures((Contract.Result<int>() >= 0) && (Contract.Result<int>() <= (input.
Length
- startIndex)));
58
if (startIndex >= input.
Length
)
70
Contract.Ensures((Contract.Result<int>() >= 0) && (Contract.Result<int>() <= (input.
Length
- startIndex)));
72
if (startIndex >= input.
Length
)
80
while (current < input.
Length
)
93
if ((current + 2 < input.
Length
) && (input[current + 1] == LF))
108
return input.
Length
- startIndex;
113
Contract.Requires((startIndex >= 0) && (startIndex < input.
Length
));
114
Contract.Ensures((Contract.Result<int>() >= 0) && (Contract.Result<int>() <= (input.
Length
- startIndex)));
133
while (current < input.
Length
)
165
Contract.Requires((startIndex >= 0) && (startIndex < input.
Length
));
175
if ((startIndex + 2 > input.
Length
) || (input[startIndex + 1] > 127))
220
Contract.Requires((startIndex >= 0) && (startIndex < input.
Length
));
230
while (current < input.
Length
)
234
if ((current + 2 < input.
Length
) &&
StringWithQualityHeaderValue.cs (5)
191
if (StringSegment.IsNullOrEmpty(input) || (startIndex >= input.
Length
))
209
if ((current == input.
Length
) || (input[current] != ';'))
233
if ((current == input.
Length
) || ((input[current] != 'q') && (input[current] != 'Q')))
242
if ((current == input.
Length
) || (input[current] != '='))
250
if (current == input.
Length
)