16462 references to Length
aspire (310)
Acquisition\IdentityChannelReader.cs (1)
150var digits = value.AsSpan(PrChannelPrefix.Length);
Acquisition\IdentityResolver.cs (2)
271if (value.Length < minLength || value.Length > maxLength)
Acquisition\InstallationDiscovery.cs (1)
143self.CanonicalPath is { Length: > 0 } sp ? [sp] : [],
Acquisition\InstallationInfo.cs (1)
154var pathStatus = GetOptionalString("pathStatus") is { Length: > 0 } parsedPathStatus
Acquisition\PeerInstallProbe.cs (7)
245ProcessCaptureFailureKind.StartFailed => result.FailureMessage is { Length: > 0 } message 248ProcessCaptureFailureKind.CaptureFailed => result.FailureMessage is { Length: > 0 } message 294if (trimmed.Length == 0) 409var builder = new StringBuilder(stderr.Length); 410for (var i = 0; i < stderr.Length; i++) 415if (i + 1 < stderr.Length && stderr[i + 1] == '[') 418while (i < stderr.Length && (stderr[i] < '@' || stderr[i] > '~'))
Agents\AspireSkills\AspireSkillsBundleProvider.cs (6)
262if (skillName.Length > MaxSkillNameLength || 350if (description.Length > MaxSkillDescriptionLength) 356description.Length, 391var value = line[keyPrefix.Length..].Trim(); 392return value.Length >= 2 && 706var operand = comparator[op.Length..];
Agents\AspireSkills\AspireSkillsInstaller.cs (2)
409return sha256.Length == 64 && sha256.All(Uri.IsHexDigit) 422return sha512.Length == 128 && sha512.All(Uri.IsHexDigit)
Agents\DeprecatedMcpCommandScanner.cs (1)
64File.AppendAllText(debugPath, $"[{DateTime.UtcNow:O}] -> Content: {content.Substring(0, Math.Min(200, content.Length))}\n");
Agents\Playwright\PlaywrightCliInstaller.cs (1)
454.OrderByDescending(d => d.Length))
Agents\SkillDefinition.cs (3)
172return relativePath.Length > excludedPath.Length && relativePath[excludedPath.Length] == Path.DirectorySeparatorChar;
Backchannel\AppHostConnectionResolver.cs (1)
290if (connection.AppHostInfo?.AppHostPath is not { Length: > 0 } appHostPath)
Bundles\BundleService.cs (1)
777var sb = new StringBuilder(versionPart.Length);
Certificates\CertificateGeneration\CertificateManager.cs (1)
235if ((byteArray.Length == AspNetHttpsOidFriendlyName.Length && byteArray[0] == (byte)'A') || byteArray.Length == 0)
Certificates\CertificateGeneration\UnixCertificateManager.cs (1)
384? Path.Combine("$HOME", certDir[homeDirectoryWithSlash.Length..])
Commands\AgentInitCommand.cs (3)
665while (simplified.Length > 0 && simplified[0] is '-' or '\u2013' or '\u2014' or ':') 674for (var i = 0; i < simplified.Length; i++) 677&& (i + 1 >= simplified.Length || char.IsWhiteSpace(simplified[i + 1])))
Commands\AgentTelemetryCommand.cs (3)
160if (value.Length > maxLength) 184if (value.Length > MaxTagValueLength || 210=> value.Length <= MaxTagValueLength &&
Commands\ConfigCommand.cs (3)
282.Select(kvp => kvp.Key.Substring(featurePrefix.Length)) 319.Select(s => s.Length) 320.Append(header.Length)
Commands\DashboardRunCommand.cs (2)
309result = arg.Substring(prefix.Length); 343var longestLabelLength = labels.Max(s => s.Length) + 1; // +1 for colon
Commands\DoctorCommand.cs (1)
128_ansiConsole.WriteLine(new string('=', DoctorCommandStrings.EnvironmentCheckHeader.Length));
Commands\GroupedHelpWriter.cs (6)
88if (label.Length > columnWidth) 90columnWidth = label.Length; 98if (label.Length > columnWidth) 100columnWidth = label.Length; 177var columnWidth = rowArray.Max(static row => row.Label.Length) + 4; 314var label = string.Join(", ", allNames.OrderBy(a => a.Length).ThenBy(a => a, StringComparer.Ordinal));
Commands\InstallationInfoOutput.cs (1)
134ansiConsole.WriteLine(new string('=', DoctorCommandStrings.HeaderInstallations.Length));
Commands\LogsCommand.cs (1)
465var dimTimestamp = timestampPrefix.Length > 0 ? $"[dim]{timestampPrefix.EscapeMarkup()}[/]" : string.Empty;
Commands\PipelineCommandBase.cs (6)
527value = token["--format=".Length..]; 641var visibleWidth = StripMarkup(firstLinePrefix).Length; 676var visiblePrefixLength = StripMarkup(firstLinePrefix).Length; 685if (i > 0 && currentLineLength + chunk.Length > maxLineLength) 689currentLineLength = StripMarkup(continuationPrefix).Length; 693currentLineLength += chunk.Length;
Commands\ResourceCommand.cs (7)
208var errorMessage = response.Message is { Length: > 0 } message 557var builder = new StringBuilder(value.Length + 4); 558for (var i = 0; i < value.Length; i++) 758writer.WriteLine(command.Description is { Length: > 0 } ? command.Description : command.DisplayName ?? command.Name); 864if (argument.Description is { Length: > 0 }) 868else if (argument.Label is { Length: > 0 }) 883if (argument.Value is { Length: > 0 } value)
Commands\ResourceCommandHelper.cs (2)
221var builder = new System.Text.StringBuilder(value.Length + 4); 222for (var i = 0; i < value.Length; i++)
Commands\RunCommand.cs (1)
1047var longestLabelLength = labels.Max(s => s.Length) + 1; // +1 for colon
Commands\TelemetryTracesCommand.cs (1)
410var displayName = escapedName.Length > maxNameLength
Configuration\AspireConfigFile.cs (1)
196if (config.AppHost?.Path is { Length: > 0 } migratedPath && !Path.IsPathRooted(migratedPath))
Diagnostics\CliLogFormat.cs (2)
116if (levelEnd < 0 || levelEnd + 3 > line.Length) 123if (categoryEnd < 0 || categoryEnd + 2 > line.Length)
Documentation\ApiDocs\ApiDocsIndexService.cs (5)
1084if (token.Length < 5 || 1101score += GetPrefixTightnessBonus(item.NameLower.Length - queryToken.Length); 1106.Select(static segment => segment.Length) 1112score += GetPrefixTightnessBonus(bestPathSegmentLength - queryToken.Length);
Documentation\ApiDocs\ApiDocsSourceConfiguration.cs (1)
211if (href.Length > 1 && href[0] is '<' && href[^1] is '>')
Documentation\ApiDocs\ApiMemberMarkdownParser.cs (6)
96return fragmentSeparatorIndex >= 0 && fragmentSeparatorIndex < href.Length - 1 114if (href.Length is 0) 120if (name.Length is 0) 143return separatorIndex >= 0 && separatorIndex < tail.Length - 4 174return slug.Length is 0 ? "member" : slug; 179var builder = new StringBuilder(value.Length);
Documentation\ApiDocs\ApiSitemapParser.cs (1)
98var remainder = absolutePath[route.PathPrefix.Length..];
Documentation\CachedHttpDocumentFetcher.cs (2)
72logger.LogInformation("Fetched content from {Url} after retry, length: {Length} chars", url, retryContent.Length); 87logger.LogInformation("Fetched content from {Url}, length: {Length} chars", url, content.Length);
Documentation\Docs\DocsIndexService.cs (16)
254if (segment.Length >= MinTokenLength) 551if (slugLower.Length is 0 || queryTokens.Length is 0) 767startIndex = absoluteIndex + token.Length; 787var builder = new StringBuilder(text.Length); 788for (var i = 0; i < text.Length; i++) 815index + 1 < text.Length && 863startIndex = absoluteIndex + token.Length; 889=> queryAsPhrase.Length > 0 && lowerText.Contains(queryAsPhrase, StringComparison.Ordinal) 963var builder = new StringBuilder(content.Length + 64); 1017if (trimmed.Length is 0) 1030if (code.Length > 0 && IsLikelyCodeFenceLanguage(language)) 1139var capacity = _slugLower.Length + TitleLower.Length + (SummaryLower?.Length ?? 0); 1142capacity += section.HeadingLower.Length + section.ContentLower.Length + 2;
Documentation\Docs\DocsSourceConfiguration.cs (1)
105if (href.Length > 1 && href[0] is '<' && href[^1] is '>')
Documentation\Docs\LlmsTxtParser.cs (2)
160: content.Length; 930var buffer = ArrayPool<char>.Shared.Rent(title.Length);
Documentation\FileBackedDocumentContentCache.cs (2)
262var result = new char[key.Length]; 263for (var i = 0; i < key.Length; i++)
Documentation\LexicalScoring.cs (3)
46.Where(token => token.Length >= minTokenLength) 113startIndex = absoluteIndex + token.Length; 152var endIndex = index + token.Length;
DotNet\DotNetCliRunner.cs (2)
359var builder = new StringBuilder(value.Length); 371return sanitized.Length <= 80 ? sanitized : sanitized[..80];
Git\GitRepository.cs (4)
54activity.SetGitOutputLengths(output.Length, errorOutput.Length); 140activity.SetGitOutputLengths(output.Length, errorOutput.Length);
Git\GitWorktree.cs (4)
282var gitDir = line[GitDirPrefix.Length..].Trim(); 283if (gitDir.Length == 0) 303return value.Length > 0 && TryResolvePath(value, relativeTo, out resolvedPath); 366var segments = resolvedPath[root.Length..].Split(
Interaction\BannerService.cs (12)
59var aspireWidth = s_aspireLines[0].TrimEnd().Length; 62var versionPadding = Math.Max(0, aspireWidth - versionText.Length); 73for (var i = 1; i <= welcomeText.Length; i += 3) 75var partial = welcomeText[..Math.Min(i, welcomeText.Length)]; 83var visibleCols = letterIdx < s_letterPositions.Length ? s_letterPositions[letterIdx] : s_aspireLines[0].Length; 91var visibleChars = (int)Math.Ceiling((double)versionText.Length * i / 8); 92var partialVer = versionText[(versionText.Length - visibleChars)..]; 157var aspireWidth = s_aspireLines[0].TrimEnd().Length; 160var padding = Math.Max(0, aspireWidth - partialVersion.Length); 197var partialLine = line[..Math.Min(visibleCols, line.Length)].PadRight(line.Length); 239for (var col = 0; col < line.Length; col++)
Mcp\Tools\ExecuteResourceCommandTool.cs (1)
138var message = (response.Message ?? response.ErrorMessage) is { Length: > 0 } errorMsg ? errorMsg : "Unknown error. See logs for details.";
Mcp\Tools\ListIntegrationsTool.cs (2)
177return packageId["CommunityToolkit.Aspire.Hosting.".Length..]; 183return packageId["Aspire.Hosting.".Length..];
Mcp\Tools\McpToolHelpers.cs (1)
59path = path[..^"/login".Length];
Migrations\TypeScriptAppHostMigration.cs (2)
218currentPath.AsSpan(0, currentPath.Length - LegacyTypeScriptAppHost.LegacyAppHostFileName.Length),
Npm\INpmProvenanceChecker.cs (2)
163var afterRefs = refString["refs/".Length..]; 165if (slashIndex <= 0 || slashIndex == afterRefs.Length - 1)
Npm\SigstoreNpmProvenanceChecker.cs (2)
304var hashBase64 = sriIntegrity["sha512-".Length..]; 360var digestBytes = Convert.FromBase64String(sriIntegrity["sha512-".Length..]);
NuGet\BundleNuGetPackageCache.cs (1)
218_logger.LogDebug("NuGet search returned {Length} bytes", output?.Length ?? 0);
Packaging\PackageChannel.cs (1)
797while (separatorIndex >= 0 && separatorIndex < packageFileName.Length - 1)
Packaging\PackagingService.cs (6)
588var truncatedHash = commitHash.Length >= 8 ? commitHash[..8] : commitHash; 604if (plusIndex < 0 || plusIndex + 1 >= informationalVersion.Length) 666.Select(fileName => fileName[(packageId.Length + 1)..^".nupkg".Length]) 745var stem = fileName[..^suffix.Length]; 749if (parts[i].Length == 0 || !char.IsDigit(parts[i][0]))
Processes\WindowsProcessInterop.cs (5)
544if (argument.Length != 0 && !argument.AsSpan().ContainsAny(' ', '\t', '"')) 552while (idx < argument.Length) 558while (idx < argument.Length && argument[idx] == '\\') 564if (idx == argument.Length) 645Encoding.Unicode.GetBytes(pStr, blockString.Length, (byte*)ptr, byteCount);
Profiling\ProfileCaptureService.cs (2)
172if (configuration[BundleDiscovery.DashboardPathEnvVar] is { Length: > 0 } dashboardPath && 180if (configuration[BundleDiscovery.ManagedPathEnvVar] is { Length: > 0 } managedPath)
Program.cs (2)
399var binaryDir = processPathProvider.ProcessPath is { Length: > 0 } p 1158var commandLine = loggableArgs.Length > 0 ? $"aspire {loggableArgs}" : "aspire";
Projects\AppHostCandidateFinder.cs (1)
285if (Path.GetDirectoryName(absolutePath) is not { Length: > 0 } absoluteDirectory)
Projects\AppHostEnvironmentDefaults.cs (2)
95return TryGetEnvironmentArgumentValue(argument[(EnvironmentArgumentName.Length + 1)..], out environment); 100return TryGetEnvironmentArgumentValue(argument[(EnvironmentArgumentAlias.Length + 1)..], out environment);
Projects\AppHostServerClosureSnapshots.cs (1)
241if (entry.FileContentHash is { Length: > 0 } fileContentHash)
Projects\DotNetAppHostProject.cs (17)
467if (trimmed.Length == 0) 478? trimmed[thisFileDirectory.Length..].TrimStart('/', '\\') 620foreach (var rawSegment in start[thisFileDirectory.Length..].Split('/', '\\')) 820if (walkUpImport.AnchorFileName.Length == 0 867if (appended.Length == 0 || appended.Contains('$') || appended.Contains('@') || ContainsWildcard(appended)) 889if (remainder.Length == 0 || remainder.AsSpan().IndexOfAny('/', '\\') >= 0) 948if (start.Length == 0) 959foreach (var rawSegment in start[thisFileDirectory.Length..].Split('/', '\\')) 1056public bool HasAppendedPath => AppendedPath.Length > 0; 1077if (!callMatch.Success || projectAttributeValue[..callMatch.Index].Trim().Length > 0) 1109while (suffixStart < projectAttributeValue.Length && char.IsWhiteSpace(projectAttributeValue[suffixStart])) 1113if (suffixStart >= projectAttributeValue.Length || projectAttributeValue[suffixStart] != ')') 1119var appendedPath = suffixStart < projectAttributeValue.Length 1153for (var i = startIndex; i < text.Length; i++) 1210afterCloseParen = text.Length; 1217if (trimmed.Length >= 2 2256if (appHostFile.DirectoryName is not { Length: > 0 } directoryName)
Projects\FallbackProjectParser.cs (1)
207var version = trimmedSdk.Substring(sdkPrefix.Length + 1);
Projects\GuestAppHostProject.cs (1)
1940if (recorded.Length == 0 || current.Contains(NormalizeManifestPath(recorded)))
Projects\LegacyTypeScriptAppHost.cs (4)
105rewritten = string.Concat(rewritten.AsSpan(0, rewritten.Length - ".ts".Length), ".mts"); 126var segmentStart = path.Length - segment.Length;
Projects\PrebuiltAppHostServer.cs (3)
894if (sourceList.Length > 0) 1332if (!shouldUseExactAspirePackageVersion || version.Length == 0 || version[0] is '[' or '(') 1647if (separatorIndex <= 0 || separatorIndex == libraryName.Length - 1)
Projects\ProjectLocator.cs (2)
666var messageSuffix = validationResult.Message is { Length: > 0 } message ? $": {message}" : string.Empty; 865if (path.Length == 0 || path.Contains('\0') || path.IndexOfAny(Path.GetInvalidPathChars()) >= 0)
Projects\ProjectUpdater.cs (2)
1163return value.StartsWith("$(", StringComparison.Ordinal) && value.EndsWith(")", StringComparison.Ordinal) && value.Length > 3; 1174return expression.Substring(2, expression.Length - 3);
Projects\TypeScriptAppHostToolchainResolver.cs (3)
364var version = packageManager[yarnPackageManagerPrefix.Length..]; 365return version.Length > 0 && 367(version.Length == 1 || !char.IsAsciiDigit(version[1]));
Scaffolding\PackageJsonMerger.cs (2)
194var unprefixed = name[AspirePrefix.Length..]; 195if (unprefixed.Length > 0)
src\Shared\BackchannelConstants.cs (8)
168if (appHostPath.Length >= 2 && appHostPath[1] == ':' && char.IsLetter(appHostPath[0])) 369var afterPrefix = fileName[$"{SocketPrefix}.".Length..]; 377var afterPrefix = fileName["aux.sock.".Length..]; 617var suffix = fileName[(prefixFileName.Length + 1)..]; 636if (fileName.Length == CompactAppHostIdLength && IsBase64UrlIdentifier(fileName)) 643if (fileName.Length <= pidSeparatorIndex || 668if (appHostId.Length != CompactAppHostIdLength || !IsBase64UrlIdentifier(appHostId)) 713return hex[..Math.Min(length, hex.Length)];
src\Shared\CommandLineArgsParser.cs (7)
39for (int i = 0; i < arguments.Length; i++) 41while (i < arguments.Length && (arguments[i] == ' ' || arguments[i] == '\t')) 46if (i == arguments.Length) 60while (i < arguments.Length) 64while (i < arguments.Length && arguments[i] == '\\') 72if (i >= arguments.Length || arguments[i] != '"') 101if (inQuotes && i < arguments.Length - 1 && arguments[i + 1] == '"')
src\Shared\ConsoleLogs\AnsiParser.cs (5)
35while (currentPos < text.Length) 56outputBuilder ??= new StringBuilder(text.Length); 86var outputBuilder = new StringBuilder(text.Length * 2); 167if (i < text.Length - 1) 175textLength = text.Length - textStartIndex;
src\Shared\ConsoleLogs\PromptContext.cs (1)
43if (input.Length < MinReferenceLength)
src\Shared\ConsoleLogs\SharedAIHelpers.cs (2)
39return text.Length / 4; 792if (value.Length <= MaximumStringLength)
src\Shared\ConsoleLogs\UrlParser.cs (2)
27builder ??= new StringBuilder(text.Length * 2); 44if (nextCharIndex < text.Length)
src\Shared\Export\ExportArchive.cs (1)
132var sanitized = new StringBuilder(name.Length);
src\Shared\FormatHelpers.cs (2)
114if (text.Length <= maxLength) 119return string.Concat(text.AsSpan(0, maxLength - Ellipsis.Length), Ellipsis);
src\Shared\IConfigurationExtensions.cs (2)
51if (primaryValue is not null && !fallbackOnEmpty || primaryValue is { Length: > 0 }) 57if (secondaryValue is not null && !fallbackOnEmpty || secondaryValue is { Length: > 0 })
src\Shared\IntegrationPackageProbeManifest.cs (1)
224fileNameWithoutExtension.Length > 3)
src\Shared\NpmVersionHelper.cs (1)
42while (normalizedVersion.Length > 0)
src\Shared\Otlp\OtlpHelpers.cs (8)
40return value.Length > maxLength ? value[..maxLength] : value; 165return value.Length == resourceName.Length + instanceId.Length + 1 166&& value.AsSpan(0, resourceName.Length).Equals(resourceName, StringComparisons.ResourceName) 167&& value[resourceName.Length] == '-' 168&& value.AsSpan(resourceName.Length + 1, instanceId.Length).Equals(instanceId, StringComparisons.ResourceName);
src\Shared\PathNormalizer.cs (5)
55if (path.Length < 3 || path[1] != ':' || path[2] != Path.DirectorySeparatorChar) 154var relative = fullPath[root.Length..]; 187if (linkTarget?.FullName is { Length: > 0 } resolved) 242var relative = fullPath[root.Length..]; 276if (linkTarget?.FullName is { Length: > 0 } resolved)
src\Shared\ProcessStartTimeHelper.cs (1)
362if (closeParenIndex < 0 || closeParenIndex + 2 >= contents.Length)
src\Shared\SearchTextParser.cs (5)
166if (value.Length > 0) 229if (fragment.Length > 0) 274if (value.Length > 0) 290if (fragment.Length > 0) 308if (fragment.Length > 0)
src\Shared\X509Certificate2Extensions.cs (1)
52if ((byteArray.Length == AspNetHttpsOidFriendlyName.Length && byteArray[0] == (byte)'A') || byteArray.Length == 0)
Telemetry\InternalMicrosoftDetector.cs (4)
950padded = padded.PadRight(padded.Length + ((4 - padded.Length % 4) % 4), '='); 1245return NormalizeAdDomainName(trimmed[..^CorpMicrosoftDomainSuffix.Length]); 1285return atIndex >= 0 && atIndex < value.Length - 1
Telemetry\ProfilingTelemetry.cs (2)
742return activity?.GetBaggageItem(Baggage.SessionId) is { Length: > 0 } sessionId ? sessionId : null; 771return configuration[name] is { Length: > 0 } value ? value : configuration[legacyName];
Templating\CliTemplateFactory.cs (1)
324var relativePath = resourceName[resourcePrefix.Length..].Replace('/', Path.DirectorySeparatorChar);
Templating\ConditionalBlockProcessor.cs (2)
82startLineEnd = startLineEnd < 0 ? content.Length : startLineEnd + 1; 88endLineEnd = endLineEnd < 0 ? content.Length : endLineEnd + 1;
Templating\OutputPathHelper.cs (1)
160return sanitized.Length > 0 ? sanitized : "output";
Utils\CliPathHelper.cs (6)
107return length >= hex.Length ? hex : hex[..length]; 271if (path.Length >= firmlink.Length && 273(path.Length == firmlink.Length || path[firmlink.Length] == '/'))
Utils\ConsoleActivityLogger.cs (11)
465var durationWidth = Math.Max(10, orderedRecords.Max(r => FormatSummaryDuration(r.Duration, totalTimeline).Length)); 466var nameWidth = Math.Max(timelineLabel.Length, orderedRecords.Max(r => StringUtils.RemoveMarkup(GetIndentedDisplayName(r)).Length)); 495var padding = renderTimeline ? Math.Max(0, nameWidth - plainDisplayName.Length) : 0; 533if (record.ParentKey is { Length: > 0 } parentKey && 635var labelWidth = Math.Max(width + 2, startText.Length + 1 + endText.Length); 636var spacing = Math.Max(1, labelWidth - startText.Length - endText.Length); 665BuildTimelineLabels(totalTimeline, SummaryTimelineWidth).Length, 666BuildTimelineScale(SummaryTimelineWidth).Length);
Utils\DotNetToolDetection.cs (1)
259var packageRuntimeIdentifier = packageId[ridSpecificPackagePrefix.Length..];
Utils\EnvironmentChecker\AspireVersionCheck.cs (2)
90if (status.UpdateCheckError is { Length: > 0 } updateCheckError) 103if (status.LatestVersion is { Length: > 0 } latestVersion)
Utils\EnvironmentChecker\DcpKubeconfig.cs (4)
104if (trimmed.Length == 0 || trimmed[0] == '#') 115var value = trimmed[prefix.Length..].Trim(); 116if (value.Length == 0) 126return value.Length >= 2 && ((value[0] == '"' && value[^1] == '"') || (value[0] == '\'' && value[^1] == '\''))
Utils\EnvironmentChecker\DevCertsCheck.cs (1)
442return hash.Length > 0 ? (true, hash) : (false, "");
Utils\EnvironmentChecker\EnvironmentChecker.cs (3)
142? checkType.Name[..^"Check".Length] 144var name = new System.Text.StringBuilder(typeName.Length + 4); 146for (var i = 0; i < typeName.Length; i++)
Utils\EnvironmentChecker\OperatingSystemCheck.cs (3)
123if (line.Length == 0 || line[0] == '#') 183normalizedName = normalizedName[..^suffix.Length]; 215if (value.Length < 2)
Utils\EnvironmentChecker\VsCodeExtensionCheck.cs (3)
216&& folderName.Length > prefix.Length 217&& char.IsAsciiDigit(folderName[prefix.Length]);
Utils\FileSystemHelper.cs (1)
219if (firstCandidateSegment.Length == 0 || Path.IsPathRooted(firstCandidateSegment))
Utils\Markdown\MarkdownToSpectreConverter.cs (1)
42return span.Start < 0 || span.End < span.Start || span.End >= markdown.Length
Utils\Markdown\MarkdownToSpectreConverter.Markup.cs (6)
200widths[i] = Math.Max(widths[i], value.Length); 222var plainLen = col < plainValues[rowIndex].Count ? plainValues[rowIndex][col].Length : 0; 353if (!AppendListItemToMarkup(builder, item, prefix, prefix.Length, markdown)) 529if (startTag.Length > 0) 536if (endTag.Length > 0) 558if (appendedLength == 0 || appendedLength == link.Url.Length && AppendedTextEquals(builder, contentStart, link.Url))
Utils\PackageSourceRedactor.cs (1)
36if (sourceToParse.Length == 0)
Utils\ReparsePoint.cs (3)
321target.Length > ntLocalPathPrefix.Length) 323return target[ntLocalPathPrefix.Length..];
Utils\StringUtils.cs (6)
78var maxLength = Math.Max(searchLower.Length, targetLower.Length); 94return string.IsNullOrWhiteSpace(target) ? 0 : target.Length; 99return source.Length; 102var sourceLength = source.Length; 103var targetLength = target.Length;
aspire-managed (2)
src\Shared\IntegrationPackageProbeManifest.cs (1)
224fileNameWithoutExtension.Length > 3)
src\Shared\ProcessStartTimeHelper.cs (1)
362if (closeParenIndex < 0 || closeParenIndex + 2 >= contents.Length)
Aspire.Azure.Messaging.ServiceBus (3)
AzureMessagingServiceBusSettings.cs (3)
144if (subscriptionsIndex > 0 && subscriptionsIndex + subscriptionsSegment.Length < entityPath.Length) 147SubscriptionName = entityPath.Substring(subscriptionsIndex + subscriptionsSegment.Length);
Aspire.Azure.Npgsql (1)
src\Components\Common\ManagedIdentityTokenCredentialHelpers.cs (1)
142private static string AddBase64Padding(string base64) => (base64.Length % 4) switch
Aspire.Azure.Npgsql.EntityFrameworkCore.PostgreSQL (1)
src\Components\Common\ManagedIdentityTokenCredentialHelpers.cs (1)
142private static string AddBase64Padding(string base64) => (base64.Length % 4) switch
Aspire.Cli.EndToEnd.Tests (26)
AppHostSyntaxErrorOutputTests.cs (1)
299return firstLine[(markerIndex + versionMarker.Length)..].Trim();
DescribeCommandTests.cs (1)
133content = content[..index] + replacement + content[(index + originalPattern.Length)..];
EmulatedLocalReleaseBuildTests.cs (2)
361version.GetString() is { Length: > 0 } sdkVersion) 388package.Value.GetString() is { Length: > 0 } version)
EmulatedReleasedBuildTests.cs (1)
250version.GetString() is { Length: > 0 } sdkVersion)
EmulatedStagingBuildTests.cs (2)
318version.GetString() is { Length: > 0 } sdkVersion) 345version.GetString() is { Length: > 0 } packageVersion)
Helpers\CaptureWorkspaceOnFailureAttribute.cs (4)
68var label = kvp.Key["CapturePath:".Length..]; 76var fileName = kvp.Key["CaptureFile:".Length..]; 100var label = kvp.Key["CapturePath:".Length..]; 109var fileName = kvp.Key["CaptureFile:".Length..];
Helpers\CliE2EAutomatorHelpers.cs (4)
180var suffixStart = markerIndex + appHostMarker.Length; 181if (markerIndex < 0 || suffixStart == formattedMessage.Length) 621if (commitSha.Length != 40) 623throw new ArgumentException($"Commit SHA must be exactly 40 characters, got {commitSha.Length}: '{commitSha}'", nameof(commitSha));
Helpers\CliE2ETestHelpers.cs (6)
848if (commit.TryGetProperty("sha", out var sha) && sha.GetString() is { Length: > 0 } value) 867var shortSha = commitSha.Length >= 8 ? commitSha[..8].ToLowerInvariant() : commitSha.ToLowerInvariant(); 895if (element.GetString() is { Length: > 0 } candidate && 1026.Select(static fileName => fileName!["Aspire.Hosting.".Length..^".nupkg".Length]) 1232internal string ShortCommit => Commit.Length >= 8 ? Commit[..8].ToLowerInvariant() : Commit.ToLowerInvariant();
RadiusPublishTests.cs (1)
143Assert.NotEmpty(radiusExtension![radiusExtensionPrefix.Length..]);
tests\Shared\CliPackageDiscovery.cs (4)
67var version = fileName[AspireCliPackagePrefix.Length..^NupkgSuffix.Length]; 74var version = fileName[AspireCliPackagePrefix.Length..^NupkgSuffix.Length];
Aspire.Cli.Tests (27)
Acquisition\PeerInstallProbeTests.cs (2)
779if (stderr.Length == 0) 800if (stderr.Length == 0)
Agents\CommonAgentApplicatorsTests.cs (4)
131description.Length <= MaxSkillDescriptionLength, 132$"Skill '{skill.Name}' description is {description.Length} characters; agent hosts such as Codex and Copilot CLI accept at most {MaxSkillDescriptionLength}."); 197var value = line[keyPrefix.Length..].Trim(); 198return value.Length >= 2 && value[0] == '"' && value[^1] == '"'
Agents\TelemetryHookScriptTests.cs (1)
454? File.ReadAllLines(capturePath).Where(line => line.Length > 0).ToArray()
Commands\DoctorCommandTests.cs (1)
1099name = name[..^suffix.Length];
Commands\McpIconHelperTests.cs (2)
34var base64Part = icon.Source.Substring("data:image/png;base64,".Length); 35Assert.True(base64Part.Length > 0, "Icon should have base64 data");
Commands\TelemetryCommandTests.cs (1)
84Assert.Equal(7, result.Length);
DotNet\DotNetCliRunnerTests.cs (1)
526var binlogPath = binlogArgument["/bl:".Length..];
Mcp\Docs\DocsCacheTests.cs (2)
103var result = new char[value.Length]; 104for (var i = 0; i < value.Length; i++)
Npm\AspireJsLauncherTests.cs (4)
200return new RidProbeCase("win32", rid["win-".Length..], false); 205return new RidProbeCase("darwin", rid["osx-".Length..], false); 210return new RidProbeCase("linux", rid["linux-musl-".Length..], true); 215return new RidProbeCase("linux", rid["linux-".Length..], false);
ProfileCaptureOptionsTests.cs (1)
53Assert.Equal(32, options.SessionId.Length);
Telemetry\AspireCliTelemetryTests.cs (1)
391if (environmentVariable.Item1.Length > 0)
tests\Shared\Logging\XunitLoggerProvider.cs (3)
78var additionalLinePrefix = "|" + new string(' ', firstLinePrefix.Length - 1); 98message = message.Substring(0, message.Length - Environment.NewLine.Length);
Utils\AppHostHelperTests.cs (2)
71Assert.Equal(11, fileName.Length); 85Assert.Equal(11, fileName.Length);
Utils\CliPathHelperTests.cs (2)
122Assert.Equal(length, key.Length); 134Assert.Equal(16, key.Length);
Aspire.Dashboard (371)
artifacts\obj\Aspire.Dashboard\Debug\net8.0\DashboardService.cs (176)
560if (ApplicationName.Length != 0) hash ^= ApplicationName.GetHashCode(); 561if (MinDashboardVersion.Length != 0) hash ^= MinDashboardVersion.GetHashCode(); 598if (ApplicationName.Length != 0) { 602if (MinDashboardVersion.Length != 0) { 616if (ApplicationName.Length != 0) { 619if (MinDashboardVersion.Length != 0) { 634if (other.ApplicationName.Length != 0) { 637if (other.MinDashboardVersion.Length != 0) { 1010if (Name.Length != 0) hash ^= Name.GetHashCode(); 1011if (DisplayName.Length != 0) hash ^= DisplayName.GetHashCode(); 1085if (Name.Length != 0) { 1089if (DisplayName.Length != 0) { 1132if (Name.Length != 0) { 1135if (DisplayName.Length != 0) { 1172if (other.Name.Length != 0) { 1175if (other.DisplayName.Length != 0) { 1513if (CommandName.Length != 0) hash ^= CommandName.GetHashCode(); 1514if (ResourceName.Length != 0) hash ^= ResourceName.GetHashCode(); 1515if (ResourceType.Length != 0) hash ^= ResourceType.GetHashCode(); 1568if (CommandName.Length != 0) { 1572if (ResourceName.Length != 0) { 1576if (ResourceType.Length != 0) { 1599if (CommandName.Length != 0) { 1602if (ResourceName.Length != 0) { 1605if (ResourceType.Length != 0) { 1627if (other.CommandName.Length != 0) { 1630if (other.ResourceName.Length != 0) { 1633if (other.ResourceType.Length != 0) { 2202if (Value.Length != 0) hash ^= Value.GetHashCode(); 2245if (Value.Length != 0) { 2267if (Value.Length != 0) { 2288if (other.Value.Length != 0) { 2504if (UniqueName.Length != 0) hash ^= UniqueName.GetHashCode(); 2544if (UniqueName.Length != 0) { 2563if (UniqueName.Length != 0) { 2582if (other.UniqueName.Length != 0) { 2780if (Name.Length != 0) hash ^= Name.GetHashCode(); 2823if (Name.Length != 0) { 2845if (Name.Length != 0) { 2866if (other.Name.Length != 0) { 3112if (FullUrl.Length != 0) hash ^= FullUrl.GetHashCode(); 3168if (FullUrl.Length != 0) { 3197if (FullUrl.Length != 0) { 3224if (other.FullUrl.Length != 0) { 3431if (DisplayName.Length != 0) hash ^= DisplayName.GetHashCode(); 3472if (DisplayName.Length != 0) { 3489if (DisplayName.Length != 0) { 3507if (other.DisplayName.Length != 0) { 3708if (Source.Length != 0) hash ^= Source.GetHashCode(); 3709if (Target.Length != 0) hash ^= Target.GetHashCode(); 3710if (MountType.Length != 0) hash ^= MountType.GetHashCode(); 3756if (Source.Length != 0) { 3760if (Target.Length != 0) { 3764if (MountType.Length != 0) { 3782if (Source.Length != 0) { 3785if (Target.Length != 0) { 3788if (MountType.Length != 0) { 3806if (other.Source.Length != 0) { 3809if (other.Target.Length != 0) { 3812if (other.MountType.Length != 0) { 4064if (Key.Length != 0) hash ^= Key.GetHashCode(); 4065if (Description.Length != 0) hash ^= Description.GetHashCode(); 4066if (Exception.Length != 0) hash ^= Exception.GetHashCode(); 4120if (Key.Length != 0) { 4124if (Description.Length != 0) { 4128if (Exception.Length != 0) { 4149if (Key.Length != 0) { 4152if (Description.Length != 0) { 4155if (Exception.Length != 0) { 4176if (other.Key.Length != 0) { 4179if (other.Description.Length != 0) { 4182if (other.Exception.Length != 0) { 4382if (ResourceName.Length != 0) hash ^= ResourceName.GetHashCode(); 4383if (Type.Length != 0) hash ^= Type.GetHashCode(); 4420if (ResourceName.Length != 0) { 4424if (Type.Length != 0) { 4438if (ResourceName.Length != 0) { 4441if (Type.Length != 0) { 4456if (other.ResourceName.Length != 0) { 4459if (other.Type.Length != 0) { 4741if (Name.Length != 0) hash ^= Name.GetHashCode(); 4799if (Name.Length != 0) { 4833if (Name.Length != 0) { 4863if (other.Name.Length != 0) { 5428if (Name.Length != 0) hash ^= Name.GetHashCode(); 5429if (ResourceType.Length != 0) hash ^= ResourceType.GetHashCode(); 5430if (DisplayName.Length != 0) hash ^= DisplayName.GetHashCode(); 5431if (Uid.Length != 0) hash ^= Uid.GetHashCode(); 5535if (Name.Length != 0) { 5539if (ResourceType.Length != 0) { 5543if (DisplayName.Length != 0) { 5547if (Uid.Length != 0) { 5604if (Name.Length != 0) { 5607if (ResourceType.Length != 0) { 5610if (DisplayName.Length != 0) { 5613if (Uid.Length != 0) { 5662if (other.Name.Length != 0) { 5665if (other.ResourceType.Length != 0) { 5668if (other.DisplayName.Length != 0) { 5671if (other.Uid.Length != 0) { 6250if (ResourceName.Length != 0) hash ^= ResourceName.GetHashCode(); 6251if (ResourceType.Length != 0) hash ^= ResourceType.GetHashCode(); 6288if (ResourceName.Length != 0) { 6292if (ResourceType.Length != 0) { 6306if (ResourceName.Length != 0) { 6309if (ResourceType.Length != 0) { 6324if (other.ResourceName.Length != 0) { 6327if (other.ResourceType.Length != 0) { 7525if (Text.Length != 0) hash ^= Text.GetHashCode(); 7568if (Text.Length != 0) { 7590if (Text.Length != 0) { 7611if (other.Text.Length != 0) { 7793if (ResourceName.Length != 0) hash ^= ResourceName.GetHashCode(); 7831if (ResourceName.Length != 0) { 7849if (ResourceName.Length != 0) { 7867if (other.ResourceName.Length != 0) { 8972if (Title.Length != 0) hash ^= Title.GetHashCode(); 8973if (Message.Length != 0) hash ^= Message.GetHashCode(); 8974if (PrimaryButtonText.Length != 0) hash ^= PrimaryButtonText.GetHashCode(); 8975if (SecondaryButtonText.Length != 0) hash ^= SecondaryButtonText.GetHashCode(); 9069if (Title.Length != 0) { 9073if (Message.Length != 0) { 9077if (PrimaryButtonText.Length != 0) { 9081if (SecondaryButtonText.Length != 0) { 9130if (Title.Length != 0) { 9133if (Message.Length != 0) { 9136if (PrimaryButtonText.Length != 0) { 9139if (SecondaryButtonText.Length != 0) { 9181if (other.Title.Length != 0) { 9184if (other.Message.Length != 0) { 9187if (other.PrimaryButtonText.Length != 0) { 9190if (other.SecondaryButtonText.Length != 0) { 9997if (LinkText.Length != 0) hash ^= LinkText.GetHashCode(); 9998if (LinkUrl.Length != 0) hash ^= LinkUrl.GetHashCode(); 10051if (LinkText.Length != 0) { 10055if (LinkUrl.Length != 0) { 10075if (LinkText.Length != 0) { 10078if (LinkUrl.Length != 0) { 10099if (other.LinkText.Length != 0) { 10102if (other.LinkUrl.Length != 0) { 10909if (Label.Length != 0) hash ^= Label.GetHashCode(); 10910if (Placeholder.Length != 0) hash ^= Placeholder.GetHashCode(); 10914if (Value.Length != 0) hash ^= Value.GetHashCode(); 10916if (Description.Length != 0) hash ^= Description.GetHashCode(); 10922if (Name.Length != 0) hash ^= Name.GetHashCode(); 10926if (FileFilter.Length != 0) hash ^= FileFilter.GetHashCode(); 11021if (Label.Length != 0) { 11025if (Placeholder.Length != 0) { 11038if (Value.Length != 0) { 11043if (Description.Length != 0) { 11067if (Name.Length != 0) { 11083if (FileFilter.Length != 0) { 11097if (Label.Length != 0) { 11100if (Placeholder.Length != 0) { 11110if (Value.Length != 0) { 11114if (Description.Length != 0) { 11132if (Name.Length != 0) { 11144if (FileFilter.Length != 0) { 11159if (other.Label.Length != 0) { 11162if (other.Placeholder.Length != 0) { 11172if (other.Value.Length != 0) { 11176if (other.Description.Length != 0) { 11194if (other.Name.Length != 0) { 11206if (other.FileFilter.Length != 0) { 11530if (FileName.Length != 0) hash ^= FileName.GetHashCode(); 11532if (InputName.Length != 0) hash ^= InputName.GetHashCode(); 11581if (FileName.Length != 0) { 11589if (InputName.Length != 0) { 11606if (FileName.Length != 0) { 11612if (InputName.Length != 0) { 11630if (other.FileName.Length != 0) { 11636if (other.InputName.Length != 0) { 11799if (FileId.Length != 0) hash ^= FileId.GetHashCode(); 11832if (FileId.Length != 0) { 11846if (FileId.Length != 0) { 11861if (other.FileId.Length != 0) {
artifacts\obj\Aspire.Dashboard\Debug\net8.0\opentelemetry\proto\collector\logs\v1\LogsService.cs (4)
584if (ErrorMessage.Length != 0) hash ^= ErrorMessage.GetHashCode(); 625if (ErrorMessage.Length != 0) { 642if (ErrorMessage.Length != 0) { 660if (other.ErrorMessage.Length != 0) {
artifacts\obj\Aspire.Dashboard\Debug\net8.0\opentelemetry\proto\collector\metrics\v1\MetricsService.cs (4)
586if (ErrorMessage.Length != 0) hash ^= ErrorMessage.GetHashCode(); 627if (ErrorMessage.Length != 0) { 644if (ErrorMessage.Length != 0) { 662if (other.ErrorMessage.Length != 0) {
artifacts\obj\Aspire.Dashboard\Debug\net8.0\opentelemetry\proto\collector\trace\v1\TraceService.cs (4)
585if (ErrorMessage.Length != 0) hash ^= ErrorMessage.GetHashCode(); 626if (ErrorMessage.Length != 0) { 643if (ErrorMessage.Length != 0) { 661if (other.ErrorMessage.Length != 0) {
artifacts\obj\Aspire.Dashboard\Debug\net8.0\opentelemetry\proto\common\v1\Common.cs (20)
1132if (Key.Length != 0) hash ^= Key.GetHashCode(); 1170if (Key.Length != 0) { 1188if (Key.Length != 0) { 1206if (other.Key.Length != 0) { 1426if (Name.Length != 0) hash ^= Name.GetHashCode(); 1427if (Version.Length != 0) hash ^= Version.GetHashCode(); 1471if (Name.Length != 0) { 1475if (Version.Length != 0) { 1494if (Name.Length != 0) { 1497if (Version.Length != 0) { 1516if (other.Name.Length != 0) { 1519if (other.Version.Length != 0) { 1757if (SchemaUrl.Length != 0) hash ^= SchemaUrl.GetHashCode(); 1758if (Type.Length != 0) hash ^= Type.GetHashCode(); 1799if (SchemaUrl.Length != 0) { 1803if (Type.Length != 0) { 1819if (SchemaUrl.Length != 0) { 1822if (Type.Length != 0) { 1839if (other.SchemaUrl.Length != 0) { 1842if (other.Type.Length != 0) {
artifacts\obj\Aspire.Dashboard\Debug\net8.0\opentelemetry\proto\logs\v1\Logs.cs (16)
470if (SchemaUrl.Length != 0) hash ^= SchemaUrl.GetHashCode(); 513if (SchemaUrl.Length != 0) { 531if (SchemaUrl.Length != 0) { 553if (other.SchemaUrl.Length != 0) { 759if (SchemaUrl.Length != 0) hash ^= SchemaUrl.GetHashCode(); 802if (SchemaUrl.Length != 0) { 820if (SchemaUrl.Length != 0) { 842if (other.SchemaUrl.Length != 0) { 1233if (SeverityText.Length != 0) hash ^= SeverityText.GetHashCode(); 1240if (EventName.Length != 0) hash ^= EventName.GetHashCode(); 1318if (SeverityText.Length != 0) { 1347if (EventName.Length != 0) { 1370if (SeverityText.Length != 0) { 1389if (EventName.Length != 0) { 1413if (other.SeverityText.Length != 0) { 1435if (other.EventName.Length != 0) {
artifacts\obj\Aspire.Dashboard\Debug\net8.0\opentelemetry\proto\metrics\v1\Metrics.cs (20)
591if (SchemaUrl.Length != 0) hash ^= SchemaUrl.GetHashCode(); 634if (SchemaUrl.Length != 0) { 652if (SchemaUrl.Length != 0) { 674if (other.SchemaUrl.Length != 0) { 880if (SchemaUrl.Length != 0) hash ^= SchemaUrl.GetHashCode(); 923if (SchemaUrl.Length != 0) { 941if (SchemaUrl.Length != 0) { 963if (other.SchemaUrl.Length != 0) { 1376if (Name.Length != 0) hash ^= Name.GetHashCode(); 1377if (Description.Length != 0) hash ^= Description.GetHashCode(); 1378if (Unit.Length != 0) hash ^= Unit.GetHashCode(); 1447if (Name.Length != 0) { 1451if (Description.Length != 0) { 1455if (Unit.Length != 0) { 1490if (Name.Length != 0) { 1493if (Description.Length != 0) { 1496if (Unit.Length != 0) { 1527if (other.Name.Length != 0) { 1530if (other.Description.Length != 0) { 1533if (other.Unit.Length != 0) {
artifacts\obj\Aspire.Dashboard\Debug\net8.0\opentelemetry\proto\trace\v1\Trace.cs (28)
459if (SchemaUrl.Length != 0) hash ^= SchemaUrl.GetHashCode(); 502if (SchemaUrl.Length != 0) { 520if (SchemaUrl.Length != 0) { 542if (other.SchemaUrl.Length != 0) { 748if (SchemaUrl.Length != 0) hash ^= SchemaUrl.GetHashCode(); 791if (SchemaUrl.Length != 0) { 809if (SchemaUrl.Length != 0) { 831if (other.SchemaUrl.Length != 0) { 1322if (TraceState.Length != 0) hash ^= TraceState.GetHashCode(); 1325if (Name.Length != 0) hash ^= Name.GetHashCode(); 1427if (TraceState.Length != 0) { 1435if (Name.Length != 0) { 1490if (TraceState.Length != 0) { 1499if (Name.Length != 0) { 1544if (other.TraceState.Length != 0) { 1553if (other.Name.Length != 0) { 1947if (Name.Length != 0) hash ^= Name.GetHashCode(); 1995if (Name.Length != 0) { 2017if (Name.Length != 0) { 2039if (other.Name.Length != 0) { 2319if (TraceState.Length != 0) hash ^= TraceState.GetHashCode(); 2380if (TraceState.Length != 0) { 2409if (TraceState.Length != 0) { 2437if (other.TraceState.Length != 0) { 2649if (Message.Length != 0) hash ^= Message.GetHashCode(); 2687if (Message.Length != 0) { 2705if (Message.Length != 0) { 2723if (other.Message.Length != 0) {
Components\Controls\Chart\ChartContainer.razor.cs (2)
233{ Length: 0 } => Loc[nameof(ControlsStrings.LabelEmpty)], 280var id = newTab.Id?.Substring("tab-".Length);
Components\Controls\StructuredLogDetails.razor.cs (1)
181for (var i = 0; i < value.Length; i++)
Components\Dialogs\FilterDialog.razor.cs (1)
217if (_formModel.Value is { Length: > 0 } value)
Components\Dialogs\GenAIVisualizerDialog.razor.cs (2)
199var id = newTab.Id?.Substring("tab-overview-".Length); 218var id = newTab.Id?.Substring("tab-message-".Length);
Components\Interactions\InteractionsProvider.cs (2)
594if (interaction.PrimaryButtonText is { Length: > 0 } primaryText) 613return interaction.SecondaryButtonText is { Length: > 0 } secondaryText
Components\Pages\Resources.razor.cs (3)
667if (current.GetResourcePropertyValue(KnownProperties.Resource.ParentName) is { Length: > 0 } value) 838var id = newTab.Id?.Substring("tab-".Length); 923&& (TextFilter.Length == 0 || resource.MatchesFilter(TextFilter))
Configuration\PostConfigureDashboardOptions.cs (1)
43if (_configuration[DashboardConfigNames.DashboardFrontendUrlName.ConfigKey] is { Length: > 0 } frontendUrls)
DashboardWebApplication.cs (1)
587if (AssemblyVersionHelper.GetInformationalVersion(typeof(DashboardWebApplication).Assembly) is { Length: > 0 } informationalVersion)
Extensions\StringExtensions.cs (1)
13var sanitizedBuilder = new StringBuilder(capacity: input.Length);
Model\ConnectionStringParser.cs (9)
154if (builder.TryGetValue(alias, out var value) && Convert.ToString(value, CultureInfo.InvariantCulture) is { Length: > 0 } parsedDatabaseName) 191? connectionString[jdbcPrefix.Length..] 200if (escapedDatabaseName.Length == 0 || escapedDatabaseName.Contains('/')) 206return databaseName.Length > 0; 374if ((afterBracket.StartsWith(':') || afterBracket.StartsWith(',')) && afterBracket.Length > 1) 445if (colonIndex > 0 && colonIndex < value.Length - 1) 522if (equalIndex > 0 && equalIndex < trimmedPart.Length - 1) 548if (splitIndex > 0 && splitIndex < token.Length - 1) 573(connectionString.Length > 2 && connectionString[1] == ':' && char.IsLetter(connectionString[0])))
Model\GenAI\GenAIHelpers.cs (1)
39return attributes.GetValueWithFallback(GenAISystem, GenAIProviderName) is { Length: > 0 };
Model\GenAI\GenAIVisualizerDialogViewModel.cs (1)
468var remainder = attr.Key.AsSpan(prefix.Length);
Model\Interaction\InputViewModel.cs (1)
82if (Value is not { Length: > 0 } value)
Model\Markdown\HighlightedCodeBlockRenderer.cs (1)
58if (obj is FencedCodeBlock fencedCode && fencedCode.Info is { Length: > 0 } info)
Model\Otlp\FilterDialogFormModel.cs (1)
32if (Value is { Length: > 0 } v &&
Model\ResourceViewModel.cs (2)
325return DisplayDescription is { Length: > 0 } ? DisplayDescription : null; 405if (value.Length > 12)
Model\SpanType.cs (3)
167if (span.Scope.Name.Length == scopePrefix.Length) 172if (span.Scope.Name[scopePrefix.Length] == '.')
Model\StructureLogsDetailsViewModel.cs (1)
15if (OtlpHelpers.GetEventName(logEntry) is { Length: > 0 } eventName)
Model\TelemetryExportService.cs (1)
738DisplayName = u.DisplayProperties.DisplayName is { Length: > 0 } n ? n : null,
Model\TextVisualizerViewModel.cs (2)
281while (index < input.Length && char.IsWhiteSpace(input[index.Value])) 286if (index == input.Length)
Otlp\Model\MetricValues\DimensionScope.cs (1)
28Name = name != null && name.Length > 0 ? name : NoDimensions;
Otlp\Model\OtlpHelpers.cs (3)
451if (incomingId.Length >= ShortenedIdLength) 503if (GetValue(logEntry.Attributes, "event.name") is { Length: > 0 } eventName) 508if (GetValue(logEntry.Attributes, "logrecord.event.name") is { Length: > 0 } logRecordEventName)
Otlp\Model\OtlpLogEntry.cs (3)
152if (GetProperty(logEntry, ExceptionStackTraceField) is { Length: > 0 } stackTrace) 157if (GetProperty(logEntry, ExceptionMessageField) is { Length: > 0 } message) 159if (GetProperty(logEntry, ExceptionTypeField) is { Length: > 0 } type)
Otlp\Model\OtlpScope.cs (1)
21Name = name is { Length: > 0 } ? name : UnknownScopeName;
Otlp\Model\OtlpSpan.cs (1)
178if (span.Attributes.GetValueWithFallback("http.request.method", "http.method") is { Length: > 0 } httpMethod)
Otlp\Model\OtlpUnits.cs (5)
39for (int i = 0; i < updatedUnit.Length; i++) 44if (i == updatedUnit.Length - 1) 49updatedPerUnit = MapUnit(updatedUnit.AsSpan(0, i)) + " per " + MapPerUnit(updatedUnit.AsSpan(i + 1, updatedUnit.Length - i - 1)); 69for (var i = 0; i < unit.Length; i++) 97sb!.Append(unit, lastWriteIndex, unit.Length - lastWriteIndex);
Otlp\Model\Serialization\OtlpJsonProtobufConverter.cs (2)
869if (hex.Length % 2 != 0) 875var bytes = new byte[hex.Length / 2];
Otlp\Storage\ResourceKey.cs (11)
21if (instanceId.Length >= name.Length + 2 && 23instanceId[name.Length] == '-') 25return new ResourceKey(name, instanceId.Substring(name.Length + 1)); 71if (name.Length != Name.Length + InstanceId.Length + 1) 76if (!name.AsSpan(0, Name.Length).Equals(Name, StringComparisons.ResourceName)) 80if (name[Name.Length] != '-') 84if (!name.AsSpan(Name.Length + 1, InstanceId.Length).Equals(InstanceId, StringComparisons.ResourceName))
ServiceClient\DashboardClient.cs (1)
1145if (informationalVersion is not { Length: > 0 })
src\Shared\ConsoleLogs\AnsiParser.cs (5)
35while (currentPos < text.Length) 56outputBuilder ??= new StringBuilder(text.Length); 86var outputBuilder = new StringBuilder(text.Length * 2); 167if (i < text.Length - 1) 175textLength = text.Length - textStartIndex;
src\Shared\ConsoleLogs\UrlParser.cs (2)
27builder ??= new StringBuilder(text.Length * 2); 44if (nextCharIndex < text.Length)
src\Shared\Export\ExportArchive.cs (1)
132var sanitized = new StringBuilder(name.Length);
src\Shared\FormatHelpers.cs (2)
114if (text.Length <= maxLength) 119return string.Concat(text.AsSpan(0, maxLength - Ellipsis.Length), Ellipsis);
src\Shared\IConfigurationExtensions.cs (2)
51if (primaryValue is not null && !fallbackOnEmpty || primaryValue is { Length: > 0 }) 57if (secondaryValue is not null && !fallbackOnEmpty || secondaryValue is { Length: > 0 })
src\Shared\Otlp\OtlpHelpers.cs (8)
40return value.Length > maxLength ? value[..maxLength] : value; 165return value.Length == resourceName.Length + instanceId.Length + 1 166&& value.AsSpan(0, resourceName.Length).Equals(resourceName, StringComparisons.ResourceName) 167&& value[resourceName.Length] == '-' 168&& value.AsSpan(resourceName.Length + 1, instanceId.Length).Equals(instanceId, StringComparisons.ResourceName);
src\Shared\SearchTextParser.cs (5)
166if (value.Length > 0) 229if (fragment.Length > 0) 274if (value.Length > 0) 290if (fragment.Length > 0) 308if (fragment.Length > 0)
src\Shared\StringUtils.cs (1)
42? value[..^suffix.Length]
Utils\BrowserStorageKeys.cs (1)
38var builder = new StringBuilder(applicationName.Length);
Utils\DashboardUIHelpers.cs (2)
82static string Repeat(string s, int n) => new StringBuilder(s.Length * n) 111return value is { Length: > TooltipLengthThreshold } ? value : null;
Utils\GlobalizationHelpers.cs (1)
42return culture.Name is { Length: > 0 } languageName ? languageName : DefaultHtmlLanguageName;
Utils\UrlValidationHelper.cs (3)
35if (url.Length == 1) 50if (url[0] == '~' && url.Length > 1 && url[1] == '/') 53if (url.Length == 2)
Utils\VersionHelpers.cs (1)
27if (lastSpace >= 0 && lastSpace < description.Length - 1)
Aspire.Dashboard.Components.Tests (4)
Controls\LogViewerTests.cs (1)
460return declaration[propertyPrefix.Length..].Trim();
tests\Shared\Logging\XunitLoggerProvider.cs (3)
78var additionalLinePrefix = "|" + new string(' ', firstLinePrefix.Length - 1); 98message = message.Substring(0, message.Length - Environment.NewLine.Length);
Aspire.Dashboard.Tests (4)
Integration\Playwright\AccessibilityTests.cs (1)
524: value.Length <= maxLength ? value : string.Concat(value.AsSpan(0, maxLength), "…");
tests\Shared\Logging\XunitLoggerProvider.cs (3)
78var additionalLinePrefix = "|" + new string(' ', firstLinePrefix.Length - 1); 98message = message.Substring(0, message.Length - Environment.NewLine.Length);
Aspire.Deployment.EndToEnd.Tests (18)
AcaDeploymentErrorOutputTests.cs (2)
138output.WriteLine($"Captured {deployOutput.Length} characters of deploy output"); 140output.WriteLine(deployOutput.Length > 2000 ? deployOutput[^2000..] : deployOutput);
AcaExistingRegistryDeploymentTests.cs (1)
63if (acrName.Length > 50)
AksStarterDeploymentTests.cs (1)
60if (acrName.Length < 5)
AksStarterWithRedisHelmDeploymentTests.cs (1)
62if (acrName.Length < 5)
AuthenticationTests.cs (2)
78output.WriteLine($" Using OIDC authentication (Client ID: {clientId?[..Math.Min(8, clientId?.Length ?? 0)]}...)"); 99Assert.True(rgName.Length <= 90, "Resource group name must be <= 90 characters");
AzureResourceScopeDeploymentTests.cs (2)
186var version = line[sdkDirectivePrefix.Length..].Trim(); 202insertionIndex = content.Length;
Helpers\AzureAuthenticationHelpers.cs (2)
116? runId[..Math.Min(8, runId.Length)] 157if (part.Length == 14 && long.TryParse(part, out _))
KubernetesGatewayTlsDeploymentTests.cs (1)
63if (acrName.Length < 5)
KubernetesHelmChartDeploymentTests.cs (1)
58if (acrName.Length < 5)
RadiusStarterDeploymentTests.cs (1)
72if (acrName.Length < 5)
tests\Shared\CliPackageDiscovery.cs (4)
67var version = fileName[AspireCliPackagePrefix.Length..^NupkgSuffix.Length]; 74var version = fileName[AspireCliPackagePrefix.Length..^NupkgSuffix.Length];
Aspire.EndToEnd.Tests (1)
tests\Shared\TemplatesTesting\AspireProject.cs (1)
224InfoTable = ProjectInfo.Parse(line.Substring("$ENDPOINTS: ".Length));
Aspire.Hosting (273)
ApplicationModel\ContainerFileSystemCallbackAnnotation.cs (1)
156var relativePath = file.Substring(fullPath.Length + 1);
ApplicationModel\ExpressionResolver.cs (1)
43var value = expr.Format.Length == 0 ? null : string.Format(CultureInfo.InvariantCulture, expr.Format, args);
ApplicationModel\ModelName.cs (6)
74if (maxLength is not null && (name.Length < 1 || name.Length > maxLength.Value)) 83for (var i = 0; i < name.Length; i++) 106if (validateStartsWithLetter && name.Length > 0 && !IsAsciiLetter(name[0])) 112if (validateNoTrailingHyphen && name.Length > 0 && name[name.Length - 1] == '-')
ApplicationModel\ProjectLaunchArgsOverrideAnnotation.cs (1)
74if (leadingResourceArgumentToRemove is not null && leadingResourceArgumentToRemove.Length == 0)
ApplicationModel\ReferenceExpression.cs (6)
199if (Format.Length == 0) 269baseName = sanitized.Length > 0 ? $"cond-{sanitized}" : "cond-expr"; 296var builder = new StringBuilder(expression.Length); 448var sb = new StringBuilder(input.Length + 4); 450for (var i = 0; i < input.Length; i++) 476idx + 1 < s.Length && s[idx + 1] == s[idx];
ApplicationModel\ResourceCommandService.cs (2)
418if (annotation.Progress is not { Message: { Length: > 0 } } progressOptions) 623if (value.Length > maxLength)
ApplicationModel\ResourceNotificationService.cs (2)
133re => re.Snapshot.State?.Text is { Length: > 0 } stateText && targetStates.Contains(stateText, StringComparers.ResourceState), 890if (_logger.IsEnabled(LogLevel.Debug) && newState.State?.Text is { Length: > 0 } newStateText && !string.IsNullOrWhiteSpace(newStateText))
artifacts\obj\Aspire.Hosting\Debug\net8.0\Dashboard\proto\DashboardService.cs (176)
560if (ApplicationName.Length != 0) hash ^= ApplicationName.GetHashCode(); 561if (MinDashboardVersion.Length != 0) hash ^= MinDashboardVersion.GetHashCode(); 598if (ApplicationName.Length != 0) { 602if (MinDashboardVersion.Length != 0) { 616if (ApplicationName.Length != 0) { 619if (MinDashboardVersion.Length != 0) { 634if (other.ApplicationName.Length != 0) { 637if (other.MinDashboardVersion.Length != 0) { 1010if (Name.Length != 0) hash ^= Name.GetHashCode(); 1011if (DisplayName.Length != 0) hash ^= DisplayName.GetHashCode(); 1085if (Name.Length != 0) { 1089if (DisplayName.Length != 0) { 1132if (Name.Length != 0) { 1135if (DisplayName.Length != 0) { 1172if (other.Name.Length != 0) { 1175if (other.DisplayName.Length != 0) { 1513if (CommandName.Length != 0) hash ^= CommandName.GetHashCode(); 1514if (ResourceName.Length != 0) hash ^= ResourceName.GetHashCode(); 1515if (ResourceType.Length != 0) hash ^= ResourceType.GetHashCode(); 1568if (CommandName.Length != 0) { 1572if (ResourceName.Length != 0) { 1576if (ResourceType.Length != 0) { 1599if (CommandName.Length != 0) { 1602if (ResourceName.Length != 0) { 1605if (ResourceType.Length != 0) { 1627if (other.CommandName.Length != 0) { 1630if (other.ResourceName.Length != 0) { 1633if (other.ResourceType.Length != 0) { 2202if (Value.Length != 0) hash ^= Value.GetHashCode(); 2245if (Value.Length != 0) { 2267if (Value.Length != 0) { 2288if (other.Value.Length != 0) { 2504if (UniqueName.Length != 0) hash ^= UniqueName.GetHashCode(); 2544if (UniqueName.Length != 0) { 2563if (UniqueName.Length != 0) { 2582if (other.UniqueName.Length != 0) { 2780if (Name.Length != 0) hash ^= Name.GetHashCode(); 2823if (Name.Length != 0) { 2845if (Name.Length != 0) { 2866if (other.Name.Length != 0) { 3112if (FullUrl.Length != 0) hash ^= FullUrl.GetHashCode(); 3168if (FullUrl.Length != 0) { 3197if (FullUrl.Length != 0) { 3224if (other.FullUrl.Length != 0) { 3431if (DisplayName.Length != 0) hash ^= DisplayName.GetHashCode(); 3472if (DisplayName.Length != 0) { 3489if (DisplayName.Length != 0) { 3507if (other.DisplayName.Length != 0) { 3708if (Source.Length != 0) hash ^= Source.GetHashCode(); 3709if (Target.Length != 0) hash ^= Target.GetHashCode(); 3710if (MountType.Length != 0) hash ^= MountType.GetHashCode(); 3756if (Source.Length != 0) { 3760if (Target.Length != 0) { 3764if (MountType.Length != 0) { 3782if (Source.Length != 0) { 3785if (Target.Length != 0) { 3788if (MountType.Length != 0) { 3806if (other.Source.Length != 0) { 3809if (other.Target.Length != 0) { 3812if (other.MountType.Length != 0) { 4064if (Key.Length != 0) hash ^= Key.GetHashCode(); 4065if (Description.Length != 0) hash ^= Description.GetHashCode(); 4066if (Exception.Length != 0) hash ^= Exception.GetHashCode(); 4120if (Key.Length != 0) { 4124if (Description.Length != 0) { 4128if (Exception.Length != 0) { 4149if (Key.Length != 0) { 4152if (Description.Length != 0) { 4155if (Exception.Length != 0) { 4176if (other.Key.Length != 0) { 4179if (other.Description.Length != 0) { 4182if (other.Exception.Length != 0) { 4382if (ResourceName.Length != 0) hash ^= ResourceName.GetHashCode(); 4383if (Type.Length != 0) hash ^= Type.GetHashCode(); 4420if (ResourceName.Length != 0) { 4424if (Type.Length != 0) { 4438if (ResourceName.Length != 0) { 4441if (Type.Length != 0) { 4456if (other.ResourceName.Length != 0) { 4459if (other.Type.Length != 0) { 4741if (Name.Length != 0) hash ^= Name.GetHashCode(); 4799if (Name.Length != 0) { 4833if (Name.Length != 0) { 4863if (other.Name.Length != 0) { 5428if (Name.Length != 0) hash ^= Name.GetHashCode(); 5429if (ResourceType.Length != 0) hash ^= ResourceType.GetHashCode(); 5430if (DisplayName.Length != 0) hash ^= DisplayName.GetHashCode(); 5431if (Uid.Length != 0) hash ^= Uid.GetHashCode(); 5535if (Name.Length != 0) { 5539if (ResourceType.Length != 0) { 5543if (DisplayName.Length != 0) { 5547if (Uid.Length != 0) { 5604if (Name.Length != 0) { 5607if (ResourceType.Length != 0) { 5610if (DisplayName.Length != 0) { 5613if (Uid.Length != 0) { 5662if (other.Name.Length != 0) { 5665if (other.ResourceType.Length != 0) { 5668if (other.DisplayName.Length != 0) { 5671if (other.Uid.Length != 0) { 6250if (ResourceName.Length != 0) hash ^= ResourceName.GetHashCode(); 6251if (ResourceType.Length != 0) hash ^= ResourceType.GetHashCode(); 6288if (ResourceName.Length != 0) { 6292if (ResourceType.Length != 0) { 6306if (ResourceName.Length != 0) { 6309if (ResourceType.Length != 0) { 6324if (other.ResourceName.Length != 0) { 6327if (other.ResourceType.Length != 0) { 7525if (Text.Length != 0) hash ^= Text.GetHashCode(); 7568if (Text.Length != 0) { 7590if (Text.Length != 0) { 7611if (other.Text.Length != 0) { 7793if (ResourceName.Length != 0) hash ^= ResourceName.GetHashCode(); 7831if (ResourceName.Length != 0) { 7849if (ResourceName.Length != 0) { 7867if (other.ResourceName.Length != 0) { 8972if (Title.Length != 0) hash ^= Title.GetHashCode(); 8973if (Message.Length != 0) hash ^= Message.GetHashCode(); 8974if (PrimaryButtonText.Length != 0) hash ^= PrimaryButtonText.GetHashCode(); 8975if (SecondaryButtonText.Length != 0) hash ^= SecondaryButtonText.GetHashCode(); 9069if (Title.Length != 0) { 9073if (Message.Length != 0) { 9077if (PrimaryButtonText.Length != 0) { 9081if (SecondaryButtonText.Length != 0) { 9130if (Title.Length != 0) { 9133if (Message.Length != 0) { 9136if (PrimaryButtonText.Length != 0) { 9139if (SecondaryButtonText.Length != 0) { 9181if (other.Title.Length != 0) { 9184if (other.Message.Length != 0) { 9187if (other.PrimaryButtonText.Length != 0) { 9190if (other.SecondaryButtonText.Length != 0) { 9997if (LinkText.Length != 0) hash ^= LinkText.GetHashCode(); 9998if (LinkUrl.Length != 0) hash ^= LinkUrl.GetHashCode(); 10051if (LinkText.Length != 0) { 10055if (LinkUrl.Length != 0) { 10075if (LinkText.Length != 0) { 10078if (LinkUrl.Length != 0) { 10099if (other.LinkText.Length != 0) { 10102if (other.LinkUrl.Length != 0) { 10909if (Label.Length != 0) hash ^= Label.GetHashCode(); 10910if (Placeholder.Length != 0) hash ^= Placeholder.GetHashCode(); 10914if (Value.Length != 0) hash ^= Value.GetHashCode(); 10916if (Description.Length != 0) hash ^= Description.GetHashCode(); 10922if (Name.Length != 0) hash ^= Name.GetHashCode(); 10926if (FileFilter.Length != 0) hash ^= FileFilter.GetHashCode(); 11021if (Label.Length != 0) { 11025if (Placeholder.Length != 0) { 11038if (Value.Length != 0) { 11043if (Description.Length != 0) { 11067if (Name.Length != 0) { 11083if (FileFilter.Length != 0) { 11097if (Label.Length != 0) { 11100if (Placeholder.Length != 0) { 11110if (Value.Length != 0) { 11114if (Description.Length != 0) { 11132if (Name.Length != 0) { 11144if (FileFilter.Length != 0) { 11159if (other.Label.Length != 0) { 11162if (other.Placeholder.Length != 0) { 11172if (other.Value.Length != 0) { 11176if (other.Description.Length != 0) { 11194if (other.Name.Length != 0) { 11206if (other.FileFilter.Length != 0) { 11530if (FileName.Length != 0) hash ^= FileName.GetHashCode(); 11532if (InputName.Length != 0) hash ^= InputName.GetHashCode(); 11581if (FileName.Length != 0) { 11589if (InputName.Length != 0) { 11606if (FileName.Length != 0) { 11612if (InputName.Length != 0) { 11630if (other.FileName.Length != 0) { 11636if (other.InputName.Length != 0) { 11799if (FileId.Length != 0) hash ^= FileId.GetHashCode(); 11832if (FileId.Length != 0) { 11846if (FileId.Length != 0) { 11861if (other.FileId.Length != 0) {
Backchannel\AuxiliaryBackchannelRpcTarget.cs (2)
1238valueTask.Result is { Length: > 0 } value) 1247if (parameter.ValueInternal is { Length: > 0 } value)
ContainerResourceBuilderExtensions.cs (1)
454var digest = parsedReference.Digest[prefix.Length..];
Dashboard\DashboardEventHandlers.cs (8)
94if (entryAssembly?.Location is null or { Length: 0 }) 316? fileName.Substring(0, fileName.Length - 4) 646&& configuration["AppHost:ResourceService:ApiKey"] is { Length: > 0 } resourceServiceApiKey) 686if (configuration["DEBUG_SESSION_PORT"] is { Length: > 0 } sessionPort) 700if (configuration["DEBUG_SESSION_TOKEN"] is { Length: > 0 } sessionToken) 704if (configuration[KnownConfigNames.DcpInstanceIdPrefix] is { Length: > 0 } sessionDcpInstanceIdPrefix) 712if (configuration["DEBUG_SESSION_SERVER_CERTIFICATE"] is { Length: > 0 } sessionCertificate) 965var categoryTrimmed = category["Aspire.Dashboard.".Length..];
Dashboard\DashboardService.cs (2)
372var resolvedContent = content.Length > LogMaxBatchCharacters 379currentChars += resolvedContent.Length;
Dashboard\InteractionFileUploadStore.cs (1)
307if (fileReferences[i] is not { Id.Length: > 0 } fileReference)
Dcp\ContainerCreator.cs (1)
127var shortApplicationName = _normalizedApplicationName.Length < 32 ? _normalizedApplicationName : _normalizedApplicationName.Substring(0, 32);
Dcp\DcpExecutor.cs (1)
361for (var i = 0; i < applicationName.Length; i++)
Dcp\DcpLogParser.cs (2)
209if (sb.Length > SystemLogPrefix.Length || hasAddedField) 230if (sb.Length > SystemLogPrefix.Length)
Dcp\DcpOptions.cs (1)
354if (configuration[KnownConfigNames.ProxylessEndpointPortRange] is not { Length: > 0 } configuredRange)
Dcp\Model\ModelCommon.cs (1)
238if (candidate.Length > 253)
Dcp\Process\ProcessUtil.cs (2)
195if (argument.Length > 0 && !argument.Any(static c => char.IsWhiteSpace(c) || c == '"')) 200var builder = new StringBuilder(argument.Length + 2);
Dcp\ResourceLogSource.cs (5)
200var prefixLength = line.Length - timestampParseResult.Value.ModifiedText.Length; 210if (text.Length == 0) 215var endIndex = text[^1] == '\r' ? text.Length - 1 : text.Length;
Diagnostics\ProfilingTelemetry.cs (1)
737return configuration?[name] is { Length: > 0 } value
DistributedApplicationLifecycle.cs (2)
44if (AssemblyVersionHelper.GetInformationalVersion(GetType().Assembly) is { Length: > 0 } informationalVersion) 57if (localeOverrideContext.OverrideErrorMessage is { Length: > 0 } localOverrideError)
InteractionService.cs (1)
596if (value.Length > maxLength)
Lifecycle\TerminalHostEventingSubscriber.cs (2)
144for (var i = 0; i < raw.Length; i++) 150if (c == '\\' && i + 1 < raw.Length && (raw[i + 1] == '"' || raw[i + 1] == '\\'))
Lifecycle\TerminalHostOrphanCleanupService.cs (1)
490return value.Length > 0 ? value : null;
Orchestrator\ApplicationOrchestrator.cs (2)
398Span<char> suffixSpan = stackalloc char[suffix.Length + 1]; 487if (primaryPath.StartsWith('/') && primaryPath.Length > 1)
Orchestrator\ParameterProcessor.cs (3)
437var shouldSave = arguments[SaveToUserSecretsName].Value is { Length: > 0 } sv && 451deleteFromUserSecretsInput.Value is { Length: > 0 } deleteInputValue && 541if (parameterResource.Secret && value is { Length: > 0 } && SecretRedactionHistory is { } history)
Publishing\ContainerRuntimeBase.cs (2)
123_logger.LogDebug("Password length being passed to stdin: {PasswordLength}", password?.Length ?? 0); 518if (trimmed.Length == 0)
Publishing\ManifestPublishingContext.cs (2)
814var builder = new StringBuilder(format.Length); 832return sanitized.Length > 0 ? sanitized : "formatted";
src\Shared\BackchannelConstants.cs (8)
168if (appHostPath.Length >= 2 && appHostPath[1] == ':' && char.IsLetter(appHostPath[0])) 369var afterPrefix = fileName[$"{SocketPrefix}.".Length..]; 377var afterPrefix = fileName["aux.sock.".Length..]; 617var suffix = fileName[(prefixFileName.Length + 1)..]; 636if (fileName.Length == CompactAppHostIdLength && IsBase64UrlIdentifier(fileName)) 643if (fileName.Length <= pidSeparatorIndex || 668if (appHostId.Length != CompactAppHostIdLength || !IsBase64UrlIdentifier(appHostId)) 713return hex[..Math.Min(length, hex.Length)];
src\Shared\CommandLineArgsParser.cs (7)
39for (int i = 0; i < arguments.Length; i++) 41while (i < arguments.Length && (arguments[i] == ' ' || arguments[i] == '\t')) 46if (i == arguments.Length) 60while (i < arguments.Length) 64while (i < arguments.Length && arguments[i] == '\\') 72if (i >= arguments.Length || arguments[i] != '"') 101if (inQuotes && i < arguments.Length - 1 && arguments[i + 1] == '"')
src\Shared\ConsoleLogs\AnsiParser.cs (5)
35while (currentPos < text.Length) 56outputBuilder ??= new StringBuilder(text.Length); 86var outputBuilder = new StringBuilder(text.Length * 2); 167if (i < text.Length - 1) 175textLength = text.Length - textStartIndex;
src\Shared\EnvironmentVariableNameEncoder.cs (1)
30var builder = new StringBuilder(name.Length + 1);
src\Shared\IConfigurationExtensions.cs (2)
51if (primaryValue is not null && !fallbackOnEmpty || primaryValue is { Length: > 0 }) 57if (secondaryValue is not null && !fallbackOnEmpty || secondaryValue is { Length: > 0 })
src\Shared\PathNormalizer.cs (5)
55if (path.Length < 3 || path[1] != ':' || path[2] != Path.DirectorySeparatorChar) 154var relative = fullPath[root.Length..]; 187if (linkTarget?.FullName is { Length: > 0 } resolved) 242var relative = fullPath[root.Length..]; 276if (linkTarget?.FullName is { Length: > 0 } resolved)
src\Shared\ProcessStartTimeHelper.cs (1)
362if (closeParenIndex < 0 || closeParenIndex + 2 >= contents.Length)
src\Shared\StringUtils.cs (1)
42? value[..^suffix.Length]
src\Shared\TerminalHost\TerminalHostPaths.cs (2)
157var candidate = fileName.AsSpan(0, fileName.Length - extension.Length);
src\Shared\X509Certificate2Extensions.cs (1)
52if ((byteArray.Length == AspNetHttpsOidFriendlyName.Length && byteArray[0] == (byte)'A') || byteArray.Length == 0)
VolumeNameGenerator.cs (2)
39return string.Create(name.Length, name, static (s, name) => 55for (var i = 0; i < value.Length; i++)
Aspire.Hosting.Analyzers (6)
src\Aspire.Hosting\ApplicationModel\ModelName.cs (6)
74if (maxLength is not null && (name.Length < 1 || name.Length > maxLength.Value)) 83for (var i = 0; i < name.Length; i++) 106if (validateStartsWithLetter && name.Length > 0 && !IsAsciiLetter(name[0])) 112if (validateNoTrailingHyphen && name.Length > 0 && name[name.Length - 1] == '-')
Aspire.Hosting.Analyzers.Tests (1)
AnalyzerTest.cs (1)
51.GetCustomAttribute<TargetFrameworkAttribute>()!.FrameworkName[".NETCoreApp,Version=v".Length..];
Aspire.Hosting.Azure (59)
AcrLoginService.cs (3)
83registryEndpoint, aadToken.Token.Length); 96_logger.LogDebug("ACR refresh token acquired, length: {TokenLength}", refreshToken.Length); 174var truncatedBody = responseBody.Length <= 1000 ? responseBody : responseBody[..1000] + "…";
AzureEnvironmentResource.cs (1)
306? type["Microsoft.".Length..]
AzureProvisioningController.cs (12)
2533if (section.Data[BicepProvisioner.DeploymentStateProvisioningStateKey]?.GetValue<string>() is { Length: > 0 } provisioningState) 2745if (section.Data[LocationOverrideKey]?.GetValue<string>() is { Length: > 0 } locationOverride) 2764if (section.Data[LocationOverrideKey]?.GetValue<string>() is { Length: > 0 } locationOverride) 2918return [.. resourceIds.OrderByDescending(static resourceId => resourceId.Length)]; 3092=> section.Data["Id"]?.GetValue<string>() is { Length: > 0 } deploymentId ? deploymentId : null; 3124parameterLocation?.ToString() is { Length: > 0 } parameterLocationValue && 3157if (section.Data["Parameters"]?.GetValue<string>() is not { Length: > 0 } parametersJson) 3188=> section.Data[LocationOverrideKey]?.GetValue<string>() is { Length: > 0 } locationOverride ? locationOverride : null; 3221Span<char> buffer = stackalloc char[location.Length]; 3393if (section.Data["Outputs"]?.GetValue<string>() is not { Length: > 0 } outputsJson) 3512if (section.Data[LocationOverrideKey]?.GetValue<string>() is { Length: > 0 } locationOverride) 3519if (section.Data["Parameters"]?.GetValue<string>() is not { Length: > 0 } parametersJson)
AzureProvisioningFailureDetails.cs (2)
761var valueStart = markerIndex + marker.Length; 762if (valueStart >= message.Length)
Provisioning\BicepUtilities.cs (2)
171if (section.Data[DeploymentStateParametersKey]?.GetValue<string>() is not { Length: > 0 } jsonString) 179var scope = section.Data[DeploymentStateScopeKey]?.GetValue<string>() is { Length: > 0 } scopeString
Provisioning\Internal\BaseProvisioningContextProvider.cs (1)
64if (string.IsNullOrWhiteSpace(name) || name.Length > 90)
Provisioning\Internal\DefaultArmClientProvider.cs (3)
357operation.TargetResource?.Id is { Length: > 0 } resourceId) 404operationDetails.TargetResource?.Id is { Length: > 0 } nestedDeploymentId && 496if (separator <= 0 || separator == resourceType.Length - 1)
Provisioning\Internal\DefaultAzurePrincipalProvider.cs (4)
51switch (part.Length % 4) 128if (GetRootString(root, "upn") is { Length: > 0 } upn) 133if (GetRootString(root, "email") is { Length: > 0 } email) 138if (isAppOnly && GetRootString(root, "app_displayname") is { Length: > 0 } appDisplayName)
Provisioning\Internal\PublishModeProvisioningContextProvider.cs (2)
50var maxApplicationNameSize = ResourceGroupNameHelpers.MaxResourceGroupNameLength - prefix.Length - 1; // extra '-' 53if (normalizedApplicationName.Length > maxApplicationNameSize)
Provisioning\Internal\RunModeProvisioningContextProvider.cs (7)
57var maxApplicationNameSize = ResourceGroupNameHelpers.MaxResourceGroupNameLength - prefix.Length - suffix.Length - 2; // extra '-'s 60if (normalizedApplicationName.Length > maxApplicationNameSize) 237if (data["Location"]?.GetValue<string>() is { Length: > 0 } location) 242if (data["SubscriptionId"]?.GetValue<string>() is { Length: > 0 } subscriptionId) 247if (data["ResourceGroup"]?.GetValue<string>() is { Length: > 0 } resourceGroup) 252if (data["TenantId"]?.GetValue<string>() is { Length: > 0 } tenantId)
Provisioning\Provisioners\BicepProvisioner.cs (15)
60if (stateSection.Data[DeploymentStateProvisioningStateKey]?.GetValue<string>() is { Length: > 0 } provisioningState && 84if (stateSection.Data[BicepUtilities.DeploymentStateOutputsKey]?.GetValue<string>() is { Length: > 0 } outputJson) 119if (stateSection.Data[BicepUtilities.DeploymentStateIdKey]?.GetValue<string>() is { Length: > 0 } configuredDeploymentId && 187stateSection.Data[BicepUtilities.DeploymentStateIdKey]?.GetValue<string>() is not { Length: > 0 } deploymentId || 358stateSection.Data[BicepUtilities.DeploymentStateChecksumKey]?.GetValue<string>() is not { Length: > 0 } checksum) 476if (stateSection.Data[key]?.GetValue<string>() is not { Length: > 0 } json) 1215{ ResourceName.Length: > 0, ResourceType.Length: > 0 } target => $"{target.ResourceName} ({target.ResourceType})", 1216{ ResourceName.Length: > 0 } target => target.ResourceName, 1217{ ResourceType.Length: > 0 } target => target.ResourceType, 1218{ Id.Length: > 0 } target => target.Id, 1464section.Data[key]?.GetValue<string>() is { Length: > 0 } value ? value : null; 1468if (section.Data[AzureProvisioningController.LocationOverrideKey]?.GetValue<string>() is { Length: > 0 } locationOverride) 1473if (section.Data[BicepUtilities.DeploymentStateParametersKey]?.GetValue<string>() is { Length: > 0 } parametersJson) 1477if (JsonNode.Parse(parametersJson)?[AzureBicepResource.KnownParameters.Location]?["value"]?.GetValue<string>() is { Length: > 0 } configuredLocation)
src\Aspire.Hosting\Dcp\Process\ProcessUtil.cs (2)
195if (argument.Length > 0 && !argument.Any(static c => char.IsWhiteSpace(c) || c == '"')) 200var builder = new StringBuilder(argument.Length + 2);
src\Shared\StringUtils.cs (1)
42? value[..^suffix.Length]
Utils\ResourceGroupNameHelpers.cs (4)
22var stringBuilder = new StringBuilder(capacity: resourceGroupName.Length); 24for (var i = 0; i < resourceGroupName.Length; i++) 42var stringBuilder = new StringBuilder(capacity: normalizedString.Length); 44for (var i = 0; i < normalizedString.Length; i++)
Aspire.Hosting.Azure.AppContainers (6)
AzureContainerAppExtensions.cs (6)
231var lengthStart = separatorIndex + TakeSeparator.Length; 232if (separatorIndex >= TakePrefix.Length && 234normalizedExpression.AsSpan(lengthStart, normalizedExpression.Length - lengthStart - 1), 237var value = normalizedExpression[TakePrefix.Length..separatorIndex]; 238return value[..Math.Min(value.Length, maxLength)]; 582if (sanitizedPrefix.Length > 9)
Aspire.Hosting.Azure.AppService (1)
AzureAppServiceWebSiteResource.cs (1)
133if (value.Length <= maxLength)
Aspire.Hosting.Azure.Functions (7)
src\Shared\CommandLineArgsParser.cs (7)
39for (int i = 0; i < arguments.Length; i++) 41while (i < arguments.Length && (arguments[i] == ' ' || arguments[i] == '\t')) 46if (i == arguments.Length) 60while (i < arguments.Length) 64while (i < arguments.Length && arguments[i] == '\\') 72if (i >= arguments.Length || arguments[i] != '"') 101if (inQuotes && i < arguments.Length - 1 && arguments[i + 1] == '"')
Aspire.Hosting.Azure.KeyVault (1)
AzureKeyVaultResourceExtensions.cs (1)
389if (secretName.Length > 127)
Aspire.Hosting.Azure.Kubernetes (5)
AzureKubernetesEnvironmentResource.AksPipeline.cs (3)
425if (line.Length + 1 > remaining) 635string { Length: > 0 } s => s, 637await provider.GetValueAsync(cancellationToken).ConfigureAwait(false) is { Length: > 0 } resolved => resolved,
src\Aspire.Hosting\Dcp\Process\ProcessUtil.cs (2)
195if (argument.Length > 0 && !argument.Any(static c => char.IsWhiteSpace(c) || c == '"')) 200var builder = new StringBuilder(argument.Length + 2);
Aspire.Hosting.Azure.Sql (1)
AzureSqlServerResource.cs (1)
622var storageName = $"{sqlName.Substring(0, Math.Min(sqlName.Length, 10))}-store";
Aspire.Hosting.Azure.Tests (5)
AzureDeployerTests.cs (3)
725var end = diagnostics.IndexOf($"{Environment.NewLine}{Environment.NewLine}If targeting '", start + marker.Length, StringComparison.Ordinal); 1479({ Length: > 0 }, { Length: > 0 }) => (subscriptionId, resourceGroupName),
AzureSqlPrincipalReconciliationTests.cs (2)
226Assert.Equal(-1, input.IndexOf(oldValue, index + oldValue.Length, StringComparison.Ordinal)); 228return string.Concat(input.AsSpan(0, index), newValue, input.AsSpan(index + oldValue.Length));
Aspire.Hosting.Azure.WebPubSub (6)
src\Aspire.Hosting\ApplicationModel\ModelName.cs (6)
74if (maxLength is not null && (name.Length < 1 || name.Length > maxLength.Value)) 83for (var i = 0; i < name.Length; i++) 106if (validateStartsWithLetter && name.Length > 0 && !IsAsciiLetter(name[0])) 112if (validateNoTrailingHyphen && name.Length > 0 && name[name.Length - 1] == '-')
Aspire.Hosting.Blazor (2)
BlazorDotNetCliRunner.cs (1)
22var executablePath = Environment.GetEnvironmentVariable("DOTNET_HOST_PATH") is { Length: > 0 } dotnetHostPath
BlazorHostedExtensions.cs (1)
263&& identity.GetString() is { Length: > 0 } projectPath)
Aspire.Hosting.Browsers (19)
BrowserLogsArtifacts.cs (3)
103var segment = appHostKey.Length > AppHostKeySegmentLength 140var buffer = new char[value.Length]; 143for (var i = 0; i < value.Length; i++)
BrowserLogsCdpProtocol.cs (1)
214return text.Length <= maxLength
BrowserLogsConfigurationManager.cs (1)
483return inputs[SaveToUserSecretsInputName].Value is { Length: > 0 } saveValue &&
BrowserLogsEventLogger.cs (7)
100if (parameters.RequestId is not { Length: > 0 } requestId || parameters.Request is not { } request) 132if (parameters.RequestId is not { Length: > 0 } requestId || 145if (parameters.Type is { Length: > 0 } resourceType) 153if (parameters.RequestId is not { Length: > 0 } requestId || 164if (parameters.RequestId is not { Length: > 0 } requestId || 172if (FormatDuration(request.StartTimestamp, parameters.Timestamp) is { Length: > 0 } duration) 194if (FormatDuration(request.StartTimestamp, completedTimestamp) is { Length: > 0 } duration)
BrowserLogsPipeBrowserProcessLauncher.Windows.cs (4)
163if (argument.Length != 0 && !argument.AsSpan().ContainsAny(' ', '\t', '"')) 172while (index < argument.Length) 178while (index < argument.Length && argument[index] == '\\') 184if (index == argument.Length)
BrowserUserDataPathResolver.cs (3)
112return configuration.AppHostKey.Length > AppHostShaSegmentLength 139var buffer = new char[value.Length]; 140for (var i = 0; i < value.Length; i++)
Aspire.Hosting.Browsers.Tests (19)
src\Aspire.Hosting.Browsers\BrowserLogsArtifacts.cs (3)
103var segment = appHostKey.Length > AppHostKeySegmentLength 140var buffer = new char[value.Length]; 143for (var i = 0; i < value.Length; i++)
src\Aspire.Hosting.Browsers\BrowserLogsCdpProtocol.cs (1)
214return text.Length <= maxLength
src\Aspire.Hosting.Browsers\BrowserLogsConfigurationManager.cs (1)
483return inputs[SaveToUserSecretsInputName].Value is { Length: > 0 } saveValue &&
src\Aspire.Hosting.Browsers\BrowserLogsEventLogger.cs (7)
100if (parameters.RequestId is not { Length: > 0 } requestId || parameters.Request is not { } request) 132if (parameters.RequestId is not { Length: > 0 } requestId || 145if (parameters.Type is { Length: > 0 } resourceType) 153if (parameters.RequestId is not { Length: > 0 } requestId || 164if (parameters.RequestId is not { Length: > 0 } requestId || 172if (FormatDuration(request.StartTimestamp, parameters.Timestamp) is { Length: > 0 } duration) 194if (FormatDuration(request.StartTimestamp, completedTimestamp) is { Length: > 0 } duration)
src\Aspire.Hosting.Browsers\BrowserLogsPipeBrowserProcessLauncher.Windows.cs (4)
163if (argument.Length != 0 && !argument.AsSpan().ContainsAny(' ', '\t', '"')) 172while (index < argument.Length) 178while (index < argument.Length && argument[index] == '\\') 184if (index == argument.Length)
src\Aspire.Hosting.Browsers\BrowserUserDataPathResolver.cs (3)
112return configuration.AppHostKey.Length > AppHostShaSegmentLength 139var buffer = new char[value.Length]; 140for (var i = 0; i < value.Length; i++)
Aspire.Hosting.CodeGeneration.Go (3)
AtsGoCodeGenerator.cs (3)
347if (!isInterface || name.Length < 2 || name[0] != 'I') 1248var rest = description.Length > 1 ? description[1..] : string.Empty; 2216var builder = new StringBuilder(name.Length);
Aspire.Hosting.CodeGeneration.Java (17)
AtsJavaCodeGenerator.cs (17)
235_ when declarationLine.StartsWith("public ", StringComparison.Ordinal) => declarationLine["public ".Length..].TrimStart(), 236_ when declarationLine.StartsWith("final ", StringComparison.Ordinal) => declarationLine["final ".Length..].TrimStart(), 237_ when declarationLine.StartsWith("abstract ", StringComparison.Ordinal) => declarationLine["abstract ".Length..].TrimStart(), 238_ when declarationLine.StartsWith("static ", StringComparison.Ordinal) => declarationLine["static ".Length..].TrimStart(), 258declarationName = declarationLine[kindPrefix.Length..] 281var leadingWhitespaceLength = line.Length - trimmed.Length; 311for (var i = 0; i < line.Length; i++) 314var next = i + 1 < line.Length ? line[i + 1] : '\0'; 428if (trimmed.Length == 0 || trimmed.StartsWith("//", StringComparison.Ordinal)) 469var imported = importLine["import ".Length..].TrimEnd(';').Trim(); 507var afterIndex = index + word.Length; 508var afterIsBoundary = afterIndex == text.Length || !IsJavaIdentifierChar(text[afterIndex]); 1045WriteLine($"/** Options for {className[..^"Options".Length]}. */"); 1222parameterName.Length > 2 && 2687var builder = new StringBuilder(name.Length); 2770for (var i = 0; i < name.Length; i++)
Aspire.Hosting.CodeGeneration.Python (8)
AtsPythonCodeGenerator.cs (8)
355var shortest = items.OrderBy(c => c.MethodName.Length).ThenBy(c => c.MethodName, StringComparer.Ordinal).First(); 1152if (setterMethodName.StartsWith("set", StringComparison.OrdinalIgnoreCase) && setterMethodName.Length > 3) 2203if (typeName.StartsWith('I') && typeName.Length > 1 && char.IsUpper(typeName[1])) 2219if (typeName.StartsWith('I') && typeName.Length > 1 && char.IsUpper(typeName[1])) 2282var sb = new System.Text.StringBuilder(identifier.Length + 1); 2325var sb = new System.Text.StringBuilder(typeName.Length + 1); 2646for (int i = 0; i < tupleContent.Length; i++) 2663if (i + 1 < tupleContent.Length && tupleContent[i + 1] == ' ')
Aspire.Hosting.CodeGeneration.Rust (1)
AtsRustCodeGenerator.cs (1)
1155var builder = new StringBuilder(name.Length);
Aspire.Hosting.CodeGeneration.Rust.Tests (1)
RustLanguageSupportTests.cs (1)
138names.Add(trimmed[namePrefix.Length..].TrimEnd('"'));
Aspire.Hosting.CodeGeneration.TypeScript (9)
AtsTypeScriptCodeGenerator.cs (8)
558WriteLine(line.Length == 0 ? $"{indent} *" : $"{indent} * {line}"); 627var builder = new StringBuilder(text.Length); 634var markerBodyStartIndex = startIndex + markerStart.Length; 638builder.Append(text, startIndex, text.Length - startIndex); 648if (targetSeparatorIndex < 0 || targetSeparatorIndex == reference.Length - 1) 668builder.Append(text, currentIndex, text.Length - currentIndex); 3407if (setterMethodName.StartsWith("set", StringComparison.OrdinalIgnoreCase) && setterMethodName.Length > 3) 4798if (typeName.StartsWith('I') && typeName.Length > 1 && char.IsUpper(typeName[1]))
src\Shared\NpmVersionHelper.cs (1)
42while (normalizedVersion.Length > 0)
Aspire.Hosting.CodeGeneration.TypeScript.Tests (1)
AtsTypeScriptCodeGeneratorTests.cs (1)
2233index += pattern.Length;
Aspire.Hosting.DevTunnels (6)
DevTunnelCli.cs (1)
389if (line.Length > 0)
DevTunnelCliClient.cs (3)
46var versionString = versionLine?.Length > prefix.Length 47? versionLine[prefix.Length..].Trim()
DevTunnelResourceBuilderExtensions.cs (1)
858if (GetAllocatedUrl(portResource.TargetEndpoint) is { Length: > 0 } localUrl)
src\Shared\EnvironmentVariableNameEncoder.cs (1)
30var builder = new StringBuilder(name.Length + 1);
Aspire.Hosting.Docker (5)
DockerComposeEnvironmentResource.cs (1)
594if (!string.IsNullOrEmpty(appHostSha) && appHostSha.Length >= 8)
EnvFile.cs (2)
43currentComment = trimmed.Length > 1 ? trimmed[1..].Trim() : string.Empty; 80value = eqIndex < trimmed.Length - 1 ? trimmed[(eqIndex + 1)..] : string.Empty;
src\Aspire.Hosting\Dcp\Process\ProcessUtil.cs (2)
195if (argument.Length > 0 && !argument.Any(static c => char.IsWhiteSpace(c) || c == '"')) 200var builder = new StringBuilder(argument.Length + 2);
Aspire.Hosting.Dotnet (12)
src\Shared\CommandLineArgsParser.cs (7)
39for (int i = 0; i < arguments.Length; i++) 41while (i < arguments.Length && (arguments[i] == ' ' || arguments[i] == '\t')) 46if (i == arguments.Length) 60while (i < arguments.Length) 64while (i < arguments.Length && arguments[i] == '\\') 72if (i >= arguments.Length || arguments[i] != '"') 101if (inQuotes && i < arguments.Length - 1 && arguments[i + 1] == '"')
src\Shared\PathNormalizer.cs (5)
55if (path.Length < 3 || path[1] != ':' || path[2] != Path.DirectorySeparatorChar) 154var relative = fullPath[root.Length..]; 187if (linkTarget?.FullName is { Length: > 0 } resolved) 242var relative = fullPath[root.Length..]; 276if (linkTarget?.FullName is { Length: > 0 } resolved)
Aspire.Hosting.EntityFrameworkCore (6)
EFCoreOperationExecutor.cs (5)
111var version = frameworkName.Substring(versionIndex + versionPrefix.Length); 453if (content.Length >= PrefixLength) 501if (content.Length < 29 || 513if (content.Length > 28 && content[27] == 'Z' && content[28] == ' ') 520if (content.Length > 33 &&
EFMigrationResourceBuilderExtensions.cs (1)
496if (tfm is null || !tfm.StartsWith("net", StringComparison.OrdinalIgnoreCase) || tfm.Length <= 3)
Aspire.Hosting.Foundry (4)
FoundryExtensions.cs (1)
453var accountNamePrefix = infrastructure.AspireResource.Name[..Math.Min(infrastructure.AspireResource.Name.Length, 50)];
FoundryLocalService.cs (2)
317if (line.Length <= modelIdStart || line.All(c => c == '-' || char.IsWhiteSpace(c))) 323if (candidate.Length > 0)
HostedAgent\AzureHostedAgentResource.cs (1)
441if (expression.Format.Length == 0)
Aspire.Hosting.GitHub.Models (2)
src\Shared\IConfigurationExtensions.cs (2)
51if (primaryValue is not null && !fallbackOnEmpty || primaryValue is { Length: > 0 }) 57if (secondaryValue is not null && !fallbackOnEmpty || secondaryValue is { Length: > 0 })
Aspire.Hosting.Go (2)
GoHostingExtensions.cs (2)
146if (delveBuildFlags.Length > 0) 753BuildFlags = buildFlags.Length > 0 ? buildFlags : null
Aspire.Hosting.Integration.Analyzers (6)
AspireExportAnalyzer.cs (6)
657var setterMethodNameSuffix = methodNameOverride is { Length: > 0 } 842shortName = shortName.Substring(0, shortName.Length - "Resource".Length); 848shortName = shortName.Substring("Azure".Length); 852if (method.Name.Length <= 4) 1388return constraints.Length > 0
Aspire.Hosting.Java (24)
JavaDockerfileGenerator.cs (6)
308return jarPath.Length > 0; 348if (normalized.Length == 0) 419|| (path.Length >= 2 && char.IsAsciiLetter(path[0]) && path[1] == ':'); 619return agentPath.Length > 0; 1074var posixSibling = relative[..^Path.GetExtension(relative).Length]; 1300=> value.Length > 0 && value.All(static c => char.IsAsciiLetterOrDigit(c) || c is '.' or '_' or '/' or ':' or '=' or '+' or '@' or '-' or ',')
JavaHostingExtensions.cs (2)
2157if (line.Length == 0) 2168value.Append(line, 1, line.Length - 1);
JavaVersionDetector.cs (11)
328var builder = new StringBuilder(contents.Length); 332while (index < contents.Length) 336if (current is '/' && index + 1 < contents.Length) 340while (index < contents.Length && contents[index] is not ('\n' or '\r')) 351index = end < 0 ? contents.Length : end + 2; 363index += delimiter.Length; 372while (index < contents.Length) 374if (contents[index] is '\\' && index + 1 < contents.Length) 385index += delimiter.Length; 396if (index >= contents.Length && (spans.Count == 0 || spans[^1].End.Value != builder.Length)) 433return value.Length > 0 && value.All(char.IsAsciiDigit) ? value : null;
src\Shared\PathNormalizer.cs (5)
55if (path.Length < 3 || path[1] != ':' || path[2] != Path.DirectorySeparatorChar) 154var relative = fullPath[root.Length..]; 187if (linkTarget?.FullName is { Length: > 0 } resolved) 242var relative = fullPath[root.Length..]; 276if (linkTarget?.FullName is { Length: > 0 } resolved)
Aspire.Hosting.Java.Tests (2)
AddJavaAppPublishTests.cs (1)
1428var stagingCommand = content[start..(end < 0 ? content.Length : end)];
AddJavaAppTests.cs (1)
1427var split = mainClass.Length / 2;
Aspire.Hosting.JavaScript (8)
JavaScriptHostingExtensions.cs (3)
925if (apiPath.Length == 0) 2066var version = packageManager.AsSpan("pnpm@".Length); 2639cleaned = cleaned.Substring(op.Length).TrimStart();
src\Shared\PathNormalizer.cs (5)
55if (path.Length < 3 || path[1] != ':' || path[2] != Path.DirectorySeparatorChar) 154var relative = fullPath[root.Length..]; 187if (linkTarget?.FullName is { Length: > 0 } resolved) 242var relative = fullPath[root.Length..]; 276if (linkTarget?.FullName is { Length: > 0 } resolved)
Aspire.Hosting.Kubernetes (10)
CertManagerExtensions.cs (3)
93if (name.Length > MaxResourceNameLength - ChartNameSuffix.Length) 96$"cert-manager resource name '{name}' is too long. The maximum length is {MaxResourceNameLength - ChartNameSuffix.Length} characters because " +
Deployment\HelmDeploymentEngine.cs (3)
90if (releaseName.Length > HelmReleaseNameMaxLength || !DnsLabelPattern().IsMatch(releaseName)) 101if (@namespace.Length > KubernetesNamespaceMaxLength || !DnsLabelPattern().IsMatch(@namespace)) 400path = path[".Values.".Length..];
HelmChartOptions.cs (3)
277if (value.Length > maxLength) 310if (name.Length > HelmChartNameMaxLength) 323if (description.Length > HelmChartDescriptionMaxLength)
KubernetesPublishingContext.cs (1)
393resourceName = resourceName.Substring(baseName.Length + 1); // +1 for the hyphen
Aspire.Hosting.Maui (8)
src\Shared\EnvironmentVariableNameEncoder.cs (1)
30var builder = new StringBuilder(name.Length + 1);
src\Shared\IConfigurationExtensions.cs (2)
51if (primaryValue is not null && !fallbackOnEmpty || primaryValue is { Length: > 0 }) 57if (secondaryValue is not null && !fallbackOnEmpty || secondaryValue is { Length: > 0 })
src\Shared\PathNormalizer.cs (5)
55if (path.Length < 3 || path[1] != ':' || path[2] != Path.DirectorySeparatorChar) 154var relative = fullPath[root.Length..]; 187if (linkTarget?.FullName is { Length: > 0 } resolved) 242var relative = fullPath[root.Length..]; 276if (linkTarget?.FullName is { Length: > 0 } resolved)
Aspire.Hosting.OpenAI (6)
OpenAIHealthCheck.cs (4)
121"none" => HealthCheckResult.Healthy(description.Length > 0 ? description : "All systems operational."), 122"minor" => HealthCheckResult.Degraded(description.Length > 0 ? description : "Minor service issues."), 123"major" => HealthCheckResult.Unhealthy(description.Length > 0 ? description : "Major service outage."), 124"critical" => HealthCheckResult.Unhealthy(description.Length > 0 ? description : "Critical service outage."),
src\Shared\IConfigurationExtensions.cs (2)
51if (primaryValue is not null && !fallbackOnEmpty || primaryValue is { Length: > 0 }) 57if (secondaryValue is not null && !fallbackOnEmpty || secondaryValue is { Length: > 0 })
Aspire.Hosting.Orleans (1)
ProviderConfiguration.cs (1)
29providerType = resourceType.EndsWith(resource, StringComparison.Ordinal) ? resourceType[..^resource.Length] : resourceType;
Aspire.Hosting.RabbitMQ (4)
RabbitMQBuilderExtensions.cs (4)
206if (existingTag.Length > alpine.Length) 257if (tag.Length == 1) 264for (var i = 1; i < tag.Length; i++)
Aspire.Hosting.Radius (17)
Publishing\RadCredentialRegisterStep.cs (1)
379.OrderByDescending(static v => v.Length))
Publishing\RadiusInfrastructureBuilder.cs (5)
1266for (var i = 0; i < format.Length; i++) 1271if (i + 1 < format.Length && format[i + 1] == '{') 1293if (c == '}' && i + 1 < format.Length && format[i + 1] == '}') 1633if (serviceName.Length > MaxKubernetesServiceNameLength) 1637$"'{mapKey}', but that is {serviceName.Length} characters — longer than the " +
Publishing\SealedSecretApplyStep.cs (2)
780TryGetChild(mapping, key, out var node) && node is YamlScalarNode { Value: { Length: > 0 } value } ? value : null; 792value is YamlScalarNode { Value: { Length: > 0 } contextValue })
RadiusExtensions.cs (1)
71if (kubernetesNamespace.Length > KubernetesNamespaceMaxLength || !DnsLabelPattern().IsMatch(kubernetesNamespace))
Secrets\KubernetesName.cs (5)
17if (value.Length is 0 or > 63) 22for (var i = 0; i < value.Length; i++) 25var isEdge = i == 0 || i == value.Length - 1; 38if (value.Length is 0 or > 253) 63if (value.Length is 0 or > 253)
Secrets\RadiusSecretStoreNaming.cs (1)
50if (string.IsNullOrEmpty(name) || name.Length > MaxNameLength)
Secrets\SealedSecretManifest.cs (2)
293if (valueNode is not YamlScalarNode { Value: { Length: > 0 } value } || 517JsonValueKind.String => element.GetString() is { Length: > 0 },
Aspire.Hosting.RemoteHost (25)
Ats\PolyglotCapabilityInvocationException.cs (2)
477_ => name.EndsWith("Resource", StringComparison.Ordinal) ? name[..^"Resource".Length] + " resource" : name 530foreach (var alias in polyglotMethodNamesByClrName.OrderByDescending(static pair => pair.Key.Length))
Ats\ReferenceExpressionRef.cs (2)
283while (current < format.Length) 289if (current < format.Length)
AtsCapabilityScanner.cs (8)
1415for (var i = 1; i < pathSegment.Length; i++) 1717var setterMethodNameSuffix = methodNameOverride is { Length: > 0 } 3531.Where(static param => param.Name.Length > 0 && param.Description.Length > 0) 3669if (separatorIndex < 1 || separatorIndex == value.Length - 1) 3766var value = cref.Length > 2 && cref[1] == ':' ? cref[2..] : cref; 3789.Where(static line => line.Length > 0); 3793return normalized.Length == 0 ? null : normalized.Replace("*/", "* /", StringComparison.Ordinal);
AtsContextFilter.cs (8)
342return assemblyName.Length > 0; 348return assemblyName.Length > 0; 361if (location.Length <= knownAssemblyName.Length || 362location[knownAssemblyName.Length] != '.' || 368if (knownAssemblyName.Length > assemblyName.Length) 374return assemblyName.Length > 0;
Diagnostics\RemoteHostProfilingTelemetry.cs (2)
315return configuration?[name] is { Length: > 0 } value ? value : configuration?[legacyName]; 320return activity?.GetBaggageItem(Baggage.SessionId) is { Length: > 0 } sessionId ? sessionId : null;
JsonRpcAuthenticationState.cs (1)
16if (configuration[KnownConfigNames.RemoteAppHostToken] is { Length: > 0 } token)
src\Shared\IntegrationPackageProbeManifest.cs (1)
224fileNameWithoutExtension.Length > 3)
src\Shared\ProcessStartTimeHelper.cs (1)
362if (closeParenIndex < 0 || closeParenIndex + 2 >= contents.Length)
Aspire.Hosting.Rust (18)
CargoMetadata.cs (2)
114&& targetName.GetString() is { Length: > 0 } name) 158if (item.ValueKind == JsonValueKind.String && item.GetString() is { Length: > 0 } value)
CargoMetadataReader.cs (7)
126var diagnosticSuffix = diagnostic.Length > 0 ? $" {diagnostic}" : string.Empty; 158.Where(static pair => pair.Value.Length >= 4 || IsSensitiveEnvironmentVariableName(pair.Key)) 166.Where(static value => value.Length > 0) 169.OrderByDescending(static value => value.Length) 171if (sensitiveValues.Any(static value => value.Length < 4)) 182if (redacted.Length <= MaximumStandardErrorLength) 187var retainedLength = MaximumStandardErrorLength - TruncatedDiagnosticSuffix.Length;
RustCargoTargetResolver.cs (1)
140if (package.DefaultRun is { Length: > 0 } defaultRun)
RustDockerfileGenerator.cs (2)
335configuration = cargoArgs[i]["--config=".Length..]; 471if (value.Length > 0 && value.All(static c => char.IsAsciiLetterOrDigit(c) || c is '-' or '_' or '.' or '/' or '=' or ',' or '+' or ':'))
RustHostingExtensions.cs (1)
712if (target.Target is null && environment.TryGetValue("CARGO_BUILD_TARGET", out var buildTarget) && buildTarget.Length > 0)
src\Shared\PathNormalizer.cs (5)
55if (path.Length < 3 || path[1] != ':' || path[2] != Path.DirectorySeparatorChar) 154var relative = fullPath[root.Length..]; 187if (linkTarget?.FullName is { Length: > 0 } resolved) 242var relative = fullPath[root.Length..]; 276if (linkTarget?.FullName is { Length: > 0 } resolved)
Aspire.Hosting.Rust.Tests (3)
CargoMetadataTests.cs (2)
135$"{new string('x', CargoMetadataReader.MaximumStandardErrorLength - TruncatedDiagnosticSuffix.Length)}{TruncatedDiagnosticSuffix}", 252var retainedLength = CargoMetadataReader.MaximumStandardErrorLength - TruncatedDiagnosticSuffix.Length;
FakeCargoMetadataReader.cs (1)
61if (environment.TryGetValue("CARGO_TARGET_DIR", out var targetDirectory) && targetDirectory.Length > 0)
Aspire.Hosting.Sdk.Tests (2)
AppHostSdkTargetsTests.cs (2)
1672Assert.True(equalsIndex > prefix.Length, $"Package reference '{packageReference}' did not contain a RID."); 1674return packageReference[prefix.Length..equalsIndex];
Aspire.Hosting.SqlServer.Tests (1)
AddSqlServerTests.cs (1)
74Assert.True(env.Value.Length >= 8);
Aspire.Hosting.Tasks (3)
ResolveAspireCliBundle.cs (3)
373while (versionEnd < directoryName.Length && directoryName[versionEnd] is (>= '0' and <= '9') or '.') 390directoryName.Length - separatorIndex - 1 != 16 || 401for (var i = startIndex; i < value.Length; i++)
Aspire.Hosting.Testing (4)
DistributedApplicationFactory.cs (2)
308SetDefault(key["DOTNET_".Length..], value); 314SetDefault(key["ASPNETCORE_".Length..], value);
DistributedApplicationTestingBuilder.cs (2)
629if (appHostAssembly is not null && GetDcpCliPath(appHostAssembly) is { Length: > 0 }) 663if (asm is not null && GetDcpCliPath(asm) is { Length: > 0 })
Aspire.Hosting.Testing.Tests (9)
DashboardUrlTests.cs (2)
36Assert.True(dashboardUri.Query.Length > 3); 332var token = dashboardUri.Query["?t=".Length..];
TestingBuilderTests.cs (3)
73Assert.True(serviceAHttpEndpoint.Host.Length > 0); 147Assert.True(workerEndpoint.Host.Length > 0); 152Assert.True(connectionString.Length > 0);
TestingFactoryTests.cs (1)
25Assert.True(workerEndpoint.Host.Length > 0);
tests\Shared\Logging\XunitLoggerProvider.cs (3)
78var additionalLinePrefix = "|" + new string(' ', firstLinePrefix.Length - 1); 98message = message.Substring(0, message.Length - Environment.NewLine.Length);
Aspire.Hosting.Tests (22)
AddParameterTests.cs (1)
243Assert.Equal(10, parameterResource.Value.Length);
ApplicationModel\GenerateParameterDefaultTests.cs (6)
25Assert.Equal(10, value.Length); 51Assert.True(value.Length >= 12); 60PasswordGenerator.LowerCaseChars.Length + 61PasswordGenerator.UpperCaseChars.Length + 62PasswordGenerator.NumericChars.Length + 63PasswordGenerator.SpecialChars.Length;
Dashboard\DashboardServiceTests.cs (7)
71l => Assert.Equal(LongLineCharacters, l.Text.Split(' ')[1].Length), 72l => Assert.Equal(LongLineCharacters, l.Text.Split(' ')[1].Length)); 76l => Assert.Equal(LongLineCharacters, l.Text.Split(' ')[1].Length), 124l => Assert.Equal(DashboardServiceImpl.LogMaxBatchCharacters, l.Text.Length)); 128l => Assert.Equal(LongLineCharacters, l.Text.Split(' ')[1].Length), 129l => Assert.Equal(LongLineCharacters, l.Text.Split(' ')[1].Length)); 133l => Assert.Equal(LongLineCharacters, l.Text.Split(' ')[1].Length));
Dcp\DcpHostNotificationTests.cs (1)
743start += prefix.Length;
Publishing\ResourceContainerImageManagerTests.cs (1)
1557Assert.Equal(ex.GetFormattedOutput(), ex.Message[(newlineIndex + Environment.NewLine.Length)..]);
TerminalHostPathsTests.cs (1)
17Assert.Equal(TerminalHostPaths.ReplicaIdLength, id.Length);
Utils\PasswordGeneratorTests.cs (5)
61Assert.Equal(10, password.Length); 83Assert.Equal(10, password.Length); 121Assert.Equal(8, password.Length); 128Assert.Equal(1025, password.Length); 131Assert.Equal(4097, password.Length);
Aspire.Hosting.TestUtilities (4)
tests\Shared\Logging\XunitLoggerProvider.cs (3)
78var additionalLinePrefix = "|" + new string(' ', firstLinePrefix.Length - 1); 98message = message.Substring(0, message.Length - Environment.NewLine.Length);
Utils\PersistentContainerTestHelpers.cs (1)
132GetPropertyValue(evt, ContainerIdPropertyName) is string { Length: > 0 } &&
Aspire.Playground.Tests (5)
Infrastructure\DistributedApplicationExtensions.cs (1)
142AssertDoesNotContain(resourceLogs, log => log.Category is { Length: > 0 } category && assertableResourceLogNames.Contains(category) && log.Level >= LogLevel.Error);
src\Shared\X509Certificate2Extensions.cs (1)
52if ((byteArray.Length == AspNetHttpsOidFriendlyName.Length && byteArray[0] == (byte)'A') || byteArray.Length == 0)
tests\Shared\Logging\XunitLoggerProvider.cs (3)
78var additionalLinePrefix = "|" + new string(' ', firstLinePrefix.Length - 1); 98message = message.Substring(0, message.Length - Environment.NewLine.Length);
Aspire.Templates.Tests (1)
tests\Shared\TemplatesTesting\AspireProject.cs (1)
224InfoTable = ProjectInfo.Parse(line.Substring("$ENDPOINTS: ".Length));
Aspire.TerminalHost (4)
src\Shared\ProcessStartTimeHelper.cs (1)
362if (closeParenIndex < 0 || closeParenIndex + 2 >= contents.Length)
src\Shared\TerminalHost\TerminalHostPaths.cs (2)
157var candidate = fileName.AsSpan(0, fileName.Length - extension.Length);
TerminalHostApp.cs (1)
287$"[Aspire.TerminalHost] startup pid={Environment.ProcessId} otel={(otelEnabled ? "on" : "off")} endpoint='{otlpEndpoint}' protocol='{otlpProtocol}' headers.len={otlpHeaders?.Length ?? 0} service='{serviceName}' resource='{resourceAttrs}'")
Aspire.TestTools (2)
TrxReader.cs (2)
160&& testDefinition.TestMethod is { ClassName: { Length: > 0 } className, Name: { Length: > 0 } methodName })
Aspire.TestUtilities (1)
src\Shared\X509Certificate2Extensions.cs (1)
52if ((byteArray.Length == AspNetHttpsOidFriendlyName.Length && byteArray[0] == (byte)'A') || byteArray.Length == 0)
BasketService (24)
artifacts\obj\BasketService\Debug\net8.0\Protos\Basket.cs (24)
148if (Id.Length != 0) hash ^= Id.GetHashCode(); 181if (Id.Length != 0) { 195if (Id.Length != 0) { 210if (other.Id.Length != 0) { 359if (BuyerId.Length != 0) hash ^= BuyerId.GetHashCode(); 394if (BuyerId.Length != 0) { 409if (BuyerId.Length != 0) { 425if (other.BuyerId.Length != 0) { 583if (BuyerId.Length != 0) hash ^= BuyerId.GetHashCode(); 618if (BuyerId.Length != 0) { 633if (BuyerId.Length != 0) { 649if (other.BuyerId.Length != 0) { 850if (Id.Length != 0) hash ^= Id.GetHashCode(); 903if (Id.Length != 0) { 933if (Id.Length != 0) { 960if (other.Id.Length != 0) { 1158if (BuyerId.Length != 0) hash ^= BuyerId.GetHashCode(); 1191if (BuyerId.Length != 0) { 1205if (BuyerId.Length != 0) { 1220if (other.BuyerId.Length != 0) { 1517if (BuyerId.Length != 0) hash ^= BuyerId.GetHashCode(); 1550if (BuyerId.Length != 0) { 1564if (BuyerId.Length != 0) { 1579if (other.BuyerId.Length != 0) {
blazor-gateway (1)
TelemetryFilters.cs (1)
51if (excluded.Length > 1 && excluded[^1] == '/')
cdac-build-tool (7)
ContractDescriptorSourceFileEmitter.cs (7)
47int count = jsonDescriptor.Length; // return the length before escaping 55if (escaped.Length > MaxChunkSize) 57StringBuilder sb = new StringBuilder(escaped.Length + escaped.Length / MaxChunkSize * 4); 59while (offset < escaped.Length) 63int chunkEnd = Math.Min(offset + MaxChunkSize, escaped.Length); 65if (chunkEnd < escaped.Length && escaped[chunkEnd - 1] == '\\')
ConfigurationSchemaGenerator (7)
ConfigSchemaEmitter.cs (2)
443if (description.Length > 0) 529var remaining = value.Length - index;
ConfigSchemaGenerator.cs (1)
38if (schema.Length == 0 || schema[^1] != '\n')
RuntimeSource\Configuration.Binder\Specs\TypeIndex.cs (2)
122displayString = displayString.Substring(GlobalPrefix.Length); 125Debug.Assert(displayString.Length > 0);
RuntimeSource\Roslyn\GetBestTypeByMetadataName.cs (2)
157return name.Length > AttributeSuffix.Length && name.EndsWith(AttributeSuffix, comparison);
crossgen2 (2)
src\runtime\src\coreclr\tools\Common\CommandLineHelpers.cs (2)
434if (token.Length > 0 && token[0] != '#') 441if (firstQuotePosition >= 0 && firstQuotePosition < token.Length - 1 &&
Crossgen2Tasks (3)
CommonFilePulledFromSdkRepo\Logger.cs (1)
79if (format.Length >= 12
CommonFilePulledFromSdkRepo\NuGetUtils.NuGet.cs (2)
19if (path.Length == 3) 24char separator = path[path.Length - 4];
csc (3)
src\roslyn\src\Compilers\Shared\BuildProtocol.cs (1)
648writer.Write(value.Length);
src\roslyn\src\Compilers\Shared\RuntimeHostInfo.cs (2)
82if (Environment.GetEnvironmentVariable(DotNetHostPathEnvironmentName) is { Length: > 0 } pathToDotNet) 87if (Environment.GetEnvironmentVariable(DotNetExperimentalHostPathEnvironmentName) is { Length: > 0 } pathToDotNetExperimental)
CSharpSyntaxGenerator (9)
AbstractFileWriter.cs (2)
287? name.Substring(0, name.Length - post.Length)
Grammar\GrammarGenerator.cs (5)
281for (var i = 0; i < value.Length; i++) 309=> new(string.Join(delim, productions.Where(p => p.Text.Length > 0)), productions.SelectMany(p => p.ReferencedRules)); 331field.Type.StartsWith("SeparatedSyntaxList") ? HandleSeparatedList(field, field.Type[("SeparatedSyntaxList".Length + 1)..^1]) : 332field.Type.StartsWith("SyntaxList") ? HandleList(field, field.Type[("SyntaxList".Length + 1)..^1]) : 367s_normalizationRegex.Replace(name.EndsWith("Syntax") ? name[..^"Syntax".Length] : name, "_").ToLower(),
Program.cs (2)
171length = text.Length; 173} while (text.Length != length);
DevTunnels.ApiService (1)
Program.cs (1)
16var contentLength = response.Content.Headers.ContentLength ?? (await response.Content.ReadAsStringAsync()).Length;
dotnet (106)
CommandFactory\CommandResolution\LocalToolsCommandResolver.cs (3)
37new ToolCommandName(arguments.CommandName.Substring(LeadingDotnetPrefix.Length)), allowRollForward); 50string.IsNullOrWhiteSpace(arguments.CommandName.Substring(LeadingDotnetPrefix.Length))) 58new ToolCommandName(arguments.CommandName.Substring(LeadingDotnetPrefix.Length)));
Commands\Hidden\Complete\CompleteCommand.cs (1)
59if (position > input.Length)
Commands\New\MSBuildEvaluation\CapabilityExpressionEvaluator.cs (4)
155throw Tokenizer.CreateInvalidExpressionException(_tokenizer.Input.Length); 213while (Position < Input.Length && char.IsWhiteSpace(Input[Position])) 218if (Position == Input.Length) 227while (Position < Input.Length && IsSymbolCharacter(Input[Position]))
Commands\Reference\List\ReferenceListCommand.cs (2)
59Reporter.Output.WriteLine(new string('-', CliStrings.ProjectReferenceOneOrMore.Length)); 78Reporter.Output.WriteLine(new string('-', CliStrings.ProjectReferenceOneOrMore.Length));
Commands\Run\CommonRunHelpers.cs (1)
176if (launchProfile is ProjectLaunchProfile { ApplicationUrl.Length: > 0 } projectProfile)
Commands\Run\CSharpCompilerCommand.cs (1)
338colonIndex = optionName.Length;
Commands\Run\FileBasedAppRunPlan.cs (1)
171if (validatedEntry.Run is { Command.Length: > 0 } runProperties)
Commands\Solution\List\SolutionListCommand.cs (1)
62Reporter.Output.WriteLine(new string('-', header.Length));
Commands\Test\MTP\ArtifactPostProcessingManager.cs (1)
267.Where(capability => capability.Length > 0)
Commands\Test\MTP\ArtifactPostProcessingPlanner.cs (1)
60.Where(group => group.Key.Length > 0)
Commands\Test\MTP\IPC\HttpTestHostGateway.cs (3)
278uri.UserInfo.Length != 0 || 279uri.Query.Length != 0 || 280uri.Fragment.Length != 0 ||
Commands\Test\MTP\MicrosoftTestingPlatformTestCommand.cs (7)
342if (argument.Length > 1 && argument[0] == '@') 406.Where(static line => line.Length > 0 && line[0] != '#') 412if (token.Length > 1 && token[0] == '@') 464if (argument.Length < 2 || 466(argument[1] == '-' && (argument.Length < 3 || argument[2] == '-'))) 489while (position < line.Length) 538if (position == line.Length)
Commands\Test\MTP\Terminal\AnsiTerminal.cs (5)
198if (path.Length > _baseDirectory.Length 199&& (path[_baseDirectory.Length] == Path.DirectorySeparatorChar 200|| path[_baseDirectory.Length] == Path.AltDirectorySeparatorChar)) 202path = path[(_baseDirectory.Length + 1)..];
Commands\Test\MTP\Terminal\AnsiTerminalTestProgressFrame.cs (21)
25currentLine.RenderedDurationLength = durationString.Length; 27int nonReservedWidth = Width - (durationString.Length + 2); 45charsTaken += passedText.Length; 56charsTaken += failedText.Length; 67charsTaken += skippedText.Length; 79charsTaken += retriedText.Length; 95charsTaken += discoveredText.Length; 112lengthNeeded += progress.TargetFramework.Length; 121lengthNeeded += progress.Architecture.Length; 147terminal.SetCursorHorizontal(Width - durationString.Length); 155currentLine.RenderedDurationLength = durationString.Length; 157int nonReservedWidth = Width - (durationString.Length + 2); 165terminal.SetCursorHorizontal(Width - durationString.Length); 171if (charsTaken + text.Length < width) 174charsTaken += text.Length; 246if (previouslyRenderedLine.RenderedDurationLength == durationString.Length) 250terminal.Append($"{AnsiCodes.SetCursorHorizontal(MaxColumn)}{AnsiCodes.MoveCursorBackward(durationString.Length)}{durationString}"); 251currentLine.RenderedDurationLength = durationString.Length; 281if (previouslyRenderedLine.RenderedDurationLength == durationString.Length) 285terminal.Append($"{AnsiCodes.SetCursorHorizontal(MaxColumn)}{AnsiCodes.MoveCursorBackward(durationString.Length)}{durationString}"); 286currentLine.RenderedDurationLength = durationString.Length;
Commands\Test\MTP\Terminal\TargetFrameworkParser.cs (12)
22if (frameworkDescription.Length < netFramework.Length + 6) 27char major = frameworkDescription[netFramework.Length + 1]; 28char minor = frameworkDescription[netFramework.Length + 3]; 29char patch = frameworkDescription[netFramework.Length + 5]; 58return frameworkDescription.Length >= netCore.Length + 4 59? $"netcoreapp{frameworkDescription[netCore.Length + 1]}.{frameworkDescription[netCore.Length + 3]}" 66int firstDotInVersion = frameworkDescription.IndexOf('.', net.Length + 1); 69: $"net{frameworkDescription.Substring(net.Length + 1, firstDotInVersion - net.Length - 1)}.{frameworkDescription[firstDotInVersion + 1]}";
Commands\Test\MTP\TestApplication.cs (5)
742bool handshakeAccepted = OnHandshakeMessage(handshakeMessage, negotiatedVersion.Length > 0); 865if (version.Length > 0 && includeControlPipe) 894if (reportedOutput.Length > 0) 901if (capturedOutput.Length > 0) 1014if (outputToWrite.Length > 0)
Commands\Test\MTP\TestModulesFilterHandler.cs (2)
127if (pattern.Length == 0) 135if (excludePattern.Length != 0)
Commands\Test\MTP\TestResultsDirectoryResolver.cs (7)
198if (firstRoot.Length == 0 || !string.Equals(firstRoot, secondRoot, comparison)) 204string[] firstSegments = first[firstRoot.Length..].Split(separators, StringSplitOptions.RemoveEmptyEntries); 205string[] secondSegments = second[secondRoot.Length..].Split(separators, StringSplitOptions.RemoveEmptyEntries); 327StringBuilder builder = new(value.Length); 339return trimmed.Length == 0 ? UnknownComponent : trimmed; 349if (component.Length <= MaxPathComponentLength) 356return string.Concat(component.AsSpan(0, MaxPathComponentLength - hash.Length - 1), "_", hash);
Commands\Test\VSTest\TestCommand.cs (3)
353propertyName = propertyKeyValue.key.RemovePrefix().Substring("property:".Length); 358propertyName = propertyKeyValue.key.RemovePrefix().Substring("p:".Length); 554var rest = token.AsSpan(prefix.Length);
Commands\Tool\Install\ProjectRestorer.cs (1)
83line = line.Substring(project.Value.Length + 3);
Commands\Workload\WorkloadUtilities.cs (4)
20firstDash = firstDash < 0 ? first.Length : firstDash; 21secondDash = secondDash < 0 ? second.Length : secondDash; 32var modifiedFirst = new ReleaseVersion(1, 1, 1, firstDash == first.Length ? null : first.Substring(firstDash)); 33var modifiedSecond = new ReleaseVersion(1, 1, 1, secondDash == second.Length ? null : second.Substring(secondDash));
Extensions\ParseResultExtensions.cs (1)
180error = error.Slice(foundIndex + part.Length);
LoggerUtility.cs (3)
32filename = filename.Substring(0, filename.Length - ".binlog".Length); 185return switchName.Length > 0;
Parser.cs (1)
321.Where(line => line.Length > 0);
PrintableTable.cs (1)
216return sum + (ColumnDelimiter.Length * (count - 1));
ShellShim\WindowsEnvironmentPath.cs (1)
56existingUserEnvPath = existingUserEnvPath.Substring(0, existingUserEnvPath.Length - 1);
SlnFileFactory.cs (1)
164match.Value.Length == 2 ? match.Value : "/");
src\sdk\artifacts\.packages\microsoft.codeanalysis.buildclient\5.11.0-1.26424.106\contentFiles\cs\net11.0\BuildProtocol.cs (1)
648writer.Write(value.Length);
src\sdk\artifacts\.packages\microsoft.codeanalysis.buildclient\5.11.0-1.26424.106\contentFiles\cs\net11.0\RuntimeHostInfo.cs (2)
82if (Environment.GetEnvironmentVariable(DotNetHostPathEnvironmentName) is { Length: > 0 } pathToDotNet) 87if (Environment.GetEnvironmentVariable(DotNetExperimentalHostPathEnvironmentName) is { Length: > 0 } pathToDotNetExperimental)
src\sdk\src\Common\EnvironmentVariableNames.cs (1)
104var span = runtimeIdentifier.AsSpan(archStart, (archEnd > 0 ? archEnd : runtimeIdentifier.Length) - archStart);
src\sdk\src\Common\NuGetUtils.NuGet.cs (2)
19if (path.Length == 3) 24char separator = path[path.Length - 4];
src\sdk\src\Resolvers\Microsoft.DotNet.MSBuildSdkResolver\FXVersion.cs (6)
56char s1char = (s1.Pre.Length == i) ? '\0' : s1.Pre[i]; 57char s2char = (s2.Pre.Length == i) ? '\0' : s2.Pre[i]; 117for (int i = 0; i < id.Length; ++i) 151if (!buildMeta && id[0] == '0' && id.Length > 1 && int.TryParse(id, out _)) 196for (int i = startIndex; i < s.Length; ++i) 261if (patchStart + 1 < fxVersionString.Length && fxVersionString[patchStart] == '0')
dotnet-aot (19)
src\sdk\src\Cli\dotnet\CommandFactory\CommandResolution\LocalToolsCommandResolver.cs (3)
37new ToolCommandName(arguments.CommandName.Substring(LeadingDotnetPrefix.Length)), allowRollForward); 50string.IsNullOrWhiteSpace(arguments.CommandName.Substring(LeadingDotnetPrefix.Length))) 58new ToolCommandName(arguments.CommandName.Substring(LeadingDotnetPrefix.Length)));
src\sdk\src\Cli\dotnet\Commands\Run\CommonRunHelpers.cs (1)
176if (launchProfile is ProjectLaunchProfile { ApplicationUrl.Length: > 0 } projectProfile)
src\sdk\src\Cli\dotnet\Commands\Run\FileBasedAppRunPlan.cs (1)
171if (validatedEntry.Run is { Command.Length: > 0 } runProperties)
src\sdk\src\Cli\dotnet\Commands\Solution\List\SolutionListCommand.cs (1)
62Reporter.Output.WriteLine(new string('-', header.Length));
src\sdk\src\Cli\dotnet\Commands\Workload\WorkloadUtilities.cs (4)
20firstDash = firstDash < 0 ? first.Length : firstDash; 21secondDash = secondDash < 0 ? second.Length : secondDash; 32var modifiedFirst = new ReleaseVersion(1, 1, 1, firstDash == first.Length ? null : first.Substring(firstDash)); 33var modifiedSecond = new ReleaseVersion(1, 1, 1, secondDash == second.Length ? null : second.Substring(secondDash));
src\sdk\src\Cli\dotnet\Extensions\ParseResultExtensions.cs (1)
180error = error.Slice(foundIndex + part.Length);
src\sdk\src\Cli\dotnet\LoggerUtility.cs (3)
32filename = filename.Substring(0, filename.Length - ".binlog".Length); 185return switchName.Length > 0;
src\sdk\src\Cli\dotnet\Parser.cs (1)
321.Where(line => line.Length > 0);
src\sdk\src\Cli\dotnet\PrintableTable.cs (1)
216return sum + (ColumnDelimiter.Length * (count - 1));
src\sdk\src\Cli\dotnet\ShellShim\WindowsEnvironmentPath.cs (1)
56existingUserEnvPath = existingUserEnvPath.Substring(0, existingUserEnvPath.Length - 1);
src\sdk\src\Cli\dotnet\SlnFileFactory.cs (1)
164match.Value.Length == 2 ? match.Value : "/");
src\sdk\src\Common\EnvironmentVariableNames.cs (1)
104var span = runtimeIdentifier.AsSpan(archStart, (archEnd > 0 ? archEnd : runtimeIdentifier.Length) - archStart);
dotnet-dev-certs (9)
src\aspnetcore\src\Shared\CertificateGeneration\CertificateManager.cs (1)
236if ((byteArray.Length == AspNetHttpsOidFriendlyName.Length && byteArray[0] == (byte)'A') || byteArray.Length == 0)
src\aspnetcore\src\Shared\CertificateGeneration\UnixCertificateManager.cs (1)
361? Path.Combine("$HOME", certDir[homeDirectoryWithSlash.Length..])
src\aspnetcore\src\Shared\CommandLineUtils\CommandLine\AnsiConsole.cs (2)
77while (endIndex != message.Length && 86if (endIndex == message.Length)
src\aspnetcore\src\Shared\CommandLineUtils\CommandLine\CommandLineApplication.cs (3)
480var maxArgLen = arguments.Max(a => a.Name.Length); 496var maxOptLen = options.Max(o => o.GetDisplayText().Length); 512var maxCmdLen = commands.Max(c => c.Name.Length);
src\aspnetcore\src\Shared\CommandLineUtils\CommandLine\CommandOption.cs (2)
29if (optName.Length == 1 && !IsEnglishLetter(optName[0])) 40ValueName = part.Substring(1, part.Length - 2);
dotnet-format (10)
Commands\FormatAnalyzersCommand.cs (1)
39parseResult.GetValue(SeverityOption) is string { Length: > 0 } analyzerSeverity)
Commands\FormatCommandCommon.cs (5)
159parseResult.GetValue(VerbosityOption) is string { Length: > 0 } verbosity) 201if (parseResult.GetValue(ReportOption) is string { Length: > 0 } reportPath) 211if (parseResult.GetValue(BinarylogOption) is string { Length: > 0 } binaryLogPath) 220parseResult.GetValue(FrameworkOption) is string { Length: > 0 } framework) 314if (parseResult.GetValue<string>(SlnOrProjectArgument) is string { Length: > 0 } slnOrProject)
Commands\FormatStyleCommand.cs (1)
39parseResult.GetValue(SeverityOption) is string { Length: > 0 } styleSeverity)
Commands\RootFormatCommand.cs (1)
42parseResult.GetValue(SeverityOption) is string { Length: > 0 } defaultSeverity)
Formatters\CharsetFormatter.cs (1)
62using var stream = new MemoryStream(text.Length * 2 + 3);
Formatters\DocumentFormatter.cs (1)
168var changeMessage = changes.Count > 1 || change.NewText?.Length != formattedText.Length
dotnet-getdocument (7)
src\aspnetcore\src\Shared\CommandLineUtils\CommandLine\AnsiConsole.cs (2)
77while (endIndex != message.Length && 86if (endIndex == message.Length)
src\aspnetcore\src\Shared\CommandLineUtils\CommandLine\CommandLineApplication.cs (3)
480var maxArgLen = arguments.Max(a => a.Name.Length); 496var maxOptLen = options.Max(o => o.GetDisplayText().Length); 512var maxCmdLen = commands.Max(c => c.Name.Length);
src\aspnetcore\src\Shared\CommandLineUtils\CommandLine\CommandOption.cs (2)
29if (optName.Length == 1 && !IsEnglishLetter(optName[0])) 40ValueName = part.Substring(1, part.Length - 2);
dotnet-Microsoft.XmlSerializer.Generator (6)
Sgen.cs (6)
330if (!outputDirectory.EndsWith("\"", StringComparison.Ordinal) || !Directory.Exists(outputDirectory = outputDirectory.Remove(outputDirectory.Length - 1))) 426if (arg.Length < 3 || arg[0] != '-' || arg[1] != '-') 437if (arg.Length < 2 || arg[0] != '-') 498Console.Out.WriteLine(SR.Format(SR.HelpUsage, this.GetType().Assembly.GetName().Name.Substring("dotnet-".Length))); 575if (s_references.Length > 0) 637sb.Remove(index, "ref".Length);
dotnet-openapi (7)
src\aspnetcore\src\Shared\CommandLineUtils\CommandLine\AnsiConsole.cs (2)
77while (endIndex != message.Length && 86if (endIndex == message.Length)
src\aspnetcore\src\Shared\CommandLineUtils\CommandLine\CommandLineApplication.cs (3)
480var maxArgLen = arguments.Max(a => a.Name.Length); 496var maxOptLen = options.Max(o => o.GetDisplayText().Length); 512var maxCmdLen = commands.Max(c => c.Name.Length);
src\aspnetcore\src\Shared\CommandLineUtils\CommandLine\CommandOption.cs (2)
29if (optName.Length == 1 && !IsEnglishLetter(optName[0])) 40ValueName = part.Substring(1, part.Length - 2);
dotnet-razorpagegenerator (6)
Program.cs (6)
99var viewDirPath = viewDir.Substring(targetProjectDirectory.Length).Replace('\\', '/'); 200while (startIndex < cshtmlContent.Length) 212var includeFileName = cshtmlContent.Substring(startIndex + startMatch.Length, endIndex - (startIndex + startMatch.Length)); 215cshtmlContent = string.Concat(cshtmlContent.AsSpan(0, startIndex), includeFileContent, cshtmlContent.AsSpan(endIndex + endMatch.Length)); 216startIndex = startIndex + includeFileContent.Length;
dotnet-sourcelink (6)
dotnet-sql-cache (7)
src\aspnetcore\src\Shared\CommandLineUtils\CommandLine\AnsiConsole.cs (2)
77while (endIndex != message.Length && 86if (endIndex == message.Length)
src\aspnetcore\src\Shared\CommandLineUtils\CommandLine\CommandLineApplication.cs (3)
480var maxArgLen = arguments.Max(a => a.Name.Length); 496var maxOptLen = options.Max(o => o.GetDisplayText().Length); 512var maxCmdLen = commands.Max(c => c.Name.Length);
src\aspnetcore\src\Shared\CommandLineUtils\CommandLine\CommandOption.cs (2)
29if (optName.Length == 1 && !IsEnglishLetter(optName[0])) 40ValueName = part.Substring(1, part.Length - 2);
dotnet-suggest (12)
SuggestionDispatcher.cs (12)
194yield return "dotnet " + fileNameWithoutExtension.Substring("dotnet-".Length); 221for (var i = "dotnet".Length; i < commandLine.Length; i++) 232for (var i = endOfWhitespace.Value; i < commandLine.Length; i++) 243for (var i = endOfSecondtoken.Value; i < commandLine.Length; i++) 262if (choppedCommandLine.Length > 0) 264offset = commandLine.Length - choppedCommandLine.Length; 275if (commandLine.Length > targetExeName.Length) 277commandLine = commandLine.Substring(targetExeName.Length + 1); 284offset = targetExeName.Length + 1;
dotnet-svcutil-lib (1398)
AppInsightsTelemetryClient.cs (1)
148int len = str.Length;
CodeDomFixup\StringHelpers.cs (1)
13return s.StartsWith(prefix, StringComparison.Ordinal) ? s.Substring(prefix.Length) : s;
CodeSerializer.cs (1)
124if (fileExtension.Length > 0 && fileExtension[0] != '.')
CommandLineParser.cs (4)
40this.Name = name.Substring(FullSwitchIndicator.Length); 49this.Abbreviation = abbreviation.Substring(AbbreviationSwitchIndicator.Length); 92otherName = other.Substring(FullSwitchIndicator.Length).ToLowerInvariant(); 97otherName = other.Substring(AbbreviationSwitchIndicator.Length).ToLowerInvariant();
FrameworkFork\Microsoft.CodeDom\Compiler\CodeGenerator.cs (3)
1224if (arg.Name != null && arg.Name.Length > 0) 2211if (value.Length == 0) 2216for (int i = 0; i < value.Length; i++)
FrameworkFork\Microsoft.CodeDom\Compiler\CodeValidator.cs (4)
155if (e.Name != null && e.Name.Length > 0) 196if (arg.Name != null && arg.Name.Length > 0) 682for (int i = 0; i < baseType.Length; i++) 688while (i < baseType.Length && baseType[i] >= '0' && baseType[i] <= '9')
FrameworkFork\Microsoft.CodeDom\Compiler\CompilerError.cs (1)
167if (FileName.Length > 0)
FrameworkFork\Microsoft.CodeDom\Compiler\IndentTextWriter.cs (1)
504StringBuilder sb = new StringBuilder(_indent * tabString.Length);
FrameworkFork\Microsoft.CodeDom\Compiler\TempFiles.cs (2)
103if (fileExtension == null || fileExtension.Length == 0) 115if (fileName == null || fileName.Length == 0)
FrameworkFork\Microsoft.CodeDom\Microsoft\CSharpCodeProvider.cs (23)
442StringBuilder b = new StringBuilder(value.Length + 5); 448while (i < value.Length) 492&& (i < value.Length - 1) 513StringBuilder b = new StringBuilder(value.Length + 5); 517for (int i = 0; i < value.Length; i++) 540if (value.Length < 256 || value.Length > 1500 || (value.IndexOf('\0') != -1)) 606if (options.MainClass != null && options.MainClass.Length > 0) 1548for (int i = 0; i < value.Length; i++) 1558if (i < value.Length - 1 && value[i + 1] == '\n') 2970if (arg.Name != null && arg.Name.Length > 0) 3265if (e.Name != null && e.Name.Length > 0) 3456if (e.Name != null && e.Name.Length > 0) 3590if (value.Length < 3) 3614if (value == null || value.Length == 0) 3619if (value.Length > 512) 3675if (s.Length == 0) 3736StringBuilder sb = new StringBuilder(s.Length + 10); 3746for (int i = 0; i < baseType.Length; i++) 3762while (i < baseType.Length && baseType[i] >= '0' && baseType[i] <= '9') 3773if (i < baseType.Length && (baseType[i] == '+' || baseType[i] == '.')) 3784if (lastIndex < baseType.Length) 3878if (options.OutputAssembly == null || options.OutputAssembly.Length == 0)
FrameworkFork\Microsoft.CodeDom\Microsoft\VBCodeProvider.cs (27)
439StringBuilder b = new StringBuilder(value.Length + 5); 447while (i < value.Length) 465if (i < value.Length - 1 && value[i + 1] == '\n') 507&& (i < value.Length - 1) 551if (rawLine != null && rawLine.Length > 0) 580if (options.MainClass != null && options.MainClass.Length > 0) 675if (arg.Name != null && arg.Name.Length > 0) 711if (prefix != null && prefix.Length > 0) 1656for (int i = 0; i < value.Length; i++) 1662if (i < value.Length - 1 && value[i + 1] == '\n') 2081if (e.ReturnType.BaseType.Length == 0 || string.Compare(e.ReturnType.BaseType, typeof(void).FullName, StringComparison.OrdinalIgnoreCase) == 0) 2457if (del.ReturnType.BaseType.Length > 0 && string.Compare(del.ReturnType.BaseType, "System.Void", StringComparison.OrdinalIgnoreCase) != 0) 2465if (del.ReturnType.BaseType.Length > 0 && string.Compare(del.ReturnType.BaseType, "System.Void", StringComparison.OrdinalIgnoreCase) != 0) 2854if (e.Name != null && e.Name.Length > 0) 2877if (e.Name != null && e.Name.Length > 0) 2938if (value == null || value.Length == 0) 2943if (value.Length > 1023) 2948if (value[0] != '[' || value[value.Length - 1] != ']') 2957value = value.Substring(1, value.Length - 2); 2961if (value.Length == 1 && value[0] == '_') 2989if (baseType.Length == 0) 3059StringBuilder sb = new StringBuilder(baseType.Length + 10); 3067for (int i = 0; i < baseType.Length; i++) 3083while (i < baseType.Length && baseType[i] >= '0' && baseType[i] <= '9') 3094if (i < baseType.Length && (baseType[i] == '+' || baseType[i] == '.')) 3105if (lastIndex < baseType.Length) 3210if (options.OutputAssembly == null || options.OutputAssembly.Length == 0)
FrameworkFork\Microsoft.CodeDom\System\CodeTypeReference.cs (4)
144if (typeName == null || typeName.Length == 0) 155int end = typeName.Length - 1; 436int end = typeName.Length - 1; 440while (start < typeName.Length && Char.IsWhiteSpace(typeName[start])) start++;
FrameworkFork\Microsoft.CodeDom\System\FixedStringLookup.cs (3)
24int length = value.Length; 48Debug.Assert(value.Length == i + 1, "Lookup table contains an item in the wrong subtable. Item name: " + value); 70while (pos < value.Length)
FrameworkFork\Microsoft.Xml\Xml\Base64Decoder.cs (2)
99if (str.Length - startPos < len) 150for (int i = 0; i < s_charsBase64.Length; i++)
FrameworkFork\Microsoft.Xml\Xml\BinaryXml\XmlBinaryReader.cs (15)
122if (prefix.Length == 0) 1848if (nsdecl.prefix.Length > 0 || nsdecl.uri.Length > 0) 1945if (5 < prefixStr.Length) 1947if (6 == prefixStr.Length || ':' != prefixStr[5]) 2475if (prefix.Length != 0) 2479if (_attributes[i].name.prefix.Length != 0) 2519if (decl.prefix.Length == 0) 2647else if (n.prefix.Length != 0) 2649if (n.namespaceUri.Length == 0) 2653else if (n.namespaceUri.Length != 0) 2781sb = new StringBuilder(value.Length + value.Length / 2); 2845if (_qnameOther.localname.Length != 0) 4050if (qname.prefix.Length == 0)
FrameworkFork\Microsoft.Xml\Xml\BinHexDecoder.cs (1)
93if (str.Length - startPos < len)
FrameworkFork\Microsoft.Xml\Xml\BufferBuilder.cs (2)
219Append(value, 0, value.Length); 246if (count < 0 || start + count > value.Length)
FrameworkFork\Microsoft.Xml\Xml\Cache\XPathDocumentBuilder.cs (2)
148Debug.Assert(prefix != null && localName != null && ns != null && localName.Length != 0 && baseUri != null); 892if (text.Length != 0)
FrameworkFork\Microsoft.Xml\Xml\Cache\XPathDocumentNavigator.cs (3)
121if (s.Length == 0) 741if (name == null || name.Length == 0) 763if (name == null || name.Length == 0)
FrameworkFork\Microsoft.Xml\Xml\Cache\XPathNode.cs (2)
98if (Prefix.Length == 0) 240return NodeType == XPathNodeType.Namespace && localName.Length == 3 && localName == "xml";
FrameworkFork\Microsoft.Xml\Xml\Cache\XPathNodeInfoAtom.cs (3)
142for (int i = 0; i < _localName.Length; i++) 321if (_localName.Length != 0) 327if (_prefix.Length != 0)
FrameworkFork\Microsoft.Xml\Xml\Core\CharEntityEncoderFallback.cs (4)
155if (_charEntityIndex == _charEntity.Length) 165Debug.Assert(_charEntityIndex < _charEntity.Length); 180Debug.Assert(_charEntityIndex <= _charEntity.Length); 204return _charEntity.Length - _charEntityIndex;
FrameworkFork\Microsoft.Xml\Xml\Core\HtmlEncodedRawTextWriter.cs (18)
79Debug.Assert(name != null && name.Length > 0); 126Debug.Assert(localName != null && localName.Length != 0 && prefix != null && ns != null); 130if (ns.Length == 0) 132Debug.Assert(prefix.Length == 0); 169if (ns.Length == 0) 171Debug.Assert(prefix.Length == 0); 194if (ns.Length == 0) 196Debug.Assert(prefix.Length == 0); 316Debug.Assert(localName != null && localName.Length != 0 && prefix != null && ns != null); 318if (ns.Length == 0) 320Debug.Assert(prefix.Length == 0); 383Debug.Assert(target != null && target.Length != 0 && text != null); 411char* pSrcEnd = pSrc + text.Length; 858Debug.Assert(localName != null && localName.Length != 0 && prefix != null && ns != null); 864if (ns.Length == 0) 866Debug.Assert(prefix.Length == 0); 889if (prefix.Length != 0) 922Debug.Assert(localName != null && localName.Length != 0 && prefix != null && ns != null);
FrameworkFork\Microsoft.Xml\Xml\Core\HtmlUtf8RawTextWriter.cs (18)
78Debug.Assert(name != null && name.Length > 0); 125Debug.Assert(localName != null && localName.Length != 0 && prefix != null && ns != null); 129if (ns.Length == 0) 131Debug.Assert(prefix.Length == 0); 168if (ns.Length == 0) 170Debug.Assert(prefix.Length == 0); 193if (ns.Length == 0) 195Debug.Assert(prefix.Length == 0); 315Debug.Assert(localName != null && localName.Length != 0 && prefix != null && ns != null); 317if (ns.Length == 0) 319Debug.Assert(prefix.Length == 0); 382Debug.Assert(target != null && target.Length != 0 && text != null); 410char* pSrcEnd = pSrc + text.Length; 854Debug.Assert(localName != null && localName.Length != 0 && prefix != null && ns != null); 860if (ns.Length == 0) 862Debug.Assert(prefix.Length == 0); 885if (prefix.Length != 0) 918Debug.Assert(localName != null && localName.Length != 0 && prefix != null && ns != null);
FrameworkFork\Microsoft.Xml\Xml\Core\IncrementalReadDecoders.cs (1)
93Debug.Assert(str.Length - startPos >= len);
FrameworkFork\Microsoft.Xml\Xml\Core\QueryOutputWriter.cs (1)
164prefix.Length != 0 ? prefix + ":" + localName : localName,
FrameworkFork\Microsoft.Xml\Xml\Core\QueryOutputWriterV1.cs (1)
154prefix.Length != 0 ? prefix + ":" + localName : localName,
FrameworkFork\Microsoft.Xml\Xml\Core\ReadContentAsBinaryHelper.cs (1)
424int decodedCharsCount = _decoder.Decode(value, _valueOffset, value.Length - _valueOffset);
FrameworkFork\Microsoft.Xml\Xml\Core\ReadContentAsBinaryHelperAsync.cs (1)
341int decodedCharsCount = _decoder.Decode(value, _valueOffset, value.Length - _valueOffset);
FrameworkFork\Microsoft.Xml\Xml\Core\ReadOnlyTernaryTree.cs (1)
102if (stringPos == stringToFind.Length)
FrameworkFork\Microsoft.Xml\Xml\Core\SecureStringHasher.cs (2)
66return s_hashCodeDelegate3(key, key.Length, _hashCodeRandomizer); 74for (int i = 0; i < key.Length; i++)
FrameworkFork\Microsoft.Xml\Xml\Core\util\TernaryTreeGenerator.cs (3)
192if (stringToAdd.Length == 0) 218if (stringPos == stringToAdd.Length) 278for (int i = stringPos; i < stringToAdd.Length; ++i)
FrameworkFork\Microsoft.Xml\Xml\Core\ValidatingReaderNodeData.cs (1)
84if (_prefix.Length == 0)
FrameworkFork\Microsoft.Xml\Xml\Core\XmlAutoDetectWriter.cs (2)
91if (ns.Length == 0 && IsHtmlTag(localName)) 360if (tagName.Length != 4)
FrameworkFork\Microsoft.Xml\Xml\Core\XmlCharCheckingReader.cs (1)
647if (prefix.Length > 0)
FrameworkFork\Microsoft.Xml\Xml\Core\XmlCharCheckingWriter.cs (16)
141if (localName == null || localName.Length == 0) 147if (prefix != null && prefix.Length > 0) 159if (localName == null || localName.Length == 0) 165if (prefix != null && prefix.Length > 0) 324if (name == null || name.Length == 0) 367if (ncname.Length == 0) 372if (len != ncname.Length) 380if (name.Length == 0) 386if (len != name.Length) 403for (i = 0; i < str.Length; i++) 418sb = new StringBuilder(str.Length + 5); 424if (i + 1 < str.Length && str[i + 1] == '\n') 433sb = new StringBuilder(str.Length + 5); 446sb = new StringBuilder(str.Length + 5); 557for (i = 0; i < text.Length; i++) 567sb = new StringBuilder(text.Length + 5);
FrameworkFork\Microsoft.Xml\Xml\Core\XmlEncodedRawTextWriter.cs (24)
263Debug.Assert(name != null && name.Length > 0); 304Debug.Assert(localName != null && localName.Length > 0); 310if (prefix != null && prefix.Length != 0) 336Debug.Assert(localName != null && localName.Length > 0); 347if (prefix != null && prefix.Length != 0) 368Debug.Assert(localName != null && localName.Length > 0); 376if (prefix != null && prefix.Length != 0) 388Debug.Assert(localName != null && localName.Length > 0); 398if (prefix != null && prefix.Length > 0) 445if (prefix.Length == 0) 530Debug.Assert(name != null && name.Length > 0); 539if (text.Length > 0) 552Debug.Assert(name != null && name.Length > 0); 604char* pSrcEnd = pSrc + ws.Length; 625char* pSrcEnd = pSrc + text.Length; 704WriteRawWithCharChecking(pSrcBegin, pSrcBegin + data.Length); 1110RawText(pSrcBegin, pSrcBegin + s.Length); 1250if (text.Length == 0) 1265char* pSrcEnd = pSrcBegin + text.Length; 1381if (text.Length == 0) 1398char* pSrcEnd = pSrcBegin + text.Length; 1739for (int i = 0; i < chars.Length; i++) 1757if (i + 1 < chars.Length) 1845Debug.Assert(localName != null && localName.Length != 0 && prefix != null && ns != null);
FrameworkFork\Microsoft.Xml\Xml\Core\XmlRawWriter.cs (1)
275if (prefix.Length != 0)
FrameworkFork\Microsoft.Xml\Xml\Core\XmlReader.cs (9)
114if (Prefix.Length == 0) 1007if (name == null || name.Length == 0) 1028if (localName == null || localName.Length == 0) 1055if (name == null || name.Length == 0) 1097if (localName == null || localName.Length == 0) 1144if (name == null || name.Length == 0) 1172if (localName == null || localName.Length == 0) 1548if (localName == null || localName.Length == 0) 1618if (value.Length == 0)
FrameworkFork\Microsoft.Xml\Xml\Core\XmlReaderAsync.cs (1)
361if (value.Length == 0)
FrameworkFork\Microsoft.Xml\Xml\Core\XmlReaderSettings.cs (1)
428if (inputUri.Length == 0)
FrameworkFork\Microsoft.Xml\Xml\Core\XmlSubtreeReader.cs (8)
857if (_nsIncReadOffset == _curNode.value.Length) 862_nsIncReadOffset += _binDecoder.Decode(_curNode.value, _nsIncReadOffset, _curNode.value.Length - _nsIncReadOffset); 993if (_nsIncReadOffset == _curNode.value.Length) 998_nsIncReadOffset += _binDecoder.Decode(_curNode.value, _nsIncReadOffset, _curNode.value.Length - _nsIncReadOffset); 1114int copyCount = _curNode.value.Length - _nsIncReadOffset; 1259if (prefix.Length == 0) 1271else if (prefix.Length != 0 && _nsManager.LookupNamespace(prefix) != ns) 1310if (prefix.Length == 0)
FrameworkFork\Microsoft.Xml\Xml\Core\XmlSubtreeReaderAsync.cs (5)
274if (_nsIncReadOffset == _curNode.value.Length) 279_nsIncReadOffset += _binDecoder.Decode(_curNode.value, _nsIncReadOffset, _curNode.value.Length - _nsIncReadOffset); 410if (_nsIncReadOffset == _curNode.value.Length) 415_nsIncReadOffset += _binDecoder.Decode(_curNode.value, _nsIncReadOffset, _curNode.value.Length - _nsIncReadOffset); 523int copyCount = _curNode.value.Length - _nsIncReadOffset;
FrameworkFork\Microsoft.Xml\Xml\Core\XmlTextEncoder.cs (2)
278int len = text.Length; 423int len = text.Length;
FrameworkFork\Microsoft.Xml\Xml\Core\XmlTextReader.cs (1)
280if (ns != null && ns.Length == 0)
FrameworkFork\Microsoft.Xml\Xml\Core\XmlTextReaderImpl.cs (38)
476if (url == null || url.Length == 0) 516if (context == null || context.BaseURI == null || context.BaseURI.Length == 0) 583if (url.Length == 0) 614if (context.BaseURI != null && context.BaseURI.Length > 0 && 617if (baseUriStr.Length > 0) 707if (context.BaseURI != null && context.BaseURI.Length > 0 && 710if (baseUriStr.Length > 0) 2439if (_ps.baseUriStr.Length > 0 && _ps.baseUri == null && _xmlResolver != null) 2656Debug.Assert((systemId != null && systemId.Length > 0) || (publicId != null && publicId.Length > 0)); 2692RegisterConsumedCharacters(internalDtd.Length, false); 3030int len = str.Length; 3032str.CopyTo(0, _ps.chars, 0, str.Length); 3133Debug.Assert(_url != null && _url.Length > 0); 4462if (prefixLen == _lastPrefix.Length && XmlConvert.StrEqual(chars, startPos, prefixLen, _lastPrefix)) 4605string qname = (prefix.Length == 0) ? defaultAttributeInfo.LocalName : (prefix + ':' + defaultAttributeInfo.LocalName); 4625int prefLen = startTagNode.prefix.Length; 4626int locLen = startTagNode.localName.Length; 4638if (startTagNode.prefix.Length == 0) 5030if (attr.prefix.Length == 0) 5091if (_curNode.prefix.Length == 0) 5106if (at.type == XmlNodeType.Attribute && at.prefix.Length > 0) 5177if (ns.Length == 0) 6305_curNode.lineInfo.linePos += _curNode.localName.Length; 7825if (prefixLen == _lastPrefix.Length && XmlConvert.StrEqual(_ps.chars, startPos, prefixLen, _lastPrefix)) 7944if (uri.Length == 0 && prefix.Length > 0) 7958if (prefix.Length == 0) 8188RegisterConsumedCharacters(entity.Text.Length, true); 8958if (Ref.Equal(_nodes[i].localName, name) && _nodes[i].prefix.Length == 0) 9316if (defAttrInfo.Prefix.Length > 0) 9369if (prefix.Length == 0 && ns.Length > 0) 9405NodeData attr = AddAttribute(localName, prefix, prefix.Length > 0 ? null : localName); 9417if (attr.prefix.Length == 0) 9427if (_nodes[_index].prefix.Length == 0) 9701Debug.Assert(endPos < str.Length); 9745int len = value.Length;
FrameworkFork\Microsoft.Xml\Xml\Core\XmlTextReaderImplHelpers.cs (5)
545Debug.Assert(localName.Length > 0); 597sb.Append(_value, valueOffset, _value.Length - valueOffset); 618int copyCount = _value.Length - valueOffset; 638return decoder.Decode(_value, valueOffset, _value.Length - valueOffset); 674if (prefix.Length == 0)
FrameworkFork\Microsoft.Xml\Xml\Core\XmlTextWriter.cs (25)
473if (prefix != null && prefix.Length != 0 && (LookupNamespace(prefix) == -1)) 492else if (prefix.Length == 0) 498if (ns.Length == 0) 507if (prefix != null && prefix.Length != 0) 516if ((ns != null && ns.Length != 0) || (prefix != null && prefix.Length != 0)) 553if (prefix != null && prefix.Length == 0) 586if (localName == null || localName.Length == 0) 618else if (ns.Length == 0) 646if (prefix != null && prefix.Length != 0) 654if ((ns != null && ns.Length != 0) || (prefix != null && prefix.Length != 0)) 729if (null != text && (text.IndexOf("--", StringComparison.Ordinal) >= 0 || (text.Length != 0 && text[text.Length - 1] == '-'))) 831if (null != text && text.Length != 0) 1026if (ns != null && ns.Length != 0 && ns != _stack[_top].defaultNs) 1038if (prefix.Length != 0) 1045else if (ns != null && ns.Length != 0) 1061if (ns == null || ns.Length == 0) 1111if (name == null || name.Length == 0) 1440if (prefix.Length != 0 && ns.Length == 0) 1625if (name == null || name.Length == 0) 1630int nameLength = name.Length; 1714if (prefix != null && prefix.Length == 3)
FrameworkFork\Microsoft.Xml\Xml\Core\XmlUtf8RawTextWriter.cs (24)
215Debug.Assert(name != null && name.Length > 0); 254Debug.Assert(localName != null && localName.Length > 0); 258if (prefix != null && prefix.Length != 0) 284Debug.Assert(localName != null && localName.Length > 0); 293if (prefix != null && prefix.Length != 0) 314Debug.Assert(localName != null && localName.Length > 0); 320if (prefix != null && prefix.Length != 0) 332Debug.Assert(localName != null && localName.Length > 0); 340if (prefix != null && prefix.Length > 0) 384if (prefix.Length == 0) 463Debug.Assert(name != null && name.Length > 0); 470if (text.Length > 0) 483Debug.Assert(name != null && name.Length > 0); 530char* pSrcEnd = pSrc + ws.Length; 550char* pSrcEnd = pSrc + text.Length; 622WriteRawWithCharChecking(pSrcBegin, pSrcBegin + data.Length); 945RawText(pSrcBegin, pSrcBegin + s.Length); 1085if (text.Length == 0) 1100char* pSrcEnd = pSrcBegin + text.Length; 1216if (text.Length == 0) 1233char* pSrcEnd = pSrcBegin + text.Length; 1619for (int i = 0; i < chars.Length; i++) 1637if (i + 1 < chars.Length) 1720Debug.Assert(localName != null && localName.Length != 0 && prefix != null && ns != null);
FrameworkFork\Microsoft.Xml\Xml\Core\XmlValidatingReader.cs (1)
209if (ns != null && ns.Length == 0)
FrameworkFork\Microsoft.Xml\Xml\Core\XmlValidatingReaderImpl.cs (4)
172if (_coreReader.BaseURI.Length > 0) 192if (_coreReader.BaseURI.Length > 0) 1013if (_parserContext.DocTypeName == null || _parserContext.DocTypeName.Length == 0) 1065if (_outerReader.BaseURI.Length > 0)
FrameworkFork\Microsoft.Xml\Xml\Core\XmlWellformedWriter.cs (28)
379if (name == null || name.Length == 0) 447if (localName == null || localName.Length == 0) 467else if (prefix.Length > 0) 474if (ns == null || (ns != null && ns.Length == 0)) 484Debug.Assert(prefix.Length == 0); 631if (localName == null || localName.Length == 0) 663if (prefix != null && prefix.Length > 0) 673if (prefix.Length == 0) 677if (namespaceName.Length > 0 && namespaceName != XmlReservedNs.NsXmlNs) 685else if (namespaceName.Length > 0) 688if (prefix == null || prefix.Length == 0) 700if (namespaceName.Length > 0 && namespaceName != XmlReservedNs.NsXmlNs) 710if (namespaceName.Length > 0 && namespaceName != XmlReservedNs.NsXml) 728if (namespaceName.Length == 0) 743if (prefix.Length != 0) 806if (value.Length == 0) 922if (name == null || name.Length == 0) 935if (name.Length == 3 && string.Compare(name, "xml", StringComparison.OrdinalIgnoreCase) == 0) 973if (name == null || name.Length == 0) 1366if (localName == null || localName.Length == 0) 1374if (ns != null && ns.Length != 0) 1391if (prefix.Length != 0) 1787throw DupAttrException((prefix.Length == 0) ? string.Empty : "xmlns", (prefix.Length == 0) ? "xmlns" : prefix); 1829if (prefix.Length > 0 && prefix[0] == 'x') 1932if (prefix.Length > 0) 2144Debug.Assert(ncname != null && ncname.Length > 0); 2147int endPos = ncname.Length;
FrameworkFork\Microsoft.Xml\Xml\Core\XmlWellformedWriterHelpers.cs (3)
107if (prefix.Length == 0) 426if (((string)item.data).Length == 0) 465if (((string)item.data).Length == 0)
FrameworkFork\Microsoft.Xml\Xml\Core\XmlWriter.cs (5)
241if (name == null || name.Length == 0) 258if (ns != null && ns.Length > 0) 606if (null != value && 0 != value.Length) 617if (null != value && 0 != value.Length) 650if (prefix.Length == 0)
FrameworkFork\Microsoft.Xml\Xml\Core\XsdCachingReader.cs (1)
743if (Ref.Equal(attribute.LocalName, name) && attribute.Prefix.Length == 0)
FrameworkFork\Microsoft.Xml\Xml\Core\XsdValidatingReader.cs (4)
253if (prefix != null && prefix.Length != 0) 2013_nsManager.AddNamespace(_coreReader.Prefix.Length == 0 ? string.Empty : _coreReader.LocalName, _coreReader.Value); 2110if (attrPrefix.Length == 0) 2152if (attrPrefix.Length == 0)
FrameworkFork\Microsoft.Xml\Xml\Core\XsdValidatingReaderAsync.cs (1)
589_nsManager.AddNamespace(_coreReader.Prefix.Length == 0 ? string.Empty : _coreReader.LocalName, _coreReader.Value);
FrameworkFork\Microsoft.Xml\Xml\Dom\DocumentSchemaValidator.cs (4)
197if (attr.Prefix.Length == 0) 376_nsManager.AddNamespace(attr.Prefix.Length == 0 ? string.Empty : attr.LocalName, attr.Value); 492if (defaultPrefix.Length != 0) 732_nsManager.AddNamespace(attr.Prefix.Length == 0 ? string.Empty : attr.LocalName, attr.Value);
FrameworkFork\Microsoft.Xml\Xml\Dom\DocumentXmlWriter.cs (2)
253if (prefix.Length == 0) 437throw new XmlException(ResXml.Xml_DupAttributeName, attr.Prefix.Length == 0 ? attr.LocalName : string.Concat(attr.Prefix, ":", attr.LocalName));
FrameworkFork\Microsoft.Xml\Xml\Dom\DocumentXPathNavigator.cs (6)
394&& name.Length != 0) 438&& name.Length != 0) 1477if (localNameAtom.Length == 0) 1851string prefix = attribute.Prefix.Length == 0 ? string.Empty : attribute.LocalName; 2396Debug.Assert(localNameAtom.Length > 0); // Use DocumentXPathNodeIterator_ElemChildren_NoLocalName class for special magic value of localNameAtom 2426Debug.Assert(localNameAtom.Length > 0); // Use DocumentXPathNodeIterator_ElemChildren_AndSelf_NoLocalName if localName == String.Empty
FrameworkFork\Microsoft.Xml\Xml\Dom\XmlAttribute.cs (2)
29if (name.LocalName.Length == 0) 408if (_name.Prefix.Length == 0 && _name.LocalName == "xmlns") return string.Empty;
FrameworkFork\Microsoft.Xml\Xml\Dom\XmlCharacterData.cs (8)
76return _data.Length; 85int len = _data != null ? _data.Length : 0; 102int capacity = _data != null ? _data.Length : 0; 103if (strData != null) capacity += strData.Length; 120int capacity = _data != null ? _data.Length : 0; 121if (strData != null) capacity += strData.Length; 138int len = _data != null ? _data.Length : 0; 166int len = _data != null ? _data.Length : 0;
FrameworkFork\Microsoft.Xml\Xml\Dom\XmlDeclaration.cs (6)
26if ((standalone != null) && (standalone.Length > 0)) 58else if (value.Length == 0 || value == YES || value == NO) 79if (Encoding.Length > 0) 85if (Standalone.Length > 0) 171return ver.Length >= 3 && ver[0] == '1' && ver[1] == '.' && XmlCharType.IsOnlyDigits(ver, 2, ver.Length - 2);
FrameworkFork\Microsoft.Xml\Xml\Dom\XmlDocument.cs (10)
132if (endPos < name.Length) 141Debug.Assert((prefix == null) ? (n.Prefix.Length == 0) : (prefix == n.Prefix)); 143Debug.Assert((namespaceURI == null) ? (n.NamespaceURI.Length == 0) : (n.NamespaceURI == namespaceURI)); 150Debug.Assert(n == null || ((prefix == null) ? (n.Prefix.Length == 0) : (prefix == n.Prefix))); 152Debug.Assert(n == null || ((namespaceURI == null) ? (n.NamespaceURI.Length == 0) : (n.NamespaceURI == namespaceURI))); 159Debug.Assert((prefix == null) ? (xmlName.Prefix.Length == 0) : (prefix == xmlName.Prefix)); 161Debug.Assert((namespaceURI == null) ? (xmlName.NamespaceURI.Length == 0) : (xmlName.NamespaceURI == namespaceURI)); 550if (prefix == strXmlns || (prefix.Length == 0 && localName == strXmlns)) 1299if (value.Length > 0) 1385if (Standalone.Length == 0)
FrameworkFork\Microsoft.Xml\Xml\Dom\XmlDomTextWriter.cs (4)
35if ((ns.Length == 0) && (prefix.Length != 0)) 45if ((ns.Length == 0) && (prefix.Length != 0))
FrameworkFork\Microsoft.Xml\Xml\Dom\XmlElement.cs (1)
32if (name.LocalName.Length == 0)
FrameworkFork\Microsoft.Xml\Xml\Dom\XmlEntityReference.cs (3)
43if (name.Length > 0 && name[0] == '#') 191if (nCount > 0 && nCount < baseURI.Length) 207if (ent.SystemId != null && ent.SystemId.Length > 0)
FrameworkFork\Microsoft.Xml\Xml\Dom\XmlLoader.cs (2)
715else if (!bHasDefXmlnsAttr && attr.Prefix.Length == 0 && attr.LocalName == _doc.strXmlns) 835else if (attr.Prefix.Length == 0 && attr.LocalName == _doc.strXmlns)
FrameworkFork\Microsoft.Xml\Xml\Dom\XmlName.cs (3)
93if (_prefix.Length > 0) 95if (_localName.Length > 0) 187for (int i = name.Length - 1; i >= 0; i--)
FrameworkFork\Microsoft.Xml\Xml\Dom\XmlNode.cs (4)
1080if (prefix.Length == 0) 1085if (attr.Prefix.Length == 0) 1168if (attr.Prefix.Length == 0) 1268if (-1 == colonPos || 0 == colonPos || name.Length - 1 == colonPos)
FrameworkFork\Microsoft.Xml\Xml\Dom\XmlNodeReader.cs (13)
375if (strTemp != null && strTemp.Length != 0) 382if (strTemp != null && strTemp.Length != 0) 389if (strTemp != null && strTemp.Length != 0) 528return (ns.Length == 0) ? GetDeclarationAttr((XmlDeclaration)_curNode, name) : null; 530return (ns.Length == 0) ? GetDocumentTypeAttr((XmlDocumentType)_curNode, name) : null; 650if (ns.Length == 0) 677else if (nt == XmlNodeType.XmlDeclaration && namespaceURI.Length == 0) 685else if (nt == XmlNodeType.DocumentType && namespaceURI.Length == 0) 877if (prefix.Length == 0) 905if (prefix.Length == 0) 965if (a.Prefix.Length == 0 && a.LocalName == "xmlns") 1013if (a.LocalName == "xmlns" && a.Prefix.Length == 0) 1776if (ns != null && ns.Length == 0)
FrameworkFork\Microsoft.Xml\Xml\NameTable.cs (7)
73int len = key.Length; 80for (int i = 0; i < key.Length; i++) 143if (value.Length == 0) 148int len = value.Length + _hashCodeRandomizer; 151for (int i = 0; i < value.Length; i++) 246if (str1.Length != str2Length) 251for (int i = 0; i < str1.Length; i++)
FrameworkFork\Microsoft.Xml\Xml\schema\AstTree.cs (6)
191if (!((URN == null) || (URN.Length == 0))) 197else if ((thisURN.Length != 0) && (thisURN != URN)) 202if ((thisname.Length != 0) && (thisname != name)) 569if ((xPath == null) || (xPath.Length == 0)) 714if (axis.Prefix.Length != 0) 723else if (axis.Name.Length != 0)
FrameworkFork\Microsoft.Xml\Xml\schema\BaseProcessor.cs (1)
71if (qname.Name.Length == 0)
FrameworkFork\Microsoft.Xml\Xml\schema\basevalidator.cs (1)
222if (textString.Length == 0)
FrameworkFork\Microsoft.Xml\Xml\schema\ChameleonKey.cs (3)
38if (chameleonLocation.OriginalString.Length == 0) 70Debug.Assert((chameleonLocation.OriginalString.Length == 0 && originalSchema != null) 71|| (chameleonLocation.OriginalString.Length != 0 && originalSchema == null));
FrameworkFork\Microsoft.Xml\Xml\schema\ContentValidator.cs (3)
1735if (s.Length != 0) 1886if (s.Length != 0) 2200if (s.Length != 0)
FrameworkFork\Microsoft.Xml\Xml\schema\DatatypeImplementation.cs (6)
1921if (s == null || s.Length == 0) 1952if (s == null || s.Length == 0) 1991if (s == null || s.Length == 0) 2762if (s == null || s.Length == 0) 3098if (s == null || s.Length == 0) 3813if (s == null || s.Length == 0)
FrameworkFork\Microsoft.Xml\Xml\schema\DtdParser.cs (23)
281if (docTypeName == null || docTypeName.Length == 0) 301if (systemId != null && systemId.Length > 0) 311if (publicId != null && publicId.Length > 0) 321if (internalSubset != null && internalSubset.Length > 0) 481if (_systemId != null && _systemId.Length > 0) 496if (_systemId != null && _systemId.Length > 0) 694if (attrDef != null && attrDef.Prefix.Length > 0 && attrDef.Prefix.Equals("xml") && attrDef.Name.Name == "space") 718if (attrDef.Prefix.Length > 0 && attrDef.Prefix.Equals("xml")) 956SendValidationEvent(_curPos - name.Name.Length, XmlSeverityType.Error, ResXml.Sch_DupElementDecl, GetNameString()); 1240entity.DeclaredURI = (_externalDtdBaseUri.Length == 0) ? _documentBaseUri : _externalDtdBaseUri; 1344SendValidationEvent(_curPos - notationName.Name.Length, XmlSeverityType.Error, ResXml.Sch_DupNotation, notationName.Name); 1377UndeclaredNotation un = new UndeclaredNotation(notationName, LineNo, LinePos - notationName.Length); 1507Throw(_curPos - systemId.Length - 1, ResXml.Xml_FragmentId, new string[] { systemId.Substring(systemId.IndexOf('#')), systemId }); 1525ThrowInvalidChar(_curPos - 1 - publicId.Length + i, publicId, i); 3333Throw(_curPos - entityName.Name.Length - 1, ResXml.Xml_InvalidParEntityRef); 3343Throw(_curPos - entityName.Name.Length - 1, paramEntity ? ResXml.Xml_RecursiveParEntity : ResXml.Xml_RecursiveGenEntity, entityName.Name); 3357if (entity.Text.Length == 0) 3436SendValidationEvent(_curPos - entityName.Name.Length - 1, XmlSeverityType.Error, ResXml.Xml_UndeclaredParEntity, entityName.Name); 3445SendValidationEvent(_curPos - entityName.Name.Length - 1, XmlSeverityType.Error, ResXml.Xml_UndeclaredEntity, entityName.Name); 3450Throw(_curPos - entityName.Name.Length - 1, ResXml.Xml_UndeclaredEntity, entityName.Name); 3458Throw(_curPos - entityName.Name.Length - 1, ResXml.Xml_UnparsedEntityRef, entityName.Name); 3463Throw(_curPos - entityName.Name.Length - 1, ResXml.Xml_ExternalEntityInAttValue, entityName.Name); 3624int len = value.Length;
FrameworkFork\Microsoft.Xml\Xml\schema\FacetChecker.cs (4)
707int length = pattern.Length; 1382int length = value.Length; 1477if (s == null || s.Length == 0) 1523int length = strValue.Length;
FrameworkFork\Microsoft.Xml\Xml\schema\Inference\infer.cs (62)
270if (ns.Length != 0) 346if (childURI.Length == 0) 362if (childURI.Length != 0) 366if (prefix.Length != 0 && String.Compare(prefix, "xml", StringComparison.OrdinalIgnoreCase) != 0) 377if (childURI.Length != 0) //BUGBUG It need not be an attribute reference if there is a namespace, it can be attribute with attributeFormDefault = qualified 487if (childURI.Length != 0) 502Debug.Assert(targetNS == null || targetNS.Length > 0, "targetns for schema is empty"); 557if (prefix.Length != 0) 1065if (childURI.Length == 0) 1442if (attr.RefName.Name.Length == 0) 1771if (s.Length == 0) return TF_string; 1798if (i == s.Length) 1817i++; if (i == s.Length) return TF_decimal | TF_float | TF_double | TF_string; //"9999.9" was matched 1830i++; if (i == s.Length) return TF_string; 1843i++; if (i == s.Length) return TF_string; //".9999e+" was matched 1849i++; if (i == s.Length) return TF_float | TF_double | TF_string; //".9999e+99" was matched 1856i++; if (i == s.Length) return TF_string; 1872i++; if (i == s.Length) return TF_string; 1886i++; if (i == s.Length) return TF_string; 1897i++; if (i == s.Length) return TF_string; //"P999" was matched 1914if (i == s.Length) 1930i++; if (i == s.Length) return TF_string; //"P999Y9" was matched 1945if (i == s.Length) 1961i++; if (i == s.Length) return TF_string; //"P999Y999M9" was matched 1974if (i == s.Length) 1987i++; if (i == s.Length) return TF_string; //"P999Y999M9999DT" was matched 1993i++; if (i == s.Length) return TF_string; //"___T9" was matched 2012if (i == s.Length) 2022i++; if (i == s.Length) return TF_string; //"___T999H9" was matched 2039if (i == s.Length) 2049i++; if (i == s.Length) return TF_string; //"___T999H999M9" was matched 2064if (i == s.Length) 2074i++; if (i == s.Length) return TF_string; //"___T999H999M999.9" was matched 2087if (i == s.Length) 2105if (i == s.Length) 2136if (i == s.Length) 2165if (i == s.Length) 2190if (i == s.Length) 2218i++; if (i == s.Length) return TF_string; //"9999-" 2221i++; if (i == s.Length) return TF_string; //"9999-9" 2225if (i == s.Length) 2245i++; if (i == s.Length) return TF_string; //"9999-99-" 2248i++; if (i == s.Length) return TF_string; //"9999-99-9" 2251i++; if (i == s.Length) return DateTime(s, bDate, bTime); //"9999-99-99" 2271if (i == s.Length) 2286i++; if (i == s.Length) return TF_string; 2289i++; if (i == s.Length) return TF_string; 2292i++; if (i == s.Length) return TF_string; 2296i++; if (i == s.Length) return TF_string; 2299i++; if (i == s.Length) return TF_string; 2303if (i == s.Length) 2317i++; if (i == s.Length) return TF_string; 2320i++; if (i == s.Length) return TF_string; 2323i++; if (i == s.Length) return TF_string; 2327i++; if (i == s.Length) return TF_string; 2330i++; if (i == s.Length) return TF_string; 2333i++; if (i == s.Length) return TF_string; 2336i++; if (i == s.Length) return TF_string; 2339i++; if (i == s.Length) return TF_string; 2342i++; if (i == s.Length) return DateTime(s, bDate, bTime); 2357i++; if (i == s.Length) return TF_string; 2361i++; if (i == s.Length) return DateTime(s, bDate, bTime);
FrameworkFork\Microsoft.Xml\Xml\schema\NamespaceList.cs (3)
37if (namespaces == "##any" || namespaces.Length == 0) 113return ns != _targetNamespace && ns.Length != 0; 151else if (s.Length == 0)
FrameworkFork\Microsoft.Xml\Xml\schema\Parser.cs (5)
193_namespaceManager.AddNamespace(_reader.Prefix.Length == 0 ? string.Empty : _reader.LocalName, _reader.Value); 357_annotationNSManager.AddNamespace(r.Prefix.Length == 0 ? string.Empty : _reader.LocalName, _reader.Value); 370else if (ns.Length == 0) 382if (r.Prefix.Length != 0) 406if (prefix.Length == 0)
FrameworkFork\Microsoft.Xml\Xml\schema\Preprocessor.cs (8)
121else if (targetNamespace != null && targetNamespace.Length != 0) 555if (tns.Length == 0) 623if (importNS.Length == 0) 660else if (targetNamespace != null && targetNamespace.Length != 0) 2109if (name == null || name.Length == 0) 2116if (len != name.Length) 2134if (_currentSchema.IsChameleon && value.Namespace.Length == 0) 2157if (location.Length == 0)
FrameworkFork\Microsoft.Xml\Xml\schema\SchemaCollectionPreprocessor.cs (5)
303if (tns.Length == 0) 338else if (schema.TargetNamespace == null && targetNamespace != null && targetNamespace.Length == 0) 414if (ns.Length == 0) 1750if (name == null || name.Length == 0) 1757if (len != name.Length)
FrameworkFork\Microsoft.Xml\Xml\schema\SchemaInfo.cs (1)
210if (!ed.ContentValidator.IsOpen || qname.Namespace.Length == 0)
FrameworkFork\Microsoft.Xml\Xml\schema\SchemaNamespaceManager.cs (1)
37return prefix.Length == 0 ? string.Empty : null;
FrameworkFork\Microsoft.Xml\Xml\schema\XdrBuilder.cs (10)
465if (prefixValue.Length != 0) 530Uri ruri = _xmlResolver.ResolveUri(_baseUri, uri.Substring(x_schema.Length)); 561return uri.Length >= x_schema.Length && 5620 == string.Compare(uri, 0, x_schema, 0, x_schema.Length, StringComparison.Ordinal) && 687if (gname.Namespace.Length == 0) 773if (s.Length == 0) 1298if (prefix.Length == 0) 1306else if (prefix.Length != 0) 1533ns.Length != 0 &&
FrameworkFork\Microsoft.Xml\Xml\schema\xdrvalidator.cs (6)
212_nsManager.AddNamespace(reader.Prefix.Length == 0 ? string.Empty : reader.LocalName, reader.Value); 337string url = uri.Substring(x_schema.Length); 474if (value.Length == 0) 504if (value.Length > decl.MaxLength) 511if (value.Length < decl.MinLength) 577if (value.Length == 0)
FrameworkFork\Microsoft.Xml\Xml\schema\XmlAtomicValue.cs (1)
399if (len == 0 || len != value.Length)
FrameworkFork\Microsoft.Xml\Xml\schema\XmlSchema.cs (1)
214if (_targetNs != null && _targetNs.Length != 0)
FrameworkFork\Microsoft.Xml\Xml\schema\XmlSchemaAny.cs (1)
58if (_ns == null || _ns.Length == 0)
FrameworkFork\Microsoft.Xml\Xml\schema\XmlSchemaCollection.cs (1)
111if (uri == null || uri.Length == 0)
FrameworkFork\Microsoft.Xml\Xml\schema\XmlSchemaDatatype.cs (3)
346if (uri.Length > 5 && uri.StartsWith("uuid:", StringComparison.Ordinal)) 350else if (uri.Length > 9 && uri.StartsWith("urn:uuid:", StringComparison.Ordinal)) 358canonicalUri = nameTable.Add(uri.Substring(0, offset) + uri.Substring(offset, uri.Length - offset).ToUpperInvariant());
FrameworkFork\Microsoft.Xml\Xml\schema\XmlSchemaElement.cs (1)
314get { return _defaultValue != null && _defaultValue.Length > 0; }
FrameworkFork\Microsoft.Xml\Xml\schema\XmlSchemaParticle.cs (1)
182return new XmlQualifiedName("*", ns.Length == 0 ? "##any" : ns);
FrameworkFork\Microsoft.Xml\Xml\schema\XmlSchemaSet.cs (9)
314if (schemaUri == null || schemaUri.Length == 0) 1000if (schemaUri == null || schemaUri.OriginalString.Length == 0) 1272if (_schemas.ContainsKey(currentSchema.SchemaId) || (baseUri != null && baseUri.OriginalString.Length != 0 && _schemaLocations[baseUri] != null)) 1278if (baseUri != null && baseUri.OriginalString.Length != 0) 1406if (_schemas.ContainsKey(schema.SchemaId) && (targetNamespace.Length == 0 || targetNamespace == schema.TargetNamespace)) 1422else if (targetNamespace.Length != 0 && targetNamespace != schema.TargetNamespace) 1441if (schemaUri == null || schemaUri.OriginalString.Length == 0) 1483if (reprocessList[i].BaseUri != null && reprocessList[i].BaseUri.OriginalString.Length != 0) 1545if (qname.Name.Length == 0)
FrameworkFork\Microsoft.Xml\Xml\schema\XmlSchemaValidator.cs (12)
580&& attQName.Namespace.Length != 0 1069if (attributeNS.Length > 0) 1072if (defaultPrefix == null || defaultPrefix.Length == 0) 1449if (stringValue.Length == 0 && currentElementDecl.DefaultValueTyped != null) 1529if (typeName.Length == 0) 1842if (elementValue.Length == 0) 2176if (defaultPrefix.Length != 0) 2388if (typedValue != null && stringValue.Length != 0) 2694if (name.Namespace.Length != 0) 2734if (name.Namespace.Length != 0) 2769return (ns.Length != 0) ? string.Concat(ns, ":", localName) : localName; 2779if (ns.Length != 0)
FrameworkFork\Microsoft.Xml\Xml\schema\XmlValueConverter.cs (2)
576if (name.Namespace.Length == 0) 857return (prefix.Length != 0) ? string.Concat(prefix, ":", qname.Name) : qname.Name;
FrameworkFork\Microsoft.Xml\Xml\schema\XsdBuilder.cs (2)
754if ((ns != _schemaNames.NsXs) && (ns.Length != 0)) 2550if (r == (int)XmlSchemaDerivationMethod.All && value.Length > HashAllLength)
FrameworkFork\Microsoft.Xml\Xml\schema\XsdDateTime.cs (23)
87private static readonly int s_lzyyyy = "yyyy".Length; 88private static readonly int s_lzyyyy_ = "yyyy-".Length; 89private static readonly int s_lzyyyy_MM = "yyyy-MM".Length; 90private static readonly int s_lzyyyy_MM_ = "yyyy-MM-".Length; 91private static readonly int s_lzyyyy_MM_dd = "yyyy-MM-dd".Length; 92private static readonly int s_lzyyyy_MM_ddT = "yyyy-MM-ddT".Length; 93private static readonly int s_lzHH = "HH".Length; 94private static readonly int s_lzHH_ = "HH:".Length; 95private static readonly int s_lzHH_mm = "HH:mm".Length; 96private static readonly int s_lzHH_mm_ = "HH:mm:".Length; 97private static readonly int s_lzHH_mm_ss = "HH:mm:ss".Length; 98private static readonly int s_Lz_ = "-".Length; 99private static readonly int s_lz_zz = "-zz".Length; 100private static readonly int s_lz_zz_ = "-zz:".Length; 101private static readonly int s_lz_zz_zz = "-zz:zz".Length; 102private static readonly int s_Lz__ = "--".Length; 103private static readonly int s_lz__mm = "--MM".Length; 104private static readonly int s_lz__mm_ = "--MM-".Length; 105private static readonly int s_lz__mm__ = "--MM--".Length; 106private static readonly int s_lz__mm_dd = "--MM-dd".Length; 107private static readonly int s_Lz___ = "---".Length; 108private static readonly int s_lz___dd = "---dd".Length; 742_length = text.Length;
FrameworkFork\Microsoft.Xml\Xml\schema\XsdDuration.cs (2)
509length = s.Length; 690int offsetEnd = s.Length;
FrameworkFork\Microsoft.Xml\Xml\schema\xsdvalidator.cs (4)
290_nsManager.AddNamespace(reader.Prefix.Length == 0 ? string.Empty : reader.LocalName, reader.Value); 349if (!(stringValue.Length == 0 && context.ElementDecl.DefaultValueTyped != null)) 519&& attQName.Namespace.Length != 0 1071if (reader.TypedValueObject != null && stringValue.Length != 0)
FrameworkFork\Microsoft.Xml\Xml\Serialization\CodeExporter.cs (2)
268if (name == null || name.Length == 0) 279if (ns != null && ns.Length != 0)
FrameworkFork\Microsoft.Xml\Xml\Serialization\CodeIdentifier.cs (11)
40if (identifier.Length <= 2) 55if (identifier.Length <= 2) 70for (int i = 0; i < identifier.Length && builder.Length < MaxIdentifierLength; i++) 88if (identifier.Length > 30) 220if (ns != null && ns.Length > 0) 249if (identifier == null || identifier.Length == 0) 256identifier = identifier.Substring(0, identifier.Length - 2); 258if (identifier.Length > 0) 272if (identifier == null || identifier.Length == 0) return identifier; 284separator += names[i].Length; 288if (sb.Length != originalIdentifier.Length)
FrameworkFork\Microsoft.Xml\Xml\Serialization\CodeIdentifiers.cs (1)
114if (identifier.Length > CodeIdentifier.MaxIdentifierLength)
FrameworkFork\Microsoft.Xml\Xml\Serialization\Compilation.cs (1)
142if (encodingStyle != null && encodingStyle.Length > 0)
FrameworkFork\Microsoft.Xml\Xml\Serialization\Mappings.cs (7)
102if (name == null || name.Length == 0) return name; 108if (name == null || name.Length == 0) return name; 114if (colon == 0 || colon == name.Length - 1) 238Name = Name.Substring("xml:".Length); 337get { return _typeName == null || _typeName.Length == 0; } 1184if (s.TargetNamespace != null && s.TargetNamespace.Length > 0) 1418if (_schema.Id == null || _schema.Id.Length == 0) throw new InvalidOperationException(string.Format(ResXml.XmlSerializableNameMissing1, _type.FullName));
FrameworkFork\Microsoft.Xml\Xml\Serialization\SchemaObjectWriter.cs (6)
165if (value == null || value.Length == 0) 169if (ns != null && ns.Length != 0) 259if (s.Length == 0) 308if (o.QualifiedName != null && !o.QualifiedName.IsEmpty && o.QualifiedName.Namespace != null && o.QualifiedName.Namespace.Length != 0) 987if (o.QualifiedName != null && !o.QualifiedName.IsEmpty && o.QualifiedName.Namespace != null && o.QualifiedName.Namespace.Length != 0) 996if (o.Name != null && o.Name.Length != 0)
FrameworkFork\Microsoft.Xml\Xml\Serialization\SoapCodeExporter.cs (1)
141if (baseName != null && baseName.Length > 0)
FrameworkFork\Microsoft.Xml\Xml\Serialization\SoapReflectionImporter.cs (8)
160element.Name = elementName == null || elementName.Length == 0 ? elementName : XmlConvert.EncodeLocalName(elementName); 198if (dataType.Length > 0) 562if (dataType.Length > 0) 629constant.XmlName = a.SoapEnum.Name.Length == 0 ? model.Name : a.SoapEnum.Name; 729attribute.Name = Accessor.EscapeQName(a.SoapAttribute == null || a.SoapAttribute.AttributeName.Length == 0 ? accessorName : a.SoapAttribute.AttributeName); 744element.Name = XmlConvert.EncodeLocalName(a.SoapElement == null || a.SoapElement.ElementName.Length == 0 ? accessorName : a.SoapElement.ElementName); 790if (typeDesc.IsPrimitive && typeDesc.DataType != null && typeDesc.DataType.Name != null && typeDesc.DataType.Name.Length > 0) 797if (a.SoapType != null && a.SoapType.TypeName.Length > 0)
FrameworkFork\Microsoft.Xml\Xml\Serialization\SoapSchemaExporter.cs (2)
120schema.TargetNamespace = ns == null || ns.Length == 0 ? null : ns; 139if (ns != null && ns.Length > 0 && FindImport(schema, ns) == null)
FrameworkFork\Microsoft.Xml\Xml\Serialization\SoapSchemaImporter.cs (3)
172if (element.Name.Length == 0) 681if (dataType.Name != null && dataType.Name.Length != 0) 696if (dataType.Name != null && dataType.Name.Length != 0)
FrameworkFork\Microsoft.Xml\Xml\Serialization\XmlAttributes.cs (1)
122if ((any.Name == null || any.Name.Length == 0) && any.NamespaceSpecified && any.Namespace == null)
FrameworkFork\Microsoft.Xml\Xml\Serialization\XmlCodeExporter.cs (6)
233if (values[i].Length == 0) continue; 334if (vals[i] != null && vals[i].Length > 0) count++; 341if (vals[i] != null && vals[i].Length > 0) 585if (baseName != null && baseName.Length > 0) 914if (form == XmlSchemaForm.Unqualified && ns != null && ns.Length == 0) 946if (name != null && name.Length > 0)
FrameworkFork\Microsoft.Xml\Xml\Serialization\XmlCustomFormatter.cs (2)
376if (value.Length == 0) 396else if (validate && parts[i].Length > 0)
FrameworkFork\Microsoft.Xml\Xml\Serialization\XmlReflectionImporter.cs (28)
214element.Name = elementName == null || elementName.Length == 0 ? elementName : XmlConvert.EncodeLocalName(elementName); 276if (root.ElementName.Length > 0) 308if (accessor.Any && accessor.Name.Length == 0) 392if (dataType.Length > 0) 715if (typeName == null || typeName.Length == 0) 957if (typeDesc.IsPrimitive && typeDesc.DataType != null && typeDesc.DataType.Name != null && typeDesc.DataType.Name.Length > 0) 965if (a.XmlType != null && a.XmlType.TypeName.Length > 0) 1160if (dataType.Length > 0) 1345if (structAttrs.XmlRoot.ElementName.Length > 0) 1360if (xmlElement.ElementName.Length == 0) 1505arrayItemElement.Name = xmlArrayItem.ElementName.Length == 0 ? arrayItemElement.Mapping.DefaultElementName : XmlConvert.EncodeLocalName(xmlArrayItem.ElementName); 1586attribute.Name = Accessor.EscapeQName(a.XmlAttribute.AttributeName.Length == 0 ? accessorName : a.XmlAttribute.AttributeName); 1638element.Name = XmlConvert.EncodeLocalName(xmlElement.ElementName.Length == 0 ? accessorName : xmlElement.ElementName); 1643element.Name = xmlElement.ElementName.Length == 0 ? element.Mapping.DefaultElementName : XmlConvert.EncodeLocalName(xmlElement.ElementName); 1674string anyName = xmlAnyElement.Name.Length == 0 ? xmlAnyElement.Name : XmlConvert.EncodeLocalName(xmlAnyElement.Name); 1693if (element.Name.Length > 0) 1730arrayElement.Name = XmlConvert.EncodeLocalName(a.XmlArray.ElementName.Length == 0 ? accessorName : a.XmlArray.ElementName); 1767attribute.Name = Accessor.EscapeQName(a.XmlAttribute.AttributeName.Length == 0 ? accessorName : a.XmlAttribute.AttributeName); 1812element.Name = XmlConvert.EncodeLocalName(xmlElement.ElementName.Length == 0 ? accessorName : xmlElement.ElementName); 1882element.Name = XmlConvert.EncodeLocalName(xmlElement.ElementName.Length == 0 ? accessorName : xmlElement.ElementName); 1886element.Name = xmlElement.ElementName.Length == 0 ? element.Mapping.DefaultElementName : XmlConvert.EncodeLocalName(xmlElement.ElementName); 1918string anyName = xmlAnyElement.Name.Length == 0 ? xmlAnyElement.Name : XmlConvert.EncodeLocalName(xmlAnyElement.Name); 1938if (element.Name.Length > 0) 1986if (element.Any && element.Name.Length == 0) 1989if (xmlName.Substring(0, xmlName.Length - 1) == anyNs) 2013if (element.Any && element.Name.Length == 0) 2020string id = element.Namespace != null && element.Namespace.Length > 0 ? element.Namespace + ":" + element.Name : element.Name; 2263if (typeName.Length == 0)
FrameworkFork\Microsoft.Xml\Xml\Serialization\XmlSchemaExporter.cs (9)
65if (type != null && type.Name != null && type.Name.Length > 0) 195if (members.Count == 1 && members[0].Any && members[0].ElementName.Length == 0) 262if (accessor.Any && accessor.Name.Length == 0) 345if (ns != null && ns.Length > 0) 353if (ns1 == null || ns1.Length == 0) 354return (ns2 == null || ns2.Length == 0); 488if (serializableMapping.NamespaceList.Length > 0) 844if (accessor.Any && accessor.Name.Length == 0) 849if (accessor.Namespace != null && accessor.Namespace.Length > 0 && accessor.Namespace != ns)
FrameworkFork\Microsoft.Xml\Xml\Serialization\XmlSchemaImporter.cs (22)
329if (element.Name.Length == 0) 335if (identifier.Length == 0) 441if (typeName != null && typeName.Length > 0) 575if (mapping != null && type.Name != null && type.Name.Length != 0) 662string typeName = type.Name == null || type.Name.Length == 0 ? GenerateUniqueTypeName(identifier, typeNs) : GenerateUniqueTypeName(identifier); 665structMapping.TypeName = type.Name == null || type.Name.Length == 0 ? null : identifier; 1206if (identifier.Length == 0) 1399arrayMapping.TypeName = (type.Name == null || type.Name.Length == 0) ? "ArrayOf" + CodeIdentifier.MakePascal(arrayMapping.TypeDesc.Name) : type.Name; 1416arrayMapping.TypeName = (type.Name == null || type.Name.Length == 0) ? "ArrayOf" + CodeIdentifier.MakePascal(itemAccessor.Mapping.TypeDesc.Name) : type.Name; 1428if (type.Name != null && type.Name.Length != 0) 1713if (attribute.Name.Length == 0) throw new InvalidOperationException(ResXml.XmlAttributeHasNoName); 1714if (identifier.Length == 0) 1847if (dataType.Name != null && dataType.Name.Length > 0) 1941if (dataType.Name != null && dataType.Name.Length != 0) 1996if (dataType.Name != null && dataType.Name.Length != 0) 2083if (ns == null || ns.Length == 0) 2090return element.QualifiedName.Namespace == null || element.QualifiedName.Namespace.Length == 0 ? XmlSchemaForm.Unqualified : XmlSchemaForm.Qualified; 2104if (typeName != null && typeName.Length > 0) 2119if (typeName != null && typeName.Length > 0) 2134if (typeName != null && typeName.Length > 0) 2155if (ns == null || ns.Length == 0) 2162return attribute.QualifiedName.Namespace == null || attribute.QualifiedName.Namespace.Length == 0 ? XmlSchemaForm.Unqualified : XmlSchemaForm.Qualified;
FrameworkFork\Microsoft.Xml\Xml\Serialization\XmlSchemas.cs (4)
582if (type.Name != null && type.Name.Length != 0) 602if (ns == null || ns.Length == 0) 626if (e.Name == null || e.Name.Length == 0) 648if (a.Name == null || a.Name.Length == 0)
FrameworkFork\Microsoft.Xml\Xml\Serialization\XmlSerializationReader.cs (9)
803if (name.Length == 5) return true; 1013if (value.Length == 0) 1094if (itemType != null && itemType.Length > 0) 1100if (arraySize != null && arraySize.Length > 0) 1109if (dimensions[i].Length > 0) 1210if (prefix == null || prefix.Length == 0) 1470if (value == null || value.Length == 0) 1689if (arrayInfo.qname.Length > 0) 1796if (_r.NamespaceURI.Length != 0)
FrameworkFork\Microsoft.Xml\Xml\Serialization\XmlSerializationWriter.cs (39)
398if (ns == null || ns.Length == 0) return name; 412else if (prefix.Length == 0) 480if (alias.Length > 0 && aliasNs == ns) 482if (alias.Length == 0) 484if (aliasNs == null || aliasNs.Length == 0) 492if (writePrefixed && prefix == null && ns != null && ns.Length > 0) 495if (prefix == null || prefix.Length == 0) 504if (needEmptyDefaultNamespace && prefix == null && ns != null && ns.Length != 0) 512if (alias.Length == 0 && (aliasNs == null || aliasNs.Length == 0)) 514if (aliasNs == null || aliasNs.Length == 0) 516if (alias.Length > 0) 525if (prefix == null && alias.Length == 0) 538int prefixLength = prefix.Length; 543if (alias.Length > prefixLength) 546int nameLength = name.Length; 547if (name.Length > prefixLength && name.Length <= prefixLength + MaxInt32.Length && name.StartsWith(prefix, StringComparison.Ordinal)) 550for (int j = prefixLength; j < name.Length; j++) 589if (name == null || name.Length == 0) 605if (name == null || name.Length == 0) 621if (name == null || name.Length == 0) 791if (node is XmlElement && name != null && name.Length > 0) 971if (prefix == null || prefix.Length == 0) 1004if (prefix == null || prefix.Length == 0) 1197if (value.Namespace == null || value.Namespace.Length == 0) 1290if (_soap12 && name != null && name.Length > 0) 1430WriteStartElement(name.Length == 0 ? entry.typeName : name, ns == null ? entry.typeNs : ns, null, true); 1486string oldPrefix = (ns == null || ns.Length == 0) ? null : Writer.LookupPrefix(ns); 1742if (values[i] == null || values[i].Length == 0) 2936if (element.Name != null && element.Name.Length > 0) 3172string ns = element.Any && element.Name.Length == 0 ? null : (element.Form == XmlSchemaForm.Qualified ? (writeAccessor ? element.Namespace : element.Mapping.Namespace) : ""); 3467if (value is string && ((string)value).Length == 0) 3667if (element.Any && element.Name.Length == 0) 3695if (enumValue == null || enumValue.Length == 0) 3697if (element.Any && element.Name.Length == 0) 4229if (cast != null && cast.Length > 0) 4253if (arg == null || arg.Length == 0)
FrameworkFork\Microsoft.Xml\Xml\Serialization\XmlSerializationWriterILGen.cs (7)
214if (values[i] == null || values[i].Length == 0) 1681if (element.Name != null && element.Name.Length > 0) 2011string ns = element.Any && element.Name.Length == 0 ? null : (element.Form == XmlSchemaForm.Qualified ? (writeAccessor ? element.Namespace : element.Mapping.Namespace) : ""); 2208if (value is string && ((string)value).Length == 0) 2383if (element.Any && element.Name.Length == 0) 2407if (enumValue == null || enumValue.Length == 0) 2409if (element.Any && element.Name.Length == 0)
FrameworkFork\Microsoft.Xml\Xml\Serialization\XmlSerializer.cs (2)
368if (encodingStyle != null && encodingStyle.Length > 0) 458if (encodingStyle != null && encodingStyle.Length > 0)
FrameworkFork\Microsoft.Xml\Xml\Serialization\XmlSerializerNamespaces.cs (2)
60if (prefix != null && prefix.Length > 0) 63if (ns != null && ns.Length > 0)
FrameworkFork\Microsoft.Xml\Xml\ValidateNames.cs (41)
42Debug.Assert(s != null && offset <= s.Length); 46while (i < s.Length) 78Debug.Assert(s != null && offset <= s.Length); 82while (i < s.Length) 106return endPos > 0 && endPos == s.Length; 121Debug.Assert(s != null && offset <= s.Length); 125if (i < s.Length) 142while (i < s.Length) 167return endPos > 0 && endPos == s.Length; 181Debug.Assert(s != null && offset <= s.Length); 185if (i < s.Length) 202while (i < s.Length) 247if (len == 0 || len != s.Length) 280if (offset < s.Length && s[offset] == ':') 305if (len == 0 || len != s.Length) 333if (s.Length != 0 && s[0] == '*') 347if (len < s.Length && s[len] == ':') 352if (offset < s.Length && s[offset] == '*') 381if (len == 0 || len != s.Length) 397if (offsetStartChar >= s.Length) 400Debug.Assert(offsetBadChar < s.Length); 417if (offsetStartChar >= s.Length) 420Debug.Assert(offsetBadChar < s.Length); 439if (s.Length < 3) 496if (prefix.Length != 0) 502if (localName.Length != 0) 516if (localName.Length == 0) 525if (ns.Length == 0 && localName.Equals("xmlns")) 534if (localName.Length == 0 || (localName.Length == 3 && StartsWithXml(localName))) 543if (localName.Length != 0) 560if (ns.Length == 0) 563if (prefix.Length != 0) 572if (prefix.Length == 0 && nodeKind == XPathNodeType.Attribute) 604if (prefix.Length != 0 || ns.Length != 0) 613if (prefix.Length != 0 || ns.Length != 0) 630return (prefix.Length != 0) ? prefix + ":" + localName : localName; 646else if (0 == colonPos || (name.Length - 1) == colonPos) 654lname = name.Substring(colonPos, name.Length - colonPos);
FrameworkFork\Microsoft.Xml\Xml\XmlCharType.cs (7)
456for (int p = 0; p < ranges.Length; p += 2) 669for (int i = 0; i < str.Length; i++) 684for (int i = 0; i < str.Length; i++) 688if (i + 1 >= str.Length || !(XmlCharType.IsHighSurrogate(str[i]) && XmlCharType.IsLowSurrogate(str[i + 1]))) 705Debug.Assert(startPos + len <= str.Length); 706Debug.Assert(startPos <= str.Length); 738for (int i = 0; i < str.Length; i++)
FrameworkFork\Microsoft.Xml\Xml\XmlComplianceUtil.cs (2)
21int len = value.Length; 106int len = value.Length;
FrameworkFork\Microsoft.Xml\Xml\XmlConvert.cs (31)
88if (name == null || name.Length == 0) 93int length = name.Length; 201int length = name.Length; 360if (name.Length == 0) 368if (endPos != name.Length) 379if (name == null || name.Length == 0) 385if (endPos != name.Length) 399if (name == null || name.Length == 0) 407if (endPos != name.Length) 430if (name.Length == 0) 437if (end != name.Length) 450if (len == 0 || len != name.Length) 464if (token == null || token.Length == 0) 468if (token[0] == ' ' || token[token.Length - 1] == ' ' || token.IndexOfAny(crt) != -1 || token.IndexOf(" ", StringComparison.Ordinal) != -1) 477if (token == null || token.Length == 0) 481if (token[0] == ' ' || token[token.Length - 1] == ' ' || token.IndexOfAny(crt) != -1 || token.IndexOf(" ", StringComparison.Ordinal) != -1) 504if (name.Length == 0) 511if (endPos != name.Length) 520if (name == null || name.Length == 0) 525if (endPos != name.Length) 932if (s.Length != 1) 1216if (str.Length != 0 && str[0] != '+') 1519if (s != null && s.Length > 0) 1522if (s.Length == 0 || s.IndexOf("##", StringComparison.Ordinal) != -1) 1539if (s != null && s.Length > 0) 1542if (s.Length == 0 || s.IndexOf("##", StringComparison.Ordinal) != -1) 1557if (strLen1 != str2.Length) 1625if (data == null || data.Length == 0) 1631int len = data.Length; 1712while (i < value.Length) 1719sb = new StringBuilder(value.Length + 4);
FrameworkFork\Microsoft.Xml\Xml\XmlException.cs (1)
190return BuildCharExceptionArgs(data[invCharIndex], invCharIndex + 1 < data.Length ? data[invCharIndex + 1] : '\0');
FrameworkFork\Microsoft.Xml\Xml\XmlNamespaceManager.cs (4)
266if (uri.Length > 0 || prefix.Length > 0 || scope == XmlNamespaceScope.Local) 348if (prefix.Length > 0 || _nsdecls[thisDecl].uri.Length > 0)
FrameworkFork\Microsoft.Xml\Xml\XmlQualifiedName.cs (6)
97get { return Name.Length == 0 && Namespace.Length == 0; } 106return Namespace.Length == 0 ? Name : string.Concat(Namespace, ":", Name); 160return ns == null || ns.Length == 0 ? name : ns + ":" + name; 190if (_ns.Length != 0) 211if (prefix.Length != 0)
FrameworkFork\Microsoft.Xml\Xml\XmlResolver.cs (3)
44if (baseUri == null || (!baseUri.IsAbsoluteUri && baseUri.OriginalString.Length == 0)) 47if (!uri.IsAbsoluteUri && uri.OriginalString.Length > 0) 55if (relativeUri == null || relativeUri.Length == 0)
FrameworkFork\Microsoft.Xml\Xml\XPath\Internal\baseaxisquery.cs (6)
43_nameTest = prefix.Length != 0 || name.Length != 0; 92if (_name.Equals(e.LocalName) || _name.Length == 0) 126if (_name.Length != 0) 130if (_prefix.Length != 0) 145w.WriteAttributeString("name", Prefix.Length != 0 ? Prefix + ':' + Name : Name);
FrameworkFork\Microsoft.Xml\Xml\XPath\Internal\BooleanFunctions.cs (4)
58return str.Length > 0; 85(lang.Length == str.Length || lang[str.Length] == '-')
FrameworkFork\Microsoft.Xml\Xml\XPath\Internal\CompiledXpathExpr.cs (1)
124if (prefix.Length == 0)
FrameworkFork\Microsoft.Xml\Xml\XPath\Internal\DescendantBaseQuery.cs (1)
69w.WriteAttributeString("name", Prefix.Length != 0 ? Prefix + ':' + Name : Name);
FrameworkFork\Microsoft.Xml\Xml\XPath\Internal\ExtensionQuery.cs (1)
128protected string QName { get { return prefix.Length != 0 ? prefix + ":" + name : name; } }
FrameworkFork\Microsoft.Xml\Xml\XPath\Internal\FilterQuery.cs (2)
71if (value is string) return ((string)value).Length != 0; 151return (((string)_cond.Evaluate(new XPathSingletonIterator(current, /*moved:*/true))).Length != 0) ? context : null;
FrameworkFork\Microsoft.Xml\Xml\XPath\Internal\FunctionQuery.cs (2)
94if (name != "key" && prefix.Length != 0) 129w.WriteAttributeString("name", prefix.Length != 0 ? prefix + ':' + name : name);
FrameworkFork\Microsoft.Xml\Xml\XPath\Internal\NamespaceQuery.cs (2)
63if (e.Value.Length == 0) 65Debug.Assert(e.LocalName.Length == 0, "Only xmlns='' can have empty string as a value");
FrameworkFork\Microsoft.Xml\Xml\XPath\Internal\querybuilder.cs (4)
61if (root.Prefix.Length > 0) 193if ((root.NodeType == XPathNodeType.All || root.NodeType == XPathNodeType.Element || root.NodeType == XPathNodeType.Attribute) && root.Prefix.Length == 0) 426if (!_allowCurrent && root.Name == "current" && root.Prefix.Length == 0) 430if (!_allowKey && root.Name == "key" && root.Prefix.Length == 0)
FrameworkFork\Microsoft.Xml\Xml\XPath\Internal\StringFunctions.cs (13)
135return s1.Length >= s2.Length && string.CompareOrdinal(s1, 0, s2, 0, s2.Length) == 0; 151if (s2.Length == 0) { return s2; } 160if (s2.Length == 0) { return s1; } 162return (idx < 0) ? string.Empty : s1.Substring(idx + s2.Length); 170if (Double.IsNaN(num) || str1.Length <= num) 191double maxlength = str1.Length - num; 209return _argList[0].Evaluate(nodeIterator).ToString().Length; 211return nodeIterator.Current.Value.Length; 230while (count < str1.Length) 253while (count < str1.Length) 258if (index < str3.Length)
FrameworkFork\Microsoft.Xml\Xml\XPath\Internal\VariableQuery.cs (1)
76w.WriteAttributeString("name", prefix.Length != 0 ? prefix + ':' + name : name);
FrameworkFork\Microsoft.Xml\Xml\XPath\Internal\XPathAncestorQuery.cs (1)
77w.WriteAttributeString("name", Prefix.Length != 0 ? Prefix + ':' + Name : Name);
FrameworkFork\Microsoft.Xml\Xml\XPath\Internal\XPathAxisIterator.cs (1)
86(name.Length == 0 || name == nav.LocalName) &&
FrameworkFork\Microsoft.Xml\Xml\XPath\Internal\XPathParser.cs (4)
233scaner.Prefix.Length == 0 && ( 535if (prefix.Length == 0) 670if (_scanner.Prefix.Length == 0) 779_scanner.Prefix.Length == 0 &&
FrameworkFork\Microsoft.Xml\Xml\XPath\Internal\XPathScanner.cs (2)
45Debug.Assert(0 <= _xpathExprIndex && _xpathExprIndex <= _xpathExpr.Length); 46if (_xpathExprIndex < _xpathExpr.Length)
FrameworkFork\Microsoft.Xml\Xml\XPath\XPathDocument.cs (1)
218if (reader.Prefix.Length == 0)
FrameworkFork\Microsoft.Xml\Xml\XPath\XPathNavigator.cs (7)
473if (prefix.Length == 0) 551if (prefix.Length != 0 || ns.Length != 0 || scope == XmlNamespaceScope.Local) 1409if (LocalName.Length == 0) 1505if (value.Length != 0) 2151if (reader.Prefix.Length == 0) 2213if (reader.Prefix.Length == 0)
FrameworkFork\Microsoft.Xml\Xml\XPath\XPathNavigatorReader.cs (5)
222if (_nav.NodeType == XPathNodeType.Namespace && _nav.LocalName.Length == 0) 236if (_nav.NodeType == XPathNodeType.Namespace && _nav.LocalName.Length != 0) 437if (0 == prefix.Length) 721if ((IsXmlnsNoPrefix = (0 == prefix.Length && localname == "xmlns")) 735else if (0 == prefix.Length)
FrameworkFork\System.Runtime.Serialization\System\Runtime\Serialization\Attributes.cs (2)
166if (xsiTypeString != null && xsiTypeString.Length > 0) 173if (factoryTypeString != null && factoryTypeString.Length > 0)
FrameworkFork\System.Runtime.Serialization\System\Runtime\Serialization\ClassDataContract.cs (2)
390if (ns.Length > 0 && ns != dataContract.Namespace.Value) 986if (memberAttribute.Name == null || memberAttribute.Name.Length == 0)
FrameworkFork\System.Runtime.Serialization\System\Runtime\Serialization\CodeExporter.cs (10)
115if (ns.Length == 0) 446contractCodeDomInfo.TypeReference = new CodeTypeReference((clrNamespace == null || clrNamespace.Length == 0) ? typeName : clrNamespace + "." + typeName); 1328if (identifier.Length <= MaxIdentifierLength && Microsoft.CodeDom.Compiler.CodeGenerator.IsValidLanguageIndependentIdentifier(identifier)) 1333for (int i = 0; i < identifier.Length && builder.Length < MaxIdentifierLength; i++) 1352int availableLength = MaxIdentifierLength - identifier.Length; 1353int requiredLength = appendString.Length; 1380uniqueNamespace = ((clrNamespace.Length == 0) ? Globals.DefaultClrNamespace : clrNamespace) + i.ToString(NumberFormatInfo.InvariantInfo); 1420if (dataContractNamespace == null || dataContractNamespace.Length == 0) 1434AddToNamespace(builder, uriString.Substring(Globals.DataContractXsdBaseNamespace.Length), fragments); 1466for (int i = 0; i < fragment.Length && builder.Length < MaxIdentifierLength; i++)
FrameworkFork\System.Runtime.Serialization\System\Runtime\Serialization\CollectionDataContract.cs (3)
630if (collectionContractAttribute.ItemName == null || collectionContractAttribute.ItemName.Length == 0) 637if (collectionContractAttribute.KeyName == null || collectionContractAttribute.KeyName.Length == 0) 645if (collectionContractAttribute.ValueName == null || collectionContractAttribute.ValueName.Length == 0)
FrameworkFork\System.Runtime.Serialization\System\Runtime\Serialization\DataContract.cs (12)
1356if (localName.Length == 0) 1360for (int i = 1; i < localName.Length; i++) 1451if (name == null || name.Length == 0) 1591if (name == null || name.Length == 0) 1673int nsLen = (type.Namespace == null) ? 0 : type.Namespace.Length; 1793if (dataContractNs.Length > 0) 1797if (trimmedNs.Length == 0 || trimmedNs.IndexOf("##", StringComparison.Ordinal) != -1) 1836return uriString.StartsWith(Globals.DataContractXsdBaseNamespace, StringComparison.Ordinal) ? uriString.Substring(Globals.DataContractXsdBaseNamespace.Length) : uriString; 2011for (int i = 0; i < format.Length; i++) 2018for (; i < format.Length; i++) 2021if (i == format.Length) 2107if (methodName.Length == 0)
FrameworkFork\System.Runtime.Serialization\System\Runtime\Serialization\EnumDataContract.cs (8)
295if (memberAttribute.Value == null || memberAttribute.Value.Length == 0) 388for (; i < stringValue.Length; i++) 395for (; i < stringValue.Length; i++) 402for (++i; i < stringValue.Length; i++) 406if (i == stringValue.Length) 416if (stringValue.Length == 0) 418longValue = ReadEnumValue(stringValue, 0, stringValue.Length); 431if (memberName.Length == count && String.CompareOrdinal(value, index, memberName, 0, count) == 0)
FrameworkFork\System.Runtime.Serialization\System\Runtime\Serialization\ExtensionDataReader.cs (1)
524prefix = (ns == null || ns.Length == 0) ? String.Empty : "p" + s_nsToPrefixTable.Count;
FrameworkFork\System.Runtime.Serialization\System\Runtime\Serialization\PrimitiveDataContract.cs (1)
861else if (ns != null && ns.Value != null && ns.Value.Length > 0)
FrameworkFork\System.Runtime.Serialization\System\Runtime\Serialization\SchemaExporter.cs (2)
23if (stableName.Name == null || stableName.Name.Length == 0) 50if (methodName == null || methodName.Length == 0)
FrameworkFork\System.Runtime.Serialization\System\Runtime\Serialization\SchemaHelper.cs (2)
34if (ns1 == null || ns1.Length == 0) 35return (ns2 == null || ns2.Length == 0);
FrameworkFork\System.Runtime.Serialization\System\Runtime\Serialization\SchemaImporter.cs (1)
112if (typeName != null && typeName.Name.Length > 0)
FrameworkFork\System.Runtime.Serialization\System\Runtime\Serialization\XmlDataContract.cs (2)
264_topLevelElementName = (elementName == null || elementName.Length == 0) ? Name : dictionary.Add(DataContract.EncodeLocalName(elementName)); 266_topLevelElementNamespace = (elementNs == null || elementNs.Length == 0) ? DictionaryGlobals.EmptyString : dictionary.Add(elementNs);
FrameworkFork\System.Runtime.Serialization\System\Runtime\Serialization\XmlFormatWriterGenerator.cs (1)
664return type == Globals.TypeOfXmlQualifiedName && (ns != null && ns.Value != null && ns.Value.Length > 0);
FrameworkFork\System.Runtime.Serialization\System\Runtime\Serialization\XmlObjectSerializerWriteContext.cs (1)
400if (ns != null && ns.Value != null && ns.Value.Length > 0)
FrameworkFork\System.Runtime.Serialization\System\Runtime\Serialization\XmlObjectSerializerWriteContextComplex.cs (1)
167if (ns != null && ns.Value != null && ns.Value.Length > 0)
FrameworkFork\System.Runtime.Serialization\System\Runtime\Serialization\XmlReaderDelegator.cs (3)
349if (str.Length == 0) 498if (str == null || str.Length == 0) 612if (str == null || str.Length == 0)
FrameworkFork\System.Runtime.Serialization\System\Runtime\Serialization\XmlWriterDelegator.cs (1)
85if (ns.Length == 0)
FrameworkFork\System.Runtime.Serialization\System\Xml\UniqueId.cs (3)
110if (value.Length == 0) 114UnsafeParse(pch, value.Length); 159return _s.Length;
FrameworkFork\System.Runtime.Serialization\System\Xml\ValueHandle.cs (2)
163return s_constStrings[_offset].Length == 0; 549if (_length != str.Length)
FrameworkFork\System.Runtime.Serialization\System\Xml\XmlBaseReader.cs (3)
1167actual = Math.Min(count, value.Length); 1491if (value.Length > _quotas.MaxStringContentLength) 2788int length = s.Length;
FrameworkFork\System.Runtime.Serialization\System\Xml\XmlBaseWriter.cs (42)
188if (localName == null || (localName.Length == 0 && prefix != "xmlns")) 205if (prefix.Length == 0 && localName == "xmlns") 232if (prefix.Length == 0) 245else if (ns.Length == 0) 248if (prefix.Length != 0) 251else if (prefix.Length == 0) 260if (ns.Length == xmlnsNamespace.Length && ns == xmlnsNamespace) 262if (ns.Length == xmlNamespace.Length && ns == xmlNamespace) 417else if (text.IndexOf("--", StringComparison.Ordinal) != -1 || (text.Length > 0 && text[text.Length - 1] == '-')) 454if (text.Length > 0) 477if (localName.Length == 0) 522if (localName.Length == 0) 705for (int i = 0; i < s.Length; i++) 793if (localName.Length == 0) 798if (prefix.Length != 0) 812if (localName.Value.Length == 0) 933for (int i = 0; i < whitespace.Length; ++i) 954if (value.Length > 0 || _inList) 978if (value.Value.Length > 0) 1035if (value.Length > 0) 1628if (_attributeValue.Length == 0) 1873if (uri.Length == 0) 1914if (prefix.Length >= 3) 1939if (prefix.Length != 0 && uri.Length == 0) 1941if (uri.Length == xmlnsNamespace.Length && uri == xmlnsNamespace) 1944if (uri.Length == xmlNamespace.Length && uri[18] == 'X' && uri == xmlNamespace) 2019if (ns.Length == 0) 2025if (_namespaces[i].Prefix.Length == 0) 2044if (_lastNameSpace != null && _lastNameSpace.Uri == ns && _lastNameSpace.Prefix.Length != 0) 2055if (prefix.Length != 0) 2081if (prefix.Length != 0) 2101if (ns.Length == 0) 2109if (prefix.Length == 0) 2114if (nameSpace.Prefix.Length == 0) 2119if (prefix.Length == 1) 2245if (value.Length == 1)
FrameworkFork\System.Runtime.Serialization\System\Xml\XmlBinaryReader.cs (1)
100if (value.Length > Quotas.MaxStringContentLength)
FrameworkFork\System.Runtime.Serialization\System\Xml\XmlBinaryWriter.cs (16)
145if (prefix.Length == 0) 154if (prefix.Length == 1 && ch >= 'a' && ch <= 'z') 182if (prefix.Length == 0) 191if (prefix.Length == 1 && ch >= 'a' && ch <= 'z') 237if (prefix.Length == 0) 245if (prefix.Length == 1 && ch >= 'a' && ch <= 'z') 270if (prefix.Length == 0) 278if (prefix.Length == 1 && ch >= 'a' && ch <= 'z') 307if (prefix.Length == 0) 329if (prefix.Length == 0) 383int length = s.Length; 627if (value.Length > 0) 631UnsafeWriteText(pch, value.Length); 983if (prefix.Length == 0) 991if (prefix.Length == 1 && (ch >= 'a' && ch <= 'z') && TryGetKey(localName, out key)) 1048if (_captureText == null || _captureText.Length == 0)
FrameworkFork\System.Runtime.Serialization\System\Xml\XmlBufferReader.cs (2)
860for (int i = 0; i < s.Length; i++) 959int charLength = s2.Length;
FrameworkFork\System.Runtime.Serialization\System\Xml\XmlConverter.cs (11)
492if (index == qname.Length - 1) 826for (int i = 0; i < s.Length; i++) 831return s.Length; 1129for (int i = 0; i < s.Length; i++) 1144int count = s.Length; 1145for (int i = 0; i < s.Length; i++) 1152if (count == s.Length) 1156for (int i = 0; i < s.Length; i++) 1170for (i = 0; i < s.Length && IsWhitespace(s[i]); i++) 1173for (j = s.Length; j > 0 && IsWhitespace(s[j - 1]); j--) 1175if (i == 0 && j == s.Length)
FrameworkFork\System.Runtime.Serialization\System\Xml\XmlDictionaryReader.cs (1)
346if (result.Length == 0)
FrameworkFork\System.Runtime.Serialization\System\Xml\XmlDictionaryString.cs (1)
110if (value.Length == 0)
FrameworkFork\System.Runtime.Serialization\System\Xml\XmlDictionaryWriter.cs (3)
111prefix = namespaceUri.Length == 0 ? string.Empty : string.Concat("d", namespaceUri.Length.ToString(System.Globalization.NumberFormatInfo.InvariantInfo)); 812if (namespaceUri.Length == 0)
FrameworkFork\System.Runtime.Serialization\System\Xml\XmlExceptionHelper.cs (2)
54if (prefix.Length == 0) 205if (localName.Length == 0)
FrameworkFork\System.Runtime.Serialization\System\Xml\XmlStreamNodeWriter.cs (1)
323int count = value.Length;
FrameworkFork\System.Runtime.Serialization\System\Xml\XmlUTF8TextWriter.cs (9)
216if (prefix.Length != 0) 227if (prefix.Length != 0) 281if (prefix.Length != 0) 293if (prefix.Length != 0) 331if (prefix.Length != 0) 362if (prefix.Length != 0) 404if (prefix.Length == 1) 444int count = s.Length; 820if (prefix.Length != 0)
FrameworkFork\System.ServiceModel\Internals\System\Runtime\Diagnostics\DiagnosticTraceBase.cs (1)
104int len = text.Length;
FrameworkFork\System.ServiceModel\Internals\System\Runtime\Diagnostics\EtwDiagnosticTrace.cs (6)
298if (exceptionData.Length < remainingLength) 301remainingLength -= exceptionData.Length; 308if (!string.IsNullOrEmpty(innerException) && innerException.Length < remainingLength) 395int minXmlLength = (localName.Length * 2) + EtwDiagnosticTrace.XmlBracketsLength; 407int xmlElementLength = (localName.Length * 2) + EtwDiagnosticTrace.XmlBracketsLength + (value != null ? value.Length : 0);
FrameworkFork\System.ServiceModel\Internals\System\Runtime\UrlUtility.cs (4)
46if (query.Length > 0 && query[0] == '?') 102int l = s.Length; 290int count = s.Length; 499int l = (s != null) ? s.Length : 0;
FrameworkFork\System.ServiceModel\System\IdentityModel\CanonicalFormWriter.cs (3)
20if (s.Length > workBuffer.Length) 26for (int i = 0; i < s.Length; i++) 40stream.Write(workBuffer, 0, s.Length);
FrameworkFork\System.ServiceModel\System\IdentityModel\Claims\Claim.cs (2)
55if (claimType.Length <= 0) 59if (right.Length <= 0)
FrameworkFork\System.ServiceModel\System\IdentityModel\Claims\X509CertificateClaimSet.cs (2)
461int separatorFirstChar = delimiterIndex + subjectName1.Length + 1; 463for (int i = separatorFirstChar + 1; i < x509ExtensionFormattedString.Length; i++)
FrameworkFork\System.ServiceModel\System\IdentityModel\Tokens\WSSecurityJan2004.cs (1)
406if (uri != null && uri.Length > 0 && uri[0] == '#')
FrameworkFork\System.ServiceModel\System\ServiceModel\Channels\AddressHeader.cs (3)
80if (hdr1.Length != hdr2.Length) 248if ((null == name) || (name.Length == 0))
FrameworkFork\System.ServiceModel\System\ServiceModel\Channels\Addressing.cs (9)
94if (act.Length > 0 && (act[0] <= 32 || act[act.Length - 1] <= 32)) 105if (actor.Length == 0 && mustUnderstand == mustUnderstandValue && !relay) 207if (actor.Length == 0 && mustUnderstand == mustUnderstandValue && !relay) 299if (actor.Length == 0 && mustUnderstand == mustUnderstandValue && !relay) 458if (actor.Length == 0 && mustUnderstand == mustUnderstandValue && !relay) 595if (actor.Length == 0 && mustUnderstand == mustUnderstandValue && !relay) 701if (actor.Length == 0 && mustUnderstand == mustUnderstandValue && !relay) 834if (actor.Length == 0 && mustUnderstand == mustUnderstandValue && !relay && (object)relationship == (object)ReplyRelationshipType)
FrameworkFork\System.ServiceModel\System\ServiceModel\Channels\BinaryMessageEncoder.cs (1)
424offset += Encoding.UTF8.GetBytes(newString, 0, newString.Length, buffer, offset);
FrameworkFork\System.ServiceModel\System\ServiceModel\Channels\Binding.cs (2)
37if (ns.Length > 0) 92if (value.Length > 0)
FrameworkFork\System.ServiceModel\System\ServiceModel\Channels\ContentOnlyMessage.cs (1)
88if (_data != null && _data.Length > 0)
FrameworkFork\System.ServiceModel\System\ServiceModel\Channels\FramingEncoders.cs (1)
62Encoding.UTF8.GetBytes(value, 0, value.Length, _encodedBytes, offset);
FrameworkFork\System.ServiceModel\System\ServiceModel\Channels\HttpChannelHelpers.cs (1)
183if (statusDescription != null && statusDescription.Length > 0)
FrameworkFork\System.ServiceModel\System\ServiceModel\Channels\HttpRequestMessageProperty.cs (1)
306return query.Length > 0 ? query.Substring(1) : string.Empty;
FrameworkFork\System.ServiceModel\System\ServiceModel\Channels\Message.cs (5)
757if (!((prefixString.Length == 1))) 1811if (value.Length == 0) 1829int byteCount = s.Length * sizeof(char); 2053if (key.Length > MaxKeyLength) 2063if (key.Length > MaxKeyLength)
FrameworkFork\System.ServiceModel\System\ServiceModel\Channels\MessageEncoder.cs (14)
149if (contentType.Length > supportedContentType.Length && 151contentType[supportedContentType.Length] == ';') 157if (contentType.Length == supportedContentType.Length) 161else if (contentType.Length > supportedContentType.Length) 163char ch = contentType[supportedContentType.Length]; 173int i = supportedContentType.Length; 174if (ch == '\r' && contentType.Length > supportedContentType.Length + 1 && contentType[i + 1] == '\n') 184while (i < contentType.Length) 192if (ch == ';' || i == contentType.Length) 203if (supportedMediaType.Length > 0 && !supportedMediaType.Equals(parsedContentType.MediaType, StringComparison.OrdinalIgnoreCase))
FrameworkFork\System.ServiceModel\System\ServiceModel\Channels\MessageFault.cs (4)
311if (Node.Length > 0) 313if (Actor.Length > 0) 384if (translation.XmlLang.Length > 0) 388if (Actor.Length > 0)
FrameworkFork\System.ServiceModel\System\ServiceModel\Channels\MessageHeader.cs (4)
134if (actor.Length > 0) 242if (value.Length == 1) 354if (name.Length == 0) 363if (ns.Length > 0)
FrameworkFork\System.ServiceModel\System\ServiceModel\Channels\MessageHeaders.cs (1)
889if (name.Length > 0)
FrameworkFork\System.ServiceModel\System\ServiceModel\Channels\TextMessageEncoder.cs (5)
142if ((contentType.Length > semiColonIndex + 11) // need room for parameter + charset + '=' 201if (charSet.Length > 2 && charSet[0] == '"' && charSet[charSet.Length - 1] == '"') 203charSet = charSet.Substring(1, charSet.Length - 2); 232if (charSet == null || charSet.Length == 0)
FrameworkFork\System.ServiceModel\System\ServiceModel\Channels\UriGenerator.cs (1)
30if (scheme.Length == 0)
FrameworkFork\System.ServiceModel\System\ServiceModel\Description\ClientClassGenerator.cs (2)
935if (interfaceName.Length >= 2 && 936String.Compare(interfaceName, 0, Strings.InterfaceTypePrefix, 0, Strings.InterfaceTypePrefix.Length, StringComparison.Ordinal) == 0 &&
FrameworkFork\System.ServiceModel\System\ServiceModel\Description\ContractDescription.cs (1)
79if (value.Length == 0)
FrameworkFork\System.ServiceModel\System\ServiceModel\Description\OperationDescription.cs (1)
43if (name.Length == 0)
FrameworkFork\System.ServiceModel\System\ServiceModel\Description\SchemaHelper.cs (5)
53if (ns != null && ns.Length > 0) 81if ((existingSchema.TargetNamespace == null && ns.Length == 0) || ns.Equals(existingSchema.TargetNamespace)) 87if (ns.Length > 0) 123if (ns1 == null || ns1.Length == 0) 124return (ns2 == null || ns2.Length == 0);
FrameworkFork\System.ServiceModel\System\ServiceModel\Description\ServiceReflector.cs (4)
200for (int i = 1; i < localName.Length; i++) 927return method.Name.Substring(BeginMethodNamePrefix.Length); 931return method.Name.Substring(0, method.Name.Length - AsyncMethodNameSuffix.Length);
FrameworkFork\System.ServiceModel\System\ServiceModel\Description\UniqueCodeIdentifierScope.cs (2)
93if (identifier.Length <= MaxIdentifierLength && Microsoft.CodeDom.Compiler.CodeGenerator.IsValidLanguageIndependentIdentifier(identifier)) 97for (int i = 0; i < identifier.Length && builder.Length < MaxIdentifierLength; i++)
FrameworkFork\System.ServiceModel\System\ServiceModel\Dispatcher\DataContractSerializerOperationFormatter.cs (1)
484string prefix = (this.Namespace == null || this.Namespace.Length == 0) ? string.Empty : "h";
FrameworkFork\System.ServiceModel\System\ServiceModel\Dispatcher\EndpointAddressProcessor.cs (3)
66val = local + "^" + local.Length.ToString(CultureInfo.InvariantCulture) + ":" + ns + "^" + ns.Length.ToString(CultureInfo.InvariantCulture); 137builder.Append(s.Length.ToString(CultureInfo.InvariantCulture));
FrameworkFork\System.ServiceModel\System\ServiceModel\Dispatcher\OperationFormatter.cs (1)
859writer.WriteStartElement((this.Namespace == null || this.Namespace.Length == 0) ? string.Empty : "h", this.Name, this.Namespace);
FrameworkFork\System.ServiceModel\System\ServiceModel\EndpointAddress.cs (10)
385int u1Len = (u1Path.Length > 0 && u1Path[u1Path.Length - 1] == '/') ? u1Path.Length - 1 : u1Path.Length; 386int u2Len = (u2Path.Length > 0 && u2Path[u2Path.Length - 1] == '/') ? u2Path.Length - 1 : u2Path.Length; 415if (uriString.Length > 0 && uriString[uriString.Length - 1] != '/')
FrameworkFork\System.ServiceModel\System\ServiceModel\EnvelopeVersion.cs (2)
77if (ultimateReceiverActor.Length == 0) 162return actor.Length == 0 || actor == _ultimateDestinationActor || actor == _nextDestinationActorValue;
FrameworkFork\System.ServiceModel\System\ServiceModel\FaultCode.cs (2)
35if (name.Length == 0) 59return _ns.Length == 0 || _version != null;
FrameworkFork\System.ServiceModel\System\ServiceModel\MessageContractMemberAttribute.cs (1)
31if (value.Length > 0)
FrameworkFork\System.ServiceModel\System\ServiceModel\Security\EncryptedKey.cs (1)
296if (_id != null && _id.Length != 0)
FrameworkFork\System.ServiceModel\System\ServiceModel\Security\ReferenceList.cs (1)
122if (uri.Length < 2 || uri[0] != '#')
FrameworkFork\System.ServiceModel\System\ServiceModel\Security\SecurityTimestamp.cs (1)
105char[] buffer = new char[DefaultFormat.Length];
FrameworkFork\System.ServiceModel\System\ServiceModel\Security\SecurityUtils.cs (1)
286if (serverCredential.Domain != null && serverCredential.Domain.Length > 0)
FrameworkFork\System.ServiceModel\System\ServiceModel\Security\Tokens\ClaimTypeRequirement.cs (1)
24if (claimType.Length <= 0)
FrameworkFork\System.ServiceModel\System\ServiceModel\Security\WSKeyInfoSerializer.cs (1)
134if (uri.Length > 0 && uri[0] != '#')
FrameworkFork\System.ServiceModel\System\ServiceModel\Security\WSSecureConversation.cs (2)
203if (label != null && label.Length > _maxKeyDerivationLabelLength) 205throw DiagnosticUtility.ExceptionUtility.ThrowHelperWarning(new MessageSecurityException(string.Format(SRServiceModel.DerivedKeyTokenLabelTooLong, label.Length, _maxKeyDerivationLabelLength)));
FrameworkFork\System.ServiceModel\System\ServiceModel\Security\WSSecurityJan2004.cs (1)
360if (type != null && type.Length > 0 && type != SecurityJan2004Strings.UPTokenPasswordTextValue)
FrameworkFork\System.ServiceModel\System\ServiceModel\Security\WSSecurityPolicy.cs (4)
2973if (message != null && message.Length > MaxLength) 2976message.Substring(0, (MaxLength - Ellipsis.Length) / 2), 2978message.Substring(message.Length - (MaxLength - Ellipsis.Length) / 2));
FrameworkFork\System.ServiceModel\System\ServiceModel\Security\WSTrust.cs (2)
134if (secretType != null && secretType.Length > 0) 436if (valueTypeUri.Length == 0)
FrameworkFork\System.ServiceModel\System\ServiceModel\Security\XmlHelper.cs (4)
117if (ns == null && prefix.Length > 0) 242if (value == null || value.Length == 0) 306if (idPrefix.Length == 0) 316for (int i = 1; i < idPrefix.Length; i++)
FrameworkFork\System.ServiceModel\System\ServiceModel\XmlUtil.cs (8)
58for (i = s.Length; i > 0 && IsWhitespace(s[i - 1]); i--) ; 60if (i != s.Length) 71for (i = 0; i < s.Length && IsWhitespace(s[i]); i++) ; 84for (i = 0; i < s.Length && IsWhitespace(s[i]); i++) ; 86if (i >= s.Length) 92for (j = s.Length; j > 0 && IsWhitespace(s[j - 1]); j--) ; 96if (i != 0 || j != s.Length) 114if (index == qname.Length - 1)
FrameworkFork\System.Web.Services\Services\Description\ServiceDescription.cs (4)
482if (this.TargetNamespace != null && this.TargetNamespace.Length != 0) 489if (tns != null && tns.Length > 0 && tns != this.TargetNamespace && tns != ServiceDescription.Namespace) 497if (import.Namespace.Length > 0) 1310if (messageName != null && messageName.Length > 0)
FrameworkFork\System.Web.Services\Services\Description\ServiceDescriptionSerializer.cs (80)
681if ((((global::System.String)o.@Encoding) != null) && (((global::System.String)o.@Encoding).Length != 0)) 730if ((((global::System.String)o.@Encoding) != null) && (((global::System.String)o.@Encoding).Length != 0)) 1141if ((((global::System.String)o.@Namespace) != null) && (((global::System.String)o.@Namespace).Length != 0)) 1145if ((((global::System.String)o.@Encoding) != null) && (((global::System.String)o.@Encoding).Length != 0)) 1181if ((((global::System.String)o.@Namespace) != null) && (((global::System.String)o.@Namespace).Length != 0)) 1185if ((((global::System.String)o.@Encoding) != null) && (((global::System.String)o.@Encoding).Length != 0)) 1223if ((((global::System.String)o.@Encoding) != null) && (((global::System.String)o.@Encoding).Length != 0)) 1227if ((((global::System.String)o.@Namespace) != null) && (((global::System.String)o.@Namespace).Length != 0)) 1265if ((((global::System.String)o.@Encoding) != null) && (((global::System.String)o.@Encoding).Length != 0)) 1269if ((((global::System.String)o.@Namespace) != null) && (((global::System.String)o.@Namespace).Length != 0)) 1306if ((((global::System.String)o.@Encoding) != null) && (((global::System.String)o.@Encoding).Length != 0)) 1310if ((((global::System.String)o.@Namespace) != null) && (((global::System.String)o.@Namespace).Length != 0)) 1348if ((((global::System.String)o.@Encoding) != null) && (((global::System.String)o.@Encoding).Length != 0)) 1352if ((((global::System.String)o.@Namespace) != null) && (((global::System.String)o.@Namespace).Length != 0)) 1841if ((((global::System.String)o.@ParameterOrderString) != null) && (((global::System.String)o.@ParameterOrderString).Length != 0)) 2861if ((((global::System.String)o.@Name) != null) && (((global::System.String)o.@Name).Length != 0)) 3006if ((((global::System.String)o.@XPath) != null) && (((global::System.String)o.@XPath).Length != 0)) 5245((Microsoft.Xml.Serialization.XmlSerializerNamespaces)o.@Namespaces).Add(Reader.Name.Length == 5 ? "" : Reader.LocalName, Reader.Value); 5348((Microsoft.Xml.Serialization.XmlSerializerNamespaces)o.@Namespaces).Add(Reader.Name.Length == 5 ? "" : Reader.LocalName, Reader.Value); 5434((Microsoft.Xml.Serialization.XmlSerializerNamespaces)o.@Namespaces).Add(Reader.Name.Length == 5 ? "" : Reader.LocalName, Reader.Value); 5712((Microsoft.Xml.Serialization.XmlSerializerNamespaces)o.@Namespaces).Add(Reader.Name.Length == 5 ? "" : Reader.LocalName, Reader.Value); 5806((Microsoft.Xml.Serialization.XmlSerializerNamespaces)o.@Namespaces).Add(Reader.Name.Length == 5 ? "" : Reader.LocalName, Reader.Value); 5909((Microsoft.Xml.Serialization.XmlSerializerNamespaces)o.@Namespaces).Add(Reader.Name.Length == 5 ? "" : Reader.LocalName, Reader.Value); 6166((Microsoft.Xml.Serialization.XmlSerializerNamespaces)o.@Namespaces).Add(Reader.Name.Length == 5 ? "" : Reader.LocalName, Reader.Value); 7196((Microsoft.Xml.Serialization.XmlSerializerNamespaces)o.@Namespaces).Add(Reader.Name.Length == 5 ? "" : Reader.LocalName, Reader.Value); 7837((Microsoft.Xml.Serialization.XmlSerializerNamespaces)o.@Namespaces).Add(Reader.Name.Length == 5 ? "" : Reader.LocalName, Reader.Value); 7925((Microsoft.Xml.Serialization.XmlSerializerNamespaces)o.@Namespaces).Add(Reader.Name.Length == 5 ? "" : Reader.LocalName, Reader.Value); 8019((Microsoft.Xml.Serialization.XmlSerializerNamespaces)o.@Namespaces).Add(Reader.Name.Length == 5 ? "" : Reader.LocalName, Reader.Value); 8101((Microsoft.Xml.Serialization.XmlSerializerNamespaces)o.@Namespaces).Add(Reader.Name.Length == 5 ? "" : Reader.LocalName, Reader.Value); 8183((Microsoft.Xml.Serialization.XmlSerializerNamespaces)o.@Namespaces).Add(Reader.Name.Length == 5 ? "" : Reader.LocalName, Reader.Value); 8261((Microsoft.Xml.Serialization.XmlSerializerNamespaces)o.@Namespaces).Add(Reader.Name.Length == 5 ? "" : Reader.LocalName, Reader.Value); 8352((Microsoft.Xml.Serialization.XmlSerializerNamespaces)o.@Namespaces).Add(Reader.Name.Length == 5 ? "" : Reader.LocalName, Reader.Value); 8425((Microsoft.Xml.Serialization.XmlSerializerNamespaces)o.@Namespaces).Add(Reader.Name.Length == 5 ? "" : Reader.LocalName, Reader.Value); 8538((Microsoft.Xml.Serialization.XmlSerializerNamespaces)o.@Namespaces).Add(Reader.Name.Length == 5 ? "" : Reader.LocalName, Reader.Value); 8660((Microsoft.Xml.Serialization.XmlSerializerNamespaces)o.@Namespaces).Add(Reader.Name.Length == 5 ? "" : Reader.LocalName, Reader.Value); 8760((Microsoft.Xml.Serialization.XmlSerializerNamespaces)o.@Namespaces).Add(Reader.Name.Length == 5 ? "" : Reader.LocalName, Reader.Value); 8838((Microsoft.Xml.Serialization.XmlSerializerNamespaces)o.@Namespaces).Add(Reader.Name.Length == 5 ? "" : Reader.LocalName, Reader.Value); 8918((Microsoft.Xml.Serialization.XmlSerializerNamespaces)o.@Namespaces).Add(Reader.Name.Length == 5 ? "" : Reader.LocalName, Reader.Value); 8996((Microsoft.Xml.Serialization.XmlSerializerNamespaces)o.@Namespaces).Add(Reader.Name.Length == 5 ? "" : Reader.LocalName, Reader.Value); 9085((Microsoft.Xml.Serialization.XmlSerializerNamespaces)o.@Namespaces).Add(Reader.Name.Length == 5 ? "" : Reader.LocalName, Reader.Value); 9197((Microsoft.Xml.Serialization.XmlSerializerNamespaces)o.@Namespaces).Add(Reader.Name.Length == 5 ? "" : Reader.LocalName, Reader.Value); 9289((Microsoft.Xml.Serialization.XmlSerializerNamespaces)o.@Namespaces).Add(Reader.Name.Length == 5 ? "" : Reader.LocalName, Reader.Value); 9393((Microsoft.Xml.Serialization.XmlSerializerNamespaces)o.@Namespaces).Add(Reader.Name.Length == 5 ? "" : Reader.LocalName, Reader.Value); 9483((Microsoft.Xml.Serialization.XmlSerializerNamespaces)o.@Namespaces).Add(Reader.Name.Length == 5 ? "" : Reader.LocalName, Reader.Value); 9623((Microsoft.Xml.Serialization.XmlSerializerNamespaces)o.@Namespaces).Add(Reader.Name.Length == 5 ? "" : Reader.LocalName, Reader.Value); 9710((Microsoft.Xml.Serialization.XmlSerializerNamespaces)o.@Namespaces).Add(Reader.Name.Length == 5 ? "" : Reader.LocalName, Reader.Value); 9797((Microsoft.Xml.Serialization.XmlSerializerNamespaces)o.@Namespaces).Add(Reader.Name.Length == 5 ? "" : Reader.LocalName, Reader.Value); 9884((Microsoft.Xml.Serialization.XmlSerializerNamespaces)o.@Namespaces).Add(Reader.Name.Length == 5 ? "" : Reader.LocalName, Reader.Value); 9971((Microsoft.Xml.Serialization.XmlSerializerNamespaces)o.@Namespaces).Add(Reader.Name.Length == 5 ? "" : Reader.LocalName, Reader.Value); 10058((Microsoft.Xml.Serialization.XmlSerializerNamespaces)o.@Namespaces).Add(Reader.Name.Length == 5 ? "" : Reader.LocalName, Reader.Value); 10145((Microsoft.Xml.Serialization.XmlSerializerNamespaces)o.@Namespaces).Add(Reader.Name.Length == 5 ? "" : Reader.LocalName, Reader.Value); 10232((Microsoft.Xml.Serialization.XmlSerializerNamespaces)o.@Namespaces).Add(Reader.Name.Length == 5 ? "" : Reader.LocalName, Reader.Value); 10319((Microsoft.Xml.Serialization.XmlSerializerNamespaces)o.@Namespaces).Add(Reader.Name.Length == 5 ? "" : Reader.LocalName, Reader.Value); 10406((Microsoft.Xml.Serialization.XmlSerializerNamespaces)o.@Namespaces).Add(Reader.Name.Length == 5 ? "" : Reader.LocalName, Reader.Value); 10493((Microsoft.Xml.Serialization.XmlSerializerNamespaces)o.@Namespaces).Add(Reader.Name.Length == 5 ? "" : Reader.LocalName, Reader.Value); 10580((Microsoft.Xml.Serialization.XmlSerializerNamespaces)o.@Namespaces).Add(Reader.Name.Length == 5 ? "" : Reader.LocalName, Reader.Value); 10662((Microsoft.Xml.Serialization.XmlSerializerNamespaces)o.@Namespaces).Add(Reader.Name.Length == 5 ? "" : Reader.LocalName, Reader.Value); 10858((Microsoft.Xml.Serialization.XmlSerializerNamespaces)o.@Namespaces).Add(Reader.Name.Length == 5 ? "" : Reader.LocalName, Reader.Value); 10968((Microsoft.Xml.Serialization.XmlSerializerNamespaces)o.@Namespaces).Add(Reader.Name.Length == 5 ? "" : Reader.LocalName, Reader.Value); 11059((Microsoft.Xml.Serialization.XmlSerializerNamespaces)o.@Namespaces).Add(Reader.Name.Length == 5 ? "" : Reader.LocalName, Reader.Value); 11142((Microsoft.Xml.Serialization.XmlSerializerNamespaces)o.@Namespaces).Add(Reader.Name.Length == 5 ? "" : Reader.LocalName, Reader.Value); 11234((Microsoft.Xml.Serialization.XmlSerializerNamespaces)o.@Namespaces).Add(Reader.Name.Length == 5 ? "" : Reader.LocalName, Reader.Value); 11346((Microsoft.Xml.Serialization.XmlSerializerNamespaces)o.@Namespaces).Add(Reader.Name.Length == 5 ? "" : Reader.LocalName, Reader.Value); 11477((Microsoft.Xml.Serialization.XmlSerializerNamespaces)o.@Namespaces).Add(Reader.Name.Length == 5 ? "" : Reader.LocalName, Reader.Value); 11569((Microsoft.Xml.Serialization.XmlSerializerNamespaces)o.@Namespaces).Add(Reader.Name.Length == 5 ? "" : Reader.LocalName, Reader.Value); 11681((Microsoft.Xml.Serialization.XmlSerializerNamespaces)o.@Namespaces).Add(Reader.Name.Length == 5 ? "" : Reader.LocalName, Reader.Value); 11769((Microsoft.Xml.Serialization.XmlSerializerNamespaces)o.@Namespaces).Add(Reader.Name.Length == 5 ? "" : Reader.LocalName, Reader.Value); 11886((Microsoft.Xml.Serialization.XmlSerializerNamespaces)o.@Namespaces).Add(Reader.Name.Length == 5 ? "" : Reader.LocalName, Reader.Value); 11963((Microsoft.Xml.Serialization.XmlSerializerNamespaces)o.@Namespaces).Add(Reader.Name.Length == 5 ? "" : Reader.LocalName, Reader.Value); 12056((Microsoft.Xml.Serialization.XmlSerializerNamespaces)o.@Namespaces).Add(Reader.Name.Length == 5 ? "" : Reader.LocalName, Reader.Value); 12153((Microsoft.Xml.Serialization.XmlSerializerNamespaces)o.@Namespaces).Add(Reader.Name.Length == 5 ? "" : Reader.LocalName, Reader.Value); 12301((Microsoft.Xml.Serialization.XmlSerializerNamespaces)o.@Namespaces).Add(Reader.Name.Length == 5 ? "" : Reader.LocalName, Reader.Value); 12394((Microsoft.Xml.Serialization.XmlSerializerNamespaces)o.@Namespaces).Add(Reader.Name.Length == 5 ? "" : Reader.LocalName, Reader.Value); 12510((Microsoft.Xml.Serialization.XmlSerializerNamespaces)o.@Namespaces).Add(Reader.Name.Length == 5 ? "" : Reader.LocalName, Reader.Value); 12625((Microsoft.Xml.Serialization.XmlSerializerNamespaces)o.@Namespaces).Add(Reader.Name.Length == 5 ? "" : Reader.LocalName, Reader.Value); 12732((Microsoft.Xml.Serialization.XmlSerializerNamespaces)o.@Namespaces).Add(Reader.Name.Length == 5 ? "" : Reader.LocalName, Reader.Value); 12815((Microsoft.Xml.Serialization.XmlSerializerNamespaces)o.@Namespaces).Add(Reader.Name.Length == 5 ? "" : Reader.LocalName, Reader.Value); 12917((Microsoft.Xml.Serialization.XmlSerializerNamespaces)o.@Namespaces).Add(Reader.Name.Length == 5 ? "" : Reader.LocalName, Reader.Value); 12999((Microsoft.Xml.Serialization.XmlSerializerNamespaces)o.@Namespaces).Add(Reader.Name.Length == 5 ? "" : Reader.LocalName, Reader.Value); 13081((Microsoft.Xml.Serialization.XmlSerializerNamespaces)o.@Namespaces).Add(Reader.Name.Length == 5 ? "" : Reader.LocalName, Reader.Value);
HelpGenerator.cs (13)
164if (argument.Name.Length > maxNameLength) 166maxNameLength = argument.Name.Length; 175int helpTextIndent = argHelpPrefix.Length + maxArgumentnLength + argHelpSeperator.Length; 225_nameStart = s_nameMidpoint - (name.Length / 2); 288while (index < text.Length) 349while ((index < text.Length) && char.IsWhiteSpace(text[index])) 365index += Environment.NewLine.Length; 412for (int end = index; end < text.Length; end++) 417return text.Length - index; 422if ((index + Environment.NewLine.Length) > text.Length) 427for (int i = 0; i < Environment.NewLine.Length; i++)
Metadata\HttpAuthenticationHelper.cs (6)
118while (index < originalString.Length) 125if (originalString[index] == '\\' && index + 1 < originalString.Length) 142while (challenge.Length > 0) 147string value = challenge.Substring(realmTokenStart.Length); 154for (i = 0; i < challenge.Length; i++) 170if (i + 1 < challenge.Length)
Metadata\MetadaExchangeResolver.cs (6)
108baseUri = this.EndpointAddress.Uri.AbsoluteUri.Remove(this.EndpointAddress.Uri.AbsoluteUri.Length - uriQuery.Length); 117baseUri = this.EndpointAddress.Uri.AbsoluteUri.Remove(this.EndpointAddress.Uri.AbsoluteUri.Length - mexUri.Length); 455if (String.Compare(paramDecl, 0, paramName, 0, paramName.Length, StringComparison.OrdinalIgnoreCase) == 0) 457int equals = paramDecl.IndexOf('=', paramName.Length);
Metadata\MetadataDocumentLoader.cs (4)
713key = key.Remove(key.Length - metadataUri.Query.Length); 717key = key.Remove(key.Length - MexUri.Length);
Metadata\MetadataFileNameManager.cs (4)
111int length = absoluteUriString.Length - DataContractXsdBaseNamespace.Length; 118FileNameFromNS_Add(fileNameBuilder, absoluteUriString.Substring(DataContractXsdBaseNamespace.Length, length).Replace('/', '.')); 131absolutePath = absolutePath.Substring(0, absolutePath.Length - 1);
OutputPathHelper.cs (4)
15private static readonly int s_dataContractXsdBaseNamespaceLength = DataContractXsdBaseNamespace.Length; 49if (directory == null || directory.Length == 0) 123int length = absoluteUriString.Length - s_dataContractXsdBaseNamespaceLength; 141absolutePath = absolutePath.Substring(0, absolutePath.Length - 1);
Shared\FrameworkInfo.cs (1)
45for (int i = 0; i < fullFrameworkName.Length; i++)
Shared\ProjectDependency.cs (4)
191if (closingIdx != processedSpec.Length - 1 || processedSpec.IndexOf('{', openingIdx + 1) != -1 || processedSpec.IndexOf('}', closingIdx + 1) != -1) 204if (assemblyName[assemblyName.Length - 1] == ',') 206assemblyName = assemblyName.Substring(0, assemblyName.Length - 1).Trim(); 352else if (version.Length == 1)
Shared\Utilities\LogTag.cs (5)
37if (string.IsNullOrEmpty(tag) || tag.Length != LogTag.s_tagLength || !tag.StartsWith(s_tagStart, StringComparison.Ordinal) || !tag.EndsWith(s_tagEnd, StringComparison.Ordinal)) 60if (!string.IsNullOrEmpty(message) && message.Length >= LogTag.s_tagLength) 67else if (message.Length > tag.Length) 69value = message.Substring(tag.Length);
Shared\Utilities\PathHelper.cs (1)
186string str = childDir.Name.Substring(directoryName.Length);
TypeLoader.cs (3)
25path = path.Remove(path.Length - DotDll.Length, DotDll.Length);
dotnet-svcutil-lib.Tests (3)
FixupUtil.cs (2)
159updatedText = updatedText.Remove(idx, target.Length); 161idx += value.Length;
TestInit.cs (1)
576g_SvcutilPkgVersion = nugetId.Substring("dotnet-svcutil-lib.".Length);
dotnet-svcutil.xmlserializer (17)
Microsoft\Tools\ServiceModel\SvcUtil\OutputModule.cs (4)
62if (directory == null || directory.Length == 0) 122private static int s_dataContractXsdBaseNamespaceLength = DataContractXsdBaseNamespace.Length; 174int length = absoluteUriString.Length - s_dataContractXsdBaseNamespaceLength; 192absolutePath = absolutePath.Substring(0, absolutePath.Length - 1);
Microsoft\Tools\ServiceModel\SvcUtil\ToolConsole.cs (13)
313if (argument.Name.Length > maxNameLength) 315maxNameLength = argument.Name.Length; 324int helpTextIndent = argHelpPrefix.Length + maxArgumentLength + argHelpSeperator.Length; 374_nameStart = s_nameMidpoint - (name.Length / 2); 465while (index < text.Length) 526while ((index < text.Length) && char.IsWhiteSpace(text[index])) 542index += Environment.NewLine.Length; 589for (int end = index; end < text.Length; end++) 594return text.Length - index; 599if ((index + Environment.NewLine.Length) > text.Length) 604for (int i = 0; i < Environment.NewLine.Length; i++)
dotnet-user-jwts (11)
Helpers\ConsoleTable.cs (4)
54.Select(x => x!.ToString()!.Length).Max()) 94var rowDivider = $" {new string('-', columnHeaders.Length - 1)} "; 115if (rows[i][j].Length <= columnLengths[j]) 117outputRow = string.Concat(outputRow, rows[i][j], new string(' ', columnLengths[j] - rows[i][j].Length));
src\aspnetcore\src\Shared\CommandLineUtils\CommandLine\AnsiConsole.cs (2)
77while (endIndex != message.Length && 86if (endIndex == message.Length)
src\aspnetcore\src\Shared\CommandLineUtils\CommandLine\CommandLineApplication.cs (3)
480var maxArgLen = arguments.Max(a => a.Name.Length); 496var maxOptLen = options.Max(o => o.GetDisplayText().Length); 512var maxCmdLen = commands.Max(c => c.Name.Length);
src\aspnetcore\src\Shared\CommandLineUtils\CommandLine\CommandOption.cs (2)
29if (optName.Length == 1 && !IsEnglishLetter(optName[0])) 40ValueName = part.Substring(1, part.Length - 2);
dotnet-user-secrets (7)
src\aspnetcore\src\Shared\CommandLineUtils\CommandLine\AnsiConsole.cs (2)
77while (endIndex != message.Length && 86if (endIndex == message.Length)
src\aspnetcore\src\Shared\CommandLineUtils\CommandLine\CommandLineApplication.cs (3)
480var maxArgLen = arguments.Max(a => a.Name.Length); 496var maxOptLen = options.Max(o => o.GetDisplayText().Length); 512var maxCmdLen = commands.Max(c => c.Name.Length);
src\aspnetcore\src\Shared\CommandLineUtils\CommandLine\CommandOption.cs (2)
29if (optName.Length == 1 && !IsEnglishLetter(optName[0])) 40ValueName = part.Substring(1, part.Length - 2);
dotnet-watch (7)
CommandLine\CommandLineOptions.cs (6)
290if (token.Length == name.Length) 295else if (token.Length > name.Length + 1 && token[name.Length] == ':') 298binLogPath = token[(name.Length + 1)..];
Watch\MsBuildFileSetFactory.cs (1)
104AddFile(staticFile.FilePath, staticFile.StaticWebAssetPath?["wwwroot/".Length..]);
EventSourceGenerator (1)
EventSourceGenerator.Emitter.cs (1)
95Encoding.UTF8.GetBytes(name, 0, name.Length, metadata, 2);
GenerateAnalyzerNuspec (12)
Program.cs (12)
68if (value.Length > 0) 101if (fileList.Length > 0 || assemblyList.Length > 0 || libraryList.Length > 0 || folderList.Length > 0 || readmePackageLocation.Length > 0) 178if (readmePackageLocation.Length > 0) 228if (rulesetsDir.Length > 0 && Directory.Exists(rulesetsDir)) 239if (editorconfigsDir.Length > 0 && Directory.Exists(editorconfigsDir)) 251if (globalAnalyzerConfigsDir.Length > 0 && Directory.Exists(globalAnalyzerConfigsDir)) 266if (analyzerDocumentationFileDir.Length > 0 && Directory.Exists(analyzerDocumentationFileDir) && analyzerDocumentationFileName.Length > 0) 275if (analyzerSarifFileDir.Length > 0 && Directory.Exists(analyzerSarifFileDir) && analyzerSarifFileName.Length > 0) 284if (analyzerConfigurationFileDir.Length > 0 && Directory.Exists(analyzerConfigurationFileDir) && analyzerConfigurationFileName.Length > 0)
GenerateDocumentationAndConfigFiles (194)
JsonWriter.cs (1)
179for (int i = 0; i < value.Length; i++)
Program.cs (1)
1142var spacing = new string(' ', count: 15 - severity.Length);
src\roslyn\src\Compilers\Core\Portable\FileSystem\FileUtilities.cs (2)
136if (path!.Length == 1) 178Debug.Assert(path.Length == 1 || !PathUtilities.IsDirectorySeparator(path[1]));
src\roslyn\src\Compilers\Core\Portable\FileSystem\PathUtilities.cs (36)
55int lastSeparator = s.Length; 61if (lastSeparator != s.Length) 74if (s.Length == 0 || IsAnyDirectorySeparator(s[s.Length - 1])) 163var rootLength = GetPathRoot(path, isUnixLike).Length; 164if (path.Length > rootLength) 166var i = path.Length; 237int length = path.Length; 312return path.Length > 0 && IsDirectorySeparator(path[0]) 339if (path.Length > 0 && path[0] == '.') 341if (path.Length == 1 || IsDirectorySeparator(path[1])) 348if (path.Length == 2 || IsDirectorySeparator(path[2])) 359if (path.Length >= 1 && IsDirectorySeparator(path[0])) 366if (path.Length >= 2 && path[1] == VolumeSeparatorChar && (path.Length <= 2 || !IsDirectorySeparator(path[2]))) 400return path.Length >= 2 && 411return path.Length >= 3 && path[1] == VolumeSeparatorChar && IsDirectorySeparator(path[2]); 465char c = root[root.Length - 1]; 504if (path.Length > 0 && IsDirectorySeparator(path[path.Length - 1])) 506return path.Substring(0, path.Length - 1); 633return parentPath.Length > 0 634&& childPath.Length > parentPath.Length 635&& PathsEqual(childPath, parentPath, parentPath.Length) 636&& (IsDirectorySeparator(parentPath[parentPath.Length - 1]) || IsDirectorySeparator(childPath[parentPath.Length])); 641var relativePath = childPath.Substring(parentPath.Length); 644int start = ConsumeDirectorySeparators(relativePath, relativePath.Length, 0); 673return PathsEqual(path1, path2, Math.Max(path1.Length, path2.Length)); 681if (path1.Length < length || path2.Length < length) 741if (!(oldPrefix?.Length > 0)) continue; 750var replacement = replacementPrefix + filePath.Substring(oldPrefix.Length); 870if (!isDriveRooted && !(p.Length > 1 && p[0] == AltDirectorySeparatorChar))
src\roslyn\src\Compilers\Core\Portable\InternalUtilities\CompilerOptionParseUtilities.cs (1)
42if (Environment.GetEnvironmentVariable(CachePathEnvironmentVariable) is not { Length: > 0 } cachePath)
src\roslyn\src\Compilers\Core\Portable\InternalUtilities\FileNameUtilities.cs (6)
122if (path.Length > 0 && path[path.Length - 1] == '.') 124return path.Substring(0, path.Length - 1); 149if (extension == null || path.Length == 0) 154if (extension.Length == 0 || extension[0] != '.') 173for (int i = path.Length - 1; i >= 0; i--)
src\roslyn\src\Compilers\Core\Portable\InternalUtilities\StringExtensions.cs (14)
41return name.Length >= 3 && name[0] == 'I' && char.IsUpper(name[1]) && char.IsLower(name[2]); 46return name.Length >= 3 && name[0] == 'T' && char.IsUpper(name[1]) && char.IsLower(name[2]); 154result = name[..^AttributeSuffix.Length]; 168return name.Length > AttributeSuffix.Length && name.EndsWith(AttributeSuffix, comparison); 174while (i < str.Length) 181if (i < str.Length && char.IsLowSurrogate(str[i])) 211if (arg.Length > 1 && arg[0] == '"' && arg[arg.Length - 1] == '"') 214return arg.Substring(1, arg.Length - 2); 226while (x < string1.Length && x < string2.Length && 238while (x < string1.Length && x < string2.Length &&
src\roslyn\src\Compilers\Core\Portable\InternalUtilities\StringTable.cs (4)
481if (array.Length != length) 487for (var i = 0; i < array.Length; i++) 500if (array.Length != text.Length) 538if (ascii.Length != text.Length)
src\roslyn\src\Compilers\Core\Portable\InternalUtilities\UnicodeCharacterUtilities.cs (1)
103int nameLength = name.Length;
src\roslyn\src\Compilers\Core\Portable\Syntax\SyntaxTreeExtensions.cs (2)
95var n1 = s1.Length; 96var n2 = s2.Length;
src\roslyn\src\Compilers\Core\Portable\Text\TextChangeRangeExtensions.cs (1)
105return new TextChangeRange(textChange.Span, textChange.NewText?.Length ?? 0);
src\roslyn\src\Dependencies\Collections\Extensions\IEnumerableExtensions.cs (2)
213return str.Length == 0; 236return source.Length == 0;
src\roslyn\src\RoslynAnalyzers\Microsoft.CodeAnalysis.Analyzers\Core\MetaAnalyzers\ReleaseTrackingHelper.cs (1)
77string versionString = lineText[ReleasePrefix.Length..].Trim();
src\roslyn\src\RoslynAnalyzers\Utilities\Compiler\Extensions\StringExtensions.cs (1)
15return Encoding.UTF8.GetByteCount(value) == value.Length;
src\roslyn\src\RoslynAnalyzers\Utilities\Compiler\Options\AnalyzerOptionsExtensions.cs (2)
357if (trimmedSuffix.Length >= 2 && 361for (int i = 1; i < trimmedSuffix.Length - 2; i++)
src\roslyn\src\RoslynAnalyzers\Utilities\Compiler\Options\SymbolNamesWithValueOption.cs (2)
109parts.SymbolName.Length == 1)) 145Debug.Assert(parts.SymbolName.Length >= 2);
src\roslyn\src\RoslynAnalyzers\Utilities\Compiler\RulesetToEditorconfigConverter.cs (2)
208if (comment.Length > 0) 213if (trimmedCommentPart.Length > 0)
src\roslyn\src\RoslynAnalyzers\Utilities\Compiler\WellKnownTypeProvider.cs (1)
220for (int i = 0; i < fullTypeName.Length; i++)
src\roslyn\src\RoslynAnalyzers\Utilities\Compiler\WordParser.cs (3)
108_buffer = new StringBuilder(text.Length); 556while (_index < _text.Length) 574for (int index = _index; index < _text.Length; index++)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\CodeGeneration\ParameterName.cs (1)
42BestNameForParameter = trimmed.Length > 0 ? tryMakeCamelCase ? trimmed.ToCamelCase() : trimmed : nameBasedOnArgument;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\VirtualChars\AbstractVirtualCharService.cs (8)
30if (index + 1 < tokenText.Length) 118Debug.Assert(lastVC.Span.End == token.Span.End - "\"".Length, "Last span has to end right before the end of the string token."); 122Debug.Assert(lastVC.Span.End == token.Span.End - "\"u8".Length, "Last span has to end right before the end of the string token."); 145if (startDelimiter.Length > 0 && !tokenText.StartsWith(startDelimiter, StringComparison.Ordinal)) 151if (endDelimiter.Length > 0 && !tokenText.EndsWith(endDelimiter, StringComparison.Ordinal)) 157var startIndexInclusive = startDelimiter.Length; 158var endIndexExclusive = tokenText.Length - endDelimiter.Length;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\VirtualChars\AbstractVirtualCharService.ITextInfo.cs (1)
30public readonly int Length(string text) => text.Length;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\VirtualChars\VirtualCharGreenSequence.Chunks.cs (2)
78public override int Length => data.Length; 83return stringIndex >= 0 && stringIndex < data.Length ? stringIndex : null;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\StringExtensions.cs (13)
18for (var i = 0; i < line.Length; i++) 33for (var i = line.Length - 1; i >= 0; i--) 61return lastOffset.HasValue && lastOffset.Value < lineText.Length 71return lineText.GetColumnFromLineOffset(lineText.Length, tabSize); 74return text.ConvertTabToSpace(tabSize, initialColumn, text.Length) + initialColumn; 80Debug.Assert(endPosition >= 0 && endPosition <= textSnippet.Length); 107for (var i = 0; i < text.Length; i++) 156for (var i = 0; i < text.Length; i++) 164if (i + 1 == text.Length || text[i + 1] != '\n') 202return line.GetColumnFromLineOffset(line.Length, tabSize); 209Contract.ThrowIfFalse(0 <= endPosition && endPosition <= line.Length); 223for (var i = 0; i < line.Length; i++) 241return line.Length;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\TokenStream.cs (2)
337length = text.ConvertTabToSpace(_options.TabSize, initialColumn, text.Length); 341length = text.Length;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\TreeData.Node.cs (1)
30return lineText.GetColumnFromLineOffset(lineText.Length, tabSize);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\FormattingExtensions.cs (9)
130spaceOrIndentation = indentationString.GetColumnFromLineOffset(indentationString.Length, tabSize); 136spaceOrIndentation = text.ConvertTabToSpace(tabSize, baseToken.ToString().GetTextColumn(tabSize, initialColumn), text.Length); 156nonWhitespaceCharIndex = triviaText.Length; 164builder.Append(triviaText, nonWhitespaceCharIndex, triviaText.Length - nonWhitespaceCharIndex); 201builder.Append(line, nonWhitespaceCharIndex, line.Length - nonWhitespaceCharIndex); 226for (var i = 0; i < text.Length; i++) 245if (i >= newText.Length || text[i] != newText[i]) 252if (i == span.Length && text.Length == newText.Length)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\TriviaEngine\AbstractTriviaFormatter.cs (6)
145for (var i = 0; i < text.Length; i++) 611var tokenPosition = lastText.ConvertTabToSpace(Options.TabSize, initialColumn, lastText.Length); 741for (var i = this.OriginalString.Length - 1; i >= 0; i--) 889spaces: text.ConvertTabToSpace(Options.TabSize, lineColumn.With(whitespaceBetween).Column, text.Length), 925spaces: lineText.GetColumnFromLineOffset(lineText.Length, Options.TabSize), 931spaces: text.ConvertTabToSpace(Options.TabSize, initialColumn, text.Length),
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\Naming\IdentifierNameParts.cs (2)
47? newBaseName[prefix.Length..] 53? newBaseName[..^suffix.Length]
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\NamingStyle.cs (19)
89if (word.Length == 0) 107if (word.Length == 0) 137if (name.Length <= Prefix.Length + Suffix.Length) 147name = StripCommonPrefixes(name[Prefix.Length..], out var prefix); 160var spanToCheck = TextSpan.FromBounds(0, name.Length - Suffix.Length); 311name = StripCommonPrefixes(name.StartsWith(Prefix) ? name[Prefix.Length..] : name, out _); 346while (index + 1 < name.Length) 353if (index + 2 < name.Length && name[index + 1] == '_') 362if (index + 1 < name.Length && !char.IsDigit(name[index + 1])) 385if (Suffix.Length + Prefix.Length >= name.Length) 390name = name[Prefix.Length..^Suffix.Length]; 428for (var i = Suffix.Length; i > 0; i--) 455for (var i = 0; i < Prefix.Length; i++)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\NamingStyle.WordSpanEnumerator.cs (1)
52Current = new TextSpan(Current.End + _wordSeparator.Length, 0);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Serialization\ObjectWriter.cs (2)
504var bytes = new byte[(uint)value.Length * sizeof(char)]; 510WriteCompressedUInt((uint)value.Length);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\SyntaxFacts\AbstractDocumentationCommentService.cs (3)
90if (text.Length > maxBannerLength) 185=> tokenText.Length > 0 && char.IsWhiteSpace(tokenText[0]); 188=> tokenText.Length > 0 && char.IsWhiteSpace(tokenText[^1]);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\SyntaxFacts\ISyntaxFactsExtensions.cs (2)
251if (name.Length == 0) 261for (var i = 1; i < name.Length; i++)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.cs (1)
198Debug.Assert(reader.Position == symbolKey.Length);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.SymbolKeyReader.cs (1)
259while (Position < Data.Length)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\Base64Utilities.cs (2)
329decodedLength = (encodedString.Length * 3) / 4 - padding; 336var index = attributeData.Length - 1;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\BKTree.Builder.cs (3)
97var distinctValues = values.Where(v => v.Length > 0).Distinct(CaseInsensitiveComparison.Comparer).ToArray(); 98var charCount = distinctValues.Sum(v => v.Length); 107_wordSpans[i] = new TextSpan(characterIndex, value.Length);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\BKTree.cs (4)
74var lowerCaseCharacters = value.Length < 512 75? stackalloc char[value.Length] 76: new char[value.Length]; 78for (var i = 0; i < value.Length; i++)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\EditDistance.cs (8)
57var array = text.Length <= PooledArraySize 59: new char[text.Length]; 61for (var i = 0; i < text.Length; i++) 89var targetLowerCaseCharacters = target.Length < 512 90? stackalloc char[target.Length] 91: new char[target.Length]; 93for (var i = 0; i < target.Length; i++) 97_sourceLowerCaseCharacters.AsSpan(0, _source.Length),
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\PathMetadataUtilities.cs (2)
31if (rootNamespace is { Length: > 0 } && 69@namespace = @namespace[(rootNamespace.Length + 1)..];
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\StringEscapeEncoder.cs (4)
17while (startIndex < text.Length) 29builder?.Append(text, startIndex, text.Length - startIndex); 66while (startIndex < text.Length) 72builder?.Append(text, startIndex, text.Length - startIndex);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\WordSimilarityChecker.cs (6)
91=> GetThreshold(value.Length); 108if (_source.Length < MinFuzzyLength) 134if (Math.Abs(_source.Length - candidateText.Length) <= _threshold) 163var lengthDifference = Math.Abs(originalText.Length - candidateText.Length);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\ISymbolExtensions.cs (1)
841(symbol.Name.Length == 1 || uint.TryParse(symbol.Name[1..], out _) || symbol.Name.All(n => n.Equals('_')));
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\ITypeSymbolExtensions.cs (1)
370return shortName.Length == 0
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Extensions\ProjectExtensions.cs (2)
60analyzerConfigDirectory.Length > bestPath.Length)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Extensions\SyntaxGeneratorExtensions_CreateEqualsMethod.cs (1)
391if (name.Length > 0)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\LanguageServices\TypeInferenceService\AbstractTypeInferenceService.cs (3)
67if (name.Length == prefix.Length) 72var nextChar = name[prefix.Length];
GetDocument.Insider (7)
src\aspnetcore\src\Shared\CommandLineUtils\CommandLine\AnsiConsole.cs (2)
77while (endIndex != message.Length && 86if (endIndex == message.Length)
src\aspnetcore\src\Shared\CommandLineUtils\CommandLine\CommandLineApplication.cs (3)
480var maxArgLen = arguments.Max(a => a.Name.Length); 496var maxOptLen = options.Max(o => o.GetDisplayText().Length); 512var maxCmdLen = commands.Max(c => c.Name.Length);
src\aspnetcore\src\Shared\CommandLineUtils\CommandLine\CommandOption.cs (2)
29if (optName.Length == 1 && !IsEnglishLetter(optName[0])) 40ValueName = part.Substring(1, part.Length - 2);
HelixTestTasks (1)
GroupWorkItems.cs (1)
122? name.Substring(0, name.Length - 4)
ILAssembler (5)
EntityRegistry.cs (2)
703StringBuilder builder = new(typeRef.Namespace.Length + typeRef.Name.Length + 1);
GrammarVisitor.cs (1)
367int codeViewDataSize = 4 + 16 + 4 + "assembly.pdb".Length + 1; // signature + guid + age + path + null
StringHelpers.cs (2)
21if (rawText.Length < 2) 33ReadOnlySpan<char> content = rawText.AsSpan(1, rawText.Length - 2);
ilc (13)
ConfigurablePInvokePolicy.cs (9)
90yield return name.Substring(0, name.Length - suffix.Length); 100yield return name.Substring(0, name.Length - suffix.Length); 102yield return name.Substring(LibPrefix.Length); 104yield return name.Substring(LibPrefix.Length, name.Length - suffix.Length - LibPrefix.Length);
Program.cs (2)
252if (separatorIndex == 0 || separatorIndex != specifier.LastIndexOf('=') || separatorIndex == specifier.Length - 1) 289string unmanagedEntryPointsAssembly = hidden ? unmanagedEntryPointsAssemblyValue[..^hiddenSuffix.Length] : unmanagedEntryPointsAssemblyValue;
src\runtime\src\coreclr\tools\Common\CommandLineHelpers.cs (2)
434if (token.Length > 0 && token[0] != '#') 441if (firstQuotePosition >= 0 && firstQuotePosition < token.Length - 1 &&
ILCompiler.Compiler (46)
Compiler\AssemblyExtensions.cs (1)
32var versionStr = tfm.Substring(idx + versionPrefix.Length);
Compiler\DependencyAnalysis\CallingConventionConverterKey.cs (2)
127if (ns.Length > 0) 157if (ns.Length > 0)
Compiler\DependencyAnalysis\FrozenStringNode.cs (3)
25protected override int ContentSize => _stringType.Context.Target.PointerSize + sizeof(int) + (_data.Length + 1) * sizeof(char); 31dataBuilder.EmitInt(_data.Length); 53public override int? ArrayLength => _data.Length;
Compiler\DependencyAnalysis\NodeFactory.cs (1)
1574Encoding.UTF8.GetBytes(str, 0, str.Length, stringBytes, 0);
Compiler\DescriptorMarker.cs (1)
312if (attribute == null || attribute.Length == 0)
Compiler\Disassembler.cs (1)
43dis = dis.Substring(0, dis.Length - 1);
Compiler\Logging\DocumentationSignatureGenerator.PartVisitor.cs (2)
191unmangledName = unmangledName.Substring(0, unmangledName.Length - expectedSuffix.Length);
Compiler\Logging\DocumentationSignatureParser.cs (5)
87if (id.Length < 2) 536if (indexOfLastDot > 0 && indexOfLastDot < name.Length - 1) 774return index >= id.Length ? '\0' : id[index]; 792index = id.Length; 809while (index < id.Length && char.IsDigit(id[index]))
Compiler\Logging\UnconditionalSuppressMessageAttributeState.cs (2)
188warningId.Length < 6 || 195if (warningId.Length > 6 && warningId[6] != ':')
Compiler\ObjectDumper.cs (1)
32name = name.Substring(0, name.Length - 4);
Compiler\UserDefinedTypeDescriptor.cs (2)
83if (fieldNameEmit.Length > 0 && fieldNameEmit[0] == '<') 105if (endIndex > 0 && endIndex + 1 < name.Length)
src\runtime\src\coreclr\tools\Common\Compiler\Dataflow\TypeExtensions.cs (4)
30if (metadataTypeName.Length + 1 > name.Length) 33if (!name.Slice(name.Length - metadataTypeName.Length).Equals(metadataTypeName.AsSpan(), StringComparison.Ordinal)) 36if (name[name.Length - metadataTypeName.Length - 1] != '.') 39return name.Slice(0, name.Length - metadataTypeName.Length - 1).Equals(metadataType.GetNamespace(), StringComparison.Ordinal);
src\runtime\src\coreclr\tools\Common\Compiler\ObjectWriter\ObjectWriter.cs (1)
656firstGeneric = name.Length;
src\runtime\src\coreclr\tools\Common\Compiler\ObjectWriter\TypeString.cs (1)
97if (ns.Length > 0)
src\runtime\src\coreclr\tools\Common\Compiler\Win32Resources\ResourceData.cs (1)
247dataBuilder.EmitUShort(checked((ushort)name.Key.Length));
src\runtime\src\coreclr\tools\Common\Microsoft\SourceLink\Tools\SourceLinkMap.cs (6)
98list.Sort((left, right) => -left.FilePath.Path.Length.CompareTo(right.FilePath.Path.Length)); 112if (key.Length == 0) 118if (filePathStar == key.Length - 1) 181var escapedPath = string.Join("/", path[file.Path.Length..].Split(['/', '\\']).Select(Uri.EscapeDataString)); 188Debug.Assert(mappedUri.Suffix.Length == 0);
src\runtime\src\libraries\Common\src\System\Text\ValueStringBuilder.cs (5)
125int count = s.Length; 167if (s.Length == 1 && (uint)pos < (uint)_chars.Length) // very common case, e.g. appending strings from NumberFormatInfo like separators, percent symbols, etc. 181if (pos > _chars.Length - s.Length) 183Grow(s.Length); 191_pos += s.Length;
src\runtime\src\tools\illink\src\ILLink.Shared\DataFlow\CompilerGeneratedNames.cs (5)
13return memberName.Length > 0 && memberName[0] == '<'; 52return typeName.Length > i + 1 && typeName[i + 1] == 'd'; 79return fieldName.Length > i + 1 && fieldName[i + 1] == '2'; 117return methodName.Length > i + 1 && methodName[i + 1] == 'b'; 148return methodName.Length > i + 1 && methodName[i + 1] == 'g';
src\runtime\src\tools\illink\src\ILLink.Shared\TrimAnalysis\HandleCallAction.cs (2)
279else if (interfaceName is KnownStringValue stringValue && stringValue.Contents.Length == 0) 1780if (assemblyNameStringValue.Contents is string assemblyName && assemblyName.Length == 0)
ILCompiler.MetadataTransform (9)
ILCompiler\Metadata\Transform.Namespace.cs (6)
29if (namespaceString.Length == 0) 47if (nextNamespaceName.Length > 0) 56Name = HandleString(segment.Length == 0 ? null : segment), 75if (namespaceString.Length == 0) 106if (nextNamespaceName.Length > 0) 115Name = HandleString(segment.Length == 0 ? null : segment),
src\runtime\src\coreclr\tools\Common\Internal\NativeFormat\NativeFormatReader.String.cs (3)
110if (numBytes < value.Length) 113for (int i = 0; i < value.Length; i++) 124return numBytes == value.Length; // All char ANSI, all matching
ILCompiler.ReadyToRun (36)
Compiler\CallChainProfile.cs (6)
153moduleSimpleName = moduleSimpleName.Substring(0, moduleSimpleName.Length - 3); 168namespaceAndTypeName = unresolvedNamespaceTypeAndMethodName.Substring(0, unresolvedNamespaceTypeAndMethodName.Length - "..ctor".Length); 173namespaceAndTypeName = unresolvedNamespaceTypeAndMethodName.Substring(0, unresolvedNamespaceTypeAndMethodName.Length - "..cctor".Length); 183methodNameWithoutType = unresolvedNamespaceTypeAndMethodName.Length > lastDotIndex ? unresolvedNamespaceTypeAndMethodName.Substring(lastDotIndex + 1) : "";
Compiler\DependencyAnalysis\ReadyToRun\WasmImportThunk.cs (2)
110while ((pos < _wasmSignature.SignatureString.Length) && char.IsDigit(_wasmSignature.SignatureString[pos])) 116if ((pos < _wasmSignature.SignatureString.Length) && (_wasmSignature.SignatureString[pos] == 'T'))
Compiler\DependencyAnalysis\ReadyToRun\WasmInterpreterToR2RThunkNode.cs (2)
58while ((pos < _wasmSignature.SignatureString.Length) && char.IsDigit(_wasmSignature.SignatureString[pos])) 64if ((pos < _wasmSignature.SignatureString.Length) && (_wasmSignature.SignatureString[pos] == 'T'))
Compiler\DependencyAnalysis\ReadyToRun\WasmR2RToInterpreterThunkNode.cs (2)
67while ((pos < _wasmSignature.SignatureString.Length) && char.IsDigit(_wasmSignature.SignatureString[pos])) 73if ((pos < _wasmSignature.SignatureString.Length) && (_wasmSignature.SignatureString[pos] == 'T'))
Compiler\ReadyToRunStandaloneMethodMetadata.cs (2)
142blob.WriteCompressedInteger(strAlternate.Length); 145blob.WriteBytes((byte*)charData, strAlternate.Length * 2);
IBC\ReaderExtensions.cs (1)
57for (int i = 0; i < s.Length; ++i)
ObjectWriter\MapFileBuilder.cs (2)
302if (sectionNameHead.Length > SectionNameHeadLength) 313writer.WriteLine(new string('-', title.Length));
src\runtime\src\coreclr\tools\Common\Compiler\Dataflow\TypeExtensions.cs (4)
30if (metadataTypeName.Length + 1 > name.Length) 33if (!name.Slice(name.Length - metadataTypeName.Length).Equals(metadataTypeName.AsSpan(), StringComparison.Ordinal)) 36if (name[name.Length - metadataTypeName.Length - 1] != '.') 39return name.Slice(0, name.Length - metadataTypeName.Length - 1).Equals(metadataType.GetNamespace(), StringComparison.Ordinal);
src\runtime\src\coreclr\tools\Common\Compiler\ObjectWriter\ObjectWriter.cs (1)
656firstGeneric = name.Length;
src\runtime\src\coreclr\tools\Common\Compiler\ObjectWriter\TypeString.cs (1)
97if (ns.Length > 0)
src\runtime\src\coreclr\tools\Common\Compiler\Win32Resources\ResourceData.cs (1)
247dataBuilder.EmitUShort(checked((ushort)name.Key.Length));
src\runtime\src\coreclr\tools\Common\JitInterface\CorInfoImpl.cs (4)
157IntPtr nativeException = AllocException(exString, exString.Length); 2174int result = (str.Length >= startIndex) ? (str.Length - startIndex) : 0; 3871Encoding.UTF8.GetBytes(s, 0, s.Length, bytes, 0);
src\runtime\src\coreclr\tools\Common\JitInterface\JitTypeNameFormatter.cs (1)
83if (ns.Length > 0)
src\runtime\src\coreclr\tools\Common\JitInterface\WasmLowering.cs (7)
417while (pos < sig.Length && char.IsDigit(sig[pos])) 454if (pos < sig.Length && sig[pos] == 'T') 463if ((pos + 1 < sig.Length) && (sig[pos] == hiddenParamChar) && (sig[pos + 1] == 'a')) 470if (pos < sig.Length && sig[pos] == 'a') 477while (pos < sig.Length && sig[pos] != 'p') 494else if (((c == 'l') || (c == 'V')) && (pos + 1 < sig.Length) && char.IsDigit(sig[pos + 1])) 519bool isManaged = pos < sig.Length && sig[pos] == 'p';
ILCompiler.RyuJit (14)
JitInterface\CorInfoImpl.RyuJit.cs (2)
2436if (valueOffset >= strDataOffset && (long)frozenStr.Data.Length * 2 >= (valueOffset - strDataOffset) + bufferSize) 2472if (HandleToObject(strObj) is FrozenStringNode frozenStr && (uint)frozenStr.Data.Length > (uint)index)
src\runtime\src\coreclr\tools\Common\JitInterface\CorInfoImpl.cs (4)
157IntPtr nativeException = AllocException(exString, exString.Length); 2174int result = (str.Length >= startIndex) ? (str.Length - startIndex) : 0; 3871Encoding.UTF8.GetBytes(s, 0, s.Length, bytes, 0);
src\runtime\src\coreclr\tools\Common\JitInterface\JitTypeNameFormatter.cs (1)
83if (ns.Length > 0)
src\runtime\src\coreclr\tools\Common\JitInterface\WasmLowering.cs (7)
417while (pos < sig.Length && char.IsDigit(sig[pos])) 454if (pos < sig.Length && sig[pos] == 'T') 463if ((pos + 1 < sig.Length) && (sig[pos] == hiddenParamChar) && (sig[pos + 1] == 'a')) 470if (pos < sig.Length && sig[pos] == 'a') 477while (pos < sig.Length && sig[pos] != 'p') 494else if (((c == 'l') || (c == 'V')) && (pos + 1 < sig.Length) && char.IsDigit(sig[pos + 1])) 519bool isManaged = pos < sig.Length && sig[pos] == 'p';
ILCompiler.TypeSystem (17)
src\runtime\src\coreclr\tools\Common\Internal\Text\Utf8Span.cs (3)
33if (_value.Length < value.Length) 36for (int i = 0; i < value.Length; i++) 47return _value.Length == value.Length; // All char ANSI, all matching
src\runtime\src\coreclr\tools\Common\TypeSystem\Common\TypeHashingAlgorithms.cs (2)
34for (int i = 0; i < src.Length; i += 2) 37if ((i + 1) < src.Length)
src\runtime\src\coreclr\tools\Common\TypeSystem\Common\Utilities\CustomAttributeTypeNameFormatter.cs (1)
133if (ns.Length > 0)
src\runtime\src\coreclr\tools\Common\TypeSystem\Common\Utilities\DebugNameFormatter.cs (1)
208sb.Append(assemblyName, 14, assemblyName.Length - 14);
src\runtime\src\coreclr\tools\Common\TypeSystem\Common\Utilities\ExceptionTypeNameFormatter.cs (1)
101if (ns.Length > 0)
src\runtime\src\coreclr\tools\Common\TypeSystem\Ecma\CachingMetadataStringDecoder.cs (1)
113if (length != text.Length)
src\runtime\src\coreclr\tools\Common\TypeSystem\IL\ILDisassembler.cs (3)
150for (int i = 0; i < s.Length; i++) 287opCodeString = opCodeString.Substring(0, opCodeString.Length - 1); 618if (ns.Length > 0)
src\runtime\src\libraries\Common\src\System\Text\ValueStringBuilder.cs (5)
125int count = s.Length; 167if (s.Length == 1 && (uint)pos < (uint)_chars.Length) // very common case, e.g. appending strings from NumberFormatInfo like separators, percent symbols, etc. 181if (pos > _chars.Length - s.Length) 183Grow(s.Length); 191_pos += s.Length;
illink (34)
ILLink.RoslynAnalyzer (28)
CompilationExtensions.cs (2)
145return name.Length > AttributeSuffix.Length && name.EndsWith(AttributeSuffix, comparison);
src\runtime\src\libraries\Common\src\System\Buffers\SearchValuesPolyfills.cs (1)
65Debug.Assert(_nonAscii.Length < 10, "Expected few non-ASCII characters at most.");
src\runtime\src\libraries\Common\src\System\Reflection\AssemblyNameFormatter.cs (4)
23Debug.Assert(name.Length != 0); 60if (cultureName.Length == 0) 108if (s.Length != span.Trim().Length || span.IndexOfAny('\"', '\'') >= 0) 114for (int i = 0; i < s.Length; i++)
src\runtime\src\libraries\Common\src\System\Reflection\AssemblyNameParser.cs (3)
310if (attributeValue.Length % 2 != 0 || (isToken && attributeValue.Length != 8 * 2)) 316byte[] pkt = new byte[attributeValue.Length / 2];
src\runtime\src\libraries\Common\src\System\Text\ValueStringBuilder.cs (5)
125int count = s.Length; 167if (s.Length == 1 && (uint)pos < (uint)_chars.Length) // very common case, e.g. appending strings from NumberFormatInfo like separators, percent symbols, etc. 181if (pos > _chars.Length - s.Length) 183Grow(s.Length); 191_pos += s.Length;
src\runtime\src\libraries\System.Reflection.Metadata\src\System\Reflection\Metadata\TypeName.cs (2)
183else if (_nestedNameLength > 0 && _fullName.Length > _nestedNameLength) // Declaring types 234else if (_nestedNameLength > 0 && _fullName.Length > _nestedNameLength) // Declaring types
src\runtime\src\libraries\System.Reflection.Metadata\src\System\Reflection\Metadata\TypeNameParserHelpers.cs (3)
105sb.EnsureCapacity(name.Length); 108for (int i = indexOfEscapeCharacter; i < name.Length;) 112if (c != EscapeCharacter || i == name.Length)
src\runtime\src\tools\illink\src\ILLink.Shared\DataFlow\CompilerGeneratedNames.cs (5)
13return memberName.Length > 0 && memberName[0] == '<'; 52return typeName.Length > i + 1 && typeName[i + 1] == 'd'; 79return fieldName.Length > i + 1 && fieldName[i + 1] == '2'; 117return methodName.Length > i + 1 && methodName[i + 1] == 'b'; 148return methodName.Length > i + 1 && methodName[i + 1] == 'g';
src\runtime\src\tools\illink\src\ILLink.Shared\TrimAnalysis\HandleCallAction.cs (2)
279else if (interfaceName is KnownStringValue stringValue && stringValue.Contents.Length == 0) 1780if (assemblyNameStringValue.Contents is string assemblyName && assemblyName.Length == 0)
TrimAnalysis\TrimDataFlowAnalysis.cs (1)
183if (line.Length != 0)
ILLink.Tasks (4)
CreateRuntimeRootDescriptorFile.cs (4)
165int startIndex = "g_".Length; 526classNamespace = classNamespace.Substring(prefixToRemove.Length); 531classNamespace = classNamespace.Substring(0, classNamespace.Length - suffixToRemove.Length);
Infrastructure.Tests (39)
CreateFailingTestIssue\CreateFailingTestIssueToolTests.cs (3)
615Assert.True(response.Issue!.Body.Length < 64 * 1024, $"Issue body length was {response.Issue.Body.Length}."); 996var builder = new System.Text.StringBuilder(targetLength + seed.Length);
Pipelines\ExtensionE2eRecorderStepTests.cs (1)
198Assert.SkipWhen(pwshPath.Length == 0, "pwsh is not on PATH.");
Pipelines\NixCliPackageTests.cs (1)
52Assert.Equal(64, Convert.FromBase64String(hash["sha512-".Length..]).Length);
Pipelines\NpmCliPackageTests.cs (1)
735index += substring.Length;
Pipelines\ReleasePublishNugetPipelineTests.cs (6)
273.Where(line => line.Length > 0) 733alias = alias[..^"@microsoft.com".Length]; 760if (line.Length == 0) 773return TrimYamlQuotes(line[valueKey.Length..].Trim()); 783while (count < value.Length && char.IsWhiteSpace(value[count])) 793if (value.Length >= 2 &&
PowerShellScripts\AspireSkillsBundleHashTests.cs (2)
109.FirstOrDefault(static l => l.Length == 128 && l.All(static c => char.IsAsciiHexDigitLower(c))); 137return line!["NAMES=".Length..].Split(';', StringSplitOptions.RemoveEmptyEntries);
PowerShellScripts\DownloadNativeArchivesTests.cs (1)
664var rest = path.Substring(i + marker.Length);
PowerShellScripts\ScanTestPartitionsFromSourceGuardTests.cs (1)
80var snippet = content.Substring(m.Index, Math.Min(70, content.Length - m.Index))
TestTriggerMap\SelectTestsAcceptanceTests.cs (1)
984.Where(d => d.Length > 0)
TestTriggerMap\TestTriggerMapModel.cs (2)
94var core = hasGlobSuffix ? pattern[..^"/**".Length] : pattern; 103var after = core[(nameIndex + "<name>".Length)..];
TestTriggerMap\TestTriggerMapTests.cs (4)
333.Select(t => "run_" + t["job:".Length..].Replace('-', '_')) 411.Select(t => t["test:".Length..]) 537workflow[(start + marker.Length)..], 540? workflow.Substring(start, marker.Length + next.Index)
tools\GenerateCITimeline\TimelineRenderer.cs (3)
344var ri = runner.Length > 0 ? GetRunnerIcon(runner) + " " : ""; 386var ri = runner.Length > 0 ? GetRunnerIcon(runner) + " " : ""; 442var ri = runner.Length > 0 ? GetRunnerIcon(runner) + " " : "";
TypeScriptApiCompat\TypeScriptApiCompatTests.cs (2)
90Assert.Equal(["Pkg.Mode"], surface.EnumTypes.Keys.Select(k => k["enum:".Length..])); 119Assert.Equal(["Aspire.Hosting.Mode"], surface.EnumTypes.Keys.Select(k => k["enum:".Length..]));
WorkflowScripts\AutoRerunTransientCiFailuresTests.cs (5)
1910Assert.True(results[0].Output.Length <= 10 * 1024, $"Output length {results[0].Output.Length} exceeds 10KB cap"); 2088rule.TryGetProperty("reason", out JsonElement reason) && reason.ValueKind == JsonValueKind.String && reason.GetString()!.Length > 0, 2115Assert.True(value.GetString()!.Length > 0, $"{fieldName}: string pattern must be non-empty."); 2122value.TryGetProperty("regex", out JsonElement regex) && regex.ValueKind == JsonValueKind.String && regex.GetString()!.Length > 0,
WorkflowScripts\SelectTestsCommentScriptTests.cs (6)
269if (line.Trim().Length == 0) 283while (body.Count > 0 && body[^1].Length == 0) 289var minIndent = body.Where(l => l.Length > 0).Min(IndentOf); 290return string.Join("\n", body.Select(l => l.Length >= minIndent ? l[minIndent..] : l)); 293private static int IndentOf(string line) => line.Length - line.TrimStart().Length;
installer.tasks (2)
StaticFileRegeneration\TpnSectionHeader.cs (2)
18return line.Length > 2 && line.All(c => SectionSeparatorChars.Contains(c)); 30if (line.Length > 2 &&
Microsoft.Analyzers.Extra (4)
LegacyLoggingFixer.FixDetails.cs (3)
73if (argName.Length == 0) 125Level = method.Name.Substring("Log".Length); 265var endIndex = message.Length;
StartsEndsWith.cs (1)
48if (s != null && s.Length == 1)
Microsoft.Analyzers.Extra.Tests (2)
RoslynTestUtils.cs (2)
99start += seq.Length; 125start += seq.Length;
Microsoft.Analyzers.Local (3)
TextScanner.cs (1)
129for (var i = 0; i < next.Length; i += 1)
Utils.cs (2)
89for (var i = 0; i < baseTypesString.Length; i++) 106results.Add(baseTypesString.Substring(start, baseTypesString.Length - start).Trim());
Microsoft.Analyzers.Local.Tests (2)
RoslynTestUtils.cs (2)
99start += seq.Length; 125start += seq.Length;
Microsoft.Arcade.Common (9)
ArgumentEscaper.cs (6)
47for (int i = 0; i < argument.Length; ++i) 49if (quoted && (i == 0 || i == argument.Length - 1)) 57while (i < argument.Length && argument[i] == '\\') 66if (i == argument.Length) 139return argument.Length > 1 && (argument[0] == '\"' || argument[argument.Length - 1] == '\"');
CompactConsoleLoggerFormatter.cs (3)
46_messagePadding = new string(' ', GetLogLevelString(LogLevel.Information).Length + LoglevelPadding.Length + (_options.TimestampFormat?.Length ?? 0));
Microsoft.AspNetCore (1)
WebApplicationBuilder.cs (1)
301if (env.IsDevelopment() && env.ApplicationName is { Length: > 0 })
Microsoft.AspNetCore.Antiforgery (9)
Internal\DefaultAntiforgeryTokenSerializer.cs (1)
35var maxTokenDecodedSize = Base64Url.GetMaxDecodedLength(serializedToken.Length);
src\aspnetcore\src\Shared\HttpExtensions.cs (2)
27if (contentType.Length < MultipartFormContentType.Length)
src\aspnetcore\src\Shared\WebEncoders\WebEncoders.cs (6)
49return Base64UrlDecode(input, offset: 0, count: input.Length); 67ValidateParameters(input.Length, nameof(input), offset, count); 88if (offset == 0 && count == input.Length) 124ValidateParameters(input.Length, nameof(input), offset, count); 145if (offset == 0 && count == input.Length) 232input.Length));
Microsoft.AspNetCore.App.Analyzers (24)
Infrastructure\RoutePattern\RoutePatternLexer.cs (1)
75for (var i = 0; i < val.Length; i++)
Infrastructure\RoutePattern\RoutePatternParser.cs (1)
103if (startText.Length > 1 ||
Infrastructure\VirtualChars\AbstractVirtualCharService.cs (8)
29if (index + 1 < tokenText.Length) 114Debug.Assert(lastVC.Span.End == token.Span.End - "\"".Length, "Last span has to end right before the end of the string token."); 118Debug.Assert(lastVC.Span.End == token.Span.End - "\"u8".Length, "Last span has to end right before the end of the string token."); 142if (startDelimiter.Length > 0 && !tokenText.StartsWith(startDelimiter, StringComparison.Ordinal)) 148if (endDelimiter.Length > 0 && !tokenText.EndsWith(endDelimiter, StringComparison.Ordinal)) 154var startIndexInclusive = startDelimiter.Length; 155var endIndexExclusive = tokenText.Length - endDelimiter.Length;
Infrastructure\VirtualChars\AbstractVirtualCharService.ITextInfo.cs (1)
29public int Length(string text) => text.Length;
Infrastructure\VirtualChars\CSharpVirtualCharService.cs (8)
140var endIndexExclusive = tokenText.Length; 144endIndexExclusive -= "u8".Length; 248if (startDelimiter.Length > 0 && !tokenText.StartsWith(startDelimiter, StringComparison.Ordinal)) 254if (endDelimiter.Length > 0 && !tokenText.EndsWith(endDelimiter, StringComparison.OrdinalIgnoreCase)) 260var startIndexInclusive = startDelimiter.Length; 261var endIndexExclusive = tokenText.Length - endDelimiter.Length; 512for (var i = 0; i < 4 && endIndex < tokenText.Length; i++)
Infrastructure\VirtualChars\VirtualCharSequence.Chunks.cs (3)
128public override int Length => _underlyingData.Length; 133if (stringIndex < 0 || stringIndex >= _underlyingData.Length) 150Debug.Assert(index + 1 >= _underlyingData.Length ||
RouteEmbeddedLanguage\RoutePatternCompletionProvider.cs (2)
375newPosition += escapedInsertionText.Length - insertionText.Length;
Microsoft.AspNetCore.Authentication.BearerToken (1)
BearerTokenHandler.cs (1)
99? authorization["Bearer ".Length..]
Microsoft.AspNetCore.Authentication.Cookies (9)
src\aspnetcore\src\Shared\ChunkingCookieManager\ChunkingCookieManager.cs (6)
75if (int.TryParse(value.AsSpan(ChunkCountPrefix.Length), NumberStyles.None, CultureInfo.InvariantCulture, out var chunksCount)) 111totalSize += chunks[i].Length; 159var templateLength = options.CreateCookieHeader(key, string.Empty).ToString().Length; 166if (!ChunkSize.HasValue || ChunkSize.Value > templateLength + value.Length) 191var cookieChunkCount = (int)Math.Ceiling(value.Length * 1.0 / dataSizePerCookie); 205var remainingLength = value.Length - offset;
src\aspnetcore\src\Shared\ResultsHelpers\SharedUrlHelper.cs (3)
48if (url.Length == 1) 63if (url[0] == '~' && url.Length > 1 && url[1] == '/') 66if (url.Length == 2)
Microsoft.AspNetCore.Authentication.JwtBearer (1)
JwtBearerHandler.cs (1)
86token = authorization.Substring("Bearer ".Length).Trim();
Microsoft.AspNetCore.Authentication.Negotiate (6)
Internal\LdapAdapter.cs (5)
94var groupCN = DistinguishedNameSeparatorRegex.Split(groupDN)[0].Substring("CN=".Length); 106var entrySize = user.Length * 2; //Approximate the size of stored key in memory cache. 110entrySize += claim.Length * 2; //Approximate the size of stored value in memory cache. 158var nestedGroupCN = DistinguishedNameSeparatorRegex.Split(nestedGroupDN)[0].Substring("CN=".Length); 179var sb = new StringBuilder(value.Length);
NegotiateHandler.cs (1)
114token = authorization.Substring(AuthHeaderPrefix.Length).Trim();
Microsoft.AspNetCore.Authentication.OpenIdConnect (3)
OpenIdConnectHandler.cs (3)
1197var nonceDecodedValue = Options.StringDataFormat.Unprotect(nonceKey.Substring(Options.NonceCookie.Name.Length, nonceKey.Length - Options.NonceCookie.Name.Length));
Microsoft.AspNetCore.Components (51)
NavigationManager.cs (9)
330return uri.Substring(_baseUri.OriginalString.Length); 335if (_baseUri.OriginalString.EndsWith('/') && uriPathOnly.Equals(_baseUri.OriginalString.AsSpan(0, _baseUri.OriginalString.Length - 1), StringComparison.Ordinal)) 343return uri.Substring(_baseUri.OriginalString.Length - 1); 356return uri[_baseUri.OriginalString.Length..]; 361if (_baseUri.OriginalString.EndsWith('/') && MemoryExtensions.Equals(uriPathOnly, _baseUri.OriginalString.AsSpan(0, _baseUri.OriginalString.Length - 1), StringComparison.Ordinal)) 369return uri[(_baseUri.OriginalString.Length - 1)..]; 621length = baseUri.OriginalString.Length; 627if (baseUri.OriginalString.EndsWith('/') && uriPathOnly.Equals(baseUri.OriginalString.AsSpan(0, baseUri.OriginalString.Length - 1), StringComparison.Ordinal)) 635length = baseUri.OriginalString.Length - 1;
NavigationManagerExtensions.cs (4)
753uri.Length - queryStartIndex : 796var uriWithoutHashLength = existingHashIndex < 0 ? uri.Length : existingHashIndex; 809var totalLength = uriWithoutHashLength + (fragmentStartsWithSymbol ? fragment.Length : fragment.Length + 1);
Rendering\SimplifiedStringHashComparer.cs (1)
27var keyLength = key.Length;
RenderTree\RenderTreeDiffBuilder.cs (1)
1018newFrame.AttributeNameField.Length >= 3 &&
Routing\RouteContext.cs (3)
23using var uriBuffer = path.Length < 128 ? 24new UriBuffer(stackalloc byte[path.Length]) : 25new UriBuffer(path.Length);
src\aspnetcore\src\Components\Shared\src\QueryParameterValueSupplier.cs (1)
67return url.AsMemory(queryStartPos..(queryEndPos < 0 ? url.Length : queryEndPos));
src\aspnetcore\src\Http\Routing\src\Constraints\LengthRouteConstraint.cs (1)
106var length = valueString.Length;
src\aspnetcore\src\Http\Routing\src\Constraints\MaxLengthRouteConstraint.cs (1)
70return valueString.Length <= MaxLength;
src\aspnetcore\src\Http\Routing\src\Constraints\MinLengthRouteConstraint.cs (1)
70return valueString.Length >= MinLength;
src\aspnetcore\src\Http\Routing\src\ParameterPolicyActivator.cs (1)
84inlineParameterPolicy.Length - indexOfFirstOpenParens - 2);
src\aspnetcore\src\Http\Routing\src\PathTokenizer.cs (9)
35if (_path.Length == 0) 43if (_path.Length == 1) 56_count = _path.AsSpan(0, _path.Length - 1).Count('/'); 89Debug.Assert(_path[_path.Length - 1] != '/'); 92return new StringSegment(_path, currentSegmentStart, _path.Length - currentSegmentStart); 148if (_path == null || _path.Length <= 1) 164if (_index >= _path.Length) 178if (_path[_path.Length - 1] == '/') 185_length = _path.Length - _index;
src\aspnetcore\src\Http\Routing\src\Patterns\RouteParameterParser.cs (5)
20if (parameter.Length == 0) 26var endIndex = parameter.Length - 1; 204if (constraintText.Length > 0) 211if (constraintText.Length > 0) 223if (constraintText.Length > 0)
src\aspnetcore\src\Http\Routing\src\Patterns\RoutePatternDebugStringFormatter.cs (4)
16if (pattern.RawText is { Length: > 0 } rawText && !HasMatchingRequiredValues(pattern)) 33if (pattern.RawText is { Length: > 0 } rt && rt[0] == Separator) 39if (result.Length == 0) 94requiredValue.ToString() is { Length: > 0 } v)
src\aspnetcore\src\Http\Routing\src\Patterns\RoutePatternMatcher.cs (5)
253if (captured.Length > 0) 404if (part is RoutePatternLiteralPart literal && ((indexOfLiteral + literal.Content.Length) != requestSegment.Length)) 408else if (part is RoutePatternSeparatorPart separator && ((indexOfLiteral + separator.Content.Length) != requestSegment.Length)) 451parameterStartIndex = newLastIndex + literal.Content.Length; 456parameterStartIndex = newLastIndex + separator.Content.Length;
src\aspnetcore\src\Http\Routing\src\Patterns\RoutePatternParser.cs (5)
209var inside = text.Substring(1, text.Length - 2); 428if (parameterName.Length == 0 || parameterName.ContainsAny(InvalidParameterNameChars)) 493get { return (_index < _template.Length && _index >= 0) ? _template[_index] : (char)0; } 516return _index >= _template.Length; 521return ++_index < _template.Length;
Microsoft.AspNetCore.Components.AI (6)
Pipeline\RichTextContentHandler.cs (4)
24return state.Id.Length > 0 29if (state.Id.Length > 0 && 30context.Update.MessageId is { Length: > 0 } messageId && 46if (state.Id.Length == 0)
Pipeline\TextBlockHandler.cs (2)
51if (rawText.Length == 0) 59while (start < rawText.Length)
Microsoft.AspNetCore.Components.AI.SourceGenerators (1)
ToolBlockEmitter.cs (1)
241var sb = new StringBuilder(value.Length);
Microsoft.AspNetCore.Components.Endpoints (21)
Discovery\ComponentInfo.cs (6)
56var size = (nameof(InteractiveServerRenderMode).Length - "RenderModeComparer".Length); 61var size = (nameof(InteractiveWebAssemblyRenderMode).Length - "RenderModeComparer".Length); 66var size = (nameof(InteractiveAutoRenderMode).Length - "RenderModeComparer".Length);
FormMapping\HttpContextFormValueMapper.cs (4)
57&& incomingScopeQualifiedFormName.Length >= currentMappingScopeName.Length + 2 58&& incomingScopeQualifiedFormName[currentMappingScopeName.Length + 1] == ']') 60incomingFormName = incomingScopeQualifiedFormNameSpan[(currentMappingScopeName.Length + 2)..];
Forms\ClientValidationCache.cs (1)
149if (name.Length > 0)
Rendering\CacheViewTextWriter.cs (1)
146contentSize += entry.Markup?.Length ?? 0;
Rendering\EndpointHtmlRenderer.Streaming.cs (2)
432Environment.GetEnvironmentVariable("DOTNET_MODIFIABLE_ASSEMBLIES") is { Length: > 0 } v1 ? v1 : null; 435Environment.GetEnvironmentVariable("__ASPNETCORE_BROWSER_TOOLS") is { Length: > 0 } v2 ? v2 : null;
src\aspnetcore\src\Shared\ChunkingCookieManager\ChunkingCookieManager.cs (6)
75if (int.TryParse(value.AsSpan(ChunkCountPrefix.Length), NumberStyles.None, CultureInfo.InvariantCulture, out var chunksCount)) 111totalSize += chunks[i].Length; 159var templateLength = options.CreateCookieHeader(key, string.Empty).ToString().Length; 166if (!ChunkSize.HasValue || ChunkSize.Value > templateLength + value.Length) 191var cookieChunkCount = (int)Math.Ceiling(value.Length * 1.0 / dataSizePerCookie); 205var remainingLength = value.Length - offset;
TempData\CookieTempDataProvider.cs (1)
61var maxDecodedSize = Base64Url.GetMaxDecodedLength(serializedDataFromCookie.Length);
Microsoft.AspNetCore.Components.QuickGrid (4)
Columns\GridSort.cs (3)
159var length = body.Member.Name.Length; 165length += parentMember.Member.Name.Length + 1; 184nextPos -= body.Member.Name.Length;
src\aspnetcore\src\Components\Shared\src\QueryParameterValueSupplier.cs (1)
67return url.AsMemory(queryStartPos..(queryEndPos < 0 ? url.Length : queryEndPos));
Microsoft.AspNetCore.Components.Server (4)
Circuits\RemoteScrollToLocationHash.cs (1)
40if (hashIndex > -1 && locationAbsolute.Length > hashIndex + 1)
src\aspnetcore\src\Components\Shared\src\RenderBatchWriter.cs (1)
307_binaryWriter.Write(stringValue.Length);
src\aspnetcore\src\submodules\MessagePack-CSharp\src\MessagePack.UnityClient\Assets\Scripts\MessagePack\MessagePackWriter.cs (2)
927ref byte buffer = ref this.WriteString_PrepareSpan(value.Length, out int bufferSize, out int useOffset); 931int byteCount = StringEncoding.UTF8.GetBytes(pValue, value.Length, pBuffer + useOffset, bufferSize);
Microsoft.AspNetCore.Components.Web (3)
Forms\FieldIdGenerator.cs (1)
44var result = new StringBuilder(fieldName.Length);
Routing\NavLink.cs (2)
254var prefixLength = prefix.Length; 255if (value.Length > prefixLength)
Microsoft.AspNetCore.Components.WebAssembly (5)
Services\WebAssemblyConsoleLogger.cs (3)
16private static readonly string _messagePadding = new(' ', GetLogLevelString(LogLevel.Information).Length + _loglevelPadding.Length); 124logBuilder.Replace(Environment.NewLine, _newLineWithMessagePadding, len, message.Length);
Services\WebAssemblyScrollToLocationHash.cs (1)
16if (hashIndex > -1 && locationAbsolute.Length > hashIndex + 1)
src\aspnetcore\src\Components\Shared\src\RenderBatchWriter.cs (1)
307_binaryWriter.Write(stringValue.Length);
Microsoft.AspNetCore.Components.WebAssembly.Server (1)
ComponentsWebAssemblyApplicationBuilderExtensions.cs (1)
26=> Environment.GetEnvironmentVariable(name) is { Length: > 0 } value ? value : null;
Microsoft.AspNetCore.Components.WebView (3)
IpcCommon.cs (1)
43var messageAfterPrefix = message.AsSpan(_ipcMessagePrefix.Length);
Services\WebViewScrollToLocationHash.cs (1)
34if (hashIndex > -1 && locationAbsolute.Length > hashIndex + 1)
src\aspnetcore\src\Components\Shared\src\RenderBatchWriter.cs (1)
307_binaryWriter.Write(stringValue.Length);
Microsoft.AspNetCore.Cryptography.Internal (1)
SafeHandles\BCryptAlgorithmHandle.cs (1)
163SetProperty(Constants.BCRYPT_CHAINING_MODE, pszChainingMode, checked((uint)(chainingMode.Length + 1 /* null terminator */) * sizeof(char)));
Microsoft.AspNetCore.Cryptography.KeyDerivation (5)
PBKDF2\Win7Pbkdf2Provider.cs (2)
30int cbPasswordBuffer = Encoding.UTF8.GetMaxByteCount(password.Length); 52cbPasswordBufferUsed = Encoding.UTF8.GetBytes(pszPassword, password.Length, pbPasswordBuffer, cbPasswordBuffer);
PBKDF2\Win8Pbkdf2Provider.cs (3)
53uint numChars = (uint)input.Length + 1U; // no overflow check necessary since Length is signed 64int cbPasswordBuffer = Encoding.UTF8.GetMaxByteCount(password.Length); 86cbPasswordBufferUsed = Encoding.UTF8.GetBytes(pszPassword, password.Length, pbPasswordBuffer, cbPasswordBuffer);
Microsoft.AspNetCore.DataProtection (4)
Internal\ContainerUtils.cs (2)
49if (line == null || line.Length == 0 || line[0] == '#') 58|| fields[1].Length <= 1 // fs_file empty or is the root directory '/'
KeyManagement\KeyRingBasedDataProtector.cs (1)
408index += EncodingUtil.SecureUtf8Encoding.GetBytes(purpose, charIndex: 0, charCount: purpose.Length, bytes: targetArr, byteIndex: index);
TypeForwardingActivator.cs (1)
84var versionEndIndex = forwardedTypeName.IndexOf(',', versionStartIndex + ", Version=".Length);
Microsoft.AspNetCore.DataProtection.Abstractions (6)
src\aspnetcore\src\Shared\WebEncoders\WebEncoders.cs (6)
49return Base64UrlDecode(input, offset: 0, count: input.Length); 67ValidateParameters(input.Length, nameof(input), offset, count); 88if (offset == 0 && count == input.Length) 124ValidateParameters(input.Length, nameof(input), offset, count); 145if (offset == 0 && count == input.Length) 232input.Length));
Microsoft.AspNetCore.DeveloperCertificates.XPlat (2)
src\aspnetcore\src\Shared\CertificateGeneration\CertificateManager.cs (1)
236if ((byteArray.Length == AspNetHttpsOidFriendlyName.Length && byteArray[0] == (byte)'A') || byteArray.Length == 0)
src\aspnetcore\src\Shared\CertificateGeneration\UnixCertificateManager.cs (1)
361? Path.Combine("$HOME", certDir[homeDirectoryWithSlash.Length..])
Microsoft.AspNetCore.Diagnostics (4)
src\aspnetcore\src\Shared\HttpExtensions.cs (2)
27if (contentType.Length < MultipartFormContentType.Length)
src\aspnetcore\src\Shared\TypeNameHelper\TypeNameHelper.cs (2)
88builder.Replace(DefaultNestedTypeDelimiter, options.NestedTypeDelimiter, builder.Length - name.Length, name.Length);
Microsoft.AspNetCore.Diagnostics.Middleware (1)
Generated\Basic.CompilerLog.Util\Basic.CompilerLog.Util.Impl.BasicGeneratedFilesAnalyzerReference\Validators.g.cs (1)
312if (value is null or string { Length: 0 })
Microsoft.AspNetCore.Diagnostics.Middleware.PerformanceTests (1)
RedactionBenchmark.cs (1)
44while (startIndex < httpRoute.Length)
Microsoft.AspNetCore.Grpc.JsonTranscoding (29)
Internal\GrpcProtocolHelpers.cs (1)
11switch (base64.Length % 4)
Internal\Json\EnumNameHelpers.cs (6)
112while (prefixIndex < normalizedPrefix.Length && valueIndex < value.Length) 129if (prefixIndex < normalizedPrefix.Length) 134while (valueIndex < value.Length && value[valueIndex] == '_') 139return valueIndex == value.Length ? value : value.Substring(valueIndex); 147return result.Length > 0 && char.IsDigit(result[0])
Internal\JsonRequestHelpers.cs (3)
459return bodyFieldName.Length + 1 < variable.Length && 461variable[bodyFieldName.Length] == '.';
Internal\JsonTranscodingRouteAdapter.cs (2)
122var constraint = suffix.Length > 0 ? $":regex({Regex.Escape(suffix)}$)" : string.Empty; 158finalValue = finalValue[..^catchAllSuffix.Length];
src\aspnetcore\src\Grpc\JsonTranscoding\src\Shared\HttpRoutePatternParser.cs (3)
50if (_tokenStart < _input.Length) 299if (_tokenEnd < _input.Length) 310private char? CurrentChar => _tokenStart < _tokenEnd && _tokenEnd <= _input.Length ? _input[_tokenEnd - 1] : null;
src\aspnetcore\src\Grpc\JsonTranscoding\src\Shared\Legacy.cs (9)
88nanosToAdd = parsedFraction * SubsecondScalingFactors[subseconds.Length]; 188if (secondsText[0] == '0' && secondsText.Length > 1) 203nanos = parsedFraction * SubsecondScalingFactors[subseconds.Length] * multiplier; 275var builder = new StringBuilder(text.Length * 2); 281for (int i = 0; i < text.Length; i++) 297(i + 1 < text.Length && // case 3 out 324var result = new StringBuilder(name.Length); 351for (var i = 0; i < input.Length; i++) 358if (c == '_' && i < input.Length - 1)
src\aspnetcore\src\Grpc\JsonTranscoding\src\Shared\ServiceDescriptorHelpers.cs (3)
617for (var i = 0; i < input.Length; i++) 661if (input.Length > 0 && input[input.Length - 1] == '#')
src\aspnetcore\src\Grpc\JsonTranscoding\src\Shared\X509CertificateHelpers.cs (2)
154int separatorFirstChar = delimiterIndex + subjectName1.Length + 1; 156for (var i = separatorFirstChar + 1; i < x509ExtensionFormattedString.Length; i++)
Microsoft.AspNetCore.HeaderParsing (2)
Generated\Basic.CompilerLog.Util\Basic.CompilerLog.Util.Impl.BasicGeneratedFilesAnalyzerReference\Validators.g.cs (1)
125if (value is null or string { Length: 0 })
Parsers\IPAddressListParser.cs (1)
28var length = (nextSeparatorIndex >= 0 ? nextSeparatorIndex : value.Length) - startIndex;
Microsoft.AspNetCore.HostFiltering (1)
HostFilteringMiddleware.cs (1)
86if (host.Length == 0)
Microsoft.AspNetCore.Hosting (5)
Internal\HostingRequestStartingLog.cs (1)
69=> potentialValue?.Length > 0 ? potentialValue.Replace(' ', '+') : EmptyEntry;
src\aspnetcore\src\Shared\HttpExtensions.cs (2)
27if (contentType.Length < MultipartFormContentType.Length)
src\aspnetcore\src\Shared\TypeNameHelper\TypeNameHelper.cs (2)
88builder.Replace(DefaultNestedTypeDelimiter, options.NestedTypeDelimiter, builder.Length - name.Length, name.Length);
Microsoft.AspNetCore.Http (14)
BindingAddress.cs (12)
103var unixPipeHostPrefixLength = UnixPipeHostPrefix.Length; 112private static string GetNamedPipeName(string host) => host.Substring(NamedPipeHostPrefix.Length); 162var schemeDelimiterEnd = schemeDelimiterStart + Uri.SchemeDelimiter.Length; 171var unixPipeHostPrefixLength = UnixPipeHostPrefix.Length; 176if (schemeDelimiterEnd + unixPipeHostPrefixLength > address.Length) 183pathDelimiterEnd = pathDelimiterStart + ":".Length; 187pathDelimiterStart = address.IndexOf(':', schemeDelimiterEnd + NamedPipeHostPrefix.Length); 188pathDelimiterEnd = pathDelimiterStart + ":".Length; 198pathDelimiterStart = pathDelimiterEnd = address.Length; 211var portDelimiterEnd = portDelimiterStart + ":".Length; 252if (address[address.Length - 1] == '/') 254pathBase = address.Substring(pathDelimiterEnd, address.Length - pathDelimiterEnd - 1);
Features\QueryFeature.cs (1)
99if (string.IsNullOrEmpty(queryString) || (queryString.Length == 1 && queryString[0] == '?'))
src\aspnetcore\src\Http\Shared\CookieHeaderParserShared.cs (1)
33while (!string.IsNullOrEmpty(value) && index < value.Length)
Microsoft.AspNetCore.Http.Abstractions (29)
HostString.cs (2)
58&& index < host.Length - 1 172&& index < uriComponent.Length - 1
Internal\HeaderSegmentCollection.cs (1)
174_headerLength = _header.Length;
Internal\ParsingHelpers.cs (4)
69(value[0] != '"' || value[value.Length - 1] != '"')) 79(value.Length > 1 && value[0] == '"' && value[value.Length - 1] == '"')) 81value = value.Substring(1, value.Length - 2);
PathString.cs (22)
100while ((uint)i < (uint)value.Length) 108buffer ??= new StringBuilder(value.Length * 3); 129count += value.Length - i; 142buffer ??= new StringBuilder(value.Length * 3); 155if (count == value.Length && !requiresEscaping) 190Span<char> pathBuffer = uriComponent.Length <= StackAllocThreshold ? stackalloc char[StackAllocThreshold] : new char[uriComponent.Length]; 192var length = UrlDecoder.DecodeInPlace(pathBuffer.Slice(position, uriComponent.Length - position)); 206Span<char> pathBuffer = uriComponent.Length < StackAllocThreshold ? stackalloc char[StackAllocThreshold] : new char[uriComponent.Length + 1]; 254return value1.Length == value2.Length || value1[value2.Length] is '/' or '\\'; 305if (value1.Length == value2.Length || value1[value2.Length] is '/' or '\\') 307remaining = new PathString(value1[value2.Length..]); 363if (value1.Length == value2.Length || value1[value2.Length] is '/' or '\\') 365matched = new PathString(value1.Substring(0, value2.Length)); 366remaining = new PathString(value1[value2.Length..]);
Microsoft.AspNetCore.Http.Connections (6)
src\aspnetcore\src\Shared\WebEncoders\WebEncoders.cs (6)
49return Base64UrlDecode(input, offset: 0, count: input.Length); 67ValidateParameters(input.Length, nameof(input), offset, count); 88if (offset == 0 && count == input.Length) 124ValidateParameters(input.Length, nameof(input), offset, count); 145if (offset == 0 && count == input.Length) 232input.Length));
Microsoft.AspNetCore.Http.Connections.Client (1)
Internal\Utils.cs (1)
63if (newQueryString.Length > 0 && newQueryString[0] == '?')
Microsoft.AspNetCore.Http.Extensions (17)
src\aspnetcore\src\Shared\TypeNameHelper\TypeNameHelper.cs (2)
88builder.Replace(DefaultNestedTypeDelimiter, options.NestedTypeDelimiter, builder.Length - name.Length, name.Length);
src\aspnetcore\src\Shared\ValueStringBuilder\ValueStringBuilder.cs (5)
155int count = s.Length; 192if (s.Length == 1 && (uint)pos < (uint)_chars.Length) // very common case, e.g. appending strings from NumberFormatInfo like separators, percent symbols, etc. 206if (pos > _chars.Length - s.Length) 208Grow(s.Length); 212_pos += s.Length;
UriHelper.cs (10)
68scheme.Length + 69Uri.SchemeDelimiter.Length + 70hostText.Length + 71pathBaseText.Length + 72pathText.Length + 73queryText.Length + 74fragmentText.Length; 127startIndex += SchemeDelimiter.Length; 130var limit = uri.Length; 234if (uriParts.path.Length > 0 && pathBaseSpan.Length > 0 && pathBaseSpan[^1] == '/')
Microsoft.AspNetCore.Http.RequestDelegateGenerator (4)
StaticRouteHandlerModel\EndpointParameter.cs (4)
543while (index < s.Length) 552if (index >= s.Length) 557var sb = new StringBuilder(s.Length); 560while (index < s.Length)
Microsoft.AspNetCore.Http.Results (3)
src\aspnetcore\src\Shared\ResultsHelpers\SharedUrlHelper.cs (3)
48if (url.Length == 1) 63if (url[0] == '~' && url.Length > 1 && url[1] == '/') 66if (url.Length == 2)
Microsoft.AspNetCore.HttpLogging (6)
src\aspnetcore\src\Shared\ValueStringBuilder\ValueStringBuilder.cs (5)
155int count = s.Length; 192if (s.Length == 1 && (uint)pos < (uint)_chars.Length) // very common case, e.g. appending strings from NumberFormatInfo like separators, percent symbols, etc. 206if (pos > _chars.Length - s.Length) 208Grow(s.Length); 212_pos += s.Length;
W3CLoggingMiddleware.cs (1)
239var len = entry.Length;
Microsoft.AspNetCore.HttpOverrides (2)
ForwardedHeadersMiddleware.cs (2)
466return (hostEndIdx + 2 == hostText.Length) || TryValidateHostPort(hostText, hostEndIdx + 2); 472if (hostText[offset] != ':' || hostText.Length == offset + 1)
Microsoft.AspNetCore.Identity.UI (4)
Areas\Identity\Pages\V4\Account\Manage\EnableAuthenticator.cshtml.cs (2)
181while (currentPosition + 4 < unformattedKey.Length) 186if (currentPosition < unformattedKey.Length)
Areas\Identity\Pages\V5\Account\Manage\EnableAuthenticator.cshtml.cs (2)
181while (currentPosition + 4 < unformattedKey.Length) 186if (currentPosition < unformattedKey.Length)
Microsoft.AspNetCore.InternalTesting (11)
AssemblyTestLog.cs (7)
114className = className.Substring(assemblyName.Length + 1); 123if (logOutputDirectory.Length + testName.Length + LogFileExtension.Length >= MaxPathLength) 128var testNameLength = MaxPathLength - logOutputDirectory.Length - LogFileExtension.Length; 135testName = string.Concat(testName.AsSpan(0, testNameLength / 2).ToString(), testName.AsSpan(testName.Length - testNameLength / 2, testNameLength / 2).ToString());
Logging\XunitLoggerProvider.cs (3)
80var additionalLinePrefix = "|" + new string(' ', firstLinePrefix.Length - 1); 100message = message.Substring(0, message.Length - Environment.NewLine.Length);
TestFileOutputContext.cs (1)
111name = name.Substring(assemblyName.Length + 1);
Microsoft.AspNetCore.JsonPatch (3)
Internal\ParsedPath.cs (3)
45var sb = new StringBuilder(path.Length); 47for (var i = 0; i < path.Length; i++) 60if (i >= path.Length)
Microsoft.AspNetCore.JsonPatch.SystemTextJson (3)
Internal\ParsedPath.cs (3)
40var sb = new StringBuilder(path.Length); 42for (var i = 0; i < path.Length; i++) 55if (i >= path.Length)
Microsoft.AspNetCore.Localization (2)
CookieRequestCultureProvider.cs (2)
88var cultureName = potentialCultureName.Slice(_culturePrefix.Length); 89var uiCultureName = potentialUICultureName.Slice(_uiCulturePrefix.Length);
Microsoft.AspNetCore.Mvc.Abstractions (11)
ModelBinding\ModelStateDictionary.cs (9)
530if (key.Length > 0) 561if (key.Length > 0) 595for (; index < key.Length; index++) 770if (prefix.Length == 0) 776if (prefix.Length > key.Length) 786if (key.Length == prefix.Length) 792var charAfterPrefix = key[prefix.Length];
src\aspnetcore\src\Shared\TypeNameHelper\TypeNameHelper.cs (2)
88builder.Replace(DefaultNestedTypeDelimiter, options.NestedTypeDelimiter, builder.Length - name.Length, name.Length);
Microsoft.AspNetCore.Mvc.Core (77)
ApiExplorer\ApiConventionMatcher.cs (12)
107if (name.Length < conventionName.Length) 112if (name.Length == conventionName.Length) 126return char.IsUpper(name[conventionName.Length]); 136if (name.Length < conventionName.Length) 142if (name.Length == conventionName.Length) 149var index = name.Length - conventionName.Length - 1; 165return string.Compare(name, index, conventionName, 1, conventionName.Length - 1, StringComparison.Ordinal) == 0;
ApplicationModels\AttributeRouteModel.cs (4)
232if (startIndex == result.Length) 237var subStringLength = result.Length - startIndex; 273for (var i = 0; i <= template.Length; i++) 275var c = i < template.Length ? (char?)template[i] : null;
ApplicationModels\DefaultApplicationModelProvider.cs (4)
166typeInfo.Name.Substring(0, typeInfo.Name.Length - "Controller".Length) : 395actionName = actionName.Substring(0, actionName.Length - Suffix.Length);
Formatters\AcceptHeaderParser.cs (8)
28while (!string.IsNullOrEmpty(value) && charIndex < value.Length) 59if (string.IsNullOrEmpty(value) || (index == value.Length)) 66if (currentIndex == value.Length) 96index = value.Length; 108if (!separatorFound && (currentIndex < value.Length)) 125Debug.Assert(startIndex <= input.Length); // it's OK if index == value.Length. 130if ((current == input.Length) || (input[current] != ',')) 141while ((current < input.Length) && (input[current] == ','))
Formatters\MediaType.cs (8)
27: this(mediaType, 0, mediaType.Length) 50if (offset < 0 || offset >= mediaType.Length) 57if (length < 0 || length > mediaType.Length) 62if (offset > mediaType.Length - length) 223var finalLength = charsetOffset + encoding.WebName.Length + restLength; 343if (OffsetIsOutOfRange(startIndex, input.Length) || input[startIndex] != ';') 353if (nameLength == 0 || OffsetIsOutOfRange(current, input.Length) || input[current] != '=') 355if (current == input.Length && name.Equals("*", StringComparison.OrdinalIgnoreCase))
ModelBinding\FormValueProvider.cs (1)
85if (key.Length == 0)
ModelBinding\JQueryKeyValuePairNormalizer.cs (2)
56while (position < key.Length) 61builder.Append(key, position, key.Length - position);
ModelBinding\ModelBindingHelper.cs (1)
405if (kvp.Key.Length > 0 && kvp.Key[0] == '[')
ModelBinding\ModelNames.cs (1)
34return (parentName.Length == 0) ? "[" + index + "]" : parentName + "[" + index + "]";
ModelBinding\PrefixContainer.cs (14)
56if (prefix.Length == 0) 83if (entry.Length == prefix.Length) 89if (prefix.Length == 0) 139var keyPosition = prefix.Length + 1; 141switch (entry[prefix.Length]) 198prefix.Length, 206if (candidate.Length == prefix.Length) 212var c = candidate[prefix.Length]; 255prefix.Length, 263if (candidate.Length == prefix.Length) 269var c = candidate[prefix.Length];
ModelBinding\QueryStringValueProvider.cs (1)
78if (key.Length == 0)
ModelBinding\RouteValueProvider.cs (1)
81if (key.Length == 0)
Routing\UrlHelperBase.cs (4)
321Debug.Assert(pageName.Length > 0); 363if (virtualPath.Length == 0) 379if (virtualPath.Length == 0) 422if (virtualPath.Length == 0)
Routing\ViewEnginePath.cs (1)
33if (index == first.Length - 1)
src\aspnetcore\src\Shared\ChunkingCookieManager\ChunkingCookieManager.cs (6)
75if (int.TryParse(value.AsSpan(ChunkCountPrefix.Length), NumberStyles.None, CultureInfo.InvariantCulture, out var chunksCount)) 111totalSize += chunks[i].Length; 159var templateLength = options.CreateCookieHeader(key, string.Empty).ToString().Length; 166if (!ChunkSize.HasValue || ChunkSize.Value > templateLength + value.Length) 191var cookieChunkCount = (int)Math.Ceiling(value.Length * 1.0 / dataSizePerCookie); 205var remainingLength = value.Length - offset;
src\aspnetcore\src\Shared\MediaType\ReadOnlyMediaTypeHeaderValue.cs (6)
20: this(mediaType, 0, mediaType.Length) 91if (offset < 0 || offset >= input.Length) 120if (current < 0 || current >= input.Length || input[current] != '/') 495if (OffsetIsOutOfRange(startIndex, input.Length) || input[startIndex] != ';') 505if (nameLength == 0 || OffsetIsOutOfRange(current, input.Length) || input[current] != '=') 507if (current == input.Length && name.Equals("*", StringComparison.OrdinalIgnoreCase))
src\aspnetcore\src\Shared\ResultsHelpers\SharedUrlHelper.cs (3)
48if (url.Length == 1) 63if (url[0] == '~' && url.Length > 1 && url[1] == '/') 66if (url.Length == 2)
Microsoft.AspNetCore.Mvc.Localization (3)
ViewLocalizer.cs (3)
99var length = path.Length - startIndex - extension.Length; 100var capacity = length + _applicationName.Length + 1;
Microsoft.AspNetCore.Mvc.NewtonsoftJson (6)
NewtonsoftJsonInputFormatter.cs (6)
276if (path.Length == member!.Length) 281else if (path.Length > member.Length) 367while (index >= 0 && index < path.Length) 392endIndex = path.Length;
Microsoft.AspNetCore.Mvc.Razor (10)
Compilation\DefaultViewCompiler.cs (1)
121if (relativePath.Length == 0)
Infrastructure\DefaultFileVersionProvider.cs (2)
67var requestPathBaseRelativePath = resolvedPath.Substring(requestPathBase.Value.Length); 82cacheEntryOptions.SetSize(value.Length * sizeof(char));
RazorFileHierarchy.cs (2)
21if (path.Length == 1) 28var index = path.Length;
RazorPageBase.cs (1)
748BeginContext(position, value.Length, isLiteral: true);
TagHelpers\UrlResolutionTagHelper.cs (3)
271appRelativeUrl.Length - postTildeSlashUrlValue.Length, 327var keyEnd = lastNonWhitespaceChar > -1 ? lastNonWhitespaceChar + 1 : value.Length;
ViewPath.cs (1)
18var length = path.Length;
Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation (21)
ChecksumValidator.cs (1)
121if (bytes.Length * 2 != checksum.Length)
FileProviderRazorProjectItem.cs (5)
82PhysicalPath.Length > _root.Length && 83(PhysicalPath[_root.Length] == Path.DirectorySeparatorChar || PhysicalPath[_root.Length] == Path.AltDirectorySeparatorChar)) 85_relativePhysicalPath = PhysicalPath.Substring(_root.Length + 1); // Include leading separator
RuntimeViewCompiler.cs (1)
384if (relativePath.Length == 0)
src\aspnetcore\src\Mvc\Mvc.Razor\src\ViewPath.cs (1)
18var length = path.Length;
src\aspnetcore\src\Mvc\Mvc.RazorPages\src\ApplicationModels\PageRouteModelFactory.cs (13)
93areaRootEndIndex >= relativePath.Length - 1 || // There's at least one token after the area root. 102if (areaEndIndex == -1 || areaEndIndex == relativePath.Length) 110if (string.Compare(relativePath, areaEndIndex, AreaPagesRoot, 0, AreaPagesRoot.Length, StringComparison.OrdinalIgnoreCase) != 0) 117var pageNameIndex = areaEndIndex + AreaPagesRoot.Length - 1; 118var viewEnginePath = relativePath.Substring(pageNameIndex, relativePath.Length - pageNameIndex - RazorViewEngine.ViewExtension.Length); 131var startIndex = rootDirectory.Length - 1; 132var endIndex = path.Length - RazorViewEngine.ViewExtension.Length; 144return string.Create(1 + areaName.Length + viewEnginePath.Length, (areaName, viewEnginePath), (span, tuple) => 152span = span.Slice(areaNameValue.Length); 176if (directory.Length > 1 && !directory.EndsWith('/'))
Microsoft.AspNetCore.Mvc.RazorPages (22)
ApplicationModels\DefaultPageApplicationModelPartsProvider.cs (5)
217if (!methodName.StartsWith("On", StringComparison.Ordinal) || methodName.Length <= "On".Length) 232var start = "On".Length; 233var length = methodName.Length; 236length -= "Async".Length;
ApplicationModels\PageConventionCollection.cs (3)
398return viewEnginePath.Length > folderPath.Length && 400viewEnginePath[folderPath.Length] == '/';
ApplicationModels\PageRouteModelFactory.cs (13)
93areaRootEndIndex >= relativePath.Length - 1 || // There's at least one token after the area root. 102if (areaEndIndex == -1 || areaEndIndex == relativePath.Length) 110if (string.Compare(relativePath, areaEndIndex, AreaPagesRoot, 0, AreaPagesRoot.Length, StringComparison.OrdinalIgnoreCase) != 0) 117var pageNameIndex = areaEndIndex + AreaPagesRoot.Length - 1; 118var viewEnginePath = relativePath.Substring(pageNameIndex, relativePath.Length - pageNameIndex - RazorViewEngine.ViewExtension.Length); 131var startIndex = rootDirectory.Length - 1; 132var endIndex = path.Length - RazorViewEngine.ViewExtension.Length; 144return string.Create(1 + areaName.Length + viewEnginePath.Length, (areaName, viewEnginePath), (span, tuple) => 152span = span.Slice(areaNameValue.Length); 176if (directory.Length > 1 && !directory.EndsWith('/'))
Infrastructure\PageViewLocationExpander.cs (1)
56var end = context.PageName.Length;
Microsoft.AspNetCore.Mvc.TagHelpers (7)
GlobbingUrlBuilder.cs (4)
167sizeInBytes += matchedUrl.Length * sizeof(char); 201var xLength = xExtIndex >= 0 ? xExtIndex : x.Length; 202var yLength = yExtIndex >= 0 ? yExtIndex : y.Length; 218var length = x.Length - xExtIndex;
JavaScriptResources.cs (1)
56return input.Substring(0, input.Length - 2);
ResourceCollectionUtilities.cs (2)
34var length = pathBase.Value.EndsWith('/') ? pathBase.Value.Length : pathBase.Value.Length + 1;
Microsoft.AspNetCore.Mvc.ViewFeatures (11)
Buffers\PagedCharBuffer.cs (1)
55var count = value.Length;
ExpressionHelper.cs (4)
60length += "[99]".Length; 77length += "[99]".Length; 97length += name.Length + 1; 120length -= ".model".Length;
Rendering\TagBuilder.cs (1)
177var stringBuffer = new StringBuilder(name.Length);
ViewComponents\ViewComponentConventions.cs (2)
77return componentType.Name.Substring(0, componentType.Name.Length - ViewComponentSuffix.Length);
ViewDataEvaluator.cs (3)
107if (leftExpression.Length == expression.Length) 115var rightExpression = expression.Substring(leftExpression.Length + 1);
Microsoft.AspNetCore.OpenApi (5)
Services\Schemas\OpenApiSchemaService.cs (3)
465referenceId = referenceId[componentsSchemasReferencePrefix.Length..]; 670var currentPath = refPath.AsSpan().Slice(OpenApiConstants.RefPrefix.Length); 779if (unescapedReferenceToken.StartsWith('0', StringComparison.Ordinal) && unescapedReferenceToken.Length > 1)
src\aspnetcore\src\Shared\TypeNameHelper\TypeNameHelper.cs (2)
88builder.Replace(DefaultNestedTypeDelimiter, options.NestedTypeDelimiter, builder.Length - name.Length, name.Length);
Microsoft.AspNetCore.OpenApi.SourceGenerators (2)
Helpers\StringExtensions.cs (1)
35while (leadingWhitespace < line.Length && char.IsWhiteSpace(line[leadingWhitespace]))
XmlComments\XmlComment.cs (1)
31xml = xml.Substring(5, xml.Length - 11);
Microsoft.AspNetCore.OutputCaching (5)
CacheEntryHelpers.cs (2)
25size += (item.Name.Length * sizeof(char)) + EstimateStringValuesSize(item.Value); 46size += stringValue.Length * sizeof(char);
FormatterBinaryWriter.cs (1)
83if (value.Length == 0)
StringBuilderExtensions.cs (2)
14builder.EnsureCapacity(builder.Length + value.Length); 15for (var i = 0; i < value.Length; i++)
Microsoft.AspNetCore.ResponseCaching (5)
CacheEntry\CacheEntryHelpers.cs (3)
27size += (item.Key.Length * sizeof(char)) + EstimateStringValuesSize(item.Value); 55size = cachedVaryByRules.VaryByKeyPrefix.Length * sizeof(char); 79size += stringValue.Length * sizeof(char);
StringBuilderExtensions.cs (2)
14builder.EnsureCapacity(builder.Length + value.Length); 15for (var i = 0; i < value.Length; i++)
Microsoft.AspNetCore.Rewrite (8)
ApacheModRewrite\CookieActionFactory.cs (1)
32for (; i < flagValue.Length; i++)
ApacheModRewrite\FlagParser.cs (2)
61if (!(flagString[0] == '[' && flagString[flagString.Length - 1] == ']')) 68var tokens = flagString.Substring(1, flagString.Length - 2).Split(',');
ParserContext.cs (3)
21public char Current => (Index < Template.Length && Index >= 0) ? Template[Index] : (char)0; 30return ++Index < Template.Length; 35return (Index + 1) < Template.Length;
RedirectRule.cs (1)
66schemeSplit += Uri.SchemeDelimiter.Length;
UrlNormalizer.cs (1)
18(url[0] == '/' && (url.Length == 1 || (url[1] != '/' && url[1] != '\\'))))
Microsoft.AspNetCore.Routing (60)
Constraints\LengthRouteConstraint.cs (1)
106var length = valueString.Length;
Constraints\MaxLengthRouteConstraint.cs (1)
70return valueString.Length <= MaxLength;
Constraints\MinLengthRouteConstraint.cs (1)
70return valueString.Length >= MinLength;
InlineRouteParameterParser.cs (2)
22if (routeParameter.Length == 0) 33var endIndex = routeParameter.Length - 1;
Matching\ContentEncodingNegotiationMatcherPolicy.cs (2)
82var (matchedEncoding, destination) = negotiationValue?.Length switch 105var (matchedEncoding, quality) = negotiationValue?.Length switch
Matching\HostMatcherPolicy.cs (2)
113MemoryExtensions.EndsWith(requestHost, host.Slice(WildcardHost.Length), StringComparison.OrdinalIgnoreCase) && 422_wildcardEndsWith = HasHostWildcard ? Host.Substring(WildcardHost.Length) : null;
Matching\HttpMethodDestinationsLookup.cs (3)
39if (method.Length >= 3) // 3 == smallest known method 99if (method.Length >= 3) // 3 == smallest known method 108'p' => method.Length switch
Matching\ILEmitTrieFactory.cs (5)
58entries.Any(e => e.text.Length >= 4); 106var groups = entries.GroupBy(e => e.text.Length).ToArray(); 534Debug.Assert(index + 4 <= text.Length); 544Debug.Assert(index + 4 <= text.Length); 552Debug.Assert(index + 1 <= text.Length);
Matching\ILEmitTrieJumpTable.cs (1)
59if (path.Length == 0)
Matching\SingleEntryAsciiJumpTable.cs (1)
39if (length != text.Length)
ParameterPolicyActivator.cs (1)
84inlineParameterPolicy.Length - indexOfFirstOpenParens - 2);
PathTokenizer.cs (9)
35if (_path.Length == 0) 43if (_path.Length == 1) 56_count = _path.AsSpan(0, _path.Length - 1).Count('/'); 89Debug.Assert(_path[_path.Length - 1] != '/'); 92return new StringSegment(_path, currentSegmentStart, _path.Length - currentSegmentStart); 148if (_path == null || _path.Length <= 1) 164if (_index >= _path.Length) 178if (_path[_path.Length - 1] == '/') 185_length = _path.Length - _index;
Patterns\RouteParameterParser.cs (5)
20if (parameter.Length == 0) 26var endIndex = parameter.Length - 1; 204if (constraintText.Length > 0) 211if (constraintText.Length > 0) 223if (constraintText.Length > 0)
Patterns\RoutePatternDebugStringFormatter.cs (4)
16if (pattern.RawText is { Length: > 0 } rawText && !HasMatchingRequiredValues(pattern)) 33if (pattern.RawText is { Length: > 0 } rt && rt[0] == Separator) 39if (result.Length == 0) 94requiredValue.ToString() is { Length: > 0 } v)
Patterns\RoutePatternMatcher.cs (5)
253if (captured.Length > 0) 404if (part is RoutePatternLiteralPart literal && ((indexOfLiteral + literal.Content.Length) != requestSegment.Length)) 408else if (part is RoutePatternSeparatorPart separator && ((indexOfLiteral + separator.Content.Length) != requestSegment.Length)) 451parameterStartIndex = newLastIndex + literal.Content.Length; 456parameterStartIndex = newLastIndex + separator.Content.Length;
Patterns\RoutePatternParser.cs (5)
209var inside = text.Substring(1, text.Length - 2); 428if (parameterName.Length == 0 || parameterName.ContainsAny(InvalidParameterNameChars)) 493get { return (_index < _template.Length && _index >= 0) ? _template[_index] : (char)0; } 516return _index >= _template.Length; 521return ++_index < _template.Length;
src\aspnetcore\src\Shared\HttpExtensions.cs (2)
27if (contentType.Length < MultipartFormContentType.Length)
src\aspnetcore\src\Shared\MediaType\ReadOnlyMediaTypeHeaderValue.cs (6)
20: this(mediaType, 0, mediaType.Length) 91if (offset < 0 || offset >= input.Length) 120if (current < 0 || current >= input.Length || input[current] != '/') 495if (OffsetIsOutOfRange(startIndex, input.Length) || input[startIndex] != ';') 505if (nameLength == 0 || OffsetIsOutOfRange(current, input.Length) || input[current] != '=') 507if (current == input.Length && name.Equals("*", StringComparison.OrdinalIgnoreCase))
Template\TemplateBinder.cs (1)
689if (part is string stringPart && stringPart.Length == 0)
UriBuildingContext.cs (3)
122if (_path.Length == 0 && value.Length > 0 && value[0] == '/') 125EncodeValue(value, 1, value.Length - 1, encodeSlashes); 287EncodeValue(value, start: 0, characterCount: value.Length, encodeSlashes);
Microsoft.AspNetCore.Server.HttpSys (22)
HttpSysOptions.cs (1)
49if (value?.Length > MaximumRequestQueueNameLength)
RequestProcessing\Request.cs (5)
102Path = originalPath[pathBase.Length..]; 107PathBase = originalPath[..pathBase.Length]; 108Path = originalPath[pathBase.Length..]; 117while (originalOffset < originalPath.Length && baseOffset < pathBase.Length)
src\aspnetcore\src\Shared\Buffers.MemoryPool\UnmanagedBufferAllocator.cs (1)
88int maxAlloc = checked(Encoding.UTF8.GetMaxByteCount(myString.Length) + 1);
src\aspnetcore\src\Shared\HttpSys\RequestProcessing\HeaderParser.cs (1)
20for (; current < value!.Length; current++)
src\aspnetcore\src\Shared\HttpSys\RequestProcessing\RequestHeaders.Generated.cs (4)
1048switch (key.Length) 1254switch (key.Length) 1502switch (key.Length) 1749switch (key.Length)
src\aspnetcore\src\Shared\ServerInfrastructure\StringUtilities.cs (2)
122length += str.Length; 136i = tupleStr.Length;
UrlPrefix.cs (3)
23PathWithoutTrailingSlash = Path.Length > 1 ? Path[0..^1] : string.Empty; 113var hostDelimiterStart = schemeDelimiterEnd + Uri.SchemeDelimiter.Length; 118pathDelimiterStart = whole.Length;
UrlPrefixCollection.cs (3)
97&& (!found || remainder.Value!.Length < remainingPath!.Length)) // Longest match 100pathBase = originalPath.Substring(0, prefix.PathWithoutTrailingSlash.Length); // Maintain the input casing
ValidationHelper.cs (2)
29else if (objectValue is string s && s.Length == 0) 53else if (objectValue is string && ((string)objectValue).Length == 0)
Microsoft.AspNetCore.Server.IIS (19)
Core\IISHttpContext.cs (8)
172if (pathBase.Length > 1 && pathBase[^1] == '/') 199else if (originalPath.Length == pathBase.Length + 1 207else if (originalPath.Length == pathBase.Length + 1 212PathBase = originalPath[..pathBase.Length]; 222while (originalOffset < originalPath.Length && baseOffset < pathBase.Length)
src\aspnetcore\src\Shared\Buffers.MemoryPool\UnmanagedBufferAllocator.cs (1)
88int maxAlloc = checked(Encoding.UTF8.GetMaxByteCount(myString.Length) + 1);
src\aspnetcore\src\Shared\HttpSys\RequestProcessing\HeaderParser.cs (1)
20for (; current < value!.Length; current++)
src\aspnetcore\src\Shared\HttpSys\RequestProcessing\RequestHeaders.Generated.cs (4)
1048switch (key.Length) 1254switch (key.Length) 1502switch (key.Length) 1749switch (key.Length)
src\aspnetcore\src\Shared\ServerInfrastructure\BufferExtensions.cs (1)
118var sourceLength = data.Length;
src\aspnetcore\src\Shared\ServerInfrastructure\StringUtilities.cs (2)
122length += str.Length; 136i = tupleStr.Length;
src\aspnetcore\src\Shared\TypeNameHelper\TypeNameHelper.cs (2)
88builder.Replace(DefaultNestedTypeDelimiter, options.NestedTypeDelimiter, builder.Length - name.Length, name.Length);
Microsoft.AspNetCore.Server.Kestrel.Core (93)
Internal\AddressBinder.cs (3)
156if (host.Length > localhostTld.Length && host.EndsWith(localhostTld, StringComparison.OrdinalIgnoreCase)) 159prefix = host[..^localhostTld.Length];
Internal\Http\DateHeaderValueManager.cs (1)
47var dateBytes = new byte[DatePreambleBytes.Length + dateValue.Length];
Internal\Http\Http1Connection.cs (8)
491previousValue == null || previousValue.Length != target.Length || 564previousValue == null || previousValue.Length != queryLength || 610previousValue == null || previousValue.Length != target.Length || 668previousValue == null || previousValue.Length != target.Length || 703Span<byte> pathBuffer = absolutePath.Length <= MaxPathBufferStackAllocSize 705: (rentedBuffer = ArrayPool<byte>.Shared.Rent(absolutePath.Length)); 706var pathBufferSliced = pathBuffer[..absolutePath.Length]; 728previousValue == null || previousValue.Length != query.Length ||
Internal\Http\HttpHeaders.Generated.cs (15)
2592switch (key.Length) 3601switch (key.Length) 4308switch (key.Length) 5415switch (key.Length) 7891if (previousValue.Length == value.Length && 8107if (previousValue.Length == value.Length && 8310if (previousValue.Length == value.Length && 10878switch (key.Length) 11685switch (key.Length) 12266switch (key.Length) 13158switch (key.Length) 17175switch (key.Length) 17254switch (key.Length) 17315switch (key.Length) 17399switch (key.Length)
Internal\Http2\Http2Stream.cs (6)
323if (Method == HttpMethod.Options && path.Length == 1 && path[0] == '*') 332var requestLineLength = _methodText!.Length + Scheme!.Length + hostText.Length + path.Length; 459Path = PathDecoder.DecodePath(pathBuffer, pathEncoded, RawTarget!, QueryString!.Length);
Internal\Http3\Http3Stream.cs (6)
1150if (Method == HttpMethod.Options && path.Length == 1 && path[0] == '*') 1159var requestLineLength = _methodText!.Length + Scheme!.Length + hostText.Length + path.Length; 1286Path = PathDecoder.DecodePath(pathBuffer, pathEncoded, RawTarget!, QueryString!.Length);
Internal\Http3\QPackHeaderWriter.cs (2)
97totalHeaderSize += HeaderField.GetLength(name.Length, value.Length);
Internal\Infrastructure\HttpUtilities.cs (7)
54Debug.Assert(str.Length == 8, "String must be exactly 8 (ASCII) characters long."); 66Debug.Assert(str.Length == 4, "String must be exactly 4 (ASCII) characters long."); 277if ((uint)(value.Length - MinWordLength) <= (MaxWordLength - MinWordLength)) 527for (var i = 1; i < hostText.Length; i++) 537else if (i + 1 < hostText.Length) 559if (firstChar != ':' || offset == hostText.Length) 565for (var i = offset; i < hostText.Length; i++)
Internal\Infrastructure\KestrelEventSource.cs (5)
404Size = (arg1.Length + 1) * sizeof(char) 409Size = (arg2.Length + 1) * sizeof(char) 414Size = (arg3.Length + 1) * sizeof(char) 419Size = (arg4.Length + 1) * sizeof(char) 424Size = (arg5.Length + 1) * sizeof(char)
Internal\SniOptionsSelector.cs (2)
241var lengthResult = y!.Length.CompareTo(x!.Length);
KestrelConfigurationLoader.cs (1)
182if (socketPath.Length == 0 || socketPath[0] != '/')
src\aspnetcore\src\Shared\Buffers.MemoryPool\UnmanagedBufferAllocator.cs (1)
88int maxAlloc = checked(Encoding.UTF8.GetMaxByteCount(myString.Length) + 1);
src\aspnetcore\src\Shared\CertificateGeneration\CertificateManager.cs (1)
236if ((byteArray.Length == AspNetHttpsOidFriendlyName.Length && byteArray[0] == (byte)'A') || byteArray.Length == 0)
src\aspnetcore\src\Shared\CertificateGeneration\UnixCertificateManager.cs (1)
361? Path.Combine("$HOME", certDir[homeDirectoryWithSlash.Length..])
src\aspnetcore\src\Shared\Hpack\DynamicHPackEncoder.cs (2)
93var headerLength = HeaderField.GetLength(name.Length, valueEncoding?.GetByteCount(value) ?? value.Length);
src\aspnetcore\src\Shared\runtime\Http2\Hpack\H2StaticTable.Http2.cs (1)
103value.Length != 0 ? Encoding.ASCII.GetBytes(value) : Array.Empty<byte>());
src\aspnetcore\src\Shared\runtime\Http2\Hpack\HPackEncoder.cs (10)
374if (IntegerEncoder.Encode(value.Length, 7, destination, out int integerLength)) 379if (value.Length <= destination.Length) 383Debug.Assert(valueBytesWritten == value.Length); 385bytesWritten = integerLength + value.Length; 397Debug.Assert(destination.Length >= value.Length); 407Debug.Assert(bytesWritten == value.Length); 465? value.Length 537valueLength = checked(valueLength + part.Length); 559destination = destination.Slice(value.Length); 568destination = destination.Slice(value.Length);
src\aspnetcore\src\Shared\runtime\Http3\QPack\QPackEncoder.cs (18)
104Span<byte> temp = value.Length < 256 ? stackalloc byte[256 + IntegerEncoder.MaxInt32EncodedLength * 2] : new byte[value.Length + IntegerEncoder.MaxInt32EncodedLength * 2]; 164Span<byte> temp = name.Length < 256 ? stackalloc byte[256 + IntegerEncoder.MaxInt32EncodedLength] : new byte[name.Length + IntegerEncoder.MaxInt32EncodedLength]; 174Span<byte> temp = (name.Length + value.Length) < 256 ? stackalloc byte[256 + IntegerEncoder.MaxInt32EncodedLength * 2] : new byte[name.Length + value.Length + IntegerEncoder.MaxInt32EncodedLength * 2]; 189? s.Length 243valueLength += part.Length; 264buffer = buffer.Slice(value.Length); 273buffer = buffer.Slice(value.Length); 303Debug.Assert(buffer.Length >= s.Length); 313Debug.Assert(bytesWritten == s.Length); 324if (IntegerEncoder.Encode(s.Length, 3, buffer, out int nameLength)) 328if (buffer.Length >= s.Length) 332Debug.Assert(valueBytesWritten == s.Length); 334length = nameLength + s.Length;
src\aspnetcore\src\Shared\ServerInfrastructure\BufferExtensions.cs (1)
118var sourceLength = data.Length;
src\aspnetcore\src\Shared\ServerInfrastructure\StringUtilities.cs (2)
122length += str.Length; 136i = tupleStr.Length;
Microsoft.AspNetCore.Server.Kestrel.Transport.NamedPipes (1)
src\aspnetcore\src\Shared\Buffers.MemoryPool\UnmanagedBufferAllocator.cs (1)
88int maxAlloc = checked(Encoding.UTF8.GetMaxByteCount(myString.Length) + 1);
Microsoft.AspNetCore.Server.Kestrel.Transport.Quic (3)
src\aspnetcore\src\Shared\Buffers.MemoryPool\UnmanagedBufferAllocator.cs (1)
88int maxAlloc = checked(Encoding.UTF8.GetMaxByteCount(myString.Length) + 1);
src\aspnetcore\src\Shared\ServerInfrastructure\StringUtilities.cs (2)
122length += str.Length; 136i = tupleStr.Length;
Microsoft.AspNetCore.Session (2)
CookieProtection.cs (1)
59var padding = 3 - ((text.Length + 3) % 4);
SessionMiddleware.cs (1)
66if (string.IsNullOrWhiteSpace(sessionKey) || sessionKey.Length != SessionKeyLength)
Microsoft.AspNetCore.Watch.BrowserRefresh (1)
src\sdk\src\Dotnet.Watch\Web.Middleware\BrowserRefreshMiddleware.cs (1)
36=> Environment.GetEnvironmentVariable(name) is { Length: > 0 } value ? value : null;
Microsoft.AspNetCore.WebSockets (5)
src\aspnetcore\src\Shared\ValueStringBuilder\ValueStringBuilder.cs (5)
155int count = s.Length; 192if (s.Length == 1 && (uint)pos < (uint)_chars.Length) // very common case, e.g. appending strings from NumberFormatInfo like separators, percent symbols, etc. 206if (pos > _chars.Length - s.Length) 208Grow(s.Length); 212_pos += s.Length;
Microsoft.AspNetCore.WebUtilities (24)
HttpResponseStreamWriter.cs (14)
170var count = value.Length; 279if (remaining >= value.Length) 293var count = value.Length; 376if (value.IsEmpty && NewLine.Length == 0) 382if (remaining >= value.Length + NewLine.Length) 409if ((values == null || count == 0) && NewLine.Length == 0) 417if (remaining >= values.Length + NewLine.Length) 445if (remaining >= NewLine.Length + 1) 475if (string.IsNullOrEmpty(value) && NewLine.Length == 0) 483if (remaining >= value.Length + NewLine.Length) 616Debug.Assert(_charBufferSize - _charBufferCount >= value.Length); 622count: value.Length); 624_charBufferCount += value.Length;
MultipartReader.cs (4)
53if (bufferSize < boundary.Length + 8) // Size of the boundary + leading and trailing CRLF + leading and trailing '--' markers. 113if (HeadersLengthLimit - totalSize < line.Length) 117totalSize += line.Length; 125var value = line.Substring(splitIndex + 1, line.Length - splitIndex - 1).Trim();
src\aspnetcore\src\Shared\WebEncoders\WebEncoders.cs (6)
49return Base64UrlDecode(input, offset: 0, count: input.Length); 67ValidateParameters(input.Length, nameof(input), offset, count); 88if (offset == 0 && count == input.Length) 124ValidateParameters(input.Length, nameof(input), offset, count); 145if (offset == 0 && count == input.Length) 232input.Length));
Microsoft.Build (341)
BackEnd\Client\MSBuildClient.cs (1)
730_sizeOfConsoleWritePackets += writePacket.Text.Length;
BackEnd\Components\Logging\BuildErrorTelemetryTracker.cs (9)
153if (errorCode!.Length < 2) 174('C', 'V') when errorCode.Length >= 3 && char.ToUpperInvariant(errorCode[2]) == 'T' => ErrorCategory.NativeToolchain, // CVT* 178('I', 'D') when errorCode.Length >= 3 && char.ToUpperInvariant(errorCode[2]) == 'E' => ErrorCategory.CodeAnalysis, // IDE* 181('L', 'N') when errorCode.Length >= 3 && char.ToUpperInvariant(errorCode[2]) == 'K' => ErrorCategory.NativeToolchain, // LNK* 185('M', 'S') when errorCode.Length >= 3 && char.ToUpperInvariant(errorCode[2]) == 'B' => CategorizeMSBError(errorCode.AsSpan()), 208=> errorCode.Length >= 3 && char.ToUpperInvariant(errorCode[2]) == 'P'; 215=> errorCode.Length >= 6 && 227if (value.Length < 2) 239('V', 'B') => value.Length >= 3 && char.ToUpperInvariant(value[2]) == 'C', // VBC* -> VB compiler
BackEnd\Components\RequestBuilder\IntrinsicTasks\ItemGroupIntrinsicTask.cs (7)
114if ((child.Include.Length != 0) || 115(child.Exclude.Length != 0)) 120else if (child.Remove.Length != 0) 405if (evaluatedInclude.Length == 0) 412if (originalItem.Exclude.Length > 0) 416if (evaluatedExclude.Length > 0) 592if (items.Count == 0 || specification.Length == 0)
BackEnd\Components\RequestBuilder\Lookup.cs (1)
455return GetProperty(name, 0, name.Length - 1);
BackEnd\Components\RequestBuilder\TargetEntry.cs (2)
903if (_target.Inputs.Length > 0) 908if (_target.Outputs.Length > 0)
BackEnd\Components\RequestBuilder\TargetUpToDateChecker.cs (5)
143ProjectErrorUtilities.VerifyThrowInvalidProject((TargetOutputSpecification.Length > 0) || (TargetInputSpecification.Length == 0), 151if (TargetOutputSpecification.Length == 0) 454if (TargetInputSpecification.Length > 0) 490if (TargetInputSpecification.Length == 0)
BackEnd\Components\RequestBuilder\TaskBuilder.cs (3)
1136outputTargetName.Length > 0, 1154outputTargetName.Length > 0, 1167taskParameterName.Length > 0,
BackEnd\Components\Scheduler\SchedulingPlan.cs (2)
368if (line.Length == 0) 398if (line.Length == 0)
BackEnd\TaskExecutionHost\TaskExecutionHost.cs (2)
1600if (expandedParameterValue.Length == 0) 1949if (output?.Length > 0)
BuildCheck\Checks\EmbeddedResourceCheck.cs (2)
96firstIndex + 2 <= s.Length && 109if (extension.Length > 1)
BuildCheck\Checks\UntrustedLocationCheck.cs (1)
54context.Data.ProjectFilePath.Substring(context.Data.ProjectFileDirectory.Length + 1)));
BuildCheck\Infrastructure\ConfigurationProvider.cs (1)
173newKey = kv.Key.Substring(keyFilter.Length);
BuildCheck\Infrastructure\EditorConfig\EditorConfigGlobsMatcher.cs (3)
474internal bool IsDone => Position >= _sectionName.Length; 484if (nextPos < _sectionName.Length && 592return str.Length == 0 || str == "-"
BuildCheck\Infrastructure\InternalOM\PropertyReadInfo.cs (1)
31: this(PropertyName, 0, PropertyName.Length - 1, ElementLocation, IsUninitialized, PropertyReadContext)
Collections\LookasideStringInterner.cs (1)
76else if (str.Length == 0)
Collections\RetrievableEntryHashSet\RetrievableEntryHashSet.cs (2)
323return GetCore(key, 0, key?.Length ?? 0); 340if (index < 0 || index > (key == null ? 0 : key.Length) - length)
Construction\ProjectExtensionsElement.cs (2)
126if (value.Length == 0) 141if (value.Length == 0)
Construction\ProjectItemElement.cs (15)
105ErrorUtilities.VerifyThrowInvalidOperation(String.IsNullOrEmpty(value) || (Remove.Length == 0 && Update.Length == 0), "OM_OneOfAttributeButNotMore", ElementName, XMakeAttributes.include, XMakeAttributes.remove, XMakeAttributes.update); 127ErrorUtilities.VerifyThrowInvalidOperation(String.IsNullOrEmpty(value) || Remove.Length == 0, "OM_EitherAttributeButNotBoth", ElementName, XMakeAttributes.exclude, XMakeAttributes.remove); 128ErrorUtilities.VerifyThrowInvalidOperation(String.IsNullOrEmpty(value) || Update.Length == 0, "OM_EitherAttributeButNotBoth", ElementName, XMakeAttributes.exclude, XMakeAttributes.update); 149ErrorUtilities.VerifyThrowInvalidOperation(String.IsNullOrEmpty(value) || (Include.Length == 0 && Update.Length == 0), "OM_OneOfAttributeButNotMore", ElementName, XMakeAttributes.include, XMakeAttributes.remove, XMakeAttributes.update); 168ErrorUtilities.VerifyThrowInvalidOperation(String.IsNullOrEmpty(value) || (Remove.Length == 0 && Include.Length == 0), "OM_OneOfAttributeButNotMore", ElementName, XMakeAttributes.include, XMakeAttributes.remove, XMakeAttributes.update); 191ErrorUtilities.VerifyThrowInvalidOperation(String.IsNullOrEmpty(value) || RemoveMetadata.Length != 0, "OM_MatchOnMetadataOnlyApplicableToRemoveItems", ElementName, XMakeAttributes.matchOnMetadata); 211ErrorUtilities.VerifyThrowInvalidOperation(String.IsNullOrEmpty(value) || MatchOnMetadata.Length != 0, "OM_MatchOnMetadataOptionsOnlyApplicableToItemsWithMatchOnMetadata", ElementName, XMakeAttributes.matchOnMetadataOptions); 232ErrorUtilities.VerifyThrowInvalidOperation(String.IsNullOrEmpty(value) || RemoveMetadata.Length == 0, "OM_EitherAttributeButNotBoth", ElementName, XMakeAttributes.removeMetadata, XMakeAttributes.keepMetadata); 253ErrorUtilities.VerifyThrowInvalidOperation(String.IsNullOrEmpty(value) || KeepMetadata.Length == 0, "OM_EitherAttributeButNotBoth", ElementName, XMakeAttributes.keepMetadata, XMakeAttributes.removeMetadata); 480ErrorUtilities.VerifyThrowInvalidOperation(parent.Parent is ProjectTargetElement || (Include.Length > 0 || Update.Length > 0 || Remove.Length > 0), "OM_ItemsOutsideTargetMustHaveIncludeOrUpdateOrRemove");
Construction\ProjectOutputElement.cs (2)
68public bool IsOutputItem => ItemType.Length > 0; 73public bool IsOutputProperty => PropertyName.Length > 0;
Construction\ProjectPropertyGroupElement.cs (1)
83if (String.Equals(property.Name, name, StringComparison.OrdinalIgnoreCase) && property.Condition.Length == 0)
Construction\ProjectRootElement.cs (6)
483if (declaration?.Encoding.Length > 0) 959ImportGroupsReversed.FirstOrDefault(importGroup => importGroup.Condition.Length <= 0); 1020if (itemGroup.Condition.Length > 0) 1096if (itemDefinitionGroup.Condition.Length > 0) 1195if (propertyGroup.Condition.Length > 0) 1207if (property.Condition.Length > 0)
Construction\ProjectUsingTaskBodyElement.cs (2)
91if (evaluateAttribute.Length == 0) 159if (parentUsingTask.TaskFactory.Length == 0)
Construction\Solution\ProjectInSolution.cs (1)
520return string.Create(projectName.Length, (projectName, indexOfChar), static (dest, state) =>
Construction\Solution\SolutionFile.cs (8)
573line.AsSpan(slnFileHeaderNoVersion.Length); 955ValidateSolutionFileVersion(str.Substring(slnFileHeaderNoVersion.Length)); 1312ProjectFileErrorUtilities.VerifyThrowInvalidProjectFile(proj.RelativePath.Length > 0, 1372var aspNetPropertyName = ((propertyName.Length - indexOfFirstDot) > 0) ? 1480if (!string.IsNullOrEmpty(property) && (property[0] == '"') && (property[property.Length - 1] == '"')) 1482return property.Substring(1, property.Length - 2); 1816if ((_defaultConfigurationName.Length == 0) && (SolutionConfigurations.Count > 0)) 1854if ((_defaultPlatformName.Length == 0) && (SolutionConfigurations.Count > 0))
Construction\Solution\SolutionProjectGenerator.cs (2)
604if (name.Length > 0) 1078escapedSolutionFileName = escapedSolutionFileName.Substring(0, escapedSolutionFileName.Length - 1);
Construction\UsingTaskParameterGroupElement.cs (1)
127if (parentUsingTask.TaskFactory.Length == 0)
Definition\Project.cs (10)
2857string displayValue = escapedValue.Substring(0, Math.Min(escapedValue.Length, 75)) + ((escapedValue.Length > 75) ? "..." : String.Empty); 2864string displayOriginalValue = originalValue.Substring(0, Math.Min(originalValue.Length, 75)) + ((originalValue.Length > 75) ? "..." : String.Empty); 2942if (group.Condition.Length > 0) 3319if (candidateExistingItemXml.Condition.Length != 0 || candidateExistingItemXml.Exclude.Length != 0 || !candidateExistingItemXml.IncludeHasWildcards) 3402if (renamedItemElement.Exclude.Length > 0) 3744if (itemGroupXml.Condition.Length > 0) 4177if (Project.Xml.ToolsVersion.Length > 0)
Definition\ProjectCollection.cs (1)
1357toolsVersionFromProject = (xml.ToolsVersion.Length > 0) ? xml.ToolsVersion : DefaultToolsVersion;
Definition\ProjectItem.cs (1)
763if (value.Length > 0 || HasMetadata(name))
Definition\Toolset.cs (1)
378toolsPathToUse = toolsPathToUse.Substring(0, toolsPathToUse.Length - 1);
Definition\ToolsetConfigurationReader.cs (2)
92if (toolset.toolsVersion?.Length == 0) 169if (propertyElement.Name?.Length == 0)
Definition\ToolsetReader.cs (2)
632if (trimmedValue.Length > 0 && !Path.IsPathRooted(trimmedValue)) 699ReadOnlySpan<char> remainder = expression.AsSpan(pos + PathBase.Length);
ElementLocation\XmlDocumentWithLocation.cs (1)
130if (reader.BaseURI.Length > 0)
Errors\InvalidProjectFileException.cs (1)
224if (projectFile.Length > 0 && !String.Equals(projectFile, "MSBUILD", StringComparison.Ordinal))
Evaluation\Conditionals\FunctionCallExpressionNode.cs (2)
82if (expandedValue.Length != 0) 84char lastCharacter = expandedValue[expandedValue.Length - 1];
Evaluation\Conditionals\Scanner.cs (34)
150if (_parsePoint >= _expression.Length) 189if ((_parsePoint + 1) < _expression.Length && _expression[_parsePoint + 1] == '(') 205if ((_parsePoint + 1) < _expression.Length && _expression[_parsePoint + 1] == '=') 218if ((_parsePoint + 1) < _expression.Length && _expression[_parsePoint + 1] == '=') 231if ((_parsePoint + 1) < _expression.Length && _expression[_parsePoint + 1] == '=') 243if ((_parsePoint + 1) < _expression.Length && _expression[_parsePoint + 1] == '=') 252if ((_parsePoint + 1) < _expression.Length) 297if (_parsePoint < _expression.Length && _expression[_parsePoint] != '(') 319if (_parsePoint >= _expression.Length) 350while (index < expression.Length) 371if (character == '$' && index < expression.Length - 1 && pchar[index + 1] == '(') 465if (expression.Length > 3 && expression[0] == '%' && expression[1] == '(' && expression[expression.Length - 1] == ')') 467expression = expression.Substring(2, expression.Length - 1 - 2); 472if (period > 0 && period < expression.Length - 1) 507if (_parsePoint < _expression.Length && _expression[_parsePoint] != '(') 521while (_parsePoint < _expression.Length) 541if (_parsePoint >= _expression.Length) 582while (_parsePoint < _expression.Length && _expression[_parsePoint] != '\'') 588if ((_expression[_parsePoint] == '%') && ((_parsePoint + 1) < _expression.Length) && (_expression[_parsePoint + 1] == '(')) 596endOfName = _expression.Length - 1; 600if (_parsePoint + 3 < _expression.Length) 610else if (_expression[_parsePoint] == '@' && ((_parsePoint + 1) < _expression.Length) && (_expression[_parsePoint + 1] == '(')) 631else if (_expression[_parsePoint] == '$' && ((_parsePoint + 1) < _expression.Length) && (_expression[_parsePoint + 1] == '(')) 643if (_parsePoint >= _expression.Length) 707if (_parsePoint < _expression.Length && _expression[_parsePoint] == '(') 721if ((_expression.Length - _parsePoint) > 2 && _expression[_parsePoint] == '0' && (_expression[_parsePoint + 1] == 'x' || _expression[_parsePoint + 1] == 'X')) 742if (_parsePoint < _expression.Length && _expression[_parsePoint] == '.') 746if (_parsePoint < _expression.Length) 750} while (_parsePoint < _expression.Length && _expression[_parsePoint] == '.'); 766while (_parsePoint < _expression.Length && char.IsWhiteSpace(_expression[_parsePoint])) 775while (_parsePoint < _expression.Length && char.IsDigit(_expression[_parsePoint])) 784while (_parsePoint < _expression.Length && CharacterUtilities.IsHexDigit(_expression[_parsePoint])) 793while (_parsePoint < _expression.Length && CharacterUtilities.IsSimpleStringChar(_expression[_parsePoint]))
Evaluation\Conditionals\StringExpressionNode.cs (3)
77switch (_value.Length) 88if (_value[1] != '(' || (_value[0] != '$' && _value[0] != '%' && _value[0] != '@') || _value[_value.Length - 1] != ')') 115return _cachedExpandedValue.Length == 0;
Evaluation\ConditionEvaluator.cs (3)
39if ((conditionedPropertiesTable != null) && (rightValueExpanded.Length > 0)) 54var pieceEnd = lastPiece ? leftValue.Length : pieceSeparator; 232if (condition.Length == 0)
Evaluation\Evaluator.cs (8)
423if (evaluatedIncludeEscaped.Length > 0) 1042if (expanded.Length > 0) 1051if (target.Length > 0) 1268int rootLength = Path.GetPathRoot(projectDirectory).Length; 2146if (importExpressionEscapedItem.Length == 0 || importExpressionEscapedItem.Trim().Length == 0) 2513if (condition.Length == 0) 2544if (condition.Length == 0)
Evaluation\Expander.cs (7)
253if (expression.Length == 0) 274if (expression.Length == 0) 322if (expression.Length == 0) 335if (expression.Length == 0) 395if (expression.Length == 0) 458if (propertyName.Length == 0 || !XmlUtilities.IsValidInitialElementNameCharacter(propertyName[0])) 463for (int n = 1; n < propertyName.Length; n++)
Evaluation\Expander.Function.cs (6)
769int assemblyNameEnd = baseName.Length; 927if (argumentStartIndex == expressionFunction.Length - 1) 953int methodLength = expressionFunction.Length - methodStartIndex; 1078if (arg is string && argString.Length == 0) 1091if (parameters.Length > 2) 1093parameters = parameters.Substring(0, parameters.Length - 2);
Evaluation\Expander.ItemExpander.cs (6)
304if (((options & ExpanderOptions.ExpandItems) == 0) || (expression.Length == 0)) 371if (expandedItemVector.Length > 0) 488if ((evaluatedIncludeEscaped.Length > 0) && (options & ExpanderOptions.BreakOnNotEmpty) != 0) 525if ((options & ExpanderOptions.ExpandItems) == 0 || expression.Length == 0) 569builder.Append(expression, lastStringIndex, expression.Length - lastStringIndex); 616if (!string.IsNullOrEmpty(entry.Value) && currentLength + entry.Value.Length > CharacterLimitPerExpansion)
Evaluation\Expander.ItemExpander.Transforms.cs (7)
562includeBuilder.Append(quotedExpressionFunction, curIndex, quotedExpressionFunction.Length - curIndex); 576includeBuilder.Append(quotedExpressionFunction, curIndex, quotedExpressionFunction.Length - curIndex); 629while (pos < quotedExpressionFunction.Length - 1) 639if (!ExpressionShredder.TryParseMetadataExpression(quotedExpressionFunction, ref refEnd, quotedExpressionFunction.Length, out string itemType, out string name)) 707int length = stringToCheck.Length; 708if (length == cachedMatch.Length + QuotedExpressionSurroundCharCount 756if (include.Length > 0)
Evaluation\Expander.ItemExpander.Transforms.MetadataMatch.cs (1)
21: this(index: 0, name.Length + QuotedExpressionSurroundCharCount, name)
Evaluation\Expander.ItemExpander.Transforms.OneOrMultipleMetadataMatches.cs (2)
40Type = quotedExpressionFunction.Length == name.Length + QuotedExpressionSurroundCharCount
Evaluation\Expander.MetadataExpander.cs (5)
149if (start < expression.Length) 151ScanAndExpandMetadata(expression, start, expression.Length); 171ScanAndExpandMetadata(value, separatorStart, value.Length); 185=> ScanAndExpandMetadata(input, 0, input.Length); 246if (IsTruncationEnabled(_options) && expanded.Length > CharacterLimitPerExpansion)
Evaluation\Expander.PropertyExpander.cs (12)
157results.Add(expression.AsMemory(propertyStartIndex, expression.Length - propertyStartIndex)); 158sourceIndex = expression.Length; 178else if ((expression.Length - (propertyStartIndex + 2)) > 9 && tryExtractRegistryFunction && s_invariantCompareInfo.IndexOf(expression, "Registry:", propertyStartIndex + 2, 9, CompareOptions.OrdinalIgnoreCase) == propertyStartIndex + 2) 226if (value.Length > CharacterLimitPerExpansion) 244if (expression.Length - sourceIndex > 0) 246results.Add(expression.AsMemory(sourceIndex, expression.Length - sourceIndex)); 271if (Char.IsWhiteSpace(propertyBody[0]) || Char.IsWhiteSpace(propertyBody[propertyBody.Length - 1])) 452return LookupProperty(properties, propertyName, 0, propertyName.Length - 1, elementLocation, propertiesUseTracker); 473if (startIndex != 0 || endIndex != propertyName.Length) 513if (elementLocation.File.Length == 0) 545int rootLength = Path.GetPathRoot(directory).Length; 581string valueName = lastAtSignOffset == -1 || lastAtSignOffset == registryLocation.Length - 1
Evaluation\Expander\WellKnownFunctions.cs (8)
271else if (string.Equals(methodName, nameof(string.Length), StringComparison.OrdinalIgnoreCase)) 275returnVal = text.Length; 294if (ParseArgs.TryGetArg(args, out string? separator) && separator?.Length == 1) 307else if (ParseArgs.TryGetArgs(args, out totalWidth, out string? paddingChar) && paddingChar?.Length == 1) 320else if (ParseArgs.TryGetArgs(args, out totalWidth, out string? paddingChar) && paddingChar?.Length == 1) 328if (ParseArgs.TryGetArg(args, out string? trimChars) && trimChars?.Length > 0) 336if (ParseArgs.TryGetArg(args, out string? trimChars) && trimChars?.Length > 0) 888if (ParseArgs.TryGetArg(args, out string? arg0) && arg0?.Length == 1)
Evaluation\ExpressionShredder.cs (7)
76GetReferencedItemNamesAndMetadata(expression, 0, expression.Length, ref pair, ShredderOptions.All); 89GetReferencedItemNamesAndMetadata(expression, 0, expression.Length, ref pair, ShredderOptions.MetadataOutsideTransforms); 103return GetReferencedItemExpressions(expression, 0, expression.Length); 540int length = expression.Length; 608while (i < expression.Length && i < end) 697=> Sink(expression, ref i, expression.Length, c); 740=> SinkWhitespace(expression, ref i, expression.Length);
Evaluation\IntrinsicFunctions.cs (4)
655if (start > input.Length) 660if (start + length > input.Length) 662length = input.Length - start; 808if (i == -1 || i == keyName.Length)
Evaluation\ItemSpec.cs (3)
206if (evaluatedItemspecEscaped.Length > 0) 266if (expression.Length == 0) 530public bool IsFullFileSystemScan => TextFragment.Length >= 4
Evaluation\LazyItemEvaluator.cs (8)
78if (condition?.Length == 0) 557if (itemElement.Exclude.Length > 0) 563if (evaluatedExclude.Length > 0) 588if (itemElement.MatchOnMetadata.Length > 0) 592if (evaluatedmatchOnMetadata.Length > 0) 647ExpressionShredder.GetReferencedItemNamesAndMetadata(expression, 0, expression.Length, ref itemsAndMetadataFound, ShredderOptions.All); 654ExpressionShredder.GetReferencedItemNamesAndMetadata(expression, 0, expression.Length, ref itemsAndMetadataFound, ShredderOptions.All); 669if (expression.Length == 0)
Evaluation\LazyItemEvaluator.LazyItemOperation.cs (2)
279ExpressionShredder.GetReferencedItemNamesAndMetadata(expression, 0, expression.Length, ref itemsAndMetadataFound, ShredderOptions.All); 282ExpressionShredder.GetReferencedItemNamesAndMetadata(expression, 0, expression.Length, ref itemsAndMetadataFound, ShredderOptions.All);
Evaluation\ParserIgnoreConfiguration.cs (1)
208if (trimmedPath.Length > 0)
Evaluation\Preprocessor.cs (7)
247if (innerInitialTargets.Length > 0) 249if (outerInitialTargets.Length > 0) 260if (outerDefaultTargets.Length == 0) 264if (innerDefaultTargets.Trim().Length > 0) 282string condition = importCondition.Length > 0 ? $" Condition=\"{importCondition}\"" : String.Empty; 285string sdk = importSdk.Length > 0 ? $" {XMakeAttributes.sdk}=\"{importSdk}\"" : String.Empty; 340string importGroupTag = "<ImportGroup" + ((importGroupCondition.Length > 0) ? " Condition=\"" + importGroupCondition + "\"" : String.Empty) + ">";
Evaluation\Profiler\EvaluationLocationMarkdownPrettyPrinter.cs (1)
43if (text.Length > 100)
Evaluation\ProjectParser.cs (10)
298XmlAttributeWithLocation errorAttribute = remove.Length > 0 ? (XmlAttributeWithLocation)element.Attributes[XMakeAttributes.remove] : (XmlAttributeWithLocation)element.Attributes[XMakeAttributes.update]; 306ProjectXmlUtilities.VerifyThrowProjectInvalidAttribute(exclude.Length == 0 || include.Length > 0, (XmlAttributeWithLocation)element.Attributes[XMakeAttributes.exclude]); 309ProjectErrorUtilities.VerifyThrowInvalidProject(include.Length > 0 || element.Attributes[XMakeAttributes.include] == null, element.Location, "MissingRequiredAttribute", XMakeAttributes.include, itemType); 312ProjectErrorUtilities.VerifyThrowInvalidProject(remove.Length > 0 || element.Attributes[XMakeAttributes.remove] == null, element.Location, "MissingRequiredAttribute", XMakeAttributes.remove, itemType); 315ProjectErrorUtilities.VerifyThrowInvalidProject(update.Length > 0 || element.Attributes[XMakeAttributes.update] == null, element.Location, "MissingRequiredAttribute", XMakeAttributes.update, itemType); 410ProjectErrorUtilities.VerifyThrowInvalidProject(!(parent is ProjectItemElement) || ((ProjectItemElement)parent).Remove.Length == 0, element.Location, "ChildElementsBelowRemoveNotAllowed", element.Name); 529ProjectErrorUtilities.VerifyThrowInvalidProject(element.GetAttribute(XMakeAttributes.taskName).Length > 0, element.Location, "ProjectTaskNameEmpty"); 535(assemblyName.Length > 0) ^ (assemblyFile.Length > 0),
Evaluation\PropertiesUseTracker.cs (1)
133if (evaluatedValue.Length > 0 && _warnForUninitializedProperties)
Evaluation\SemiColonTokenizer.cs (3)
75for (; _index < _expression.Length; _index++) 97if (_expression.Length > _index + 1 && _expression[_index + 1] == '(') 124_current = GetExpressionSubstring(segmentStart, _expression.Length - segmentStart);
Globbing\MSBuildGlob.cs (3)
137int fixedDirectoryPartLength = normalizedInput.Length - wildcardDirectoryPart.Length - filenamePart.Length;
Graph\GraphBuilder.cs (1)
655var errorMessage = new StringBuilder(projectsInCycle.Select(p => p.Length).Sum());
Graph\ProjectGraph.cs (2)
703string projectTargetName = targetName.Substring(baseProjectName.Length + 1); 707projectTargetName.Length > 0 && !projectTargetName.Equals("Build", StringComparison.OrdinalIgnoreCase),
Instance\ProjectInstance.cs (1)
3283if (xml.ToolsVersion.Length > 0)
Instance\ProjectItemInstance.cs (1)
593if (value.Length > 0 || HasMetadata(name))
Instance\ProjectMetadataInstance.cs (2)
262if (reservedName.Length == name.Length && reservedName[0] == name[0])
Instance\TaskRegistry.cs (8)
311taskName.Length > 0, 326if (projectUsingTaskXml.AssemblyFile.Length > 0) 336assemblyFile == null || assemblyFile.Length > 0, 345assemblyName == null || assemblyName.Length > 0, 471string mostSpecificTaskName = (taskName.Length > record.RegisteredName.Length) ? taskName : record.RegisteredName; 763(taskName.Length > r.TaskIdentity.Name.Length) ? taskName : r.TaskIdentity.Name,
Logging\BaseConsoleLogger.cs (2)
235StringBuilder result = new StringBuilder((indentLevel * tabWidth) + formattedString.Length); 1002if (parameterValue.Length == 0)
Logging\BinaryLogger\BinaryLogger.cs (2)
276parameter = parameter.Substring(LogFileParameterPrefix.Length); 785parameter = parameter.Substring(LogFileParameterPrefix.Length);
Logging\BinaryLogger\BuildEventArgsReader.cs (3)
1932if (text.Length <= StringSizeThreshold && totalAllocatedShortStrings < 1_000_000_000) 1934totalAllocatedShortStrings += text.Length; 1944stringPosition.StringLength = text.Length;
Logging\BinaryLogger\BuildEventArgsWriter.cs (1)
1356else if (text.Length == 0)
Logging\ConsoleLogger.cs (1)
116if (param.Length <= 0)
Logging\DistributedLoggers\ConfigurableForwardingLogger.cs (1)
79if (parameterComponents[param].Length > 0)
Logging\DistributedLoggers\DistributedFileLogger.cs (3)
49if (parameterComponents[param].Length > 0) 82int length = ((string)(parameterName + s_fileLoggerParameterValueSplitCharacter[0] + parameterValue)).Length; 84if ((indexOfParameter + length) < _parameters.Length && _parameters[indexOfParameter + length] == ';')
Logging\FileLogger.cs (1)
180if (parameter.Length <= 0)
Logging\LogFormatter.cs (1)
50int rawTimeLength = rawTime.Length;
Logging\OptimizedStringIndenter.cs (2)
64int indentedStringLength = segments.Length * (Environment.NewLine.Length + indent); 87output = output.Slice(Environment.NewLine.Length);
Logging\ParallelLogger\ConsoleOutputAligner.cs (5)
59int estimatedCapacity = message.Length + ((prefixAlreadyWritten ? 0 : prefixWidth) + Environment.NewLine.Length) * (message.Length / averageLineLength + 1); 66i = j + (message[j] == '\r' && (j + 1) < message.Length && message[j + 1] == '\n' ? 2 : 1); 71AlignAndIndentLineOfMessage(sb, prefixAlreadyWritten, prefixWidth, message, i, message.Length - i);
Logging\ParallelLogger\ParallelConsoleLogger.cs (1)
1639_prefixWidth = prefixString.Length;
Logging\TerminalLogger\TerminalLogger.cs (7)
408value is { Length: > 0 } && 418value is { Length: > 0 } && 1781if (indent.Length + line.Length > terminalWidth) // custom wrapping with indentation 1804while (start < text.Length) 1806int length = Math.Min(maxLength - indent.Length, text.Length - start);
Logging\TerminalLogger\TerminalNodesFrame.cs (11)
51_nodes[i].durationLength = durationString.Length; 62? targetPrefix!.Length + 1 + target.Length 63: target.Length; 98.Append(AnsiCodes.MoveCursorBackward(targetWithoutAnsiLength + durationString.Length + 1)) 107TerminalLogger.Indentation.Length + 108project.Length + 1 + 109(targetFramework?.Length ?? -1) + 1 + 110(runtimeIdentifier?.Length ?? -1) + 1 + 112durationString.Length; 138sb.Append($"{AnsiCodes.SetCursorHorizontal(MaxColumn)}{AnsiCodes.MoveCursorBackward(durationString.Length)}{durationString}");
src\9f0d3f3da306d8cf\IEnumerableExtensions.cs (2)
298return str.Length == 0; 321return source.Length == 0;
src\msbuild\src\Shared\BuildEventFileInfo.cs (1)
88_file = (e.SourceUri.Length == 0) ? String.Empty : new Uri(e.SourceUri).LocalPath;
src\msbuild\src\Shared\CanonicalError.cs (2)
299if (message.Length > 400) 427if (location.Length > 0)
src\msbuild\src\Shared\PropertyParser.cs (2)
57if (propertyName.Length == 0) 110if (propertyName.Length == 0)
src\msbuild\src\Shared\StringExtensions.cs (5)
38var builder = new StringBuilder(aString.Length - oldValue.Length + newValue.Length); 46endOfPreviousOccurrence = currentOccurrence + oldValue.Length; 50builder.Append(aString, endOfPreviousOccurrence, aString.Length - endOfPreviousOccurrence);
src\msbuild\src\Shared\TypeLoader.cs (9)
170if (typeName1.Length != typeName2.Length) 176if (typeName1.Length > typeName2.Length) 190int matchIndex = longerTypeName.Length - shorterTypeName.Length; 516if ((_assemblyLoadInfo.AssemblyName != null) && (typeName.Length > 0)) 550if (typeName.Length == 0 || IsPartialTypeNameMatch(desiredTypeInAssembly.Key, typeName)) 602if (IsDesiredType(publicType) && (typeName.Length == 0 || IsPartialTypeNameMatch(publicType.FullName, typeName)))
Utilities\Utilities.cs (3)
262for (int i = firstLessThan; i < innerXml.Length; i++) 267if (i < innerXml.Length - 3 292if (i < innerXml.Length - 2
Utilities\XmlUtilities.cs (1)
157for (int i = 1; i < name.Length; i++)
Xml\ProjectXmlUtilities.cs (4)
83if (element.Prefix.Length != 0) 130attribute == null || attribute.Value.Length > 0, 174ProjectErrorUtilities.VerifyThrowInvalidProject(element.GetAttribute(attributeName).Length > 0, element.Location, "MissingRequiredAttribute", attributeName, element.Name); 239if (value == null || (!allowSettingEmptyAttributes && value.Length == 0))
Microsoft.Build.Framework (203)
BackEnd\CommunicationsUtilities.cs (1)
701int len = fileVersion.Length;
BackEnd\Handshake.cs (1)
192if (!NativeMethods.IsWindows || string.IsNullOrEmpty(path) || path!.Length < 2 || path[1] != ':')
Coordinator\CoordinatorSettings.cs (1)
167return string.Create(prefix.Length + (hash.Length * 2), new PrefixAndHash(prefix, hash), static (span, state) =>
ErrorUtilities.cs (1)
87if (parameter?.Length == 0)
EscapingUtilities.cs (7)
112int endIndex = value.Length; 149sb ??= StringBuilderCache.Acquire(value.Length); 173=> startIndex == 0 && endIndex == value.Length 231int length = value.Length + (specialCharIndices.Length * 2); 332if (value.Length < 3) 338int percentIndex = value.IndexOf('%', startIndex: 0, value.Length - 2); 352percentIndex = value.IndexOf('%', percentIndex + 1, value.Length - (percentIndex + 1) - 2);
FileClassifier.cs (6)
240if (directory?.Length > 0) 325path = path.Substring(0, path.Length - 1); 343return (fileSpec.Length > 0) && IsSlash(fileSpec[fileSpec.Length - 1]); 358if (fileSpec.Length >= 1 && !EndsWithSlash(fileSpec)) 396IsMicrosoftAssembly(filePath.AsSpan(containingNugetCache.Length));
FileUtilities_TempFiles.cs (1)
180else if (extension.Length > 0 && extension[0] != '.')
FileUtilities.cs (28)
188return (fileSpec.Length > 0) 189? IsSlash(fileSpec[fileSpec.Length - 1]) 211if (fileSpec.Length > 0 && !IsSlash(fileSpec[fileSpec.Length - 1])) 225if (path.Length > 0 && IsSlash(path[path.Length - 1])) 227path = path.Substring(0, path.Length - 1); 234=> path.Length >= NativeMethods.MaxPath; // >= not > because MAX_PATH assumes a trailing null 279if (IsSlash(path.Value[path.Value.Length - 1]) && !HasWindowsDirectorySeparatorOnUnix(path.Value)) 307if (!IsSlash(path.Value[path.Value.Length - 1]) && !HasWindowsDirectorySeparatorOnUnix(path.Value)) 427if (directoryPath.Length > 0) 474int stop = path.Length; 492int stop = path.Length; 545if (path.Length > 1 && path[0] == convertQuote && path[path.Length - 1] == convertQuote) 548path = $"{targetQuote}{path.AsSpan(1, path.Length - 2)}{targetQuote}"; 554else if (path.Length == 1 || path[0] != targetQuote || path[path.Length - 1] != targetQuote) 590int i = fullPath.Length; 615for (int i = 0; i < path.Length; i++) 617if (i + 1 < path.Length && path[i] == '.' && path[i + 1] == '.') 646var rightBound = rightIndex + 1 < path.Length 873else if ((directory.Length > 0) && !EndsWithSlash(directory)) 1389if (fullPath[fullPath.Length - 1] != Path.DirectorySeparatorChar) 1416return hasMaxPath && !IsRootedNoThrow(path) && Environment.CurrentDirectory.Length + path.Length + 1 /* slash */ >= maxPath; 1525var endA = path1.Length - 1; 1526var endB = path2.Length - 1;
FileUtilitiesRegex.cs (8)
28return pattern.Length == 2 && 39return pattern.Length == 3 && 53return pattern.Length >= 2 && 73return pattern.Length >= 3 && 89return StartsWithUncPatternMatchLength(pattern) == pattern.Length; 118for (int i = 2; i < pattern.Length; i++) 150return pattern.Length; 161return pattern.Length >= 5 &&
Globbing\MSBuildPathMatcher.cs (10)
136_matchesAllFiles = filePattern.Length == 0 535if (patternIndex < pattern.Length 541else if (patternIndex < pattern.Length && pattern[patternIndex] == '*') 557while (patternIndex < pattern.Length && pattern[patternIndex] == '*') 562return patternIndex == pattern.Length; 608StringBuilder expression = new(pattern.Length + 8); 633StringBuilder expression = new(pattern.Length + 8); 636int patternLength = hasTrailingDot ? pattern.Length - 1 : pattern.Length; 686if (wildcardDirectoryPart.Length == 0)
InterningWriteTranslator.cs (1)
135&& splitId < str.Length - 1
ItemSpecModifiers.cs (5)
116switch (name.Length) 563(directory.Length > length) && FileUtilities.IsSlash(directory[length]), 625uncMatchLength == path.Length) 640((path.Length >= 3 && path[2] != '\\' && path[2] != '/') || 641(path.Length >= 4 && path[3] != '\\' && path[3] != '/')))
MSBuildNameIgnoreCaseComparer.cs (3)
34return Equals(x, y, 0, y?.Length ?? 0); 39return GetHashCode(obj, 0, obj?.Length ?? 0); 49Assumed.LessThanOrEqual(start, (constrainedString?.Length ?? 0) - lengthToCompare, $"Invalid {nameof(start)} '{constrainedString}' {start} {lengthToCompare}");
PathHelpers\AbsolutePath.cs (2)
148return root is { Length: > 0 } baseRoot 154if (combined.Length >= 2 && combined[1] == ':')
SolutionConfiguration.cs (1)
98if (dependencyGuid.Length == 0)
Telemetry\CrashTelemetry.cs (14)
685lineEnd = stackTrace.Length; 784&& originNamespace.Length > prefix.Length 785&& originNamespace[prefix.Length] == '.')) 846message = message.Substring(internalErrorPrefix.Length); 853return message.Length <= maxLength ? message : message.Substring(0, maxLength); 904if (sanitized.Length > MaxStackTraceLength) 907sanitized = sanitized.Substring(0, MaxStackTraceLength - truncationSuffix.Length) + truncationSuffix; 947if (secondStart >= stackTrace.Length) 958return trimmed.Length > 0 ? SanitizeStackFrame(trimmed) : null; 986return frame.Substring(0, inIndex + inToken.Length) + "<redacted>"; 989string prefix = frame.Substring(0, inIndex + inToken.Length); 1016string prefix = line.Substring(0, inIndex + inToken.Length); 1023lines[i] = line.Substring(0, inIndex + inToken.Length) + "<redacted>";
Utilities\AssemblyNameExtension.cs (2)
573baseLenThis = asString1.Length; 577baseLenThat = asString2.Length;
Utilities\ConversionUtilities.cs (1)
185if (number.Length >= 3 && number[0] is '0' && number[1] is 'x' or 'X')
Utilities\EventArgsFormatting.cs (2)
316if (logOutputProperties?.Length > 0) 330if (logOutputProperties?.Length > 0)
Utilities\FileMatcher.cs (83)
417Path.GetExtension(searchPattern).Length == (3 + 1 /* +1 for the period */) && 444string dir = ((path.Length == 0) ? s_thisDirectory : path); 511directories = fileSystem.EnumerateDirectories((path.Length == 0) ? s_thisDirectory : path); 515directories = fileSystem.EnumerateDirectories((path.Length == 0) ? s_thisDirectory : path, pattern); 589if (path.Length > 2 && path[1] == ':') 611if (parts[i].Length == 0) 826bool directoryLastCharIsSeparator = IsDirectorySeparator(projectDirectory[projectDirectory.Length - 1]); 835if (path.Length <= projectDirectory.Length || !IsDirectorySeparator(path[projectDirectory.Length])) 840yield return path.Substring(projectDirectory.Length + 1); 844yield return path.Substring(projectDirectory.Length); 1234else if (recursionState.RemainingWildcardDirectory.Length == 0) 1253if (recursionState.SearchData.NeedsRecursion && recursionState.RemainingWildcardDirectory.Length > 0) 1315int actualLength = FileSpecRegexParts.BeginningOfLine.Length + 1316FileSpecRegexParts.WildcardGroupStart.Length + 1317FileSpecRegexParts.FilenameGroupStart.Length + 1318(FileSpecRegexParts.GroupEnd.Length * 2) + 1319FileSpecRegexParts.EndOfLine.Length; 1352for (int i = 0; i < str.Length - 1; i++) 1358&& i < str.Length - 2 && FileUtilities.IsAnySlash(str[i + 2]); 1379bool isUncPath = NativeMethods.IsWindows && fixedDir.Length > 1 1387for (int i = startIndex; i < fixedDir.Length; i = LastIndexOfDirectorySequence(fixedDir, i + 1)) 1406bool hasRecursiveOperatorAtStart = wildcardDir.Length > 2 && wildcardDir[0] == '*' && wildcardDir[1] == '*'; 1414for (int i = startIndex; i < wildcardDir.Length; i = LastIndexOfDirectoryOrRecursiveSequence(wildcardDir, i + 1)) 1417bool isRecursiveOperator = i < wildcardDir.Length - 2 && wildcardDir[i + 1] == '*' && wildcardDir[i + 2] == '*'; 1451bool hasTrailingDot = filename.Length > 0 && filename[filename.Length - 1] == '.'; 1452int partLength = hasTrailingDot ? filename.Length - 1 : filename.Length; 1539if (startIndex >= str.Length || !FileUtilities.IsAnySlash(str[startIndex])) 1546while (!isSequenceEndFound && i < str.Length) 1548bool isSeparator = i < str.Length - 1 && FileUtilities.IsAnySlash(str[i + 1]); 1549bool isRelativeSeparator = i < str.Length - 2 && str[i + 1] == '.' && FileUtilities.IsAnySlash(str[i + 2]); 1585bool isRecursiveSequence = startIndex < str.Length - 1 1595while (!isSequenceEndFound && i < str.Length) 1598bool isRecursiveOperator = i < str.Length - 2 && str[i + 1] == '*' && str[i + 2] == '*'; 1723needsRecursion = (wildcardDirectoryPart.Length != 0); 1842int patternLength = pattern.Length; 2156excludeSize += exclude.Length; 2160using (var sb = new ReuseableStringBuilder(projectDirectoryUnescaped.Length + filespecUnescaped.Length + excludeSize)) 2191sb.Append(value.Length.ToString(CultureInfo.InvariantCulture)); 2264if (fixedDirectoryPart.Length > 0 && !_fileSystem.DirectoryExists(fixedDirectoryPart)) 2280if (wildcardDirectoryPart.Length > 0) 2286int wildcardLength = wildcard.Length; 2308(wildcardDirectoryPart.Length > 0) && 2352var sb = new StringBuilder(aString.Length); 2356if (aString.Length >= 2 && aString[1] == ':' && IsValidDriveChar(aString[0])) 2386while (index < aString.Length) 2391if (afterSlashesIndex >= aString.Length) 2403var afterNonSlashIndex = indexOfAnySlash == -1 ? aString.Length : indexOfAnySlash; 2420int directoryPartLength = directoryPart.Length; 2421int wildcardPartLength = wildcardPart.Length; 2493while (index < aString.Length && FileUtilities.IsAnySlash(aString[index])) 2585spec.Length > 0 2591|| directory.Length == 0 2632fileSpec.Length > 0 && FileUtilities.IsAnySlash(fileSpec[^1]); 2636&& fileSpec.Length >= 2 2638&& (fileSpec.Length == 2 || !FileUtilities.IsAnySlash(fileSpec[2])); 2812|| excludeWildcardDirectory.Length == 0) 2832if (excludeBaseDirectory.Length < includeBaseDirectory.Length 3266string childRelativeDirectory = parentRelativeDirectory.Length == 0 3288if (excludeBaseDirectory.Length == includeBaseDirectory.Length) 3293if (excludeBaseDirectory.Length > includeBaseDirectory.Length) 3303|| excludeState.RemainingWildcardDirectory.Length == 0) 3699if (relativeStart == lexicalEnumerationRoot.Length) 3710while (relativeStart < lexicalEnumerationRoot.Length 3837if (excludeBaseDirectory.Length == includeBaseDirectory.Length) 3842else if (excludeBaseDirectory.Length > includeBaseDirectory.Length) 3881if (excludeState.RemainingWildcardDirectory.Length == 0) 3919includeFilespec.Length - includeFilespec.LastIndexOfAny(s_wildcardCharacters) - 1, 3920excludeFilespec.Length - excludeFilespec.LastIndexOfAny(s_wildcardCharacters) - 1); 3923includeFilespec.Length - compareLength, 3925excludeFilespec.Length - compareLength, 4013if (Array.IndexOf(directorySeparatorCharacters, possibleParent[possibleParent.Length - 1]) >= 0) 4019return Array.IndexOf(directorySeparatorCharacters, possibleChild[possibleParent.Length]) >= 0; 4040internal static bool IsAllFilesWildcard(string pattern) => pattern?.Length switch
Utilities\MessageParser.cs (7)
203=> _position < _text.Length 209while (_position < _text.Length && char.IsWhiteSpace(_text[_position])) 217Assumed.LessThan(_position, _text.Length); 225if (_text.Length < _position + 8 || 264while (_position < _text.Length && char.IsAsciiLetter(_text[_position])) 277while (_position < _text.Length && char.IsAsciiDigit(_text[_position])) 289return _position < _text.Length && _text[_position] is ':';
Utilities\QuotingUtilities.cs (9)
76splitString.EnsureCapacity(input.Length); 82for (int i = 0; (i < input.Length) && (splits < maxSplits); i++) 101(i < (input.Length - 1)) && 114(((separators.Length == 0) && char.IsWhiteSpace(input[i])) || 120splitString.Append(input, i + 1, input.Length - (i + 1)); 141if ((piece.Length > 0) || keepEmptySplits) 179unquotedString.EnsureCapacity(input.Length); 185for (int i = 0; i < input.Length; i++) 198(i < (input.Length - 1)) &&
Utilities\StringUtils.cs (1)
57$"{fromString.AsSpan(0, lastOccurrenceIndex)}{fromString.AsSpan(lastOccurrenceIndex + substring.Length)}";
Utilities\TypeExtensions.cs (1)
38return location.Length == 0 ? location : Path.GetFullPath(location);
Utilities\ValueStringBuilder.cs (5)
259int count = s.Length; 302if (s.Length == 1 && (uint)pos < (uint)_chars.Length) 317if (pos > _chars.Length - s.Length) 319Grow(s.Length); 323_length += s.Length;
Utilities\VersionUtilities.cs (2)
38if (version.Length > 0) 69if (version.Length > 0 && (version[0] == 'v' || version[0] == 'V'))
Microsoft.Build.Tasks.CodeAnalysis (21)
src\roslyn\src\Compilers\Core\MSBuildTask\CanonicalError.cs (2)
264if (message.Length > 400) 349if (location.Length > 0)
src\roslyn\src\Compilers\Core\MSBuildTask\CommandLineBuilderExtension.cs (1)
256if ((metadataValue != null) && (metadataValue.Length > 0))
src\roslyn\src\Compilers\Core\MSBuildTask\Csc.cs (3)
399if (alias.Length == 0) 500else if (singleIdentifier.Length > 0) 720else if (errorMessage != null && errorMessage.Length > 0)
src\roslyn\src\Compilers\Core\MSBuildTask\ManagedCompiler.cs (1)
1159if (itemSpec.Length > 1 && itemSpec[0] == '/' && itemSpec.IndexOf('/', 1) < 0)
src\roslyn\src\Compilers\Core\MSBuildTask\ManagedToolTask.cs (2)
301if (AppContext.GetData("Microsoft.DotNet.Sdk.Root") is string { Length: > 0 } sdkDirectory) 310if (Path.GetDirectoryName(typeof(ManagedToolTask).Assembly.Location) is { Length: > 0 } buildTaskDirectory)
src\roslyn\src\Compilers\Core\MSBuildTask\MapSourceRoots.cs (3)
86if (path.Length == 0) 91char c = path[path.Length - 1]; 192nestedRoot = fullOriginalPath.Substring(containingRoot.Length);
src\roslyn\src\Compilers\Core\MSBuildTask\Utilities.cs (1)
39if (metadataValue == null || metadataValue.Length == 0)
src\roslyn\src\Compilers\Core\MSBuildTask\Vbc.cs (3)
350if (originalBaseAddress.Length > 2) 685if (!_isDoneOutputtingErrorMessage && singleLine.Length == 0) 787if ((originalDefineConstants == null) || (originalDefineConstants.Length == 0))
src\roslyn\src\Compilers\Core\Portable\InternalUtilities\CompilerOptionParseUtilities.cs (1)
42if (Environment.GetEnvironmentVariable(CachePathEnvironmentVariable) is not { Length: > 0 } cachePath)
src\roslyn\src\Compilers\Core\Portable\InternalUtilities\UnicodeCharacterUtilities.cs (1)
103int nameLength = name.Length;
src\roslyn\src\Compilers\Shared\BuildProtocol.cs (1)
648writer.Write(value.Length);
src\roslyn\src\Compilers\Shared\RuntimeHostInfo.cs (2)
82if (Environment.GetEnvironmentVariable(DotNetHostPathEnvironmentName) is { Length: > 0 } pathToDotNet) 87if (Environment.GetEnvironmentVariable(DotNetExperimentalHostPathEnvironmentName) is { Length: > 0 } pathToDotNetExperimental)
Microsoft.Build.Tasks.Core (114)
AssemblyDependency\AssemblyFoldersFromConfig\AssemblyFoldersFromConfigResolver.cs (2)
108if (_targetRuntimeVersion.Length != 0) 191string directoryPath = assemblyFolder.DirectoryPath.Length == 0
AssemblyDependency\AssemblyResolution.cs (1)
205else if (0 == String.Compare(basePath, 0, AssemblyResolutionConstants.assemblyFoldersFromConfigSentinel, 0, AssemblyResolutionConstants.assemblyFoldersFromConfigSentinel.Length, StringComparison.OrdinalIgnoreCase))
AssemblyDependency\RawFilenameResolver.cs (1)
51string fullRawFileName = rawFileNameCandidate.Length == 0
AssemblyDependency\Reference.cs (5)
210Debug.Assert(dependee.FullPath.Length > 0, "Cannot add dependee that doesn't have a full name. This should have already been resolved."); 291if (extension.Length > 0 && extension[0] != '.') 539if (_directoryName.Length == 0) 784get { return _fullPath.Length > 0; } 960String.Compare(directoryPath, 0, fullPath, 0, directoryPath.Length, StringComparison.OrdinalIgnoreCase) == 0;
AssemblyDependency\ReferenceTable.cs (7)
365if (sdkName.Length > 0) 446if (reference.FullPath.Length > 0) 625if (assemblyName != null && !wantSpecificVersion && !isSimpleName && reference.HintPath.Length == 0) 638if (assemblyName != null && _installedAssemblies != null && !wantSpecificVersion && reference.HintPath.Length == 0) 850position += component.Length + 1; 1324if (reference.SDKName.Length > 0) 1754if (!hasFrameworkPath && !reference.EmbedInteropTypes && reference.SDKName.Length == 0)
AssemblyDependency\ResolveAssemblyReference.cs (2)
1956bool containsAssemblyFoldersExSentinel = String.Compare(location.SearchPath, 0, AssemblyResolutionConstants.assemblyFoldersExSentinel, 0, AssemblyResolutionConstants.assemblyFoldersExSentinel.Length, StringComparison.OrdinalIgnoreCase) == 0; 2066if (reference.FullPath.Length > 0)
AssemblyDependency\Resolver.cs (1)
173if (candidateBaseName.Length > 0)
AssignLinkMetadata.cs (1)
56string link = fullPath.Substring(definingProjectDirectory.Length);
AssignProjectConfiguration.cs (4)
49if (_defaultToVcxPlatformMapping?.Length == 0) 89if (_vcxToDefaultPlatformMapping?.Length == 0) 351if (buildReferenceMetadata.Length == 0) 356if (referenceOutputAssemblyMetadata.Length == 0)
AssignTargetPath.cs (3)
137targetPath = itemSpecFullFileNamePath.Value.Substring(fullRootPath.Value.Length); 152if (String.Compare(fullRootPathString, 0, itemSpecFullFileNamePath, 0, fullRootPathString.Length, StringComparison.CurrentCultureIgnoreCase) == 0) 155targetPath = itemSpecFullFileNamePath.Substring(fullRootPathString.Length);
BootstrapperUtil\BootstrapperBuilder.cs (8)
331productCodes = productCodes.Substring(0, productCodes.Length - 2); 353productCodes = productCodes.Substring(0, productCodes.Length - 2); 463if (folder.Length >= packagePath.Length && folder.StartsWith(packagePath, StringComparison.OrdinalIgnoreCase)) 465string relPath = folder.Substring(packagePath.Length); 607int nStartIndex = packagePath.Length; 966int nStartIndex = packagePath.Length; 2193if (currentNode.Attributes.Count == 0 && currentNode.InnerText.Length > 0)
BootstrapperUtil\Util.cs (3)
37if (str.LastIndexOf(ch) == str.Length - 1) 135dotIndex = visualStudioVersion.Length; 154if (normalizedVersion.Length == 0)
CreateManifestResourceName.cs (4)
189int indexJustBeforeCulture = fileNameWithoutExtension.Length - culture.Length - 1; 334for (int i = 1; i < subName.Length; i++) 387var everettId = new StringBuilder(name.Length);
Culture.cs (1)
62if ((cultureName?.Length > 1))
Exec.cs (4)
401if (trimmedTextLine.Length > 0) 453if (Command.Trim().Length == 0) 624for (int i = 0; i < batchFileForCommandLine.Length; i++) 633fileName = StringBuilderCache.Acquire(batchFileForCommandLine.Length);
FileIO\ReadLinesFromFile.cs (1)
61if (trimmedTextLine.Length > 0)
FindInvalidProjectReferences.cs (1)
135return platformIdentity.Length > 0 && parsedVersion;
FormatUrl.cs (1)
47if (InputUrl.Length > 0 && NativeMethodsShared.IsWindows && string.IsNullOrWhiteSpace(InputUrl))
FormatVersion.cs (2)
51else if (Version[Version.Length - 1] == '*') 55string.Create(CultureInfo.InvariantCulture, $"{Version.AsSpan(0, Version.Length - 1)}{Revision:G}");
GenerateManifestBase.cs (1)
616if (manifestFileName.Length > MaxTargetPath)
GenerateResource.cs (3)
2220if (StateFile?.ItemSpec.Length > 0) 2912success = currentOutputFile.Length <= EffectiveMaxPath; 2932success = currentOutputFile.Length <= EffectiveMaxPath;
GetSDKReferenceFiles.cs (9)
264if (targetedConfiguration.Length == 0) 270if (targetedArchitecture.Length == 0) 307if (targetedConfiguration.Length > 0 && targetedArchitecture.Length > 0) 381else if (targetedConfiguration.Length > 0 && targetedArchitecture.Length > 0) 458if (outputItem.GetMetadata(ItemMetadataNames.msbuildReferenceSourceTarget).Length == 0) 540if (outputItem.GetMetadata(ItemMetadataNames.msbuildReferenceSourceTarget).Length == 0) 664ErrorUtilities.VerifyThrowArgument(sdkIdentity.Length != 0, "GetSDKReferenceFiles.NoOriginalItemSpec", sdk.ItemSpec);
Hash.cs (2)
85for (int itemSpecPosition = 0; itemSpecPosition < itemSpec.Length; itemSpecPosition += MaxInputChunkLength) 87int charsToProcess = Math.Min(itemSpec.Length - itemSpecPosition, MaxInputChunkLength);
ListOperators\FindUnderPath.cs (1)
90int conePathLength = conePath.Length;
MakeDir.cs (1)
57if (directory.ItemSpec.Length > 0)
ManifestUtil\ApplicationManifest.cs (4)
581if (fileAssociation.Extension.Length > Constants.MaxFileAssociationExtensionLength) 656if (_maxTargetPath > 0 && assembly.TargetPath.Length > _maxTargetPath) 676if (_maxTargetPath > 0 && assembly.AssemblyIdentity.Name.Length > _maxTargetPath) 702if (_maxTargetPath > 0 && file.TargetPath.Length > _maxTargetPath)
ManifestUtil\BaseReference.cs (2)
51path = path.Substring(0, path.Length - Constants.DeployFileExtension.Length);
ManifestUtil\PathUtil.cs (1)
230$"{path.AsSpan(0, i)}{Environment.MachineName.ToLowerInvariant()}{path.AsSpan(i + localHost.Length)}" :
ResolveNonMSBuildProjectOutput.cs (1)
105if (resolvedPath.ItemSpec.Length > 0)
ResolveProjectBase.cs (1)
62if (attrValue.Length > 0)
ResolveSDKReference.cs (9)
307if (installLocation.Length > 0 && sdkName.Length > 0) 321if (sdkName.Length > 0) 512if (missingDependencies.Length > 0) 553return dependsOnSDK.Split(MSBuildConstants.SemicolonChar, StringSplitOptions.RemoveEmptyEntries).Select(x => x.Trim()).Where(y => y.Length > 0).ToList<string>(); 595return sdkSimpleName.Length > 0 && parsedVersion; 1193sdkConfiguration = sdkConfiguration.Length > 0 ? sdkConfiguration : targetConfiguration; 1195string sdkArchitecture = ReferenceItem.GetMetadata(TargetedSDKArchitecture).Length > 0 ? ReferenceItem.GetMetadata(TargetedSDKArchitecture) : targetArchitecture; 1196sdkArchitecture = sdkArchitecture.Length > 0 ? sdkArchitecture : targetArchitecture;
ResourceHandling\MSBuildResXReader.cs (2)
349if (lastIndexOfQuote + 2 > stringValue.Length) 365if (nextSemiColumn + 1 > stringValue.Length)
src\msbuild\src\Shared\AssemblyFolders\AssemblyFoldersEx.cs (3)
370if ((version.Length > 0) && version[0] is 'v' or 'V') 378if (String.Compare(version, 0, targetRuntimeVersion, 0, targetRuntimeVersion.Length, StringComparison.OrdinalIgnoreCase) == 0) 409if (String.Compare(version, 0, targetRuntimeVersion, 0, targetRuntimeVersion.Length, StringComparison.OrdinalIgnoreCase) == 0)
src\msbuild\src\Shared\CanonicalError.cs (2)
299if (message.Length > 400) 427if (location.Length > 0)
src\msbuild\src\Shared\LanguageParser\tokenCharReader.cs (3)
151if (_sources.IsPastEnd(_position + match.Length - 1)) 156string compare = _sources.Substring(_position, match.Length); 165Skip(match.Length);
src\msbuild\src\Shared\LanguageParser\VisualBasictokenEnumerator.cs (1)
170current.InnerText = identifierOrKeyword.Substring(1, identifierOrKeyword.Length - 2);
src\msbuild\src\Shared\PropertyParser.cs (2)
57if (propertyName.Length == 0) 110if (propertyName.Length == 0)
System.Design.cs (1)
142if (value?.Length > 1024)
system.design\stronglytypedresourcebuilder.cs (4)
350if (resourcesNamespace.Length > 0) 527if (commentString.Length > DocCommentLengthThreshold) 778if ((key.Length > 0 && key[0] == '$') || 779(key.Length > 1 && key[0] == '>' && key[1] == '>'))
TarDirectory.cs (1)
345string relativePath = info.FullName.Substring(basePath.Length);
Untar.cs (1)
297if (tarEntry.EntryType is TarEntryType.Directory || Path.GetFileName(destinationPath.FullName).Length == 0)
Unzip.cs (1)
196if (Path.GetFileName(destinationPath.FullName).Length == 0)
WriteCodeFragment.cs (6)
105if (code.Length == 0) 232name.AsSpan("_Parameter".Length), 333var parameterNameKey = key.Substring(0, key.Length - TypeNameSuffix.Length); 364var parameterNameKey = key.Substring(0, key.Length - IsLiteralSuffix.Length);
Microsoft.Build.Tasks.Git (54)
GitDataReader\GitConfig.cs (1)
164switch (str[str.Length - 1])
GitDataReader\GitConfig.Reader.cs (9)
276if (relativePath.Length >= 2 && relativePath[0] == '~' && PathUtils.IsDirectorySeparator(relativePath[1])) 318pattern = key.SubsectionName[caseSensitiveGitDirPrefix.Length..]; 323pattern = key.SubsectionName[caseInsensitiveGitDirPrefix.Length..]; 331if (pattern.Length >= 2 && pattern[0] == '.' && pattern[1] == '/') 336else if (pattern.Length >= 2 && pattern[0] == '~' && pattern[1] == '/') 346if (pattern[pattern.Length - 1] == '/') 411var prefix = (firstDot == name.Length - 1) ? name : name[..firstDot]; 414subsectionName = (subsectionName.Length > 0) ? suffix + "." + subsectionName : suffix; 462if (name.Length == 0)
GitDataReader\GitIgnore.cs (2)
158var e = line.Length - 1; 173if (e < line.Length && line[e] == ' ' && line[e - 1] == '\\')
GitDataReader\GitIgnore.Matcher.cs (3)
58var parentDirectory = directory[..(directory.LastIndexOf('/', directory.Length - 2, directory.Length - 1) + 1)]; 225lazyRelativePath ??= normalizedPosixPath[patternGroup.ContainingDirectory.Length..] :
GitDataReader\GitReferenceResolver.cs (4)
119if (line.Length > 0 && line[0] == '^') 152if (reference.Length == 0) 252name = reference[refPrefix.Length..]; 396=> reference.Length == _objectNameFormat.HashSize * 2 && reference.All(CharUtils.IsHexadecimalDigit);
GitDataReader\GitRepository.cs (1)
444var link = content[GitDirPrefix.Length..].TrimEnd(CharUtils.AsciiWhitespace);
GitDataReader\GitVariableName.cs (1)
42=> (SubsectionName.Length == 0) ?
GitDataReader\Glob.cs (15)
38while (patternIndex < pattern.Length) 45var isDoubleAsterisk = patternIndex < pattern.Length && pattern[patternIndex] == '*' && 46(patternIndex == pattern.Length - 1 || pattern[patternIndex + 1] == '/') && 52if (patternIndex == pattern.Length - 1) 77if (patternIndex == pattern.Length) 118matching = pathIndex < path.Length && (matchWildCardWithDirectorySeparator || path[pathIndex] != '/'); 123matching = pathIndex < path.Length && IsRangeMatch(pattern, ref patternIndex, path[pathIndex], ignoreCase, matchWildCardWithDirectorySeparator); 127if (c == '\\' && patternIndex < pattern.Length) 133matching = pathIndex < path.Length && equal(c, path[pathIndex]); 146if (!stopAtPathSlash || pathIndex < path.Length && path[pathIndex] == '/') 174if (pathIndex >= path.Length) 186return pathIndex == path.Length; 193if (patternIndex == pattern.Length) 214while (patternIndex < pattern.Length) 230if (patternIndex + 1 < pattern.Length && pattern[patternIndex] == '-' && (d = pattern[patternIndex + 1]) != ']')
GitDataReader\PathUtils.cs (8)
30=> path.Length > 0 && path[path.Length - 1] == '/'; 33=> path.Length > 0 && (path[path.Length - 1] == '/' || path[path.Length - 1] == '\\'); 54var c = root[root.Length - 1]; 93return path.Length >= 2 && 104return path.Length >= 3 && path[1] == VolumeSeparatorChar && IsDirectorySeparator(path[2]);
GitOperations.cs (5)
129if (prefix.Length > longestPrefixLength && url.StartsWith(prefix, StringComparison.Ordinal)) 131longestPrefixLength = prefix.Length; 174if (url.Length == 2 && IsWindowsAbsoluteOrDriveRelativePath(url)) 210value.Length >= 2 && 225if (colon + 2 < value.Length && value[colon + 1] == '/' && value[colon + 2] == '/')
src\sourcelink\src\Common\Utilities\Hash.cs (1)
294return GetFNVHashCode(text, start, length: text.Length - start);
src\sourcelink\src\Common\Utilities\PathUtilities.cs (1)
44var last = path[path.Length - 1];
src\sourcelink\src\Common\Utilities\UriUtilities.cs (3)
44if (relativeUrl.Length == 0 || relativeUrl == "/") 59var end = relativeUrl.Length - 1; 66return !parts.Any(part => part.Length == 0);
Microsoft.Build.Utilities.Core (14)
CommandLineBuilder.cs (1)
340if (fileName.Length != 0 && fileName[0] == '-')
SDKManifest.cs (1)
373if (value.Length > 0)
src\msbuild\src\Shared\AssemblyFolders\AssemblyFoldersEx.cs (3)
370if ((version.Length > 0) && version[0] is 'v' or 'V') 378if (String.Compare(version, 0, targetRuntimeVersion, 0, targetRuntimeVersion.Length, StringComparison.OrdinalIgnoreCase) == 0) 409if (String.Compare(version, 0, targetRuntimeVersion, 0, targetRuntimeVersion.Length, StringComparison.OrdinalIgnoreCase) == 0)
src\msbuild\src\Shared\CanonicalError.cs (2)
299if (message.Length > 400) 427if (location.Length > 0)
ToolLocationHelper.cs (2)
2901if (userLocalAppData.Length > 0) 3849if (folder.Name.Length >= 4 && folder.Name.StartsWith("v", StringComparison.OrdinalIgnoreCase))
ToolTask.cs (5)
548bool isOnlyFileName = Path.GetFileName(pathToTool).Length == pathToTool.Length; 653if (commandLine.Length > 32000) 715if (nameValuePair.Length == 2 && nameValuePair[0].Length > 0) 1469if (nameValuePair.Length == 1 || (nameValuePair.Length == 2 && nameValuePair[0].Length == 0))
Microsoft.CodeAnalysis (275)
CaseInsensitiveComparison.cs (14)
111int len = Math.Min(str1.Length, str2.Length); 122return str1.Length - str2.Length; 158if (str1.Length != str2.Length) 163for (int i = 0; i < str1.Length; i++) 204int i = value.Length - 1; 205int j = possibleEnd.Length - 1; 238if (value.Length < possibleStart.Length) 243for (int i = 0; i < possibleStart.Length; i++) 258for (int i = 0; i < str.Length; i++) 375if (value.Length == 0)
CodeAnalysisEventSource.Common.cs (1)
197Size = (value.Length + 1) * sizeof(char),
CodeGen\ILBuilderEmit.cs (1)
747bool success = (value.Length > module.CommonCompilation.DataSectionStringLiteralThreshold)
CodeGen\PrivateImplementationDetails.cs (1)
351previousText[..Math.Min(previousText.Length, 500)]));
Collections\Rope.cs (3)
52if (_currentString != null && _index < _currentString.Length) 162wrote = Math.Min(maxLength, _value.Length); 166public override int Length => _value.Length;
CommandLine\AnalyzerConfig.cs (2)
107(e1, e2) => e1.NormalizedDirectory.Length.CompareTo(e2.NormalizedDirectory.Length));
CommandLine\AnalyzerConfig.SectionNameMatching.cs (3)
484public bool IsDone => Position >= _sectionName.Length; 494if (nextPos < _sectionName.Length && 602return str.Length == 0 || str == "-"
CommandLine\AnalyzerConfigSet.cs (5)
217int dirLength = config.NormalizedDirectory.Length; 407diagIdLength = key.Length - (diagnosticOptionPrefix.Length + diagnosticOptionSuffix.Length); 412ReadOnlyMemory<char> idSlice = key.AsMemory().Slice(diagnosticOptionPrefix.Length, diagIdLength);
CommandLine\CommandLineParser.cs (20)
104if (optionName.Length != value.Length) 107for (int i = 0; i < optionName.Length; i++) 184if (arg.Length > 1 && arg[0] != '-') 248int versionParameterDesignatorLength = versionParameterDesignator.Length; 251part.Length > versionParameterDesignatorLength && 336int length = path.Length; 375if (from.Length == 0 || to.Length == 0) 397if (str.Length == 0) 407while (i < str.Length) 412if (i < str.Length && str[i] == separator) 461PathUtilities.ChangeExtension(outputFileName, extension: null).Length == 0) 786if (arg.Length == 0 || !(arg[0] == '/' || arg[0] == '-')) 797if (arg.Length > optionName.Length) 799if (!(arg[optionName.Length] == ':' || arg[optionName.Length] == '=')) 805optionValue = arg.Substring(optionName.Length + 1).Trim('"'); 1408=> pathMap.Sort((x, y) => -x.Key.Length.CompareTo(y.Key.Length));
CommandLine\CommonCompiler.cs (1)
1753return diagnosticId.StartsWith(expectedPrefix, StringComparison.Ordinal) && uint.TryParse(diagnosticId.Substring(expectedPrefix.Length), out code);
CommandLine\SarifV1ErrorLogger.cs (1)
49if (culture.Name.Length > 0)
CommandLine\SarifV2ErrorLogger.cs (1)
220if (_culture.Name.Length > 0)
Compilation\SubsystemVersion.cs (1)
96if (str.Length == index + 1)
CvtRes.cs (11)
693cbKey = (lpszKey.Length + 1) * 2; // Make room for the NULL 694cbValue = (lpszValue.Length + 1) * 2; 706int cbKey = (keyValuePair.Key.Length + 1) * 2; // includes terminating NUL 707int cbVal = (keyValuePair.Value.Length + 1) * 2; // includes terminating NUL 713writer.Write((WORD)(keyValuePair.Value.Length + 1)); //add 1 for nul 734return PadKeyLen((sz.Length + 1) * sizeof(WCHAR)) / sizeof(WCHAR); 811writer.Write(new byte[KEYBYTES(vsVersionInfoKey) - vsVersionInfoKey.Length * 2]); 818writer.Write(new byte[KEYBYTES(varFileInfoKey) - varFileInfoKey.Length * 2]); //padding 824writer.Write(new byte[KEYBYTES(translationKey) - translationKey.Length * 2]); //padding 834writer.Write(new byte[KEYBYTES(stringFileInfoKey) - stringFileInfoKey.Length * 2]); //padding. 840writer.Write(new byte[KEYBYTES(_langIdAndCodePageKey) - _langIdAndCodePageKey.Length * 2]); //padding
Desktop\DesktopAssemblyIdentityComparer.cs (1)
203return identity.CultureName.Length != 0
DiagnosticAnalyzer\SuppressMessageAttributeState.TargetSymbolResolver.cs (9)
54return id[prefix.Length..]; 86if (_name.Length >= 2 && _name[0] == 'e' && _name[1] == ':') 257if (callingConvention == _name.Substring(_index, callingConvention.Length)) 259_index += callingConvention.Length; 281_index = _name.Length; 289return _index >= _name.Length ? '\0' : _name[_index]; 296while (_index < _name.Length && char.IsDigit(_name[_index])) 456for (; _index < _name.Length && _name[_index] != '}'; ++_index) { } 463for (; _index < _name.Length; ++_index)
DiaSymReader\Metadata\SymWriterMetadataAdapter.cs (1)
111int adjustedLength = Math.Min(nameStr.Length, nameBufferLength - 1);
DiaSymReader\Utilities\InteropUtilities.cs (6)
45int fullLength = (namespaceStr.Length > 0 ? namespaceStr.Length + 1 : 0) + nameStr.Length; 64if (namespaceStr.Length > 0) 66for (int i = 0; i < namespaceStr.Length && dst < dstEndPtr; i++) 79for (int i = 0; i < nameStr.Length && dst < dstEndPtr; i++)
DiaSymReader\Writer\SymUnmanagedWriterImpl.cs (2)
433while (i < str.Length) 440if (i < str.Length && char.IsLowSurrogate(str[i]))
DocumentationCommentId.cs (8)
227if (id.Length > 1 && id[0] == 'N' && id[1] == ':') 250if (id.Length > 1 && id[0] == 'N' && id[1] == ':') 299name = name.Substring(0, name.Length - 6) + "Item"; 316name = name.Substring(0, name.Length - 4) + "this[]"; 737if (id.Length < 2) 1582return index >= id.Length ? '\0' : id[index]; 1600index = id.Length; 1621while (index < id.Length && char.IsDigit(id[index]))
DocumentationComments\XmlDocumentationCommentTextReader.XmlStream.cs (9)
64_position = RootStart.Length; 108_position += EncodeAndAdvance(CurrentStart, _position - RootStart.Length, buffer, ref index, ref count); 111_position += EncodeAndAdvance(_text, _position - RootStart.Length - CurrentStart.Length, buffer, ref index, ref count); 114_position += EncodeAndAdvance(CurrentEnd, _position - RootStart.Length - CurrentStart.Length - _text.Length, buffer, ref index, ref count); 129if (destCount == 0 || srcIndex < 0 || srcIndex >= src.Length) 134int charCount = Math.Min(src.Length - srcIndex, destCount);
EmbeddedText.cs (2)
54Debug.Assert(filePath.Length > 0); 202if (filePath.Length == 0)
FileSystem\FileUtilities.cs (2)
136if (path!.Length == 1) 178Debug.Assert(path.Length == 1 || !PathUtilities.IsDirectorySeparator(path[1]));
FileSystem\PathUtilities.cs (36)
55int lastSeparator = s.Length; 61if (lastSeparator != s.Length) 74if (s.Length == 0 || IsAnyDirectorySeparator(s[s.Length - 1])) 163var rootLength = GetPathRoot(path, isUnixLike).Length; 164if (path.Length > rootLength) 166var i = path.Length; 237int length = path.Length; 312return path.Length > 0 && IsDirectorySeparator(path[0]) 339if (path.Length > 0 && path[0] == '.') 341if (path.Length == 1 || IsDirectorySeparator(path[1])) 348if (path.Length == 2 || IsDirectorySeparator(path[2])) 359if (path.Length >= 1 && IsDirectorySeparator(path[0])) 366if (path.Length >= 2 && path[1] == VolumeSeparatorChar && (path.Length <= 2 || !IsDirectorySeparator(path[2]))) 400return path.Length >= 2 && 411return path.Length >= 3 && path[1] == VolumeSeparatorChar && IsDirectorySeparator(path[2]); 465char c = root[root.Length - 1]; 504if (path.Length > 0 && IsDirectorySeparator(path[path.Length - 1])) 506return path.Substring(0, path.Length - 1); 633return parentPath.Length > 0 634&& childPath.Length > parentPath.Length 635&& PathsEqual(childPath, parentPath, parentPath.Length) 636&& (IsDirectorySeparator(parentPath[parentPath.Length - 1]) || IsDirectorySeparator(childPath[parentPath.Length])); 641var relativePath = childPath.Substring(parentPath.Length); 644int start = ConsumeDirectorySeparators(relativePath, relativePath.Length, 0); 673return PathsEqual(path1, path2, Math.Max(path1.Length, path2.Length)); 681if (path1.Length < length || path2.Length < length) 741if (!(oldPrefix?.Length > 0)) continue; 750var replacement = replacementPrefix + filePath.Substring(oldPrefix.Length); 870if (!isDriveRooted && !(p.Length > 1 && p[0] == AltDirectorySeparatorChar))
InternalUtilities\CompilerOptionParseUtilities.cs (1)
42if (Environment.GetEnvironmentVariable(CachePathEnvironmentVariable) is not { Length: > 0 } cachePath)
InternalUtilities\FileNameUtilities.cs (6)
122if (path.Length > 0 && path[path.Length - 1] == '.') 124return path.Substring(0, path.Length - 1); 149if (extension == null || path.Length == 0) 154if (extension.Length == 0 || extension[0] != '.') 173for (int i = path.Length - 1; i >= 0; i--)
InternalUtilities\JsonWriter.cs (1)
272for (int i = 0; i < value.Length; i++)
InternalUtilities\StringExtensions.cs (14)
41return name.Length >= 3 && name[0] == 'I' && char.IsUpper(name[1]) && char.IsLower(name[2]); 46return name.Length >= 3 && name[0] == 'T' && char.IsUpper(name[1]) && char.IsLower(name[2]); 154result = name[..^AttributeSuffix.Length]; 168return name.Length > AttributeSuffix.Length && name.EndsWith(AttributeSuffix, comparison); 174while (i < str.Length) 181if (i < str.Length && char.IsLowSurrogate(str[i])) 211if (arg.Length > 1 && arg[0] == '"' && arg[arg.Length - 1] == '"') 214return arg.Substring(1, arg.Length - 2); 226while (x < string1.Length && x < string2.Length && 238while (x < string1.Length && x < string2.Length &&
InternalUtilities\StringTable.cs (4)
481if (array.Length != length) 487for (var i = 0; i < array.Length; i++) 500if (array.Length != text.Length) 538if (ascii.Length != text.Length)
InternalUtilities\UnicodeCharacterUtilities.cs (1)
103int nameLength = name.Length;
MetadataReader\MetadataDecoder.cs (3)
516MetadataTypeName mdName = @namespace.Length > 0 560Debug.Assert(fullName.NamespaceName.Length == 0); 670mdName = namespaceName.Length > 0
MetadataReader\MetadataHelpers.cs (16)
124if (i <= _input.Length) 134return _offset >= _input.Length; 281typeNameBuilder.Append(DecodeGenericName(_input.Length)); 301if (decodedTypeName.Length != 0) 325Debug.Assert(i == _input.Length || s_typeNameDelimiters.Contains(_input[i])); 416i = _input.Length; 421i = _input.Length; 599Debug.Assert(suffixStartsAt > 0 && suffixStartsAt < emittedTypeName.Length - 1); 694for (int i = 0; i < pstrName.Length; i++) 825while (pair.Key.Length == namespaceNameLength) 1023if (name.Length == 0) 1068return fullyQualified.Length == namespaceName.Length + typeName.Length + 1 && 1069fullyQualified[namespaceName.Length] == MetadataHelpers.DotDelimiter && 1097var byteLength = value.Length * 2 + 1;
MetadataReader\MetadataReaderExtensions.cs (1)
27var parts = version.Substring(prefix.Length).Split('.');
MetadataReader\ModuleExtensions.cs (4)
165for (index = prefix.Length; index < emittedMethodName.Length; index++) 173if (index == prefix.Length || 174index >= emittedMethodName.Length - 1 ||
MetadataReader\PEModule.cs (3)
531Debug.Assert(name.Length == 0 || MetadataHelpers.IsValidMetadataIdentifier(name)); // Obfuscated assemblies can have types with empty names. 546if (namespaceName.Length > 0) 3897if (namespaceString.Length > 0)
MetadataReference\AssemblyIdentity.DisplayName.cs (18)
93if (_cultureName.Length == 0) 244while (position < displayName.Length) 260if (position >= displayName.Length || displayName[position] != '=') 457if (i == displayName.Length) 481int valueEnd = displayName.Length; 486if (i >= displayName.Length) 488i = displayName.Length; 535while (i < displayName.Length) 552Debug.Assert(i == displayName.Length || IsNameTokenTerminator(displayName[i])); 602Debug.Assert(str.Length > 0); 619char c = (i < str.Length) ? str[i++] : '\0'; 690if (value.Length != (PublicKeyTokenBytes * 2) || !TryParseHexBytes(value, out result)) 702if (value.Length == 0 || (value.Length % 2) != 0) 708var length = value.Length / 2; 762if (IsWhiteSpace(name[0]) || IsWhiteSpace(name[name.Length - 1])) 768for (int i = 0; i < name.Length; i++) 835if (i == str.Length)
NativePdbWriter\PdbWriter.cs (1)
394if (namespaceName.Length != 0)
PEWriter\CustomDebugInfoWriter.cs (1)
232local.Name.Length < CustomDebugInfoEncoder.IdentifierSize;
PEWriter\MetadataWriter.cs (5)
1338if (namespaceName.Length == 0) // Optimization: CheckNamespaceLength is relatively expensive. 1379if (namespaceName.Length + 1 + mangledTypeName.Length > NameLengthLimit / 3) 1429if (str.Length < maxLength / 3) //UTF-8 uses at most 3 bytes per char 3371Debug.Assert(guidStringLength == default(Guid).ToString().Length);
PEWriter\MetadataWriter.DynamicAnalysis.cs (1)
254for (int i = 0; i < str.Length; i++)
PEWriter\NativeResourceWriter.cs (1)
305dataWriter.WriteUInt16((ushort)name.Length);
PEWriter\SigningUtilities.cs (1)
57keySize = (assembly.SignatureKey == null) ? 0 : assembly.SignatureKey.Length / 2;
PEWriter\TypeNameSerializer.cs (2)
69if (name.Length != 0) 279if (name.Length != 0)
RealParser.cs (9)
286public uint MantissaCount => (uint)Mantissa.Length; 297while (i < source.Length && source[i] == '0') i++; 299while (i < source.Length && source[i] >= '0' && source[i] <= '9') 314if (i < source.Length && source[i] == '.') 317while (i < source.Length && source[i] >= '0' && source[i] <= '9') 334if (i < source.Length && (source[i] == 'e' || source[i] == 'E')) 339if (i < source.Length && (source[i] == '-' || source[i] == '+')) 346while (i < source.Length && source[i] >= '0' && source[i] <= '9') lastExponent = ++i; 385if (data.Mantissa.Length == 0)
ReferenceManager\CommonReferenceManager.Resolution.cs (1)
872string? basePath = (tree != null && tree.FilePath.Length > 0) ? tree.FilePath : null;
SourceFileResolver.cs (1)
66if (key == null || key.Length == 0)
SourceGeneration\AdditionalSourcesCollection.cs (2)
37Debug.Assert(fileExtension.Length > 0 && fileExtension[0] == '.'); 52for (int i = 0; i < hintName.Length; i++)
SourceGeneration\Nodes\SyntaxValueProvider_ForAttributeWithSimpleName.cs (3)
305return name.Length + "Attribute".Length == matchAgainst.Length &&
src\roslyn\src\Dependencies\CodeAnalysis.Debugging\CustomDebugInfoEncoder.cs (2)
153Debug.Assert(info.LocalName.Length <= IdentifierSize); 160builder.WriteBytes(0, sizeof(char) * (IdentifierSize - info.LocalName.Length));
src\roslyn\src\Dependencies\CodeAnalysis.Debugging\CustomDebugInfoReader.cs (7)
504if (importString.Length >= 2 && importString[0] == '@') 558return import.Length > 0 && import[0] == 'Z'; 691if (import.Length == 0) 725if (pos >= import.Length) 743if (pos >= import.Length) 831if (offset <= separatorPos && separatorPos < input.Length) 834after = separatorPos + 1 == input.Length
src\roslyn\src\Dependencies\Collections\Extensions\IEnumerableExtensions.cs (2)
213return str.Length == 0; 236return source.Length == 0;
StrongName\StrongNameKeys.cs (1)
229if (string.IsNullOrEmpty(publicKey) || publicKey.Length % 2 != 0)
Symbols\Attributes\CommonAttributeData.cs (2)
101int index = namespaceName.Length; 126index -= name.Length;
Syntax\SyntaxDiffer.cs (2)
440w += text1.Length; 498w += tokenText.Length;
Syntax\SyntaxTreeExtensions.cs (2)
95var n1 = s1.Length; 96var n2 = s2.Length;
Text\LargeTextWriter.cs (1)
64var count = value.Length;
Text\SourceText.cs (2)
799where !c.Span.IsEmpty || c.NewText?.Length > 0 808var newTextLength = change.NewText?.Length ?? 0;
Text\StringText.cs (2)
47public override int Length => _source.Length; 73if (span.End > this.Source.Length)
Text\TextChange.cs (3)
92return new TextChangeRange(change.Span, change.NewText.Length); 105{ Length: < 10 } => $"\"{NewText}\"", 106{ Length: var length } => $"(NewLength = {length})"
Text\TextChangeRangeExtensions.cs (1)
105return new TextChangeRange(textChange.Span, textChange.NewText?.Length ?? 0);
VersionHelper.cs (1)
122for (var idx = 0; idx < elements[i].Length; idx++)
Xml\XmlCharType.cs (6)
1090for (int i = 0; i < str.Length; i++) 1105for (int i = 0; i < str.Length; i++) 1109if (i + 1 >= str.Length || !(XmlCharType.IsHighSurrogate(str[i]) && XmlCharType.IsLowSurrogate(str[i + 1]))) 1126Debug.Assert(startPos + len <= str.Length); 1127Debug.Assert(startPos <= str.Length); 1159for (int i = 0; i < str.Length; i++)
Microsoft.CodeAnalysis.Analyzers (213)
MetaAnalyzers\DiagnosticDescriptorCreationAnalyzer_IdRangeAndCategoryValidation.cs (3)
90var suffix = ruleId[allowedIds.prefix.Length..]; 246if (contents.Length == 0 || contents.StartsWith("#", StringComparison.Ordinal)) 383return prefix.Length > 0 && int.TryParse(suffixStr.ToString(), out suffix);
MetaAnalyzers\DiagnosticDescriptorCreationAnalyzer_ReleaseTracking.cs (1)
371ruleId.Length > 2 &&
MetaAnalyzers\DiagnosticDescriptorCreationAnalyzer_ResourceStringsFormat.cs (5)
97valueTagPrefix.Length; 98var valueLength = valueElementStr.Length - (valueTagPrefix.Length + valueTagSuffix.Length); 103var value = valueElementStr.Substring(valueTagPrefix.Length, valueLength);
MetaAnalyzers\DiagnosticDescriptorCreationAnalyzer.cs (5)
999if (part.TrimEnd().Length == part.Length && 1019=> s.Trim().Length != s.Length; 1291if (ruleId.Length < 3)
MetaAnalyzers\ReleaseTrackingHelper.cs (1)
77string versionString = lineText[ReleasePrefix.Length..].Trim();
src\roslyn\src\Compilers\Core\Portable\FileSystem\FileUtilities.cs (2)
136if (path!.Length == 1) 178Debug.Assert(path.Length == 1 || !PathUtilities.IsDirectorySeparator(path[1]));
src\roslyn\src\Compilers\Core\Portable\FileSystem\PathUtilities.cs (36)
55int lastSeparator = s.Length; 61if (lastSeparator != s.Length) 74if (s.Length == 0 || IsAnyDirectorySeparator(s[s.Length - 1])) 163var rootLength = GetPathRoot(path, isUnixLike).Length; 164if (path.Length > rootLength) 166var i = path.Length; 237int length = path.Length; 312return path.Length > 0 && IsDirectorySeparator(path[0]) 339if (path.Length > 0 && path[0] == '.') 341if (path.Length == 1 || IsDirectorySeparator(path[1])) 348if (path.Length == 2 || IsDirectorySeparator(path[2])) 359if (path.Length >= 1 && IsDirectorySeparator(path[0])) 366if (path.Length >= 2 && path[1] == VolumeSeparatorChar && (path.Length <= 2 || !IsDirectorySeparator(path[2]))) 400return path.Length >= 2 && 411return path.Length >= 3 && path[1] == VolumeSeparatorChar && IsDirectorySeparator(path[2]); 465char c = root[root.Length - 1]; 504if (path.Length > 0 && IsDirectorySeparator(path[path.Length - 1])) 506return path.Substring(0, path.Length - 1); 633return parentPath.Length > 0 634&& childPath.Length > parentPath.Length 635&& PathsEqual(childPath, parentPath, parentPath.Length) 636&& (IsDirectorySeparator(parentPath[parentPath.Length - 1]) || IsDirectorySeparator(childPath[parentPath.Length])); 641var relativePath = childPath.Substring(parentPath.Length); 644int start = ConsumeDirectorySeparators(relativePath, relativePath.Length, 0); 673return PathsEqual(path1, path2, Math.Max(path1.Length, path2.Length)); 681if (path1.Length < length || path2.Length < length) 741if (!(oldPrefix?.Length > 0)) continue; 750var replacement = replacementPrefix + filePath.Substring(oldPrefix.Length); 870if (!isDriveRooted && !(p.Length > 1 && p[0] == AltDirectorySeparatorChar))
src\roslyn\src\Compilers\Core\Portable\InternalUtilities\CompilerOptionParseUtilities.cs (1)
42if (Environment.GetEnvironmentVariable(CachePathEnvironmentVariable) is not { Length: > 0 } cachePath)
src\roslyn\src\Compilers\Core\Portable\InternalUtilities\FileNameUtilities.cs (6)
122if (path.Length > 0 && path[path.Length - 1] == '.') 124return path.Substring(0, path.Length - 1); 149if (extension == null || path.Length == 0) 154if (extension.Length == 0 || extension[0] != '.') 173for (int i = path.Length - 1; i >= 0; i--)
src\roslyn\src\Compilers\Core\Portable\InternalUtilities\StringExtensions.cs (14)
41return name.Length >= 3 && name[0] == 'I' && char.IsUpper(name[1]) && char.IsLower(name[2]); 46return name.Length >= 3 && name[0] == 'T' && char.IsUpper(name[1]) && char.IsLower(name[2]); 154result = name[..^AttributeSuffix.Length]; 168return name.Length > AttributeSuffix.Length && name.EndsWith(AttributeSuffix, comparison); 174while (i < str.Length) 181if (i < str.Length && char.IsLowSurrogate(str[i])) 211if (arg.Length > 1 && arg[0] == '"' && arg[arg.Length - 1] == '"') 214return arg.Substring(1, arg.Length - 2); 226while (x < string1.Length && x < string2.Length && 238while (x < string1.Length && x < string2.Length &&
src\roslyn\src\Compilers\Core\Portable\InternalUtilities\StringTable.cs (5)
481if (array.Length != length) 487for (var i = 0; i < array.Length; i++) 500if (array.Length != text.Length) 517for (var i = array.Length - 1; i >= 0; i--) 538if (ascii.Length != text.Length)
src\roslyn\src\Compilers\Core\Portable\InternalUtilities\UnicodeCharacterUtilities.cs (1)
103int nameLength = name.Length;
src\roslyn\src\Compilers\Core\Portable\Syntax\SyntaxTreeExtensions.cs (2)
95var n1 = s1.Length; 96var n2 = s2.Length;
src\roslyn\src\Compilers\Core\Portable\Text\TextChangeRangeExtensions.cs (1)
105return new TextChangeRange(textChange.Span, textChange.NewText?.Length ?? 0);
src\roslyn\src\Dependencies\Collections\Extensions\IEnumerableExtensions.cs (2)
213return str.Length == 0; 236return source.Length == 0;
src\roslyn\src\RoslynAnalyzers\Microsoft.CodeAnalysis.BannedApiAnalyzers\Core\DocumentationCommentIdParser.cs (4)
20if (id.Length < 2) 82=> index >= id.Length ? '\0' : id[index]; 97index = id.Length; 105while (index < id.Length && char.IsDigit(id[index]))
src\roslyn\src\RoslynAnalyzers\Microsoft.CodeAnalysis.BannedApiAnalyzers\Core\SymbolIsBannedAnalyzerBase.cs (1)
499else if (index == text.Length - 1)
src\roslyn\src\RoslynAnalyzers\Utilities\Compiler\CodeMetrics\CodeAnalysisMetricData.cs (1)
141if (index >= 0 && index < symbolName.Length)
src\roslyn\src\RoslynAnalyzers\Utilities\Compiler\Extensions\StringExtensions.cs (1)
15return Encoding.UTF8.GetByteCount(value) == value.Length;
src\roslyn\src\RoslynAnalyzers\Utilities\Compiler\Options\AnalyzerOptionsExtensions.cs (2)
357if (trimmedSuffix.Length >= 2 && 361for (int i = 1; i < trimmedSuffix.Length - 2; i++)
src\roslyn\src\RoslynAnalyzers\Utilities\Compiler\Options\SymbolNamesWithValueOption.cs (2)
109parts.SymbolName.Length == 1)) 145Debug.Assert(parts.SymbolName.Length >= 2);
src\roslyn\src\RoslynAnalyzers\Utilities\Compiler\RulesetToEditorconfigConverter.cs (2)
208if (comment.Length > 0) 213if (trimmedCommentPart.Length > 0)
src\roslyn\src\RoslynAnalyzers\Utilities\Compiler\WellKnownTypeProvider.cs (1)
220for (int i = 0; i < fullTypeName.Length; i++)
src\roslyn\src\RoslynAnalyzers\Utilities\Compiler\WordParser.cs (3)
108_buffer = new StringBuilder(text.Length); 556while (_index < _text.Length) 574for (int index = _index; index < _text.Length; index++)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\CodeGeneration\ParameterName.cs (1)
42BestNameForParameter = trimmed.Length > 0 ? tryMakeCamelCase ? trimmed.ToCamelCase() : trimmed : nameBasedOnArgument;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\VirtualChars\AbstractVirtualCharService.cs (8)
30if (index + 1 < tokenText.Length) 118Debug.Assert(lastVC.Span.End == token.Span.End - "\"".Length, "Last span has to end right before the end of the string token."); 122Debug.Assert(lastVC.Span.End == token.Span.End - "\"u8".Length, "Last span has to end right before the end of the string token."); 145if (startDelimiter.Length > 0 && !tokenText.StartsWith(startDelimiter, StringComparison.Ordinal)) 151if (endDelimiter.Length > 0 && !tokenText.EndsWith(endDelimiter, StringComparison.Ordinal)) 157var startIndexInclusive = startDelimiter.Length; 158var endIndexExclusive = tokenText.Length - endDelimiter.Length;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\VirtualChars\AbstractVirtualCharService.ITextInfo.cs (1)
30public readonly int Length(string text) => text.Length;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\VirtualChars\VirtualCharGreenSequence.Chunks.cs (2)
78public override int Length => data.Length; 83return stringIndex >= 0 && stringIndex < data.Length ? stringIndex : null;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\StringExtensions.cs (13)
18for (var i = 0; i < line.Length; i++) 33for (var i = line.Length - 1; i >= 0; i--) 61return lastOffset.HasValue && lastOffset.Value < lineText.Length 71return lineText.GetColumnFromLineOffset(lineText.Length, tabSize); 74return text.ConvertTabToSpace(tabSize, initialColumn, text.Length) + initialColumn; 80Debug.Assert(endPosition >= 0 && endPosition <= textSnippet.Length); 107for (var i = 0; i < text.Length; i++) 156for (var i = 0; i < text.Length; i++) 164if (i + 1 == text.Length || text[i + 1] != '\n') 202return line.GetColumnFromLineOffset(line.Length, tabSize); 209Contract.ThrowIfFalse(0 <= endPosition && endPosition <= line.Length); 223for (var i = 0; i < line.Length; i++) 241return line.Length;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\TokenStream.cs (2)
337length = text.ConvertTabToSpace(_options.TabSize, initialColumn, text.Length); 341length = text.Length;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\TreeData.Node.cs (1)
30return lineText.GetColumnFromLineOffset(lineText.Length, tabSize);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\FormattingExtensions.cs (9)
130spaceOrIndentation = indentationString.GetColumnFromLineOffset(indentationString.Length, tabSize); 136spaceOrIndentation = text.ConvertTabToSpace(tabSize, baseToken.ToString().GetTextColumn(tabSize, initialColumn), text.Length); 156nonWhitespaceCharIndex = triviaText.Length; 164builder.Append(triviaText, nonWhitespaceCharIndex, triviaText.Length - nonWhitespaceCharIndex); 201builder.Append(line, nonWhitespaceCharIndex, line.Length - nonWhitespaceCharIndex); 226for (var i = 0; i < text.Length; i++) 245if (i >= newText.Length || text[i] != newText[i]) 252if (i == span.Length && text.Length == newText.Length)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\TriviaEngine\AbstractTriviaFormatter.cs (6)
145for (var i = 0; i < text.Length; i++) 611var tokenPosition = lastText.ConvertTabToSpace(Options.TabSize, initialColumn, lastText.Length); 741for (var i = this.OriginalString.Length - 1; i >= 0; i--) 889spaces: text.ConvertTabToSpace(Options.TabSize, lineColumn.With(whitespaceBetween).Column, text.Length), 925spaces: lineText.GetColumnFromLineOffset(lineText.Length, Options.TabSize), 931spaces: text.ConvertTabToSpace(Options.TabSize, initialColumn, text.Length),
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\Naming\IdentifierNameParts.cs (2)
47? newBaseName[prefix.Length..] 53? newBaseName[..^suffix.Length]
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\NamingStyle.cs (19)
89if (word.Length == 0) 107if (word.Length == 0) 137if (name.Length <= Prefix.Length + Suffix.Length) 147name = StripCommonPrefixes(name[Prefix.Length..], out var prefix); 160var spanToCheck = TextSpan.FromBounds(0, name.Length - Suffix.Length); 311name = StripCommonPrefixes(name.StartsWith(Prefix) ? name[Prefix.Length..] : name, out _); 346while (index + 1 < name.Length) 353if (index + 2 < name.Length && name[index + 1] == '_') 362if (index + 1 < name.Length && !char.IsDigit(name[index + 1])) 385if (Suffix.Length + Prefix.Length >= name.Length) 390name = name[Prefix.Length..^Suffix.Length]; 428for (var i = Suffix.Length; i > 0; i--) 455for (var i = 0; i < Prefix.Length; i++)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\NamingStyle.WordSpanEnumerator.cs (1)
52Current = new TextSpan(Current.End + _wordSeparator.Length, 0);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Serialization\ObjectWriter.cs (2)
504var bytes = new byte[(uint)value.Length * sizeof(char)]; 510WriteCompressedUInt((uint)value.Length);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\SyntaxFacts\AbstractDocumentationCommentService.cs (3)
90if (text.Length > maxBannerLength) 185=> tokenText.Length > 0 && char.IsWhiteSpace(tokenText[0]); 188=> tokenText.Length > 0 && char.IsWhiteSpace(tokenText[^1]);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\SyntaxFacts\ISyntaxFactsExtensions.cs (2)
251if (name.Length == 0) 261for (var i = 1; i < name.Length; i++)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.cs (1)
198Debug.Assert(reader.Position == symbolKey.Length);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.SymbolKeyReader.cs (1)
259while (Position < Data.Length)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\Base64Utilities.cs (2)
329decodedLength = (encodedString.Length * 3) / 4 - padding; 336var index = attributeData.Length - 1;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\BKTree.Builder.cs (3)
97var distinctValues = values.Where(v => v.Length > 0).Distinct(CaseInsensitiveComparison.Comparer).ToArray(); 98var charCount = distinctValues.Sum(v => v.Length); 107_wordSpans[i] = new TextSpan(characterIndex, value.Length);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\BKTree.cs (4)
74var lowerCaseCharacters = value.Length < 512 75? stackalloc char[value.Length] 76: new char[value.Length]; 78for (var i = 0; i < value.Length; i++)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\EditDistance.cs (8)
57var array = text.Length <= PooledArraySize 59: new char[text.Length]; 61for (var i = 0; i < text.Length; i++) 89var targetLowerCaseCharacters = target.Length < 512 90? stackalloc char[target.Length] 91: new char[target.Length]; 93for (var i = 0; i < target.Length; i++) 97_sourceLowerCaseCharacters.AsSpan(0, _source.Length),
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\PathMetadataUtilities.cs (2)
31if (rootNamespace is { Length: > 0 } && 69@namespace = @namespace[(rootNamespace.Length + 1)..];
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\StringEscapeEncoder.cs (4)
17while (startIndex < text.Length) 29builder?.Append(text, startIndex, text.Length - startIndex); 66while (startIndex < text.Length) 72builder?.Append(text, startIndex, text.Length - startIndex);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\WordSimilarityChecker.cs (6)
91=> GetThreshold(value.Length); 108if (_source.Length < MinFuzzyLength) 134if (Math.Abs(_source.Length - candidateText.Length) <= _threshold) 163var lengthDifference = Math.Abs(originalText.Length - candidateText.Length);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\ISymbolExtensions.cs (1)
841(symbol.Name.Length == 1 || uint.TryParse(symbol.Name[1..], out _) || symbol.Name.All(n => n.Equals('_')));
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\ITypeSymbolExtensions.cs (1)
370return shortName.Length == 0
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Extensions\ProjectExtensions.cs (2)
60analyzerConfigDirectory.Length > bestPath.Length)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Extensions\SyntaxGeneratorExtensions_CreateEqualsMethod.cs (1)
391if (name.Length > 0)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\LanguageServices\TypeInferenceService\AbstractTypeInferenceService.cs (3)
67if (name.Length == prefix.Length) 72var nextChar = name[prefix.Length];
Microsoft.CodeAnalysis.AnalyzerUtilities (191)
src\roslyn\src\Compilers\Core\Portable\FileSystem\FileUtilities.cs (2)
136if (path!.Length == 1) 178Debug.Assert(path.Length == 1 || !PathUtilities.IsDirectorySeparator(path[1]));
src\roslyn\src\Compilers\Core\Portable\FileSystem\PathUtilities.cs (36)
55int lastSeparator = s.Length; 61if (lastSeparator != s.Length) 74if (s.Length == 0 || IsAnyDirectorySeparator(s[s.Length - 1])) 163var rootLength = GetPathRoot(path, isUnixLike).Length; 164if (path.Length > rootLength) 166var i = path.Length; 237int length = path.Length; 312return path.Length > 0 && IsDirectorySeparator(path[0]) 339if (path.Length > 0 && path[0] == '.') 341if (path.Length == 1 || IsDirectorySeparator(path[1])) 348if (path.Length == 2 || IsDirectorySeparator(path[2])) 359if (path.Length >= 1 && IsDirectorySeparator(path[0])) 366if (path.Length >= 2 && path[1] == VolumeSeparatorChar && (path.Length <= 2 || !IsDirectorySeparator(path[2]))) 400return path.Length >= 2 && 411return path.Length >= 3 && path[1] == VolumeSeparatorChar && IsDirectorySeparator(path[2]); 465char c = root[root.Length - 1]; 504if (path.Length > 0 && IsDirectorySeparator(path[path.Length - 1])) 506return path.Substring(0, path.Length - 1); 633return parentPath.Length > 0 634&& childPath.Length > parentPath.Length 635&& PathsEqual(childPath, parentPath, parentPath.Length) 636&& (IsDirectorySeparator(parentPath[parentPath.Length - 1]) || IsDirectorySeparator(childPath[parentPath.Length])); 641var relativePath = childPath.Substring(parentPath.Length); 644int start = ConsumeDirectorySeparators(relativePath, relativePath.Length, 0); 673return PathsEqual(path1, path2, Math.Max(path1.Length, path2.Length)); 681if (path1.Length < length || path2.Length < length) 741if (!(oldPrefix?.Length > 0)) continue; 750var replacement = replacementPrefix + filePath.Substring(oldPrefix.Length); 870if (!isDriveRooted && !(p.Length > 1 && p[0] == AltDirectorySeparatorChar))
src\roslyn\src\Compilers\Core\Portable\InternalUtilities\CompilerOptionParseUtilities.cs (1)
42if (Environment.GetEnvironmentVariable(CachePathEnvironmentVariable) is not { Length: > 0 } cachePath)
src\roslyn\src\Compilers\Core\Portable\InternalUtilities\FileNameUtilities.cs (6)
122if (path.Length > 0 && path[path.Length - 1] == '.') 124return path.Substring(0, path.Length - 1); 149if (extension == null || path.Length == 0) 154if (extension.Length == 0 || extension[0] != '.') 173for (int i = path.Length - 1; i >= 0; i--)
src\roslyn\src\Compilers\Core\Portable\InternalUtilities\StringExtensions.cs (14)
41return name.Length >= 3 && name[0] == 'I' && char.IsUpper(name[1]) && char.IsLower(name[2]); 46return name.Length >= 3 && name[0] == 'T' && char.IsUpper(name[1]) && char.IsLower(name[2]); 154result = name[..^AttributeSuffix.Length]; 168return name.Length > AttributeSuffix.Length && name.EndsWith(AttributeSuffix, comparison); 174while (i < str.Length) 181if (i < str.Length && char.IsLowSurrogate(str[i])) 211if (arg.Length > 1 && arg[0] == '"' && arg[arg.Length - 1] == '"') 214return arg.Substring(1, arg.Length - 2); 226while (x < string1.Length && x < string2.Length && 238while (x < string1.Length && x < string2.Length &&
src\roslyn\src\Compilers\Core\Portable\InternalUtilities\StringTable.cs (5)
481if (array.Length != length) 487for (var i = 0; i < array.Length; i++) 500if (array.Length != text.Length) 517for (var i = array.Length - 1; i >= 0; i--) 538if (ascii.Length != text.Length)
src\roslyn\src\Compilers\Core\Portable\InternalUtilities\UnicodeCharacterUtilities.cs (1)
103int nameLength = name.Length;
src\roslyn\src\Compilers\Core\Portable\Syntax\SyntaxTreeExtensions.cs (2)
95var n1 = s1.Length; 96var n2 = s2.Length;
src\roslyn\src\Compilers\Core\Portable\Text\TextChangeRangeExtensions.cs (1)
105return new TextChangeRange(textChange.Span, textChange.NewText?.Length ?? 0);
src\roslyn\src\Dependencies\Collections\Extensions\IEnumerableExtensions.cs (2)
213return str.Length == 0; 236return source.Length == 0;
src\roslyn\src\RoslynAnalyzers\Utilities\Compiler\CodeMetrics\CodeAnalysisMetricData.cs (1)
141if (index >= 0 && index < symbolName.Length)
src\roslyn\src\RoslynAnalyzers\Utilities\Compiler\Extensions\StringExtensions.cs (1)
15return Encoding.UTF8.GetByteCount(value) == value.Length;
src\roslyn\src\RoslynAnalyzers\Utilities\Compiler\Options\AnalyzerOptionsExtensions.cs (2)
357if (trimmedSuffix.Length >= 2 && 361for (int i = 1; i < trimmedSuffix.Length - 2; i++)
src\roslyn\src\RoslynAnalyzers\Utilities\Compiler\Options\SymbolNamesWithValueOption.cs (2)
109parts.SymbolName.Length == 1)) 145Debug.Assert(parts.SymbolName.Length >= 2);
src\roslyn\src\RoslynAnalyzers\Utilities\Compiler\RulesetToEditorconfigConverter.cs (2)
208if (comment.Length > 0) 213if (trimmedCommentPart.Length > 0)
src\roslyn\src\RoslynAnalyzers\Utilities\Compiler\WellKnownTypeProvider.cs (1)
220for (int i = 0; i < fullTypeName.Length; i++)
src\roslyn\src\RoslynAnalyzers\Utilities\Compiler\WordParser.cs (3)
108_buffer = new StringBuilder(text.Length); 556while (_index < _text.Length) 574for (int index = _index; index < _text.Length; index++)
src\roslyn\src\RoslynAnalyzers\Utilities\FlowAnalysis\FlowAnalysis\Analysis\TaintedDataAnalysis\HardcodedSymmetricAlgorithmKeysSources.cs (2)
41v => v is string s && s.Length % 4 == 0 && IsLegalKeySize(s.Length * 3 / 4))
src\roslyn\src\RoslynAnalyzers\Utilities\FlowAnalysis\FlowAnalysis\Analysis\ValueContentAnalysis\ValueContentAbstractValue.cs (2)
66if (((string)literal).Length == 0) 100if (stringVal.Length == 0)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\CodeGeneration\ParameterName.cs (1)
42BestNameForParameter = trimmed.Length > 0 ? tryMakeCamelCase ? trimmed.ToCamelCase() : trimmed : nameBasedOnArgument;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\VirtualChars\AbstractVirtualCharService.cs (8)
30if (index + 1 < tokenText.Length) 118Debug.Assert(lastVC.Span.End == token.Span.End - "\"".Length, "Last span has to end right before the end of the string token."); 122Debug.Assert(lastVC.Span.End == token.Span.End - "\"u8".Length, "Last span has to end right before the end of the string token."); 145if (startDelimiter.Length > 0 && !tokenText.StartsWith(startDelimiter, StringComparison.Ordinal)) 151if (endDelimiter.Length > 0 && !tokenText.EndsWith(endDelimiter, StringComparison.Ordinal)) 157var startIndexInclusive = startDelimiter.Length; 158var endIndexExclusive = tokenText.Length - endDelimiter.Length;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\VirtualChars\AbstractVirtualCharService.ITextInfo.cs (1)
30public readonly int Length(string text) => text.Length;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\VirtualChars\VirtualCharGreenSequence.Chunks.cs (2)
78public override int Length => data.Length; 83return stringIndex >= 0 && stringIndex < data.Length ? stringIndex : null;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\StringExtensions.cs (13)
18for (var i = 0; i < line.Length; i++) 33for (var i = line.Length - 1; i >= 0; i--) 61return lastOffset.HasValue && lastOffset.Value < lineText.Length 71return lineText.GetColumnFromLineOffset(lineText.Length, tabSize); 74return text.ConvertTabToSpace(tabSize, initialColumn, text.Length) + initialColumn; 80Debug.Assert(endPosition >= 0 && endPosition <= textSnippet.Length); 107for (var i = 0; i < text.Length; i++) 156for (var i = 0; i < text.Length; i++) 164if (i + 1 == text.Length || text[i + 1] != '\n') 202return line.GetColumnFromLineOffset(line.Length, tabSize); 209Contract.ThrowIfFalse(0 <= endPosition && endPosition <= line.Length); 223for (var i = 0; i < line.Length; i++) 241return line.Length;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\TokenStream.cs (2)
337length = text.ConvertTabToSpace(_options.TabSize, initialColumn, text.Length); 341length = text.Length;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\TreeData.Node.cs (1)
30return lineText.GetColumnFromLineOffset(lineText.Length, tabSize);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\FormattingExtensions.cs (9)
130spaceOrIndentation = indentationString.GetColumnFromLineOffset(indentationString.Length, tabSize); 136spaceOrIndentation = text.ConvertTabToSpace(tabSize, baseToken.ToString().GetTextColumn(tabSize, initialColumn), text.Length); 156nonWhitespaceCharIndex = triviaText.Length; 164builder.Append(triviaText, nonWhitespaceCharIndex, triviaText.Length - nonWhitespaceCharIndex); 201builder.Append(line, nonWhitespaceCharIndex, line.Length - nonWhitespaceCharIndex); 226for (var i = 0; i < text.Length; i++) 245if (i >= newText.Length || text[i] != newText[i]) 252if (i == span.Length && text.Length == newText.Length)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\TriviaEngine\AbstractTriviaFormatter.cs (6)
145for (var i = 0; i < text.Length; i++) 611var tokenPosition = lastText.ConvertTabToSpace(Options.TabSize, initialColumn, lastText.Length); 741for (var i = this.OriginalString.Length - 1; i >= 0; i--) 889spaces: text.ConvertTabToSpace(Options.TabSize, lineColumn.With(whitespaceBetween).Column, text.Length), 925spaces: lineText.GetColumnFromLineOffset(lineText.Length, Options.TabSize), 931spaces: text.ConvertTabToSpace(Options.TabSize, initialColumn, text.Length),
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\Naming\IdentifierNameParts.cs (2)
47? newBaseName[prefix.Length..] 53? newBaseName[..^suffix.Length]
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\NamingStyle.cs (19)
89if (word.Length == 0) 107if (word.Length == 0) 137if (name.Length <= Prefix.Length + Suffix.Length) 147name = StripCommonPrefixes(name[Prefix.Length..], out var prefix); 160var spanToCheck = TextSpan.FromBounds(0, name.Length - Suffix.Length); 311name = StripCommonPrefixes(name.StartsWith(Prefix) ? name[Prefix.Length..] : name, out _); 346while (index + 1 < name.Length) 353if (index + 2 < name.Length && name[index + 1] == '_') 362if (index + 1 < name.Length && !char.IsDigit(name[index + 1])) 385if (Suffix.Length + Prefix.Length >= name.Length) 390name = name[Prefix.Length..^Suffix.Length]; 428for (var i = Suffix.Length; i > 0; i--) 455for (var i = 0; i < Prefix.Length; i++)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\NamingStyle.WordSpanEnumerator.cs (1)
52Current = new TextSpan(Current.End + _wordSeparator.Length, 0);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Serialization\ObjectWriter.cs (2)
504var bytes = new byte[(uint)value.Length * sizeof(char)]; 510WriteCompressedUInt((uint)value.Length);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\SyntaxFacts\AbstractDocumentationCommentService.cs (3)
90if (text.Length > maxBannerLength) 185=> tokenText.Length > 0 && char.IsWhiteSpace(tokenText[0]); 188=> tokenText.Length > 0 && char.IsWhiteSpace(tokenText[^1]);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\SyntaxFacts\ISyntaxFactsExtensions.cs (2)
251if (name.Length == 0) 261for (var i = 1; i < name.Length; i++)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.cs (1)
198Debug.Assert(reader.Position == symbolKey.Length);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.SymbolKeyReader.cs (1)
259while (Position < Data.Length)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\Base64Utilities.cs (2)
329decodedLength = (encodedString.Length * 3) / 4 - padding; 336var index = attributeData.Length - 1;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\BKTree.Builder.cs (3)
97var distinctValues = values.Where(v => v.Length > 0).Distinct(CaseInsensitiveComparison.Comparer).ToArray(); 98var charCount = distinctValues.Sum(v => v.Length); 107_wordSpans[i] = new TextSpan(characterIndex, value.Length);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\BKTree.cs (4)
74var lowerCaseCharacters = value.Length < 512 75? stackalloc char[value.Length] 76: new char[value.Length]; 78for (var i = 0; i < value.Length; i++)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\EditDistance.cs (8)
57var array = text.Length <= PooledArraySize 59: new char[text.Length]; 61for (var i = 0; i < text.Length; i++) 89var targetLowerCaseCharacters = target.Length < 512 90? stackalloc char[target.Length] 91: new char[target.Length]; 93for (var i = 0; i < target.Length; i++) 97_sourceLowerCaseCharacters.AsSpan(0, _source.Length),
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\PathMetadataUtilities.cs (2)
31if (rootNamespace is { Length: > 0 } && 69@namespace = @namespace[(rootNamespace.Length + 1)..];
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\StringEscapeEncoder.cs (4)
17while (startIndex < text.Length) 29builder?.Append(text, startIndex, text.Length - startIndex); 66while (startIndex < text.Length) 72builder?.Append(text, startIndex, text.Length - startIndex);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\WordSimilarityChecker.cs (6)
91=> GetThreshold(value.Length); 108if (_source.Length < MinFuzzyLength) 134if (Math.Abs(_source.Length - candidateText.Length) <= _threshold) 163var lengthDifference = Math.Abs(originalText.Length - candidateText.Length);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\ISymbolExtensions.cs (1)
841(symbol.Name.Length == 1 || uint.TryParse(symbol.Name[1..], out _) || symbol.Name.All(n => n.Equals('_')));
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\ITypeSymbolExtensions.cs (1)
370return shortName.Length == 0
Microsoft.CodeAnalysis.CodeStyle (202)
src\roslyn\src\Analyzers\Core\Analyzers\FileHeaders\AbstractFileHeaderHelper.cs (2)
122var eolLength = Environment.NewLine.Length; 126return new FileHeader(sb.ToString(), fileHeaderStart, fileHeaderEnd, CommentPrefix.Length);
src\roslyn\src\Analyzers\Core\Analyzers\Formatting\AbstractFormattingAnalyzer.cs (6)
64if (change.NewText.Length > 0 && !change.Span.IsEmpty) 69var offset = change.Span.Length - change.NewText.Length; 72if (oldText.GetSubText(new TextSpan(change.Span.Start + offset, change.NewText.Length)).ContentEquals(SourceText.From(change.NewText))) 81if (oldText.GetSubText(new TextSpan(change.Span.Start, change.NewText.Length)).ContentEquals(SourceText.From(change.NewText))) 83change = new TextChange(new TextSpan(change.Span.Start + change.NewText.Length, offset), ""); 90if (change.NewText.Length == 0 && change.Span.IsEmpty)
src\roslyn\src\Analyzers\Core\Analyzers\RemoveUnnecessarySuppressions\AbstractRemoveUnnecessaryPragmaSuppressionsDiagnosticAnalyzer.cs (6)
310var idWithoutPrefix = id.StartsWith(CompilerErrorCodePrefix) && id.Length == CompilerErrorCodePrefix.Length + CompilerErrorCodeDigitCount 311? id[CompilerErrorCodePrefix.Length..] 377trimmedPart = trimmedPart[categoryPrefix.Length..].Trim(); 808category?.Length > 0 && userCategoryExclusions.Contains(category, StringComparer.OrdinalIgnoreCase)) 868return id.Length > 0;
src\roslyn\src\Analyzers\Core\Analyzers\RemoveUnusedMembers\AbstractRemoveUnusedMembersDiagnosticAnalyzer.cs (2)
1086var suffix = methodSymbol.Name[prefix.Length..]; 1087return suffix.Length > 0 &&
src\roslyn\src\Analyzers\Core\Analyzers\ValidateFormatString\AbstractValidateFormatStringDiagnosticAnalyzer.cs (2)
356invalidPlaceholderText.Length)); 385if (placeholderIndexText.Length > 0 && char.IsWhiteSpace(placeholderIndexText, 0))
src\roslyn\src\Compilers\Core\Portable\DiagnosticAnalyzer\SuppressMessageAttributeState.TargetSymbolResolver.cs (9)
54return id[prefix.Length..]; 86if (_name.Length >= 2 && _name[0] == 'e' && _name[1] == ':') 257if (callingConvention == _name.Substring(_index, callingConvention.Length)) 259_index += callingConvention.Length; 281_index = _name.Length; 289return _index >= _name.Length ? '\0' : _name[_index]; 296while (_index < _name.Length && char.IsDigit(_name[_index])) 456for (; _index < _name.Length && _name[_index] != '}'; ++_index) { } 463for (; _index < _name.Length; ++_index)
src\roslyn\src\Compilers\Core\Portable\FileSystem\FileUtilities.cs (2)
136if (path!.Length == 1) 178Debug.Assert(path.Length == 1 || !PathUtilities.IsDirectorySeparator(path[1]));
src\roslyn\src\Compilers\Core\Portable\FileSystem\PathUtilities.cs (36)
55int lastSeparator = s.Length; 61if (lastSeparator != s.Length) 74if (s.Length == 0 || IsAnyDirectorySeparator(s[s.Length - 1])) 163var rootLength = GetPathRoot(path, isUnixLike).Length; 164if (path.Length > rootLength) 166var i = path.Length; 237int length = path.Length; 312return path.Length > 0 && IsDirectorySeparator(path[0]) 339if (path.Length > 0 && path[0] == '.') 341if (path.Length == 1 || IsDirectorySeparator(path[1])) 348if (path.Length == 2 || IsDirectorySeparator(path[2])) 359if (path.Length >= 1 && IsDirectorySeparator(path[0])) 366if (path.Length >= 2 && path[1] == VolumeSeparatorChar && (path.Length <= 2 || !IsDirectorySeparator(path[2]))) 400return path.Length >= 2 && 411return path.Length >= 3 && path[1] == VolumeSeparatorChar && IsDirectorySeparator(path[2]); 465char c = root[root.Length - 1]; 504if (path.Length > 0 && IsDirectorySeparator(path[path.Length - 1])) 506return path.Substring(0, path.Length - 1); 633return parentPath.Length > 0 634&& childPath.Length > parentPath.Length 635&& PathsEqual(childPath, parentPath, parentPath.Length) 636&& (IsDirectorySeparator(parentPath[parentPath.Length - 1]) || IsDirectorySeparator(childPath[parentPath.Length])); 641var relativePath = childPath.Substring(parentPath.Length); 644int start = ConsumeDirectorySeparators(relativePath, relativePath.Length, 0); 673return PathsEqual(path1, path2, Math.Max(path1.Length, path2.Length)); 681if (path1.Length < length || path2.Length < length) 741if (!(oldPrefix?.Length > 0)) continue; 750var replacement = replacementPrefix + filePath.Substring(oldPrefix.Length); 870if (!isDriveRooted && !(p.Length > 1 && p[0] == AltDirectorySeparatorChar))
src\roslyn\src\Compilers\Core\Portable\InternalUtilities\CompilerOptionParseUtilities.cs (1)
42if (Environment.GetEnvironmentVariable(CachePathEnvironmentVariable) is not { Length: > 0 } cachePath)
src\roslyn\src\Compilers\Core\Portable\InternalUtilities\FileNameUtilities.cs (6)
122if (path.Length > 0 && path[path.Length - 1] == '.') 124return path.Substring(0, path.Length - 1); 149if (extension == null || path.Length == 0) 154if (extension.Length == 0 || extension[0] != '.') 173for (int i = path.Length - 1; i >= 0; i--)
src\roslyn\src\Compilers\Core\Portable\InternalUtilities\StringExtensions.cs (14)
41return name.Length >= 3 && name[0] == 'I' && char.IsUpper(name[1]) && char.IsLower(name[2]); 46return name.Length >= 3 && name[0] == 'T' && char.IsUpper(name[1]) && char.IsLower(name[2]); 154result = name[..^AttributeSuffix.Length]; 168return name.Length > AttributeSuffix.Length && name.EndsWith(AttributeSuffix, comparison); 174while (i < str.Length) 181if (i < str.Length && char.IsLowSurrogate(str[i])) 211if (arg.Length > 1 && arg[0] == '"' && arg[arg.Length - 1] == '"') 214return arg.Substring(1, arg.Length - 2); 226while (x < string1.Length && x < string2.Length && 238while (x < string1.Length && x < string2.Length &&
src\roslyn\src\Compilers\Core\Portable\InternalUtilities\StringTable.cs (5)
481if (array.Length != length) 487for (var i = 0; i < array.Length; i++) 500if (array.Length != text.Length) 517for (var i = array.Length - 1; i >= 0; i--) 538if (ascii.Length != text.Length)
src\roslyn\src\Compilers\Core\Portable\InternalUtilities\UnicodeCharacterUtilities.cs (1)
103int nameLength = name.Length;
src\roslyn\src\Compilers\Core\Portable\Syntax\SyntaxTreeExtensions.cs (2)
95var n1 = s1.Length; 96var n2 = s2.Length;
src\roslyn\src\Compilers\Core\Portable\Text\TextChangeRangeExtensions.cs (1)
105return new TextChangeRange(textChange.Span, textChange.NewText?.Length ?? 0);
src\roslyn\src\Dependencies\Collections\Extensions\IEnumerableExtensions.cs (2)
213return str.Length == 0; 236return source.Length == 0;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\CodeGeneration\ParameterName.cs (1)
42BestNameForParameter = trimmed.Length > 0 ? tryMakeCamelCase ? trimmed.ToCamelCase() : trimmed : nameBasedOnArgument;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\VirtualChars\AbstractVirtualCharService.cs (8)
30if (index + 1 < tokenText.Length) 118Debug.Assert(lastVC.Span.End == token.Span.End - "\"".Length, "Last span has to end right before the end of the string token."); 122Debug.Assert(lastVC.Span.End == token.Span.End - "\"u8".Length, "Last span has to end right before the end of the string token."); 145if (startDelimiter.Length > 0 && !tokenText.StartsWith(startDelimiter, StringComparison.Ordinal)) 151if (endDelimiter.Length > 0 && !tokenText.EndsWith(endDelimiter, StringComparison.Ordinal)) 157var startIndexInclusive = startDelimiter.Length; 158var endIndexExclusive = tokenText.Length - endDelimiter.Length;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\VirtualChars\AbstractVirtualCharService.ITextInfo.cs (1)
30public readonly int Length(string text) => text.Length;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\VirtualChars\VirtualCharGreenSequence.Chunks.cs (2)
78public override int Length => data.Length; 83return stringIndex >= 0 && stringIndex < data.Length ? stringIndex : null;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\StringExtensions.cs (13)
18for (var i = 0; i < line.Length; i++) 33for (var i = line.Length - 1; i >= 0; i--) 61return lastOffset.HasValue && lastOffset.Value < lineText.Length 71return lineText.GetColumnFromLineOffset(lineText.Length, tabSize); 74return text.ConvertTabToSpace(tabSize, initialColumn, text.Length) + initialColumn; 80Debug.Assert(endPosition >= 0 && endPosition <= textSnippet.Length); 107for (var i = 0; i < text.Length; i++) 156for (var i = 0; i < text.Length; i++) 164if (i + 1 == text.Length || text[i + 1] != '\n') 202return line.GetColumnFromLineOffset(line.Length, tabSize); 209Contract.ThrowIfFalse(0 <= endPosition && endPosition <= line.Length); 223for (var i = 0; i < line.Length; i++) 241return line.Length;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\TokenStream.cs (2)
337length = text.ConvertTabToSpace(_options.TabSize, initialColumn, text.Length); 341length = text.Length;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\TreeData.Node.cs (1)
30return lineText.GetColumnFromLineOffset(lineText.Length, tabSize);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\FormattingExtensions.cs (9)
130spaceOrIndentation = indentationString.GetColumnFromLineOffset(indentationString.Length, tabSize); 136spaceOrIndentation = text.ConvertTabToSpace(tabSize, baseToken.ToString().GetTextColumn(tabSize, initialColumn), text.Length); 156nonWhitespaceCharIndex = triviaText.Length; 164builder.Append(triviaText, nonWhitespaceCharIndex, triviaText.Length - nonWhitespaceCharIndex); 201builder.Append(line, nonWhitespaceCharIndex, line.Length - nonWhitespaceCharIndex); 226for (var i = 0; i < text.Length; i++) 245if (i >= newText.Length || text[i] != newText[i]) 252if (i == span.Length && text.Length == newText.Length)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\TriviaEngine\AbstractTriviaFormatter.cs (6)
145for (var i = 0; i < text.Length; i++) 611var tokenPosition = lastText.ConvertTabToSpace(Options.TabSize, initialColumn, lastText.Length); 741for (var i = this.OriginalString.Length - 1; i >= 0; i--) 889spaces: text.ConvertTabToSpace(Options.TabSize, lineColumn.With(whitespaceBetween).Column, text.Length), 925spaces: lineText.GetColumnFromLineOffset(lineText.Length, Options.TabSize), 931spaces: text.ConvertTabToSpace(Options.TabSize, initialColumn, text.Length),
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\Naming\IdentifierNameParts.cs (2)
47? newBaseName[prefix.Length..] 53? newBaseName[..^suffix.Length]
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\NamingStyle.cs (19)
89if (word.Length == 0) 107if (word.Length == 0) 137if (name.Length <= Prefix.Length + Suffix.Length) 147name = StripCommonPrefixes(name[Prefix.Length..], out var prefix); 160var spanToCheck = TextSpan.FromBounds(0, name.Length - Suffix.Length); 311name = StripCommonPrefixes(name.StartsWith(Prefix) ? name[Prefix.Length..] : name, out _); 346while (index + 1 < name.Length) 353if (index + 2 < name.Length && name[index + 1] == '_') 362if (index + 1 < name.Length && !char.IsDigit(name[index + 1])) 385if (Suffix.Length + Prefix.Length >= name.Length) 390name = name[Prefix.Length..^Suffix.Length]; 428for (var i = Suffix.Length; i > 0; i--) 455for (var i = 0; i < Prefix.Length; i++)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\NamingStyle.WordSpanEnumerator.cs (1)
52Current = new TextSpan(Current.End + _wordSeparator.Length, 0);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Serialization\ObjectWriter.cs (2)
504var bytes = new byte[(uint)value.Length * sizeof(char)]; 510WriteCompressedUInt((uint)value.Length);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\SyntaxFacts\AbstractDocumentationCommentService.cs (3)
90if (text.Length > maxBannerLength) 185=> tokenText.Length > 0 && char.IsWhiteSpace(tokenText[0]); 188=> tokenText.Length > 0 && char.IsWhiteSpace(tokenText[^1]);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\SyntaxFacts\ISyntaxFactsExtensions.cs (2)
251if (name.Length == 0) 261for (var i = 1; i < name.Length; i++)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.cs (1)
198Debug.Assert(reader.Position == symbolKey.Length);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.SymbolKeyReader.cs (1)
259while (Position < Data.Length)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\Base64Utilities.cs (2)
329decodedLength = (encodedString.Length * 3) / 4 - padding; 336var index = attributeData.Length - 1;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\BKTree.Builder.cs (3)
97var distinctValues = values.Where(v => v.Length > 0).Distinct(CaseInsensitiveComparison.Comparer).ToArray(); 98var charCount = distinctValues.Sum(v => v.Length); 107_wordSpans[i] = new TextSpan(characterIndex, value.Length);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\BKTree.cs (4)
74var lowerCaseCharacters = value.Length < 512 75? stackalloc char[value.Length] 76: new char[value.Length]; 78for (var i = 0; i < value.Length; i++)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\EditDistance.cs (8)
57var array = text.Length <= PooledArraySize 59: new char[text.Length]; 61for (var i = 0; i < text.Length; i++) 89var targetLowerCaseCharacters = target.Length < 512 90? stackalloc char[target.Length] 91: new char[target.Length]; 93for (var i = 0; i < target.Length; i++) 97_sourceLowerCaseCharacters.AsSpan(0, _source.Length),
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\PathMetadataUtilities.cs (2)
31if (rootNamespace is { Length: > 0 } && 69@namespace = @namespace[(rootNamespace.Length + 1)..];
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\StringEscapeEncoder.cs (4)
17while (startIndex < text.Length) 29builder?.Append(text, startIndex, text.Length - startIndex); 66while (startIndex < text.Length) 72builder?.Append(text, startIndex, text.Length - startIndex);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\WordSimilarityChecker.cs (6)
91=> GetThreshold(value.Length); 108if (_source.Length < MinFuzzyLength) 134if (Math.Abs(_source.Length - candidateText.Length) <= _threshold) 163var lengthDifference = Math.Abs(originalText.Length - candidateText.Length);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\ISymbolExtensions.cs (1)
841(symbol.Name.Length == 1 || uint.TryParse(symbol.Name[1..], out _) || symbol.Name.All(n => n.Equals('_')));
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\ITypeSymbolExtensions.cs (1)
370return shortName.Length == 0
Microsoft.CodeAnalysis.CodeStyle.Fixes (12)
src\roslyn\src\Analyzers\Core\CodeFixes\ConflictMarkerResolution\AbstractConflictMarkerCodeFixProvider.cs (1)
40private static readonly int s_mergeConflictLength = "<<<<<<<".Length;
src\roslyn\src\Analyzers\Core\CodeFixes\GenerateConstructor\GenerateConstructorHelpers.cs (1)
218var fieldNameMinusPrefix = newFieldName[fieldNamingRule.NamingStyle.Prefix.Length..];
src\roslyn\src\Analyzers\Core\CodeFixes\MakeMethodSynchronous\AbstractMakeMethodSynchronousCodeFixProvider.cs (3)
60methodSymbol.Name.Length > AsyncSuffix.Length && 74var newName = name[..^AsyncSuffix.Length];
src\roslyn\src\Analyzers\Core\CodeFixes\UseObjectInitializer\AbstractUseObjectInitializerCodeFixProvider.cs (1)
135endPosition: existingWhitespace.Length);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Extensions\ProjectExtensions.cs (2)
60analyzerConfigDirectory.Length > bestPath.Length)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Extensions\SyntaxGeneratorExtensions_CreateEqualsMethod.cs (1)
391if (name.Length > 0)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\LanguageServices\TypeInferenceService\AbstractTypeInferenceService.cs (3)
67if (name.Length == prefix.Length) 72var nextChar = name[prefix.Length];
Microsoft.CodeAnalysis.CSharp (103)
Binder\Binder_InterpolatedString.cs (5)
126if (text.Length == 0) 131else if (SyntaxFacts.IsWhitespace(lastChar = text[text.Length - 1]) || SyntaxFacts.IsNewLine(lastChar)) 195for (int i = 0, formatLength = value.Length; i < formatLength; i++) 208var result = builder.Length == value.Length 959baseStringLength += literalText.Length;
Binder\Binder.CapturedParametersFinder.cs (1)
93if (parameter.Name.Length != 0)
Binder\Binder.cs (3)
1012var lastSize = Math.Min(last.Length, 12); 1013snippet = first.Substring(0, Math.Min(first.Length, 12)) + " ... " + last.Substring(last.Length - lastSize, lastSize);
BoundTree\LengthBasedStringSwitchData.cs (2)
154foreach (var group in inputCases.Where(c => !c.value.IsNull).GroupBy(c => c.value.StringValue!.Length)) 169Debug.Assert(casesWithGivenLength.All(c => c.value.Length == stringLength));
CodeGen\EmitStatement.cs (1)
1600else if (stringConstant.StringValue.Length == 0 && lengthMethodRef != null)
CommandLine\CommandLineDiagnosticFormatter.cs (2)
75? normalizedBaseDirectory.Length 76: normalizedBaseDirectory.Length + 1);
CommandLine\CSharpCommandLineParser.cs (3)
731else if (value.Length == 0) 1712if (simpleName.Length == 0 && !outputKind.IsNetModule()) 1723if (simpleName.Length == 0)
Compilation\CSharpCompilation.cs (3)
4075if (bytesText.Length != bytes.Length * 2) 4080for (int i = 0, len = bytesText.Length / 2; i < len; i++) 4097int length = bytesText.Length / 2;
Compilation\CSharpSemanticModel.cs (1)
4513if (argumentName.Length == 0)
Compiler\ClsComplianceChecker.cs (2)
952System.Diagnostics.Debug.Assert(name.Length == 0 || name[0] != '\uFF3F'); 954if (name.Length > 0 && name[0] == '\u005F')
Compiler\DocumentationCommentCompiler.cs (14)
945return GetIndexOfFirstNonWhitespaceChar(str, 0, str.Length); 958Debug.Assert(start <= str.Length); 960Debug.Assert(end <= str.Length); 985int len = str.Length - start; 986if (len < prefix.Length) 991for (int i = 0; i < prefix.Length; i++) 1012for (; start < str.Length; start++) 1017if ((start + 1) < str.Length && str[start + 1] == '\n') 1045for (int start = 0; start < text.Length;) 1062for (int start = 0; start < text.Length;) 1110skipLength = pattern.Length; 1191int minLength = Math.Min(str1.Length, str2.Length); 1501: message.Remove(position, locationString.Length);
Compiler\MethodBodySynthesizer.Lowered.cs (1)
39if (i < text.Length)
CSharpExtensions.cs (2)
239return token.Kind() is (SyntaxKind.StringLiteralToken or SyntaxKind.Utf8StringLiteralToken) && token.Text.Length > 0 && token.Text[0] == '@'; 244return token.IsKind(SyntaxKind.IdentifierToken) && token.Text.Length > 0 && token.Text[0] == '@';
CSharpParseOptions.cs (2)
196ImmutableArray<ImmutableArray<string>> previewNamespaces = Features.TryGetValue(Feature.InterceptorsNamespaces, out var namespaces) && namespaces.Length > 0 208while (currentIndex < namespaces.Length && namespaces.IndexOf(';', currentIndex) is not -1 and var semicolonIndex)
DocumentationComments\DocumentationCommentIDVisitor.PartVisitor.cs (3)
178if ((object)containingSymbol != null && (containingSymbol.Name.Length != 0 || containingSymbol is NamedTypeSymbol { IsExtension: true })) 230if ((object)symbol.ContainingNamespace != null && symbol.ContainingNamespace.Name.Length != 0) 285pooled.Builder.Append(metadataName, startIndex, metadataName.Length - startIndex);
Emitter\EditAndContinue\CSharpDefinitionMap.cs (2)
217Debug.Assert(name.Length >= closeBracketOffset + 1); 227suffixIndex += GeneratedNameConstants.SuffixSeparator.Length;
Emitter\EditAndContinue\PEDeltaAssemblyBuilder.cs (2)
149if (int.TryParse(name.Substring(GeneratedNames.AnonymousTypeNameWithoutModulePrefix.Length), NumberStyles.None, CultureInfo.InvariantCulture, out int index)) 170if (int.TryParse(name.Substring(GeneratedNames.AnonymousDelegateNameWithoutModulePrefix.Length), NumberStyles.None, CultureInfo.InvariantCulture, out int index))
Lowering\Instrumentation\CodeCoverageInstrumenter.cs (1)
485if (path.Length == 0)
Parser\CharacterInfo.cs (1)
211int nameLength = name.Length;
Parser\DirectiveParser.cs (2)
350LanguageVersionFacts.TryParse(errorText.Substring(versionMarker.Length), out var languageVersion)) 657if (bytes.ValueText.Length % 2 != 0)
Parser\DocumentationCommentParser.cs (1)
678return token.Text.Length == 1 && SyntaxFacts.IsNonAsciiQuotationMark(token.Text[0]);
Parser\DocumentationCommentXmlTokens.cs (2)
77switch (text.Length) 160if (text.Length != 4)
Parser\LanguageParser_InterpolatedString.cs (2)
83while (startIndex < originalText.Length && originalText[startIndex] is '"') 598result = result.WithDiagnosticsGreen(MoveDiagnostics(token.GetDiagnostics(), -prefix.Length));
Parser\Lexer.cs (3)
1603if ((valueText.Length == 0) || !valueText.All(SyntaxFacts.IsHexDigit)) 2061private static readonly int s_conflictMarkerLength = "<<<<<<<".Length; 3816if (this.ScanIdentifier(ref info) && info.Text!.Length > 0)
Parser\LexerCache.cs (1)
176if (key.Length > MaxKeywordLength)
Parser\SlidingTextWindow.cs (1)
364int length = desired.Length;
SymbolDisplay\ObjectDisplay.cs (1)
238for (int i = 0; i < value.Length; i++)
SymbolDisplay\SymbolDisplayVisitor.Members.cs (1)
799var includeName = symbol.Name.Length != 0 && (Format.ParameterOptions.IncludesOption(SymbolDisplayParameterOptions.IncludeName) ||
SymbolDisplay\SymbolDisplayVisitor.Types.cs (2)
190var fileDescription = identifier.DisplayFilePath is { Length: not 0 } path ? path 512if (members.Length == 0)
Symbols\AnonymousTypes\AnonymousTypeManager.Templates.cs (1)
536moduleId = moduleId[..^extension.Length];
Symbols\Metadata\PE\PENamedTypeSymbol.cs (1)
2555if (name.Length > 0)
Symbols\Metadata\PE\PENamespaceSymbol.cs (2)
240int length = this.Name.Length; 246length += parent.Name.Length + 1;
Symbols\MissingMetadataTypeSymbol.cs (1)
244if (_namespaceName.Length > 0)
Symbols\Source\ExplicitInterfaceHelpers.cs (1)
112Debug.Assert(idx < fullName.Length);
Symbols\Source\QuickAttributeChecker.cs (3)
207(name.Length + nameof(System.Attribute).Length) == attributeDescription.Name.Length &&
Symbols\Source\SourceMemberContainerSymbol.cs (1)
521return name is { Length: > 0 } && name.All(c => c >= 'a' && c <= 'z');
Symbols\Source\SourceNamedTypeSymbol_Extension.cs (1)
779builder.Append(callingConventionTypes[i].Name["CallConv".Length..]);
Symbols\Synthesized\GeneratedNameParser.cs (7)
47if (closeBracketOffset >= 0 && closeBracketOffset + 1 < name.Length) 69for (int i = openingOffset + 1; i < str.Length; i++) 126int localFunctionNameStart = closeBracketOffset + 2 + GeneratedNameConstants.SuffixSeparator.Length; 127if (localFunctionNameStart >= generatedName.Length) 148if (lastUnder - 1 < 0 || lastUnder == fieldName.Length || fieldName[lastUnder - 1] != '_') 169propertyName = typeParameterName.Substring(1, typeParameterName.Length - 9); 184parameterName = fieldName.Substring(1, fieldName.Length - 3);
Symbols\Synthesized\GeneratedNames.cs (3)
18return memberName.Length > 0 && memberName[0] == '<'; 431if (name.Length <= DelegateNamePrefixLength || name[DelegateNamePrefixLength] != '{') 447if (nameEndIndex < name.Length - 1)
Symbols\Tuples\TupleTypeSymbol.cs (1)
473string tail = name.Substring("Item".Length);
Symbols\TypeSymbolExtensions.cs (2)
1871return qualifiedName.Length == 0; 1874return HasNamespaceName(@namespace, qualifiedName, comparison, length: qualifiedName.Length);
Syntax\InternalSyntax\SyntaxToken.cs (4)
25FullWidth = this.Text.Length; 32FullWidth = this.Text.Length; 39FullWidth = this.Text.Length; 317get { return this.Text.Length; }
Syntax\InternalSyntax\SyntaxToken.SyntaxIdentifier.cs (2)
18: base(SyntaxKind.IdentifierToken, text.Length) 24: base(SyntaxKind.IdentifierToken, text.Length, diagnostics, annotations)
Syntax\InternalSyntax\SyntaxToken.SyntaxLiteral.cs (2)
20: base(kind, text.Length) 27: base(kind, text.Length, diagnostics, annotations)
Syntax\InternalSyntax\SyntaxTrivia.cs (2)
15: base(kind, diagnostics, annotations, text.Length) 50Debug.Assert(this.FullWidth == this.Text.Length);
Syntax\SyntaxNormalizer.cs (1)
1259return text.Length > 0 && SyntaxFacts.IsNewLine(text[^1]);
Utilities\ValueSetFactory.FloatingValueSet.cs (1)
170if (b.Length > 1 && more.Length > 1)
Microsoft.CodeAnalysis.CSharp.CodeStyle (26)
src\roslyn\src\Analyzers\CSharp\Analyzers\UseCollectionExpression\CSharpUseCollectionExpressionForFluentDiagnosticAnalyzer.cs (3)
440if (name.Length == (ToPrefix.Length + suffix.Length) &&
src\roslyn\src\Analyzers\CSharp\Analyzers\UseIndexOrRangeOperator\Helpers.cs (1)
22=> TryGetNoArgInt32Property(namedType, nameof(string.Length)) ??
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\EmbeddedLanguages\VirtualChars\CSharpVirtualCharService.cs (12)
136var endIndexExclusive = tokenText.Length; 141endIndexExclusive -= "u8".Length; 233if (startDelimiter.Length > 0 && !tokenText.StartsWith(startDelimiter)) 239if (endDelimiter.Length > 0 && !tokenText.EndsWith(endDelimiter, StringComparison.OrdinalIgnoreCase)) 245var startIndexInclusive = startDelimiter.Length; 246var endIndexExclusive = tokenText.Length - endDelimiter.Length; 435result.Add(new VirtualCharGreen((char)highSurrogate, offset: startIndex, width: prefix.Length)); 436result.Add(new VirtualCharGreen((char)lowSurrogate, offset: startIndex + prefix.Length, width: 4)); 439return @"\UAAAABBBB".Length; 465var width = @"\uAAAA".Length; 482for (var i = 0; i < 4 && endIndex < tokenText.Length; i++)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\SyntaxTriviaExtensions.cs (2)
109textBuilder.Remove(textBuilder.Length - newLine.Length, newLine.Length);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Engine\Trivia\TriviaDataFactory.CodeShapeAnalyzer.cs (2)
147_indentation += text.ConvertTabToSpace(_options.TabSize, _indentation, text.Length); 345if (xmlCommentText.GetColumnFromLineOffset(xmlCommentText.Length - 3, tabSize) != indentation)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Engine\Trivia\TriviaDataFactory.cs (1)
128return textSnippet.ConvertTabToSpace(Options.TabSize, initialColumn, textSnippet.Length);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\FormattingHelpers.cs (1)
30var start = lastNewLinePos + NewLine.Length;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Services\SyntaxFacts\CSharpSyntaxFacts.cs (4)
460return this.IsIdentifier(token) && !token.ContainsDiagnostics && token.ToString().Length == identifier.Length; 466return this.IsIdentifier(token) && !token.ContainsDiagnostics && token.ToString().Length == identifier.Length && token.IsVerbatimIdentifier();
Microsoft.CodeAnalysis.CSharp.CodeStyle.Fixes (12)
src\roslyn\src\Analyzers\CSharp\CodeFixes\ConvertNamespace\ConvertNamespaceTransform.cs (3)
168if (lastRawStringLiteralData.closeTerminatorIndentationLength != indentation.Length) 182while (commonIndentation < indentation.Length && commonIndentation < textLine.Span.Length) 416if (outerIndentation.Length > 0)
src\roslyn\src\Analyzers\CSharp\CodeFixes\UseCollectionExpression\CSharpCollectionExpressionRewriter.cs (1)
712? preferredIndentation + positionIndentation[firstTokenOnLineIndentationString.Length..]
src\roslyn\src\Analyzers\CSharp\CodeFixes\UsePrimaryConstructor\CSharpUsePrimaryConstructorCodeFixProvider.cs (4)
350if (constructorLeadingWhitespace.Length > typeLeadingWhitespace.Length && 353var indentation = constructorLeadingWhitespace[typeLeadingWhitespace.Length..]; 363leadingTrivia.Take(leadingTrivia.Count - 1).Concat(Whitespace(elementLeadingWhitespace[..^indentation.Length])));
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\CSharpCodeGenerationHelpers.cs (2)
132if (tokenText.Length <= 2 || tokenText.Last() != '"') 141if (tokenText.Length <= 1 || tokenText.Last() != '"')
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\ITypeSymbolExtensions.TypeSyntaxGeneratorVisitor.cs (1)
153? null : symbol.Signature.UnmanagedCallingConventionTypes.Select(type => GetConventionForString(type.Name["CallConv".Length..])),
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\StringExtensions.cs (1)
37if (escaped.Length == 0 || escaped[0] != '@')
Microsoft.CodeAnalysis.CSharp.Features (76)
BraceMatching\BlockCommentBraceMatcher.cs (4)
50return new BraceMatchingResult(new TextSpan(trivia.SpanStart, "/*".Length), TextSpan.FromBounds(trivia.Span.End - "*/".Length, trivia.Span.End)); 54var startBrace = new TextSpan(trivia.FullSpan.Start, "/**".Length); 55var endBrace = TextSpan.FromBounds(trivia.FullSpan.End - "*/".Length, trivia.FullSpan.End);
CodeRefactorings\SyncNamespace\CSharpChangeNamespaceService.cs (2)
423Debug.Assert(part.Length > 0); 436Debug.Assert(part.Length > 0);
Completion\CompletionProviders\AttributeNamedParameterCompletionProvider.cs (6)
259return new TextChange(selectedItem.Span, displayText.Remove(displayText.Length - SpaceEqualsString.Length)); 266return new TextChange(selectedItem.Span, displayText.Remove(displayText.Length - EqualsString.Length)); 273return new TextChange(selectedItem.Span, displayText.Remove(displayText.Length - ColonString.Length));
Completion\CompletionProviders\DeclarationName\DeclarationNameInfo.cs (1)
56if (info.Type is IErrorTypeSymbol { Name.Length: > 0 } &&
Completion\CompletionProviders\DeclarationName\DeclarationNameRecommender.cs (1)
262if (name.Length > 1 &&
Completion\CompletionProviders\DeclarationName\DeclarationNameRecommender.NameGenerator.cs (1)
129private static bool CanRemovePrefix(string name, char prefix) => name.Length > 1 && name[0] == prefix && char.IsUpper(name[1]);
Completion\CompletionProviders\ExplicitInterfaceMemberCompletionProvider.cs (1)
118for (var i = 0; i < memberString.Length; i++)
Completion\CompletionProviders\FileBasedPrograms\AbstractAppDirectiveCompletionProvider.cs (1)
76var textAfterDirectiveKind = textLeftOfCaret.Slice(start: DirectiveKind.Length);
Completion\CompletionProviders\FunctionPointerUnmanagedCallingConventionCompletionProvider.cs (1)
111var displayName = type.Name[CallConvPrefix.Length..];
Completion\CompletionProviders\OperatorsAndIndexer\UnnamedSymbolCompletionProvider_Operators.cs (1)
150var newPosition = expressionStart + replacement.Length;
Completion\CompletionProviders\OperatorsAndIndexer\UnnamedSymbolCompletionProvider.cs (1)
196var newPosition = replacementStart + text.Length + positionOffset;
ConvertPrimaryToRegularConstructor\ConvertPrimaryToRegularConstructorCodeRefactoringProvider.cs (4)
430if (constructorLeadingWhitespace.Length > typeLeadingWhitespace.Length && 433var indentation = constructorLeadingWhitespace[typeLeadingWhitespace.Length..]; 439if (elementLeadingWhitespace.Length > 0 && elementLeadingWhitespace.StartsWith(typeLeadingWhitespace))
ConvertToInterpolatedString\CSharpConvertConcatenationToInterpolatedStringRefactoringProvider.cs (2)
26? text["@'".Length..^1] 27: text["'".Length..^1];
ConvertToRawString\ConvertInterpolatedStringToRawStringCodeRefactoringProvider.cs (5)
331? indentation + positionIndentation[anchorIndentation.Length..] 594builder.Append(text.ToString(TextSpan.FromBounds(line.Start + commonWhitespacePrefix.Length, line.EndIncludingLineBreak))); 612builder.Append(text.ToString(TextSpan.FromBounds(line.Start + commonWhitespacePrefix.Length, line.EndIncludingLineBreak))); 679var length = Math.Min(leadingWhitespace1.Length, leadingWhitespace2.Length);
Debugging\BreakpointResolver.cs (2)
70if (lengthOfParsedText < text.Length) 88if (!foundIncompleteParameterList && (lengthOfParsedText == text.Length) &&
Debugging\CSharpProximityExpressionsService.Worker.cs (1)
49var result = _expressions.Distinct().Where(e => e.Length > 0).ToList();
EditAndContinue\BreakpointSpans.cs (1)
47for (var i = 0; i < text.Length; i++)
EditAndContinue\SyntaxComparer.cs (2)
1618oldToken.Text, Math.Min(oldToken.Text.Length, LongestCommonSubsequence.MaxSequenceLengthForDistanceCalculation), 1619newToken.Text, Math.Min(newToken.Text.Length, LongestCommonSubsequence.MaxSequenceLengthForDistanceCalculation));
EncapsulateField\CSharpEncapsulateFieldService.cs (1)
150.Where(f => f.Name.Length != 0)];
ExtractMethod\CSharpMethodExtractor.CSharpCodeGenerator.ExpressionCodeGenerator.cs (2)
51return (name != null && name.Length > 0) ? MakeMethodName("Get", name, methodName.Equals(NewMethodCamelCaseStr)) : methodName; 80return (unqualifiedNameIdentifierValueText != null && unqualifiedNameIdentifierValueText.Length > 0) ?
LanguageServices\CSharpSymbolDisplayService.SymbolDescriptionBuilder.cs (1)
358=> trivia.ToFullString()["//".Length..];
SignatureHelp\AttributeSignatureHelpProvider.cs (1)
59token.ValueText.Length == 1 &&
SignatureHelp\ElementAccessExpressionSignatureHelpProvider.cs (3)
280token.ValueText.Length == 1 && 329token.ValueText.Length == 1 && 364token.ValueText.Length == 1 &&
SignatureHelp\GenericNameFullyWrittenSignatureHelpProvider.cs (1)
45token.ValueText.Length == 1 &&
SignatureHelp\InitializerExpressionSignatureHelpProvider.cs (1)
48token.ValueText.Length == 1 &&
SignatureHelp\SignatureHelpUtilities.cs (1)
137token.ValueText.Length == 1 &&
Snippets\CSharpSnippetFunctionService.cs (2)
56var typeSpan = new TextSpan(caseGenerationLocation.Start + "case ".Length, fullyQualifiedTypeName.Length);
SplitStringLiteral\InterpolatedStringSplitter.cs (1)
93protected override int StringOpenQuoteLength() => "$\"".Length;
SplitStringLiteral\SimpleStringSplitter.cs (3)
33return _token.IsKind(SyntaxKind.Utf8StringLiteralToken) && CursorPosition >= _token.Span.End - "u8".Length; 47? Document.Text.GetSubText(TextSpan.FromBounds(_token.Span.End - "u8".Length, _token.Span.End)).ToString() 74protected override int StringOpenQuoteLength() => "\"".Length;
SplitStringLiteral\StringSplitter.cs (1)
119return (newRoot2, rightExpression.Span.Start + indentString.Length + StringOpenQuoteLength());
src\roslyn\src\Analyzers\CSharp\Analyzers\UseCollectionExpression\CSharpUseCollectionExpressionForFluentDiagnosticAnalyzer.cs (3)
440if (name.Length == (ToPrefix.Length + suffix.Length) &&
src\roslyn\src\Analyzers\CSharp\Analyzers\UseIndexOrRangeOperator\Helpers.cs (1)
22=> TryGetNoArgInt32Property(namedType, nameof(string.Length)) ??
src\roslyn\src\Analyzers\CSharp\CodeFixes\ConvertNamespace\ConvertNamespaceTransform.cs (3)
168if (lastRawStringLiteralData.closeTerminatorIndentationLength != indentation.Length) 182while (commonIndentation < indentation.Length && commonIndentation < textLine.Span.Length) 416if (outerIndentation.Length > 0)
src\roslyn\src\Analyzers\CSharp\CodeFixes\UseCollectionExpression\CSharpCollectionExpressionRewriter.cs (1)
712? preferredIndentation + positionIndentation[firstTokenOnLineIndentationString.Length..]
src\roslyn\src\Analyzers\CSharp\CodeFixes\UsePrimaryConstructor\CSharpUsePrimaryConstructorCodeFixProvider.cs (4)
350if (constructorLeadingWhitespace.Length > typeLeadingWhitespace.Length && 353var indentation = constructorLeadingWhitespace[typeLeadingWhitespace.Length..]; 363leadingTrivia.Take(leadingTrivia.Count - 1).Concat(Whitespace(elementLeadingWhitespace[..^indentation.Length])));
Structure\CSharpStructureHelpers.cs (4)
113var prefixLength = prefix.Length; 136text = text.Length >= "/**/".Length && text.EndsWith(MultiLineCommentSuffix) 137? text[..^MultiLineCommentSuffix.Length]
Structure\Providers\DocumentationCommentStructureProvider.cs (1)
34var endPos = documentationComment.SpanStart + documentationComment.ToString().TrimEnd().Length;
Structure\Providers\RegionDirectiveStructureProvider.cs (1)
22if (text.Length == 0)
TaskList\CSharpTaskListService.cs (3)
20private static readonly int s_multilineCommentPostfixLength = "*/".Length; 69for (var i = 0; i < message.Length; i++) 79return message.Length;
Microsoft.CodeAnalysis.CSharp.NetAnalyzers (6)
Microsoft.CodeQuality.Analyzers\ApiDesignGuidelines\CSharpIdentifiersShouldNotContainUnderscores.Fixer.cs (1)
21if (result.Length == 0)
Microsoft.NetCore.Analyzers\Performance\CSharpUseSearchValues.cs (2)
112length = value.Length; 174length = value.Length;
Microsoft.NetCore.Analyzers\Runtime\CSharpForwardCancellationTokenToInvocationsFixer.TypeNameVisitor.cs (1)
197if (escaped.Length == 0 || escaped[0] != '@')
Microsoft.NetCore.Analyzers\Usage\CSharpMissingShebangInFileBasedProgram.cs (2)
77(content.Length == directiveName.Length || char.IsWhiteSpace(content[directiveName.Length]));
Microsoft.CodeAnalysis.CSharp.Workspaces (34)
Classification\SyntaxClassification\DocCommentCodeBlockClassifier.cs (3)
187if (token.ValueText.Length != 1) 191virtualCharsBuilder.Add(new(new(token.ValueText[0], offset: 0, token.Text.Length), token.SpanStart)); 197for (var i = 0; i < token.Text.Length; i++)
Classification\Worker_DocumentationComments.cs (1)
103for (var index = 0; index < text.Length; index++)
Classification\Worker.cs (2)
133AddClassification(TextSpan.FromBounds(token.Span.Start, token.Span.End - "u8".Length), type); 134AddClassification(TextSpan.FromBounds(token.Span.End - "u8".Length, token.Span.End), ClassificationTypeNames.Keyword);
Rename\CSharpRenameRewriterLanguageService.cs (1)
1063if (replacementText.EndsWith("Attribute", StringComparison.Ordinal) && replacementText.Length > 9)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\EmbeddedLanguages\VirtualChars\CSharpVirtualCharService.cs (12)
136var endIndexExclusive = tokenText.Length; 141endIndexExclusive -= "u8".Length; 233if (startDelimiter.Length > 0 && !tokenText.StartsWith(startDelimiter)) 239if (endDelimiter.Length > 0 && !tokenText.EndsWith(endDelimiter, StringComparison.OrdinalIgnoreCase)) 245var startIndexInclusive = startDelimiter.Length; 246var endIndexExclusive = tokenText.Length - endDelimiter.Length; 435result.Add(new VirtualCharGreen((char)highSurrogate, offset: startIndex, width: prefix.Length)); 436result.Add(new VirtualCharGreen((char)lowSurrogate, offset: startIndex + prefix.Length, width: 4)); 439return @"\UAAAABBBB".Length; 465var width = @"\uAAAA".Length; 482for (var i = 0; i < 4 && endIndex < tokenText.Length; i++)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\SyntaxTriviaExtensions.cs (2)
109textBuilder.Remove(textBuilder.Length - newLine.Length, newLine.Length);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Engine\Trivia\TriviaDataFactory.CodeShapeAnalyzer.cs (2)
147_indentation += text.ConvertTabToSpace(_options.TabSize, _indentation, text.Length); 345if (xmlCommentText.GetColumnFromLineOffset(xmlCommentText.Length - 3, tabSize) != indentation)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Engine\Trivia\TriviaDataFactory.cs (1)
128return textSnippet.ConvertTabToSpace(Options.TabSize, initialColumn, textSnippet.Length);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\FormattingHelpers.cs (1)
30var start = lastNewLinePos + NewLine.Length;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Services\SyntaxFacts\CSharpSyntaxFacts.cs (4)
460return this.IsIdentifier(token) && !token.ContainsDiagnostics && token.ToString().Length == identifier.Length; 466return this.IsIdentifier(token) && !token.ContainsDiagnostics && token.ToString().Length == identifier.Length && token.IsVerbatimIdentifier();
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\CSharpCodeGenerationHelpers.cs (2)
132if (tokenText.Length <= 2 || tokenText.Last() != '"') 141if (tokenText.Length <= 1 || tokenText.Last() != '"')
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\ITypeSymbolExtensions.TypeSyntaxGeneratorVisitor.cs (1)
153? null : symbol.Signature.UnmanagedCallingConventionTypes.Select(type => GetConventionForString(type.Name["CallConv".Length..])),
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\StringExtensions.cs (1)
37if (escaped.Length == 0 || escaped[0] != '@')
SyncedSource\FileBasedPrograms\VirtualProjectBuilder.cs (1)
123entryPointFilePath = projectPath[..^CsprojExtension.Length];
Microsoft.CodeAnalysis.Extensions.Package (18)
src\roslyn\src\Compilers\Core\Portable\InternalUtilities\StringExtensions.cs (14)
41return name.Length >= 3 && name[0] == 'I' && char.IsUpper(name[1]) && char.IsLower(name[2]); 46return name.Length >= 3 && name[0] == 'T' && char.IsUpper(name[1]) && char.IsLower(name[2]); 154result = name[..^AttributeSuffix.Length]; 168return name.Length > AttributeSuffix.Length && name.EndsWith(AttributeSuffix, comparison); 174while (i < str.Length) 181if (i < str.Length && char.IsLowSurrogate(str[i])) 211if (arg.Length > 1 && arg[0] == '"' && arg[arg.Length - 1] == '"') 214return arg.Substring(1, arg.Length - 2); 226while (x < string1.Length && x < string2.Length && 238while (x < string1.Length && x < string2.Length &&
src\roslyn\src\Dependencies\Collections\Extensions\IEnumerableExtensions.cs (2)
213return str.Length == 0; 236return source.Length == 0;
Symbols\ISymbolExtensions.cs (1)
841(symbol.Name.Length == 1 || uint.TryParse(symbol.Name[1..], out _) || symbol.Name.All(n => n.Equals('_')));
Symbols\ITypeSymbolExtensions.cs (1)
370return shortName.Length == 0
Microsoft.CodeAnalysis.Features (226)
CodeFixes\Configuration\ConfigurationUpdater.cs (15)
474severitySuffixInValue.Length == 0) 498var newSeverityValue = _configurationKind == ConfigurationKind.Severity && severitySuffixInValue.Length > 0 ? $":{_newSeverity}" : severitySuffixInValue; 507severitySuffixInValue.Length == 0 && 524var diagIdLength = key.Length - (DiagnosticOptionPrefix.Length + SeveritySuffix.Length); 527var diagId = key.Substring(DiagnosticOptionPrefix.Length, diagIdLength); 544var categoryLength = key.Length - (BulkConfigureAnalyzerDiagnosticsByCategoryOptionPrefix.Length + SeveritySuffix.Length); 545var category = key.Substring(BulkConfigureAnalyzerDiagnosticsByCategoryOptionPrefix.Length, categoryLength); 715if (lastValidSpecificHeaderSpanEnd.Value.ToString().Trim().Length != 0) 725if (lastValidHeaderSpanEnd.Value.ToString().Trim().Length != 0) 743if (lastLine.ToString().Trim().Length != 0) 749if (lines.Count > 1 && lastLine.ToString().Trim().Length == 0)
CodeFixes\Suppression\AbstractSuppressionCodeFixProvider.PragmaBatchFixHelpers.cs (1)
154var delta = textChange.NewText.Length - textChange.Span.Length;
CodeRefactorings\AddMissingImports\AbstractAddMissingImportsFeatureService.cs (1)
114.Select(changes => new TextSpan(changes.Key.Start, changes.Sum(change => change.NewText!.Length)));
CodeRefactorings\CodeRefactoringService.cs (1)
93if (FileNameUtilities.GetExtension(document.FilePath) is string documentExtension && documentExtension.Length > 0)
CodeRefactorings\SyncNamespace\AbstractChangeNamespaceService.cs (1)
191|| (targetNamespace.Length > 0 && !targetNamespace.Split(s_dotSeparator).All(syntaxFacts.IsValidIdentifier)))
CodeRefactorings\SyncNamespace\AbstractSyncNamespaceCodeRefactoringProvider.cs (1)
81var title = state.TargetNamespace.Length == 0
CodeRefactorings\SyncNamespace\AbstractSyncNamespaceCodeRefactoringProvider.MoveFileCodeAction.cs (1)
59var parts = state.RelativeDeclaredNamespace.Length == 0
CodeRefactorings\SyncNamespace\AbstractSyncNamespaceCodeRefactoringProvider.State.cs (5)
208else if (relativeTo.Length == 0) 212else if (relativeTo.Length >= @namespace.Length) 218var namespacePrefix = @namespace[..containingText.Length]; 221? @namespace[(relativeTo.Length + 1)..]
Common\TaggedText.cs (3)
143builder.EnsureCapacity(values.Sum(static value => value.Text.Length)); 197yield return new ClassifiedSpan(new TextSpan(index, text.Length), classificationTypeName); 198index += text.Length;
Completion\CommonCompletionUtilities.cs (2)
190characterPosition = characterPosition - value.Length + 1; 192for (var i = 0; i < value.Length; i++, characterPosition++)
Completion\CompletionHelper.cs (2)
172if (item1.GetEntireDisplayText().Length != item2.GetEntireDisplayText().Length)
Completion\CompletionItem.cs (2)
547_lazyEntireDisplayText ??= (DisplayTextPrefix.Length > 0 || DisplayTextSuffix.Length > 0)
Completion\FileSystemCompletionHelper.cs (1)
200if (directoryPath.Length == 2)
Completion\PatternMatchHelper.cs (4)
149var patternMatch = Pattern.Length > 0 162if (Pattern.Length > 0 && item.HasAdditionalFilterTexts) 220if (Pattern.Length == 0) 240return filterText.Length <= 1 ||
Completion\Providers\AbstractDocCommentCompletionProvider.cs (1)
308var newPosition = replacementSpan.Start + beforeCaretText.Length;
Completion\Providers\ImportCompletionProvider\ExtensionMemberImportCompletionHelper.SymbolComputer.cs (2)
500if (filterReceiverTypeName.Length > 0 && !string.Equals(filterReceiverTypeName, GetReceiverTypeName(extensionParameter.Type), StringComparison.Ordinal)) 516if (filterReceiverTypeName.Length > 0 && !string.Equals(filterReceiverTypeName, GetReceiverTypeName(method.Parameters[0].Type), StringComparison.Ordinal))
Completion\Providers\ImportCompletionProvider\ImportCompletionItem.cs (1)
194=> namespaceName.Length == 0 ? typeName : namespaceName + "." + typeName;
Completion\Providers\Scripting\AbstractDirectivePathCompletionProvider.cs (4)
84var directiveNameEndIndex = directiveNameStartIndex + DirectiveName.Length; 102var afterLastSlashIndex = AfterLastSlashIndex(path, path.Length); 123var endIndex = quotedPath.Length; 145position = Math.Min(position, text.Length - 1);
Completion\Providers\SymbolCompletionItem.cs (1)
280while (current < projectIds.Length)
Completion\Utilities.cs (1)
39var sumOfDeltas = changes.Sum(c => c.NewText!.Length - c.Span.Length);
ConvertNumericLiteral\AbstractConvertNumericLiteralCodeRefactoringProvider.cs (3)
92NumericKind.Decimal when number.Length > 3 => CreateCodeAction(AddSeparators(number, interval: 3), FeaturesResources.Separate_thousands), 93NumericKind.Hexadecimal when number.Length > 4 => CreateCodeAction(hexPrefix + AddSeparators(number, interval: 4), FeaturesResources.Separate_words), 94NumericKind.Binary when number.Length > 4 => CreateCodeAction(binaryPrefix + AddSeparators(number, interval: 4), FeaturesResources.Separate_nibbles),
ConvertToInterpolatedString\AbstractConvertPlaceholderToInterpolatedStringRefactoringProvider.cs (1)
242if (currentLocation + 1 >= stringLiteralText.Length)
Copilot\CopilotUtilities.cs (1)
44var newTextLength = change.NewText!.Length;
Copilot\ICopilotChangeAnalysisService.cs (1)
367=> codeFixCollection.Provider.GetType().FullName![RoslynPrefix.Length..];
DocumentationComments\AbstractDocumentationCommentFormattingService.cs (2)
587var builder = new StringBuilder(rawText.Length); 592for (var i = 0; i < rawText.Length; i++)
DocumentationComments\AbstractDocumentationCommentSnippetService.cs (17)
44var commentStart = endPosition - "///".Length; 92lines[^1] = lines[^1][..^options.NewLine.Length]; 130var summaryOpenTagLength = "<summary>".Length; 131caretOffset = " ".Length + summaryOpenTagLength; 137caretOffset = lines[0].Length + indentText.Length + ExteriorTriviaText.Length + " ".Length; 140spanToReplaceLength = existingCommentText!.Length; 288var offset = lines[0].Length + lines[1].Length - newLine.Length; 294newText = newText[..^newLine.Length]; 345var offset = lines[0].Length + lines[1].Length - newLine.Length; 426return new DocumentationCommentSnippet(replaceSpan, insertionText, insertionText.Length, position: null, memberNode: null, indentText: null);
DocumentationComments\CopilotDocumentationCommentGenerator.cs (11)
49proposedEdits.Add(new DocumentationCommentProposedEdit(new TextSpan(summaryEndTag + "</summary>".Length + startIndex, 0), symbolName: null, DocumentationCommentTagType.Remarks)); 61var typeParamNameStart = typeParamStartTag + "<typeparam name=\"".Length; 69index = typeParamEndTag + "</typeparam>".Length; 82var paramNameStart = paramStartTag + "<param name=\"".Length; 90index = paramEndTag + "</param>".Length; 109var exceptionNameStart = exceptionStartTag + "<exception cref=\"".Length; 117index = exceptionEndTag + "</exception>".Length; 209characterLimit -= (indentText!.Length + "/// ".Length); 212if (currentLineLength + word.Length >= characterLimit) 227currentLineLength += word.Length;
EditAndContinue\EditAndContinueDiagnosticDescriptors.cs (4)
270=> diagnosticId.Length > EncDiagnosticIdPrefix.Length && diagnosticId.StartsWith(EncDiagnosticIdPrefix, StringComparison.Ordinal) && diagnosticId[EncDiagnosticIdPrefix.Length] is >= '0' and <= '9'; 276=> IsRudeEdit(diagnosticId) && int.TryParse(diagnosticId[RudeEditDiagnosticIdPrefix.Length..], out var id) ? (RudeEditKind)id : RudeEditKind.None;
EmbeddedLanguages\Classification\AbstractFallbackEmbeddedLanguageClassifier.cs (1)
44if (virtualChars.Length == token.Text.Length)
EmbeddedLanguages\DateAndTime\EmbeddedCompletionContext.cs (1)
92var formatString = !standard && displayText.Length == 1
EmbeddedLanguages\Json\JsonLexer.cs (1)
324for (var i = 0; i < val.Length; i++)
EmbeddedLanguages\Json\JsonParser.cs (2)
531if (chars.Length != val.Length) 534for (var i = 0; i < val.Length; i++)
EmbeddedLanguages\Json\JsonParser.JsonNetSyntaxChecks.cs (1)
91if (!long.TryParse(chars["0x".Length..].CreateString(), NumberStyles.AllowHexSpecifier, CultureInfo.InvariantCulture, out _))
EmbeddedLanguages\RegularExpressions\LanguageServices\EmbeddedCompletionContext.cs (2)
58newPosition += escapedInsertionText.Length - insertionText.Length;
EmbeddedLanguages\RegularExpressions\LanguageServices\RegexEmbeddedCompletionProvider.cs (33)
234context.AddIfMissing("{n}", Regex_match_exactly_n_times_short, Regex_match_exactly_n_times_long, parentOpt: null, positionOffset: "{".Length, insertionText: "{}"); 235context.AddIfMissing("{n}?", Regex_match_exactly_n_times_lazy_short, Regex_match_exactly_n_times_lazy_long, parentOpt: null, positionOffset: "{".Length, insertionText: "{}?"); 237context.AddIfMissing("{n,}", Regex_match_at_least_n_times_short, Regex_match_at_least_n_times_long, parentOpt: null, positionOffset: "{".Length, insertionText: "{,}"); 238context.AddIfMissing("{n,}?", Regex_match_at_least_n_times_lazy_short, Regex_match_at_least_n_times_lazy_long, parentOpt: null, positionOffset: "{".Length, insertionText: "{,}?"); 240context.AddIfMissing("{m,n}", Regex_match_between_m_and_n_times_short, Regex_match_between_m_and_n_times_long, parentOpt: null, positionOffset: "{".Length, insertionText: "{,}"); 241context.AddIfMissing("{m,n}?", Regex_match_between_m_and_n_times_lazy_short, Regex_match_between_m_and_n_times_lazy_long, parentOpt: null, positionOffset: "{".Length, insertionText: "{,}?"); 281var description = longDesc.Length > 0 306context.AddIfMissing($"( {Regex_subexpression} )", Regex_matched_subexpression_short, Regex_matched_subexpression_long, parentOpt, positionOffset: "(".Length, insertionText: "()"); 307context.AddIfMissing($"(?< {Regex_name} > {Regex_subexpression} )", Regex_named_matched_subexpression_short, Regex_named_matched_subexpression_long, parentOpt, positionOffset: "(?<".Length, insertionText: "(?<>)"); 308context.AddIfMissing($"(?< {Regex_name1} - {Regex_name2} > {Regex_subexpression} )", Regex_balancing_group_short, Regex_balancing_group_long, parentOpt, positionOffset: "(?<".Length, insertionText: "(?<->)"); 309context.AddIfMissing($"(?: {Regex_subexpression} )", Regex_noncapturing_group_short, Regex_noncapturing_group_long, parentOpt, positionOffset: "(?:".Length, insertionText: "(?:)"); 310context.AddIfMissing($"(?= {Regex_subexpression} )", Regex_zero_width_positive_lookahead_assertion_short, Regex_zero_width_positive_lookahead_assertion_long, parentOpt, positionOffset: "(?=".Length, insertionText: "(?=)"); 311context.AddIfMissing($"(?! {Regex_subexpression} )", Regex_zero_width_negative_lookahead_assertion_short, Regex_zero_width_negative_lookahead_assertion_long, parentOpt, positionOffset: "(?!".Length, insertionText: "(?!)"); 312context.AddIfMissing($"(?<= {Regex_subexpression} )", Regex_zero_width_positive_lookbehind_assertion_short, Regex_zero_width_positive_lookbehind_assertion_long, parentOpt, positionOffset: "(?<=".Length, insertionText: "(?<=)"); 313context.AddIfMissing($"(?<! {Regex_subexpression} )", Regex_zero_width_negative_lookbehind_assertion_short, Regex_zero_width_negative_lookbehind_assertion_long, parentOpt, positionOffset: "(?<!".Length, insertionText: "(?<!)"); 314context.AddIfMissing($"(?> {Regex_subexpression} )", Regex_atomic_group_short, Regex_atomic_group_long, parentOpt, positionOffset: "(?>".Length, insertionText: "(?>)"); 316context.AddIfMissing($"(?( {Regex_expression} ) {Regex_yes} | {Regex_no} )", Regex_conditional_expression_match_short, Regex_conditional_expression_match_long, parentOpt, positionOffset: "(?(".Length, insertionText: "(?()|)"); 317context.AddIfMissing($"(?( {Regex_name_or_number} ) {Regex_yes} | {Regex_no} )", Regex_conditional_group_match_short, Regex_conditional_group_match_long, parentOpt, positionOffset: "(?(".Length, insertionText: "(?()|)"); 319context.AddIfMissing($"(?# {Regex_comment} )", Regex_inline_comment_short, Regex_inline_comment_long, parentOpt, positionOffset: "(?#".Length, insertionText: "(?#)"); 320context.AddIfMissing($"(?imnsx-imnsx)", Regex_inline_options_short, Regex_inline_options_long, parentOpt, positionOffset: "(?".Length, insertionText: "(?)"); 321context.AddIfMissing($"(?imnsx-imnsx: {Regex_subexpression} )", Regex_group_options_short, Regex_group_options_long, parentOpt, positionOffset: "(?".Length, insertionText: "(?:)"); 333context.AddIfMissing($"[ {Regex_character_group} ]", Regex_positive_character_group_short, Regex_positive_character_group_long, parentOpt, positionOffset: "[".Length, insertionText: "[]"); 334context.AddIfMissing($"[ firstCharacter-lastCharacter ]", Regex_positive_character_range_short, Regex_positive_character_range_long, parentOpt, positionOffset: "[".Length, insertionText: "[-]"); 335context.AddIfMissing($"[^ {Regex_character_group} ]", Regex_negative_character_group_short, Regex_negative_character_group_long, parentOpt, positionOffset: "[^".Length, insertionText: "[^]"); 336context.AddIfMissing($"[^ firstCharacter-lastCharacter ]", Regex_negative_character_group_short, Regex_negative_character_range_long, parentOpt, positionOffset: "[^".Length, insertionText: "[^-]"); 337context.AddIfMissing($"[ {Regex_base_group} -[ {Regex_excluded_group} ] ]", Regex_character_class_subtraction_short, Regex_character_class_subtraction_long, parentOpt, positionOffset: "[".Length, insertionText: "[-[]]"); 357context.AddIfMissing($@"\k< {Regex_name_or_number} >", Regex_named_backreference_short, Regex_named_backreference_long, parentOpt, @"\k<".Length, insertionText: @"\k<>"); 365context.AddIfMissing(@"\1-9", Regex_numbered_backreference_short, Regex_numbered_backreference_long, parentOpt, @"\".Length, @"\"); 377context.AddIfMissing(@"\x##", Regex_hexadecimal_escape_short, Regex_hexadecimal_escape_long, parentOpt, @"\x".Length, @"\x"); 378context.AddIfMissing(@"\u####", Regex_unicode_escape_short, Regex_unicode_escape_long, parentOpt, @"\u".Length, @"\u"); 379context.AddIfMissing(@"\cX", Regex_control_character_short, Regex_control_character_long, parentOpt, @"\c".Length, @"\c"); 383context.AddIfMissing(@"\p{...}", Regex_unicode_category_short, Regex_unicode_category_long, parentOpt, @"\p".Length, @"\p"); 384context.AddIfMissing(@"\P{...}", Regex_negative_unicode_category_short, Regex_negative_unicode_category_long, parentOpt, @"\P".Length, @"\P");
EmbeddedLanguages\RegularExpressions\RegexLexer.cs (1)
184for (var i = 0; i < val.Length; i++)
EmbeddedLanguages\RegularExpressions\RegexParser.cs (2)
1763var afterBackslashPosition = _lexer.Position - @"k".Length; 1984if (_lexer.Text.Length - _lexer.Position < "{x}".Length)
EmbeddedLanguages\StackFrame\StackFrameLexer.cs (3)
449for (var i = 0; i < val.Length; i++) 466Position += valueToLookFor.Length; 479Position += valueToLookFor.Length;
EncapsulateField\AbstractEncapsulateFieldService.cs (1)
426if (baseName.Length == 0)
FindUsages\AbstractFindUsagesService_FindReferences.cs (1)
214if (title.Length >= 10)
GenerateType\AbstractGenerateTypeService.Editor.cs (3)
172namespaceToGenerateInto = namespaceToGenerateInto[rootNamespace.Length..]; 239return rootNamespace.Length; 244return rootNamespace.Length + 1;
InitializeParameter\AbstractAddParameterCheckCodeRefactoringProvider.cs (1)
1013return (text[..index], text[(index + Placeholder.Length)..]);
InlineHints\AbstractInlineParameterNameHintsService.cs (6)
176if (name?.Length >= 2 && 193if (name?.Length >= 2 && 257if (nameValue.Length > prefix.Length && 259char.IsUpper(nameValue[prefix.Length])) 261suffix = nameValue.AsMemory()[prefix.Length..];
MetadataAsSource\AbstractMetadataAsSourceService.DocCommentFormatter.cs (2)
135while (formattedCommentLinesBuilder is [{ Length: 0 }, ..]) 139while (formattedCommentLinesBuilder is [.., { Length: 0 }])
MetadataAsSource\DocumentationCommentUtilities.cs (1)
25str = str[docCommentPrefix.Length..];
MoveToNamespace\AbstractMoveToNamespaceService.cs (1)
293: symbol.ContainingNamespace.ToDisplayString().Length + 1;
NavigateTo\RegexPatternDetector.cs (1)
96if (containerEnd == 0 || nameStart >= pattern.Length)
PdbSourceDocument\SourceLinkMap.cs (6)
105list.Sort((left, right) => -left.FilePath.Path.Length.CompareTo(right.FilePath.Path.Length)); 119if (key.Length == 0) 125if (filePathStar == key.Length - 1) 194var escapedPath = string.Join("/", path[file.Path.Length..].Split(['/', '\\']).Select(Uri.EscapeDataString)); 201Debug.Assert(mappedUri.Suffix.Length == 0);
QuickInfo\QuickInfoUtilities.cs (2)
63builder.AddText(FeaturesResources.Awaited_task_returns_0[(symbolIndex + defaultSymbol.Length)..]); 146builder.AddText(FeaturesResources.Intercepted_by_0[(symbolIndex + defaultSymbol.Length)..]);
ReplaceMethodWithProperty\ReplaceMethodWithPropertyCodeRefactoringProvider.cs (5)
63methodName[GetPrefix.Length..], 94=> text.StartsWith(prefix, StringComparison.OrdinalIgnoreCase) && text.Length > prefix.Length && !char.IsLower(text[prefix.Length]); 99var setMethodName = "Set" + getMethod.Name[GetPrefix.Length..];
SemanticSearch\SemanticSearchDefinitionItemFactory.cs (3)
30displayParts: text.Length == displayStr.Length ? [displayText] : [displayText, new TaggedText(TextTags.Punctuation, "…")]); 81=> str[0..Math.Min(str.Length, maxLength)];
Shared\Utilities\ExtractTypeHelpers.cs (1)
79? containingNamespaceDisplay.Remove(index, rootNamespace.Length)
Snippets\RoslynLSPSnippetConverter.cs (3)
61i += placeholderInfo.text.Length; 65if (i < textChangeText.Length) 129var endPosition = textChange.Span.Start + textChangeText.Length;
Snippets\SnippetFunctionService.cs (1)
42var updatedTextSpan = new TextSpan(fieldSpan.Start, fullyQualifiedTypeName.Length);
Snippets\SnippetProviders\AbstractTypeSnippetProvider.cs (2)
55: [new SnippetPlaceholder(identifier.Text[prefix.Length..], identifier.SpanStart + prefix.Length)];
SpellCheck\AbstractSpellCheckCodeFixProvider.cs (2)
77if (nameText?.Length >= MinTokenLength) 98if (nameText?.Length >= MinTokenLength)
src\roslyn\src\Analyzers\Core\Analyzers\FileHeaders\AbstractFileHeaderHelper.cs (2)
122var eolLength = Environment.NewLine.Length; 126return new FileHeader(sb.ToString(), fileHeaderStart, fileHeaderEnd, CommentPrefix.Length);
src\roslyn\src\Analyzers\Core\Analyzers\Formatting\AbstractFormattingAnalyzer.cs (6)
64if (change.NewText.Length > 0 && !change.Span.IsEmpty) 69var offset = change.Span.Length - change.NewText.Length; 72if (oldText.GetSubText(new TextSpan(change.Span.Start + offset, change.NewText.Length)).ContentEquals(SourceText.From(change.NewText))) 81if (oldText.GetSubText(new TextSpan(change.Span.Start, change.NewText.Length)).ContentEquals(SourceText.From(change.NewText))) 83change = new TextChange(new TextSpan(change.Span.Start + change.NewText.Length, offset), ""); 90if (change.NewText.Length == 0 && change.Span.IsEmpty)
src\roslyn\src\Analyzers\Core\Analyzers\RemoveUnnecessarySuppressions\AbstractRemoveUnnecessaryPragmaSuppressionsDiagnosticAnalyzer.cs (6)
310var idWithoutPrefix = id.StartsWith(CompilerErrorCodePrefix) && id.Length == CompilerErrorCodePrefix.Length + CompilerErrorCodeDigitCount 311? id[CompilerErrorCodePrefix.Length..] 377trimmedPart = trimmedPart[categoryPrefix.Length..].Trim(); 808category?.Length > 0 && userCategoryExclusions.Contains(category, StringComparer.OrdinalIgnoreCase)) 868return id.Length > 0;
src\roslyn\src\Analyzers\Core\Analyzers\RemoveUnusedMembers\AbstractRemoveUnusedMembersDiagnosticAnalyzer.cs (2)
1086var suffix = methodSymbol.Name[prefix.Length..]; 1087return suffix.Length > 0 &&
src\roslyn\src\Analyzers\Core\Analyzers\ValidateFormatString\AbstractValidateFormatStringDiagnosticAnalyzer.cs (2)
356invalidPlaceholderText.Length)); 385if (placeholderIndexText.Length > 0 && char.IsWhiteSpace(placeholderIndexText, 0))
src\roslyn\src\Analyzers\Core\CodeFixes\ConflictMarkerResolution\AbstractConflictMarkerCodeFixProvider.cs (1)
40private static readonly int s_mergeConflictLength = "<<<<<<<".Length;
src\roslyn\src\Analyzers\Core\CodeFixes\GenerateConstructor\GenerateConstructorHelpers.cs (1)
218var fieldNameMinusPrefix = newFieldName[fieldNamingRule.NamingStyle.Prefix.Length..];
src\roslyn\src\Analyzers\Core\CodeFixes\MakeMethodSynchronous\AbstractMakeMethodSynchronousCodeFixProvider.cs (3)
60methodSymbol.Name.Length > AsyncSuffix.Length && 74var newName = name[..^AsyncSuffix.Length];
src\roslyn\src\Analyzers\Core\CodeFixes\UseObjectInitializer\AbstractUseObjectInitializerCodeFixProvider.cs (1)
135endPosition: existingWhitespace.Length);
src\roslyn\src\Compilers\Core\Portable\DiagnosticAnalyzer\SuppressMessageAttributeState.TargetSymbolResolver.cs (9)
54return id[prefix.Length..]; 86if (_name.Length >= 2 && _name[0] == 'e' && _name[1] == ':') 257if (callingConvention == _name.Substring(_index, callingConvention.Length)) 259_index += callingConvention.Length; 281_index = _name.Length; 289return _index >= _name.Length ? '\0' : _name[_index]; 296while (_index < _name.Length && char.IsDigit(_name[_index])) 456for (; _index < _name.Length && _name[_index] != '}'; ++_index) { } 463for (; _index < _name.Length; ++_index)
src\roslyn\src\Dependencies\CodeAnalysis.Debugging\CustomDebugInfoEncoder.cs (2)
153Debug.Assert(info.LocalName.Length <= IdentifierSize); 160builder.WriteBytes(0, sizeof(char) * (IdentifierSize - info.LocalName.Length));
src\roslyn\src\Dependencies\CodeAnalysis.Debugging\CustomDebugInfoReader.cs (7)
504if (importString.Length >= 2 && importString[0] == '@') 558return import.Length > 0 && import[0] == 'Z'; 691if (import.Length == 0) 725if (pos >= import.Length) 743if (pos >= import.Length) 831if (offset <= separatorPos && separatorPos < input.Length) 834after = separatorPos + 1 == input.Length
TaskList\AbstractTaskListService.cs (4)
87if (index >= message.Length) 99if (message.Length > index + token.Length && IsIdentifierCharacter(message[index + token.Length]))
Wrapping\SeparatedSyntaxList\SeparatedSyntaxListCodeActionComputer.cs (1)
324currentOffset += " ".Length;
Microsoft.CodeAnalysis.NetAnalyzers (62)
Microsoft.CodeQuality.Analyzers\ApiDesignGuidelines\IdentifiersShouldHaveCorrectPrefix.cs (2)
118if (allowSingleLetterTypeParameters && typeParameter.Name.Length == 1) 134if (firstWord == null || firstWord.Length > 1)
Microsoft.CodeQuality.Analyzers\ApiDesignGuidelines\IdentifiersShouldNotContainUnderscores.Fixer.cs (1)
50if (newName.Length == 0)
Microsoft.CodeQuality.Analyzers\ApiDesignGuidelines\IdentifiersShouldNotHaveIncorrectSuffix.cs (2)
192if (IsInvalidSuffix(name, ExSuffix, allowedSuffixes) && name.Length > ExSuffix.Length)
Microsoft.CodeQuality.Analyzers\ApiDesignGuidelines\MarkAttributesWithAttributeUsage.Fixer.cs (1)
87string value = equivalenceKey[Prefix.Length..];
Microsoft.CodeQuality.Analyzers\ApiDesignGuidelines\OverrideMethodsOnComparableTypes.cs (2)
104if (!overridesEquals && comparisonOperatorsString.Length != 0) 112else if (comparisonOperatorsString.Length != 0)
Microsoft.CodeQuality.Analyzers\ApiDesignGuidelines\UsePropertiesWhereAppropriate.cs (1)
119return methodName.Length > 3 &&
Microsoft.CodeQuality.Analyzers\Maintainability\CodeMetricsAnalyzer.cs (2)
335if (contents.Length == 0 || contents.StartsWith("#", StringComparison.Ordinal)) 375keyParts[1].Length == 0 ||
Microsoft.CodeQuality.Analyzers\QualityGuidelines\UseLiteralsWhereAppropriate.cs (1)
98((string)initializerValue).Length == 0)
Microsoft.NetCore.Analyzers\InteropServices\PlatformCompatibilityAnalyzer.cs (4)
275platformName = methodName.Substring(2, methodName.Length - 2 - OptionalSuffix.Length); 401platformName.Length > 0) 2121for (int i = 0; i < osString.Length; i++)
Microsoft.NetCore.Analyzers\InteropServices\UseValidPlatformString.cs (5)
143return (name[2..(name.Length - VersionSuffix.Length)], method.Parameters.Length); 219else if (count == 0 && versionPart.Length != 0) 233platformName.Length == 0 || !knownPlatforms.ContainsKey(platformName); 240for (int i = 0; i < osString.Length; i++)
Microsoft.NetCore.Analyzers\Performance\UseSearchValues.cs (3)
177return value.Length >= MinLengthWorthReplacing; 197return utf8String.Value.Length >= MinLengthWorthReplacing; 241length = value.Length;
Microsoft.NetCore.Analyzers\Performance\UseSearchValues.Fixer.cs (1)
284if (name.Length >= 2 && IsAsciiLetterUpper(name[0]) && !IsAsciiLetterUpper(name[1]))
Microsoft.NetCore.Analyzers\Performance\UseStringContainsCharOverloadWithSingleCharactersAnalyzer.cs (1)
90&& constantString.Length == 1)
Microsoft.NetCore.Analyzers\Performance\UseStringMethodCharOverloadWithSingleCharacters.cs (1)
219constantString.Length == 1)
Microsoft.NetCore.Analyzers\Runtime\AttributeStringLiteralsShouldParseCorrectly.cs (2)
183if (value.Length == 0) 216if (value.Length == 0)
Microsoft.NetCore.Analyzers\Runtime\DoNotPassLiteralsAsLocalizedParameters.cs (1)
358return trimmedLiteral.Length > 2 && trimmedLiteral[0] == '<' && trimmedLiteral[^1] == '>';
Microsoft.NetCore.Analyzers\Runtime\InstantiateArgumentExceptionsCorrectly.cs (3)
262if (stringArgumentValue.Length > parameter.Name.Length && 264char.IsPunctuation(stringArgumentValue, parameter.Name.Length))
Microsoft.NetCore.Analyzers\Runtime\LoggerMessageDefineAnalyzer.cs (3)
288while (index < messageTemplate.Length) 292if (index < messageTemplate.Length - 1 && messageTemplate[index + 1] == '{') 311else if (index < messageTemplate.Length - 1 && messageTemplate[index + 1] == '}')
Microsoft.NetCore.Analyzers\Runtime\LogValuesFormatter.cs (1)
29var endIndex = format.Length;
Microsoft.NetCore.Analyzers\Runtime\PreferConstCharOverConstUnitStringAnalyzer.cs (1)
76if (firstArgument.Value.ConstantValue.HasValue && firstArgument.Value.ConstantValue.Value is string unitString && unitString.Length == 1)
Microsoft.NetCore.Analyzers\Runtime\ProvideCorrectArgumentsToFormattingMethods.cs (1)
152int len = format.Length;
Microsoft.NetCore.Analyzers\Runtime\TestForEmptyStringsUsingStringLength.cs (2)
20/// Comparing strings using the <see cref="string.Length"/> property or the <see cref="string.IsNullOrEmpty"/> method is significantly faster than using <see cref="string.Equals(string)"/>. 151return constantValueOpt.Value is string { Length: 0 };
Microsoft.NetCore.Analyzers\Runtime\TestForEmptyStringsUsingStringLength.Fixer.cs (1)
198optionalValue.HasValue && optionalValue.Value is string value && value.Length == 0;
Microsoft.NetCore.Analyzers\Security\UseAutoValidateAntiforgeryToken.cs (2)
314attributeName.EndsWith("Attribute", StringComparison.Ordinal) ? attributeName.Remove(attributeName.Length - "Attribute".Length) : attributeName),
src\40daf5e1cab76dff\HardcodedSymmetricAlgorithmKeysSources.cs (2)
40(object? v) => v is string s && s.Length % 4 == 0 && IsLegalKeySize(s.Length * 3 / 4))
src\440320f3f10733a8\ValueContentAbstractValue.cs (2)
65if (((string)literal).Length == 0) 99if (stringVal.Length == 0)
src\sdk\src\Microsoft.CodeAnalysis.NetAnalyzers\src\Utilities\Compiler\CodeMetrics\CodeAnalysisMetricData.cs (1)
142if (index >= 0 && index < symbolName.Length)
src\sdk\src\Microsoft.CodeAnalysis.NetAnalyzers\src\Utilities\Compiler\Extensions\ISymbolExtensions.cs (1)
845(symbol.Name.Length == 1 || uint.TryParse(symbol.Name[1..], out _) || symbol.Name.All(n => n.Equals('_')));
src\sdk\src\Microsoft.CodeAnalysis.NetAnalyzers\src\Utilities\Compiler\Extensions\StringExtensions.cs (2)
45return str[..^suffix.Length]; 51return Encoding.UTF8.GetByteCount(value) == value.Length;
src\sdk\src\Microsoft.CodeAnalysis.NetAnalyzers\src\Utilities\Compiler\Options\AnalyzerOptionsExtensions.cs (2)
356if (trimmedSuffix.Length >= 2 && 360for (int i = 1; i < trimmedSuffix.Length - 2; i++)
src\sdk\src\Microsoft.CodeAnalysis.NetAnalyzers\src\Utilities\Compiler\Options\SymbolNamesWithValueOption.cs (2)
107parts.SymbolName.Length == 1)) 143Debug.Assert(parts.SymbolName.Length >= 2);
src\sdk\src\Microsoft.CodeAnalysis.NetAnalyzers\src\Utilities\Compiler\RulesetToEditorconfigConverter.cs (2)
207if (comment.Length > 0) 212if (trimmedCommentPart.Length > 0)
src\sdk\src\Microsoft.CodeAnalysis.NetAnalyzers\src\Utilities\Compiler\WellKnownTypeProvider.cs (1)
274for (int i = 0; i < fullTypeName.Length; i++)
src\sdk\src\Microsoft.CodeAnalysis.NetAnalyzers\src\Utilities\Compiler\WordParser.cs (3)
107_buffer = new StringBuilder(text.Length); 555while (_index < _text.Length) 573for (int index = _index; index < _text.Length; index++)
Microsoft.CodeAnalysis.Razor.Compiler (222)
CSharp\DefaultTagHelperDescriptorFactory.cs (2)
92name = name[..^TagHelperNameEnding.Length]; 204var (hasExplicitName, attributeName) = attributeNameAttribute?.ConstructorArguments is [{ Value: string { Length: > 0 } value }, ..]
CSharp\SymbolExtensions.cs (2)
80if (typeSymbol.Name.Length > fullName.Length)
Language\BoundAttributeDescriptorBuilder.cs (1)
267else if (IndexerAttributeNamePrefix.Length > 0 && string.IsNullOrWhiteSpace(IndexerAttributeNamePrefix))
Language\CodeGeneration\CodeWriter.cs (1)
217ArgHelper.ThrowIfGreaterThan(startIndex, value.Length - count);
Language\CodeGeneration\CodeWriterExtensions.cs (1)
327if (writer.Length >= writer.NewLine.Length && !IsAtBeginningOfLine(writer))
Language\CodeGeneration\IntermediateNodeWriter.cs (7)
85var characterOffset = WriteCSharpExpressionMethod.Length 182var suffixLocation = node.Source.Value.AbsoluteIndex + node.Source.Value.Length - node.Suffix.Length; 208var valueLocation = node.Source.Value.AbsoluteIndex + node.Prefix.Length; 253var valueLocation = node.Source.Value.AbsoluteIndex + node.Prefix.Length; 254var valueLength = node.Source.Value.Length - node.Prefix.Length; 270var valueLocation = node.Source.Value.AbsoluteIndex + node.Prefix.Length; 271var valueLength = node.Source.Value.Length - node.Prefix.Length;
Language\Components\BuilderVariableName.cs (2)
191 => ComponentsApi.RenderTreeBuilder.BuilderParameter.Length, 20_ => ComponentsApi.RenderTreeBuilder.BuilderParameter.Length + Index.CountDigits()
Language\Components\ComponentBindLoweringPass.cs (6)
711valueAttributeName = attributeName["bind-".Length..]; 955if (format is { Content.Length: > 0 }) 961if (culture is { Content.Length: > 0 }) 1027if (format is { Content.Length: > 0 }) 1032if (culture is { Content.Length: > 0 }) 1122var offset = "bind-".Length;
Language\Components\ComponentLoweringPass.cs (3)
410EqualsWithOptionalChangedOrExpressionSuffix(originalAttributeName.AsSpan(start: bindPrefix.Length), attributeName)) 416EqualsWithOptionalChangedOrExpressionSuffix(nameWithoutParameter.AsSpan(start: bindPrefix.Length - 1), attributeName)) 439specifiedName.Equals(requiredName[..^suffix.Length], StringComparison.Ordinal);
Language\Components\ComponentNodeWriter.cs (1)
705+ ComponentsApi.RenderTreeBuilder.AddContent.Length
Language\Components\ComponentTildePathPass.cs (2)
180var path = content[TildePrefix.Length..]; 181if (path.Length == 0)
Language\Components\TypeNameHelper.cs (2)
38if (typeName.Length == 0) 58if (typeName.Length is < 3 or > 7)
Language\CSharpIdentifier.cs (1)
26span = span[..^cshtmlExtension.Length];
Language\DefaultDirectiveSyntaxTreePass.cs (1)
84var errorLength = /* @ */ 1 + SectionDirective.Directive.Directive.Length;
Language\DefaultRazorIntermediateNodeLoweringPhase.cs (4)
160trimmedNamespace = usingReference.Namespace.AsSpan()[globalPrefix.Length..]; 1522if (node.LiteralTokens is [{ Kind: SyntaxKind.Marker, Content.Length: 0 }]) 1953if (node.LiteralTokens is [{ Kind: SyntaxKind.Marker, Content.Length: 0 }]) 2131public string Text => field ??= (Span.Length < original.Length ? Span.ToString() : original);
Language\DefaultRazorProjectFileSystem.cs (4)
30if (root.Length == 0) 77var relativePhysicalPath = physicalPath[(absoluteBasePath.Length + 1)..]; // Don't include leading separator 128var length = Root.Length + normalizedPath.Length + (needsSlash ? 1 : 0);
Language\DefaultRazorTagHelperContextDiscoveryPhase.cs (3)
71return mem[globalPrefix.Length..]; 569if (typeNamespace.Length > @namespace.Length && typeNamespace[@namespace.Length] != '.')
Language\DefaultTagHelperResolutionPhase.ComponentTagHelperResolver.cs (8)
220var nameWithoutParamLen = directiveAttributeName.TextWithoutParameter.Length; 658var mergedSource = ExtendSpanBackward(htmlToken.Source, prefix.Length); 790var mergedSource = ExtendSpanBackward(firstToken.Source, prefix.Length); 995: mergedText.Length; 1040var nameLength = htmlAttr.AttributeName?.Length ?? 0; 1101var valueStart = prefix.Length; 1102var valueLength = attrSource.Length - prefix.Length - suffix.Length;
Language\DefaultTagHelperResolutionPhase.cs (5)
249resolvedTagName = resolvedTagName.Substring(prefix.Length); 583childTagName = childTagName.Substring(prefix.Length); 915if (exprText.Length >= 3 && exprText[0] == '@' && exprText[1] == '(') 1176.WithLength(tagName.Length) 1178.WithEndCharacterIndex(ets.CharacterIndex + 2 + tagName.Length);
Language\DefaultTagHelperResolutionPhase.LegacyTagHelperResolver.cs (22)
430if (content.Length > 0) 578var valueStart = attrSource.AbsoluteIndex + prefix.Length; 579var valueLength = attrSource.Length - prefix.Length - suffix.Length; 596var valueCharIndex = attrSource.CharacterIndex + prefix.Length + (attrSource.AbsoluteIndex + prefix.Length < valueStart ? 1 : 0); 597var valueEndCharIndex = attrSource.EndCharacterIndex - suffix.Length; 653if (attrContent.Length > 0) 724var valueStart = attrSource.AbsoluteIndex + prefix.Length; 725var valueLength = attrSource.Length - prefix.Length - suffix.Length; 739var openParenCharIndex = attrSource.CharacterIndex + prefix.Length + 1; 765var closeParenCharIndex = attrSource.CharacterIndex + prefix.Length + valueLength - 1; 785if (content.Length > 0) 861var valueAbsIndex = attrSource.AbsoluteIndex + prefix.Length; 862var valueCharIndex = attrSource.CharacterIndex + prefix.Length; 1077if (prefix.Length > 0) 1088if (content.Length > 0) 1124if (suffix.Length > 0) 1336if (text.Length >= 2 && text[0] == '(' && text[text.Length - 1] == ')') 1511var mergedSource = ExtendSpanBackward(htmlToken.Source, prefix.Length);
Language\DirectiveDescriptor.cs (2)
205if (Directive.Length == 0) 210for (var i = 0; i < Directive.Length; i++)
Language\DirectiveTokenEditHandler.cs (1)
43for (var i = 0; i < content.Length; i++)
Language\Extensions\DefaultTagHelperTargetExtension.cs (1)
516var dictionaryKey = node.AttributeName.AsMemory()[node.BoundAttribute.IndexerNamePrefix.Length..];
Language\Extensions\PreallocatedAttributeTargetExtension.cs (1)
162var dictionaryKey = node.AttributeName.Substring(node.BoundAttribute.IndexerNamePrefix.Length);
Language\Intermediate\BaseTypeWithModel.cs (3)
22BaseType = IntermediateNodeFactory.CSharpToken(baseType[0..^ModelGenericParameter.Length]); 29var greaterThanIndex = baseType.Length - ModelGenericParameter.Length;
Language\Intermediate\ComponentAttributeIntermediateNode.cs (4)
221candidate = candidate["global::".Length..]; 233if (candidate.Length <= eventCallbackName.Length + "<>".Length || 258candidate = candidate["global::".Length..]; 268candidate = candidate["System.Action".Length..];
Language\Intermediate\IntermediateNodeFormatter.cs (3)
57shortName = shortName[..^ShortNameSuffix.Length]; 199if (startIndex < content.Length) 201_builder.Append(content, startIndex, content.Length - startIndex);
Language\Legacy\CSharpCodeParser.cs (27)
295CurrentToken.Content.Length > 0 && 302_tokenizer.Reset(Context.Source.Position - split.right.Content.Length); 354new SourceSpan(CurrentStart, CurrentToken.Content.Length)); 412new SourceSpan(CurrentStart, CurrentToken.Content.Length))); 424new SourceSpan(CurrentStart, CurrentToken.Content.Length), 1225new SourceSpan(CurrentStart, currentDirective.Length), currentDirective)); 1247var errorLength = /* @ */ 1 + SyntaxConstants.CSharp.TagHelperPrefixKeyword.Length; 1383new SourceSpan(valueStartLocation.Value, rawValue.Length), keyword)); 1472new SourceSpan(directiveLocation, Math.Max(text?.Length ?? 0, 1)), text ?? string.Empty)); 1528new SourceSpan(directiveLocation, prefix.Length), 1588new SourceSpan(CurrentStart, CurrentToken.Content.Length), descriptor.Directive)); 1655new SourceSpan(CurrentStart, CurrentToken.Content.Length), descriptor.Directive)); 1684new SourceSpan(CurrentStart, CurrentToken.Content.Length), descriptor.Directive)); 1699new SourceSpan(CurrentStart, CurrentToken.Content.Length), descriptor.Directive)); 1714new SourceSpan(CurrentStart, CurrentToken.Content.Length), descriptor.Directive)); 1732new SourceSpan(CurrentStart, CurrentToken.Content.Length), descriptor.Directive)); 1753new SourceSpan(CurrentStart, CurrentToken.Content.Length), descriptor.Directive, CurrentToken.Content, lastSeenMemberIdentifier ?? string.Empty)); 1783new SourceSpan(CurrentStart, CurrentToken.Content.Length), 1846new SourceSpan(CurrentStart, CurrentToken.Content.Length), 1958var errorLength = /* @ */ 1 + descriptor.Directive.Length; 1994currentIdentifierLength += token.Content.Length; 2007identifierLength += token.Content.Length; 2019identifierLength += token.Content.Length; 2040new SourceSpan(CurrentStart, CurrentToken.Content.Length), descriptor.Directive, "{")); 2232new SourceSpan(CurrentStart, CurrentToken.Content.Length))); 2510new SourceSpan(block.Start, block.Name.Length))); 2755new SourceSpan(CurrentStart, CurrentToken.Content.Length), CurrentToken.Content));
Language\Legacy\HtmlMarkupParser.cs (18)
160new SourceSpan(CurrentStart, CurrentToken.Content.Length))); 340tracker.TagName.Length), 410if (CurrentToken.Kind == SyntaxKind.Text && CurrentToken.Content.Length > 0 && CurrentToken.Content[0] == ':') 553new SourceSpan(SourceLocationTracker.Advance(endTagStartLocation, "</"), Math.Max(endTagName.Length, 1)), endTagName)); 571tracker.TagName.Length), 663tagName.Length == 0 && 701tagName.Length == 0 ? tagStartLocation : SourceLocationTracker.Advance(tagStartLocation, "<"), 702Math.Max(tagName.Length, 1)), 1559new SourceSpan(SourceLocationTracker.Advance(tagStart, "</"), ScriptTagName.Length), 1832(trimmedStartContent.Length == 4 || 2171for (var i = 0; i < CurrentToken.Content.Length; i++) 2191position + sequence.Length <= CurrentToken.Content.Length) 2193var possibleStart = CurrentToken.Content.AsSpan(position, sequence.Length); 2204var (sequenceToken, _) = Language.SplitToken(right, sequence.Length, SyntaxKind.Text); 2205var postSequenceBookmark = bookmark.AbsoluteIndex + preSequence.Content.Length + sequenceToken.Content.Length; 2218Context.Source.Position = bookmark.AbsoluteIndex + preSequence.Content.Length;
Language\Legacy\ImplicitExpressionEditHandler.cs (14)
135change.NewText.Length > 0 && 147return change.NewText.Length == 1 && 327var tokenEnd = tokenStart + currentToken.Content.Length; 357if (content.Length > 0 && content[content.Length - 1] != '"') 369if (content.Length > 0 && content[content.Length - 1] != '\'') 392for (var i = 0; i < content.Length; i++) 582change.NewText.Length == 2 && 590change.NewText.Length == 1 && 598change.NewText.Length == 1 && 604return (content.Length == 1 && content[0] == '.') || 605(content[content.Length - 1] == '.' && 606content.Take(content.Length - 1).All(SyntaxFacts.IsIdentifierPartCharacter));
Language\Legacy\LanguageCharacteristics.cs (1)
93if (splitAt < token.Content.Length)
Language\Legacy\ParserHelpers.cs (1)
32if (value.Length == 0)
Language\Legacy\RoslynCSharpTokenizer.cs (10)
393new SourceSpan(CurrentStart, contentLength: expectedPrefix?.Length ?? 0 /* " */))); 570for (var i = 0; i < triviaString.Length; i++) 586var length = "#else".Length; 600var length = "#endif".Length; 618if (i + 1 + substring.Length > triviaString.Length) 825if (tokenText.Length >= expectedPostfix.Length + 2) 827var suffix = tokenText.AsSpan(tokenText.Length - 2); 831var textBeforeSuffix = tokenText.AsSpan(0, tokenText.Length - 2);
Language\Legacy\SourceLocationTracker.cs (1)
37if ((Environment.NewLine.Length == 1 && characterRead == Environment.NewLine[0]) ||
Language\Legacy\TagHelperBlockRewriter.cs (4)
190var errorLocation = new SourceSpan(attributeNameLocation, result.AttributeName.Length); 200var errorLocation = new SourceSpan(attributeNameLocation, result.AttributeName.Length); 513isMissingDictionaryKey = match.Attribute.IndexerNamePrefix?.Length == name.Length;
Language\Legacy\TagHelperParseTreeRewriter.cs (7)
142var source = new SourceSpan(SourceLocationTracker.Advance(startTag.GetSourceLocation(_source), "<"), tagName.Length); 187new SourceSpan(SourceLocationTracker.Advance(endTag.GetSourceLocation(_source), "</"), tagName.Length), tagName)); 368new SourceSpan(SourceLocationTracker.Advance(endTag.GetSourceLocation(_source), "</"), tagName.Length), 515new SourceSpan(errorStart, tagName.Length), tagName)); 532new SourceSpan(errorStart, tagName.Length), tagName)); 705new SourceSpan(errorStart, tagName.Length), 723new SourceSpan(errorStart, tagName.Length),
Language\Legacy\Tokenizer.cs (2)
349if (expected.Length == 0 || filter(CurrentCharacter) != filter(expected[0])) 363for (int i = 0; i < expected.Length; i++)
Language\Legacy\TokenizerView.cs (1)
37Reset(Source.Position - token.Content.Length);
Language\MarkupSplitter.Slicing.cs (2)
50var tokenEnd = tokenStart + content.Length; 64localBoundaries.Add(content.Length);
Language\NamespaceComputer.cs (2)
29if (filePath == null || relativePath == null || filePath.Length < relativePath.Length)
Language\RazorCodeDocumentExtensions.cs (2)
152var ns = content.Substring("using ".Length).TrimEnd(';').Trim(); 153if (ns.Length > 0)
Language\RazorCSharpDocumentWriter.cs (1)
149if (checksum.Length > 0)
Language\RazorHtmlWriter.cs (1)
218if (content.Length == 0)
Language\RazorProjectFileSystem.cs (4)
90if (path.Length == 1) 119while (index > basePath.Length && (index = pathMemory.Span.LastIndexOf('/')) >= 0) 124length: pathMemory.Length + fileName.Length, 134Debug.Assert(span[fileName.Length..].IsEmpty);
Language\SourceChange.cs (3)
46public bool IsDelete => Span.Length > 0 && NewText.Length == 0; 48public bool IsInsert => Span.Length == 0 && NewText.Length > 0; 50public bool IsReplace => Span.Length > 0 && NewText.Length > 0;
Language\Syntax\InternalSyntax\SyntaxToken.cs (1)
14: base(kind, content.Length, diagnostics)
Language\TagHelperMatchingConventions.cs (2)
273nameMatches = attributeName.Length != descriptor.Name.Length &&
Language\TagHelpers\Producers\BindTagHelperProducer.cs (1)
421var valueAttributeName = changeAttribute.Name[..^"Changed".Length];
Language\VirtualRazorProjectFileSystem.cs (4)
104var directoryLength = directory.Path.Length; 140while ((index = path.IndexOf('/', directory.Path.Length)) != -1 && index != path.Length) 175var startIndex = parentDirectory.Path.Length;
Mvc.Version1_X\ViewComponentTagHelperDescriptorFactory.cs (2)
265return componentType.Name.Substring(0, componentType.Name.Length - ViewComponentTypes.ViewComponentSuffix.Length);
Mvc.Version2_X\NamespaceDirective.cs (3)
102source.Length <= directiveSource.Length) 115var segments = source.Substring(directiveSource.Length).Split(Separators);
Mvc.Version2_X\ViewComponentTagHelperDescriptorFactory.cs (2)
280return componentType.Name.Substring(0, componentType.Name.Length - ViewComponentTypes.ViewComponentSuffix.Length);
Mvc\InjectDirective.cs (3)
89typeName = typeName[..^tModel.Length] + "<" + modelType + ">"; 92typeSpan = new SourceSpan(typeSpan.Value.FilePath, typeSpan.Value.AbsoluteIndex, typeSpan.Value.LineIndex, typeSpan.Value.CharacterIndex, typeSpan.Value.Length - tModel.Length, typeSpan.Value.LineCount, typeSpan.Value.EndCharacterIndex - tModel.Length);
Mvc\PageDirective.cs (2)
82Debug.Assert(content.Length >= 2); 86return content.Substring(1, content.Length - 2);
Mvc\ViewComponentTagHelperDescriptorFactory.cs (2)
283return componentType.Name.Substring(0, componentType.Name.Length - ViewComponentTypes.ViewComponentSuffix.Length);
SourceGenerators\RazorSourceGenerator.Helpers.cs (4)
39return baseName.Length == typeName.Length ? typeName : baseName.ToString(); 59return descriptor.TypeNamespace is { Length: > 0 } typeNamespace 77? implHintName.Substring(0, implHintName.Length - ImplSuffix.Length) + DeclSuffix
SourceGenerators\RazorSourceGenerator.RazorProviders.cs (2)
120projectPath is { Length: > 0 } && 126relativePath = additionalText.Path[projectPath.Length..].TrimStart(['/', '\\']);
Microsoft.CodeAnalysis.Rebuild (1)
CompilationOptionsReader.cs (1)
471if (value is null or { Length: 0 })
Microsoft.CodeAnalysis.ResxSourceGenerator (196)
AbstractResxGenerator.cs (9)
84if (options.TryGetValue("build_metadata.AdditionalFiles.Link", out var link) && link.Length > 0) 88if (linkRelativeDir.Length > 0 && !linkRelativeDir.EndsWith("\\", StringComparison.Ordinal)) 124if (!options.TryGetValue("build_metadata.AdditionalFiles.ManifestResourceName", out var resourceName) || resourceName.Length == 0) 129if (!options.TryGetValue("build_metadata.AdditionalFiles.ClassName", out var resourceClassName) || resourceClassName.Length == 0) 460if (name.Length == 0) 466var docCommentString = value.Length > maxDocCommentLength ? value.Substring(0, maxDocCommentLength) + " ..." : value; 746var builder = new StringBuilder(name.Length); 809var stringLiteral = new StringBuilder(original.Length + 3); 816for (var i = 0; i < original.Length; i++)
src\roslyn\src\Compilers\Core\Portable\FileSystem\FileUtilities.cs (2)
136if (path!.Length == 1) 178Debug.Assert(path.Length == 1 || !PathUtilities.IsDirectorySeparator(path[1]));
src\roslyn\src\Compilers\Core\Portable\FileSystem\PathUtilities.cs (36)
55int lastSeparator = s.Length; 61if (lastSeparator != s.Length) 74if (s.Length == 0 || IsAnyDirectorySeparator(s[s.Length - 1])) 163var rootLength = GetPathRoot(path, isUnixLike).Length; 164if (path.Length > rootLength) 166var i = path.Length; 237int length = path.Length; 312return path.Length > 0 && IsDirectorySeparator(path[0]) 339if (path.Length > 0 && path[0] == '.') 341if (path.Length == 1 || IsDirectorySeparator(path[1])) 348if (path.Length == 2 || IsDirectorySeparator(path[2])) 359if (path.Length >= 1 && IsDirectorySeparator(path[0])) 366if (path.Length >= 2 && path[1] == VolumeSeparatorChar && (path.Length <= 2 || !IsDirectorySeparator(path[2]))) 400return path.Length >= 2 && 411return path.Length >= 3 && path[1] == VolumeSeparatorChar && IsDirectorySeparator(path[2]); 465char c = root[root.Length - 1]; 504if (path.Length > 0 && IsDirectorySeparator(path[path.Length - 1])) 506return path.Substring(0, path.Length - 1); 633return parentPath.Length > 0 634&& childPath.Length > parentPath.Length 635&& PathsEqual(childPath, parentPath, parentPath.Length) 636&& (IsDirectorySeparator(parentPath[parentPath.Length - 1]) || IsDirectorySeparator(childPath[parentPath.Length])); 641var relativePath = childPath.Substring(parentPath.Length); 644int start = ConsumeDirectorySeparators(relativePath, relativePath.Length, 0); 673return PathsEqual(path1, path2, Math.Max(path1.Length, path2.Length)); 681if (path1.Length < length || path2.Length < length) 741if (!(oldPrefix?.Length > 0)) continue; 750var replacement = replacementPrefix + filePath.Substring(oldPrefix.Length); 870if (!isDriveRooted && !(p.Length > 1 && p[0] == AltDirectorySeparatorChar))
src\roslyn\src\Compilers\Core\Portable\InternalUtilities\CompilerOptionParseUtilities.cs (1)
42if (Environment.GetEnvironmentVariable(CachePathEnvironmentVariable) is not { Length: > 0 } cachePath)
src\roslyn\src\Compilers\Core\Portable\InternalUtilities\FileNameUtilities.cs (6)
122if (path.Length > 0 && path[path.Length - 1] == '.') 124return path.Substring(0, path.Length - 1); 149if (extension == null || path.Length == 0) 154if (extension.Length == 0 || extension[0] != '.') 173for (int i = path.Length - 1; i >= 0; i--)
src\roslyn\src\Compilers\Core\Portable\InternalUtilities\StringExtensions.cs (14)
41return name.Length >= 3 && name[0] == 'I' && char.IsUpper(name[1]) && char.IsLower(name[2]); 46return name.Length >= 3 && name[0] == 'T' && char.IsUpper(name[1]) && char.IsLower(name[2]); 154result = name[..^AttributeSuffix.Length]; 168return name.Length > AttributeSuffix.Length && name.EndsWith(AttributeSuffix, comparison); 174while (i < str.Length) 181if (i < str.Length && char.IsLowSurrogate(str[i])) 211if (arg.Length > 1 && arg[0] == '"' && arg[arg.Length - 1] == '"') 214return arg.Substring(1, arg.Length - 2); 226while (x < string1.Length && x < string2.Length && 238while (x < string1.Length && x < string2.Length &&
src\roslyn\src\Compilers\Core\Portable\InternalUtilities\StringTable.cs (5)
481if (array.Length != length) 487for (var i = 0; i < array.Length; i++) 500if (array.Length != text.Length) 517for (var i = array.Length - 1; i >= 0; i--) 538if (ascii.Length != text.Length)
src\roslyn\src\Compilers\Core\Portable\InternalUtilities\UnicodeCharacterUtilities.cs (1)
103int nameLength = name.Length;
src\roslyn\src\Compilers\Core\Portable\Syntax\SyntaxTreeExtensions.cs (2)
95var n1 = s1.Length; 96var n2 = s2.Length;
src\roslyn\src\Compilers\Core\Portable\Text\TextChangeRangeExtensions.cs (1)
105return new TextChangeRange(textChange.Span, textChange.NewText?.Length ?? 0);
src\roslyn\src\Dependencies\Collections\Extensions\IEnumerableExtensions.cs (2)
213return str.Length == 0; 236return source.Length == 0;
src\roslyn\src\RoslynAnalyzers\Utilities\Compiler\CodeMetrics\CodeAnalysisMetricData.cs (1)
141if (index >= 0 && index < symbolName.Length)
src\roslyn\src\RoslynAnalyzers\Utilities\Compiler\Extensions\StringExtensions.cs (1)
15return Encoding.UTF8.GetByteCount(value) == value.Length;
src\roslyn\src\RoslynAnalyzers\Utilities\Compiler\Options\AnalyzerOptionsExtensions.cs (2)
357if (trimmedSuffix.Length >= 2 && 361for (int i = 1; i < trimmedSuffix.Length - 2; i++)
src\roslyn\src\RoslynAnalyzers\Utilities\Compiler\Options\SymbolNamesWithValueOption.cs (2)
109parts.SymbolName.Length == 1)) 145Debug.Assert(parts.SymbolName.Length >= 2);
src\roslyn\src\RoslynAnalyzers\Utilities\Compiler\RulesetToEditorconfigConverter.cs (2)
208if (comment.Length > 0) 213if (trimmedCommentPart.Length > 0)
src\roslyn\src\RoslynAnalyzers\Utilities\Compiler\WellKnownTypeProvider.cs (1)
220for (int i = 0; i < fullTypeName.Length; i++)
src\roslyn\src\RoslynAnalyzers\Utilities\Compiler\WordParser.cs (3)
108_buffer = new StringBuilder(text.Length); 556while (_index < _text.Length) 574for (int index = _index; index < _text.Length; index++)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\CodeGeneration\ParameterName.cs (1)
42BestNameForParameter = trimmed.Length > 0 ? tryMakeCamelCase ? trimmed.ToCamelCase() : trimmed : nameBasedOnArgument;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\VirtualChars\AbstractVirtualCharService.cs (8)
30if (index + 1 < tokenText.Length) 118Debug.Assert(lastVC.Span.End == token.Span.End - "\"".Length, "Last span has to end right before the end of the string token."); 122Debug.Assert(lastVC.Span.End == token.Span.End - "\"u8".Length, "Last span has to end right before the end of the string token."); 145if (startDelimiter.Length > 0 && !tokenText.StartsWith(startDelimiter, StringComparison.Ordinal)) 151if (endDelimiter.Length > 0 && !tokenText.EndsWith(endDelimiter, StringComparison.Ordinal)) 157var startIndexInclusive = startDelimiter.Length; 158var endIndexExclusive = tokenText.Length - endDelimiter.Length;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\VirtualChars\AbstractVirtualCharService.ITextInfo.cs (1)
30public readonly int Length(string text) => text.Length;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\VirtualChars\VirtualCharGreenSequence.Chunks.cs (2)
78public override int Length => data.Length; 83return stringIndex >= 0 && stringIndex < data.Length ? stringIndex : null;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\StringExtensions.cs (13)
18for (var i = 0; i < line.Length; i++) 33for (var i = line.Length - 1; i >= 0; i--) 61return lastOffset.HasValue && lastOffset.Value < lineText.Length 71return lineText.GetColumnFromLineOffset(lineText.Length, tabSize); 74return text.ConvertTabToSpace(tabSize, initialColumn, text.Length) + initialColumn; 80Debug.Assert(endPosition >= 0 && endPosition <= textSnippet.Length); 107for (var i = 0; i < text.Length; i++) 156for (var i = 0; i < text.Length; i++) 164if (i + 1 == text.Length || text[i + 1] != '\n') 202return line.GetColumnFromLineOffset(line.Length, tabSize); 209Contract.ThrowIfFalse(0 <= endPosition && endPosition <= line.Length); 223for (var i = 0; i < line.Length; i++) 241return line.Length;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\TokenStream.cs (2)
337length = text.ConvertTabToSpace(_options.TabSize, initialColumn, text.Length); 341length = text.Length;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\TreeData.Node.cs (1)
30return lineText.GetColumnFromLineOffset(lineText.Length, tabSize);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\FormattingExtensions.cs (9)
130spaceOrIndentation = indentationString.GetColumnFromLineOffset(indentationString.Length, tabSize); 136spaceOrIndentation = text.ConvertTabToSpace(tabSize, baseToken.ToString().GetTextColumn(tabSize, initialColumn), text.Length); 156nonWhitespaceCharIndex = triviaText.Length; 164builder.Append(triviaText, nonWhitespaceCharIndex, triviaText.Length - nonWhitespaceCharIndex); 201builder.Append(line, nonWhitespaceCharIndex, line.Length - nonWhitespaceCharIndex); 226for (var i = 0; i < text.Length; i++) 245if (i >= newText.Length || text[i] != newText[i]) 252if (i == span.Length && text.Length == newText.Length)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\TriviaEngine\AbstractTriviaFormatter.cs (6)
145for (var i = 0; i < text.Length; i++) 611var tokenPosition = lastText.ConvertTabToSpace(Options.TabSize, initialColumn, lastText.Length); 741for (var i = this.OriginalString.Length - 1; i >= 0; i--) 889spaces: text.ConvertTabToSpace(Options.TabSize, lineColumn.With(whitespaceBetween).Column, text.Length), 925spaces: lineText.GetColumnFromLineOffset(lineText.Length, Options.TabSize), 931spaces: text.ConvertTabToSpace(Options.TabSize, initialColumn, text.Length),
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\Naming\IdentifierNameParts.cs (2)
47? newBaseName[prefix.Length..] 53? newBaseName[..^suffix.Length]
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\NamingStyle.cs (19)
89if (word.Length == 0) 107if (word.Length == 0) 137if (name.Length <= Prefix.Length + Suffix.Length) 147name = StripCommonPrefixes(name[Prefix.Length..], out var prefix); 160var spanToCheck = TextSpan.FromBounds(0, name.Length - Suffix.Length); 311name = StripCommonPrefixes(name.StartsWith(Prefix) ? name[Prefix.Length..] : name, out _); 346while (index + 1 < name.Length) 353if (index + 2 < name.Length && name[index + 1] == '_') 362if (index + 1 < name.Length && !char.IsDigit(name[index + 1])) 385if (Suffix.Length + Prefix.Length >= name.Length) 390name = name[Prefix.Length..^Suffix.Length]; 428for (var i = Suffix.Length; i > 0; i--) 455for (var i = 0; i < Prefix.Length; i++)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\NamingStyle.WordSpanEnumerator.cs (1)
52Current = new TextSpan(Current.End + _wordSeparator.Length, 0);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Serialization\ObjectWriter.cs (2)
504var bytes = new byte[(uint)value.Length * sizeof(char)]; 510WriteCompressedUInt((uint)value.Length);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\SyntaxFacts\AbstractDocumentationCommentService.cs (3)
90if (text.Length > maxBannerLength) 185=> tokenText.Length > 0 && char.IsWhiteSpace(tokenText[0]); 188=> tokenText.Length > 0 && char.IsWhiteSpace(tokenText[^1]);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\SyntaxFacts\ISyntaxFactsExtensions.cs (2)
251if (name.Length == 0) 261for (var i = 1; i < name.Length; i++)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.cs (1)
198Debug.Assert(reader.Position == symbolKey.Length);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.SymbolKeyReader.cs (1)
259while (Position < Data.Length)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\Base64Utilities.cs (2)
329decodedLength = (encodedString.Length * 3) / 4 - padding; 336var index = attributeData.Length - 1;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\BKTree.Builder.cs (3)
97var distinctValues = values.Where(v => v.Length > 0).Distinct(CaseInsensitiveComparison.Comparer).ToArray(); 98var charCount = distinctValues.Sum(v => v.Length); 107_wordSpans[i] = new TextSpan(characterIndex, value.Length);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\BKTree.cs (4)
74var lowerCaseCharacters = value.Length < 512 75? stackalloc char[value.Length] 76: new char[value.Length]; 78for (var i = 0; i < value.Length; i++)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\EditDistance.cs (8)
57var array = text.Length <= PooledArraySize 59: new char[text.Length]; 61for (var i = 0; i < text.Length; i++) 89var targetLowerCaseCharacters = target.Length < 512 90? stackalloc char[target.Length] 91: new char[target.Length]; 93for (var i = 0; i < target.Length; i++) 97_sourceLowerCaseCharacters.AsSpan(0, _source.Length),
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\PathMetadataUtilities.cs (2)
31if (rootNamespace is { Length: > 0 } && 69@namespace = @namespace[(rootNamespace.Length + 1)..];
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\StringEscapeEncoder.cs (4)
17while (startIndex < text.Length) 29builder?.Append(text, startIndex, text.Length - startIndex); 66while (startIndex < text.Length) 72builder?.Append(text, startIndex, text.Length - startIndex);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\WordSimilarityChecker.cs (6)
91=> GetThreshold(value.Length); 108if (_source.Length < MinFuzzyLength) 134if (Math.Abs(_source.Length - candidateText.Length) <= _threshold) 163var lengthDifference = Math.Abs(originalText.Length - candidateText.Length);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\ISymbolExtensions.cs (1)
841(symbol.Name.Length == 1 || uint.TryParse(symbol.Name[1..], out _) || symbol.Name.All(n => n.Equals('_')));
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\ITypeSymbolExtensions.cs (1)
370return shortName.Length == 0
Microsoft.CodeAnalysis.Scripting (16)
Hosting\ObjectFormatter\CommonObjectFormatter.Builder.cs (1)
98count = Math.Min(count, str.Length - start);
Hosting\ObjectFormatter\CommonObjectFormatter.Visitor.cs (2)
791while (i < format.Length) 809result.Append(format, i - 1, format.Length - i + 1);
Hosting\ObjectFormatter\CommonObjectFormatter.Visitor.FormattedMember.cs (5)
41get { return (Name != null ? Name.Length : "[0]".Length) + Value.Length; } 51return Index >= 0 && Name != null && Name.Length >= 2 && Name[0] == '[' && Name[^1] == ']'; 62result.Append(Name, 1, Name.Length - 2);
Hosting\Resolvers\NuGetPackageResolver.cs (3)
24var parts = reference[ReferencePrefix.Length..].Split('/'); 27if (name.Length > 0) 36if (version.Length > 0)
Hosting\Resolvers\RuntimeMetadataReferenceResolver.cs (1)
219fileName = fileName[..^".ni".Length];
ScriptState.cs (1)
109if (field.IsPublic && field.Name.Length > 0 && (char.IsLetterOrDigit(field.Name[0]) || field.Name[0] == '_'))
src\roslyn\src\Compilers\Shared\GlobalAssemblyCacheHelpers\FusionAssemblyIdentity.cs (3)
349Debug.Assert(p[data.Length] == '\0'); 352nameObject.SetProperty(propertyId, p, (uint)(data.Length + 1) * 2); 558candidateCulture.Length == 0 && !StringComparer.OrdinalIgnoreCase.Equals(bestCulture, preferredCultureOpt))
Microsoft.CodeAnalysis.VisualBasic (113)
Binding\Binder_Invocation.vb (1)
2117Debug.Assert(argumentNames(i) Is Nothing OrElse argumentNames(i).Length > 0)
Binding\Binder_Query.vb (4)
2271If right.ValueText.Length > 0 Then 2858If rangeVarName IsNot Nothing AndAlso rangeVarName.Length = 0 Then 4046If rangeVarName IsNot Nothing AndAlso rangeVarName.Length = 0 Then 4182If rangeVarName IsNot Nothing AndAlso rangeVarName.Length = 0 Then
Binding\Binder_Symbols.vb (1)
333If diagName.Length > 0 Then
Binding\BlockBaseBinder.vb (2)
73If symName Is name OrElse (symName.Length = name.Length And IdentifierComparison.Equals(symName, name)) Then
Binding\LookupResult.vb (1)
1014If container.Name.Length > 0 Then
Binding\SyntheticBoundTrees\SynthesizedStringSwitchHashMethod.vb (1)
39If (i < text.Length) Then
CommandLine\VisualBasicCommandLineParser.vb (9)
580If unquoted.Length = 0 Then 829AddDiagnostic(diagnostics, ERRID.ERR_SwitchNeedsBool, name.Substring(0, name.Length - 1)) 838AddDiagnostic(diagnostics, ERRID.ERR_SwitchNeedsBool, name.Substring(0, name.Length - 1)) 1059AddDiagnostic(diagnostics, ERRID.ERR_SwitchNeedsBool, name.Substring(0, name.Length - 1)) 1875If trimmedSymbolList.Length > 0 AndAlso IsConnectorPunctuation(trimmedSymbolList(trimmedSymbolList.Length - 1)) Then 2333If simpleName.Length = 0 AndAlso Not kind.IsNetModule() Then 2343If ext.Length = 0 Then 2360If simpleName.Length = 0 Then
Compilation\ClsComplianceChecker.vb (2)
543Debug.Assert(name.Length = 0 OrElse name(0) <> ChrW(&HFF3F)) 544If name.Length > 0 AndAlso name(0) = "_"c Then
Compilation\DocumentationComments\DocumentationCommentCompiler.Common.vb (1)
603Dim [end] As Integer = xmlDocComment.Length
Compilation\DocumentationComments\DocumentationCommentCompiler.Includes.vb (1)
699If value.Length < 2 OrElse value(0) = ":"c OrElse value(1) <> ":"c Then
Compilation\DocumentationComments\DocumentationCommentCompiler.TextUtils.vb (6)
53Debug.Assert(start <= str.Length) 55Debug.Assert([end] <= str.Length) 74Dim len As Integer = str.Length 78If (start + 1) < str.Length AndAlso str(start + 1) = ChrW(10) Then 104Dim len As Integer = text.Length 143Return If(position < 0, message, message.Remove(position, locationString.Length))
Compilation\DocumentationComments\DocumentationCommentWalker.vb (1)
243Dim needError As Boolean = strValue.Length < 2 OrElse strValue(0) = ":"c OrElse strValue(1) <> ":"c
Compilation\SemanticModel.vb (1)
2762If argumentName.Length = 0 Then
Compilation\VisualBasicCompilation.vb (3)
2692If bytesText.Length <> bytes.Length * 2 Then 2696For i As Integer = 0 To bytesText.Length \ 2 - 1 2712For i As Integer = 0 To bytesText.Length \ 2 - 1
Declarations\DeclarationTreeBuilder.vb (2)
285Debug.Assert(identifier(identifier.Length - 1) = "]") 286Return identifier.Substring(1, identifier.Length - 2)
Emit\EditAndContinue\PEDeltaAssemblyBuilder.vb (1)
175Integer.TryParse(name.Substring(prefix.Length), NumberStyles.None, CultureInfo.InvariantCulture, index) Then
Emit\EditAndContinue\VisualBasicDefinitionMap.vb (2)
231hasDebugIds = name.Length > suffixIndex 238hasDebugIds = name.Length > suffixIndex
GlobalImport.vb (3)
120If (startindex < 0 OrElse length <= 0 OrElse startindex >= _importedName.Length) Then 123length = _importedName.Length 125length = Math.Min(_importedName.Length - startindex, length)
Lowering\Instrumentation\CodeCoverageInstrumenter.vb (1)
442If path.Length = 0 Then
Lowering\LocalRewriter\LocalRewriter_StringConcat.vb (2)
210leftVal.Length + rightVal.Length < 0 Then
Lowering\StateMachineRewriter\SynthesizedStateMachineProperty.vb (1)
34If name.Length = 7 Then ' "Current".Length
OptionsValidator.vb (1)
83If Not IsValidRootNamespaceComponent(name, start, If(index < 0, name.Length, index), allowEscaping:=True) Then
Parser\ParseConditional.vb (1)
355If checksumText.Length Mod 2 <> 0 Then
Parser\Parser.vb (1)
5412Dim tokenLength = token.Text.Length
Parser\ParseXml.vb (3)
1083If text.Length >= 2 AndAlso text(0) <> ":" AndAlso text(1) = ":" Then 1847If name.Text.Length = 3 AndAlso String.Equals(name.Text, "xml", StringComparison.OrdinalIgnoreCase) Then 1924If textToken.Text.Length = 2 AndAlso textToken.Text = "--" Then
Scanner\CharacterInfo.vb (3)
337Dim nameLength As Integer = name.Length 358For i = 0 To text.Length - 1 363characters = New Char(text.Length - 1) {}
Scanner\KeywordTable.vb (2)
311For i As Integer = 0 To s.Length - 1 318result = New Char(s.Length - 1) {}
Scanner\Scanner.vb (5)
414Dim n = chars.Length 714Private Shared ReadOnly s_conflictMarkerLength As Integer = "<<<<<<<".Length 1476Dim spellingLength As Integer = spelling.Length 1612If spelling.Length > 16 Then 1653Debug.Assert(spelling.Length > idStringLength + 1)
Scanner\ScannerBuffer.vb (1)
213If result.Length < 1024 Then
Scanner\TokenFactories.vb (3)
158Debug.Assert(text.Length > 0) 181Debug.Assert(text.Length = 1) 200Debug.Assert(text.Length = 1)
Scanner\XmlTokenFactories.vb (1)
157Select Case text.Length
Semantics\Conversions.vb (1)
760If str Is Nothing OrElse str.Length = 0 Then
Semantics\Operators.vb (1)
81If name.Length > 3 AndAlso IdentifierComparison.Equals("op_", name.Substring(0, 3)) AndAlso s_operatorNames.TryGetValue(name, result) Then
Semantics\OverloadResolution.vb (1)
3131Debug.Assert(argumentNames(i) Is Nothing OrElse argumentNames(i).Length > 0)
SymbolDisplay\ObjectDisplay.vb (3)
368If str.Length = 0 Then 380While i < str.Length 393ElseIf c = s_Cr AndAlso i < str.Length AndAlso str(i) = s_Lf Then
SymbolDisplay\SymbolDisplayVisitor.Types.vb (1)
335If members.Length = 0 Then
Symbols\AnonymousTypes\AnonymousTypeManager_Templates.vb (2)
226moduleId = moduleId.Substring(0, moduleId.Length - extension.Length)
Symbols\Metadata\PE\PENamedTypeSymbol.vb (2)
169Debug.Assert(Not _mangleName OrElse _name.Length < name.Length)
Symbols\Metadata\PE\PENamedTypeSymbolWithEmittedNamespaceName.vb (2)
32Debug.Assert(emittedNamespaceName.Length > 0) 37Debug.Assert(emittedNamespaceName.Length > 0)
Symbols\MissingMetadataTypeSymbol.vb (1)
143If _namespaceName.Length > 0 Then
Symbols\Source\QuickAttributeChecker.vb (3)
48_nameToAttributeMap(name.Substring(0, name.Length - "Attribute".Length)) = newAttributes Or current 179(name.Length + NameOf(Attribute).Length) = description.Name.Length AndAlso
Symbols\Source\SourceModuleSymbol.vb (1)
1162If prop.DefaultInstanceAlias.Length > 0 Then
Symbols\Source\SourceNamedTypeSymbol_GroupClass.vb (3)
51If baseTypeNames(i).Length = 0 OrElse createMethods(i).Length = 0 Then 403(disposeMethod.Length > 0 AndAlso ConflictsWithExistingMemberOrType(binder.GetAccessorName(propertyName, MethodKind.PropertySet, isWinMd), membersBuilder, nestedTypes, conflictsWith)) OrElse
Symbols\Source\SourceNamedTypeSymbol.vb (1)
2285If eventName IsNot Nothing AndAlso eventName.Length > 0 AndAlso Not FindDefaultEvent(eventName) Then
Symbols\Source\SynthesizedMyGroupCollectionPropertyAccessorSymbol.vb (1)
29Debug.Assert(createOrDisposeMethod IsNot Nothing AndAlso createOrDisposeMethod.Length > 0)
Symbols\Source\SynthesizedMyGroupCollectionPropertySymbol.vb (1)
44If disposeMethod.Length > 0 Then
Symbols\Symbol.vb (3)
606Return If(Me.Name?.Length, 0) > 0 611Return Me.Name.Length > 0 796Return If(result.Length = 0, Nothing, result)
Symbols\SynthesizedSymbols\GeneratedNameParser.vb (6)
55Dim prefixLength As Integer = GeneratedNameConstants.StateMachineTypeNamePrefix.Length 57If separatorPos < 0 OrElse separatorPos = stateMachineTypeName.Length - 1 Then 71Dim prefixLen As Integer = GeneratedNameConstants.HoistedUserVariablePrefix.Length 72If proxyName.Length <= prefixLen Then 97Dim prefixLen As Integer = GeneratedNameConstants.StateMachineHoistedUserVariableOrDisplayClassPrefix.Length 134Integer.TryParse(fieldName.Substring(prefix.Length), NumberStyles.None, CultureInfo.InvariantCulture, slotIndex) Then
Symbols\TypeSymbolExtensions.vb (3)
1246Return qualifiedName.Length = 0 1249Return HasNamespaceName([namespace], qualifiedName, comparison, length:=qualifiedName.Length) 1278Return (name.Length = length) AndAlso (String.Compare(name, 0, namespaceName, offset, length, comparison) = 0)
Syntax\InternalSyntax\SyntaxToken.vb (5)
85MyBase.New(kind, text.Length) 105MyBase.New(kind, errors, text.Length) 125MyBase.New(kind, errors, annotations, text.Length) 145If Text.Length = 0 AndAlso Kind <> SyntaxKind.EndOfFileToken AndAlso Kind <> SyntaxKind.EmptyToken Then 201Return FullWidth - _text.Length - _leadingTriviaWidth()
Syntax\InternalSyntax\SyntaxTrivia.vb (4)
20MyBase.New(kind, errors, annotations, text.Length) 22If text.Length > 0 Then 33MyBase.New(kind, text.Length) 35If text.Length > 0 Then
Syntax\SyntaxNormalizer.vb (1)
625Return text.Length > 0 AndAlso IsNewLineChar(text.Last())
Microsoft.CodeAnalysis.VisualBasic.CodeStyle (6)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\VisualBasic\Formatting\Engine\Trivia\TriviaDataFactory.Analyzer.vb (1)
66result.HasTrailingSpace = trivia.ToFullString().Length <> 3
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\VisualBasic\Formatting\Engine\Trivia\TriviaDataFactory.CodeShapeAnalyzer.vb (3)
117Dim currentSpaces = text.ConvertTabToSpace(_options.TabSize, Me._currentColumn, text.Length) 184If trivia.ToFullString().Length <> 3 Then 299If xmlCommentText.GetColumnFromLineOffset(xmlCommentText.Length - 3, tabSize) <> indentation Then
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\VisualBasic\Services\SyntaxFacts\VisualBasicSyntaxFacts.vb (2)
472Return IsIdentifier(token) AndAlso Not token.ContainsDiagnostics AndAlso token.ToString().Length = identifier.Length
Microsoft.CodeAnalysis.VisualBasic.CodeStyle.Fixes (9)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\VisualBasic\CodeGeneration\EnumMemberGenerator.vb (1)
114Dim lastTwoChars = numericText.Substring(numericText.Length - 2, 2)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\VisualBasic\CodeGeneration\ExpressionGenerator.StringPiece.vb (2)
82While i < value.Length 118If i < value.Length AndAlso value(i) = vbLf Then
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\VisualBasic\Extensions\StringExtensions.vb (5)
24Not (halfWidthValueText.Length = 10 AndAlso halfWidthValueText(0) = "_") Then 26withoutSuffix = identifierText.Substring(0, identifierText.Length - 9) 67If text.Length > 2 AndAlso MakeHalfWidthIdentifier(text.First()) = "[" AndAlso MakeHalfWidthIdentifier(text.Last()) = "]" Then 68unescaped = text.Substring(1, text.Length() - 2) 73Dim token = If(escaped.Length > 0 AndAlso escaped(0) = "["c,
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\VisualBasic\Utilities\VisualBasicSimplificationHelpers.vb (1)
11If identifierToken.Kind <> SyntaxKind.IdentifierToken OrElse identifierToken.ValueText.Length = 0 Then
Microsoft.CodeAnalysis.VisualBasic.Features (31)
Completion\CompletionProviders\CompletionUtilities.vb (1)
146Return insertionText.Substring(0, insertionText.Length - 1)
Completion\CompletionProviders\NamedParameterCompletionProvider.vb (4)
202change = New TextChange(symbolItem.Span, insertionText.Substring(0, insertionText.Length - s_colonEquals.Length)) 204change = New TextChange(selectedItem.Span, insertionText.Substring(0, insertionText.Length - (s_colonEquals.Length - 1)))
Completion\CompletionProviders\XmlDocCommentCompletionProvider.vb (1)
215If Not nameToken.IsMissing AndAlso nameToken.ValueText.Length > 0 Then
ConvertToInterpolatedString\VisualBasicConvertConcatenationToInterpolatedStringRefactoringProvider.vb (6)
28Return text.Substring("'".Length, text.Length - "''C".Length) 30Return text.Substring("'".Length, text.Length - "''".Length)
EditAndContinue\BreakpointSpans.vb (1)
37For i = 0 To text.Length - 1
EditAndContinue\SyntaxComparer.vb (2)
1395oldToken.Text, Math.Min(oldToken.Text.Length, LongestCommonSubsequence.MaxSequenceLengthForDistanceCalculation), 1396newToken.Text, Math.Min(newToken.Text.Length, LongestCommonSubsequence.MaxSequenceLengthForDistanceCalculation))
ExtractInterface\VisualBasicExtractInterfaceService.vb (1)
67Return fullDisplayName.Substring(rootNamespace.Length + 1)
ExtractMethod\VisualBasicMethodExtractor.VisualBasicCodeGenerator.ExpressionCodeGenerator.vb (1)
52Return If(name IsNot Nothing AndAlso name.Length > 0, MakeMethodName("Get", name, camelCase:=False), methodName)
ExtractMethod\VisualBasicMethodExtractor.VisualBasicCodeGenerator.vb (1)
390Dim unescaped = name.Substring(1, name.Length() - 2)
SignatureHelp\CollectionInitializerSignatureHelpProvider.vb (1)
36token.ValueText.Length = 1 AndAlso
Snippets\VisualBasicSnippetFunctionService.vb (2)
47Dim typeSpan = New TextSpan(caseGenerationLocation.Start + "Case ".Length, fullyQualifiedTypeName.Length)
Structure\Providers\DisabledTextTriviaStructureProvider.vb (1)
22Dim endPos = startPos + trivia.ToString().TrimEnd().Length
Structure\Providers\RegionDirectiveStructureProvider.vb (1)
18If text.Length = 0 Then
TaskList\VisualBasicTaskListService.vb (8)
53If index >= message.Length OrElse 54index > message.Length - 3 Then 58Dim remText = message.Substring(index, "REM".Length) 60Return GetFirstCharacterIndex(message, index + remText.Length) 70For i = index To message.Length - 1 Step 1 82Return message.Length 86For i = start To message.Length - 1 Step 1 92Return message.Length
Microsoft.CodeAnalysis.VisualBasic.NetAnalyzers (6)
Microsoft.CodeQuality.Analyzers\ApiDesignGuidelines\BasicIdentifiersShouldNotContainUnderscores.Fixer.vb (1)
19If result.Length = 0 Then
Microsoft.NetCore.Analyzers\Runtime\BasicForwardCancellationTokenToInvocationsFixer.TypeNameVisitor.vb (5)
197If text.Length > 2 AndAlso MakeHalfWidthIdentifier(text.First()) = "[" AndAlso MakeHalfWidthIdentifier(text.Last()) = "]" Then 198unescaped = text.Substring(1, text.Length() - 2) 203Dim token = If(escaped.Length > 0 AndAlso escaped(0) = "["c, 275For i = 0 To text.Length - 1 280characters = New Char(text.Length - 1) {}
Microsoft.CodeAnalysis.VisualBasic.Workspaces (28)
CaseCorrection\VisualBasicCaseCorrectionService.Rewriter.vb (3)
218Return symbol.Name.Substring(0, symbol.Name.Length - s_attributeSuffix.Length) 293Dim expectedText = actualText.Substring(0, actualText.Length - 1) & "c"
Classification\Worker.DocumentationCommentClassifier.vb (1)
84For index = 0 To text.Length - 1
CodeCleanup\Providers\FixIncorrectTokensCodeCleanupProvider.vb (1)
71If triviaText.Length > 0 AndAlso s_smartSingleQuotes.Contains(triviaText(0)) Then
CodeCleanup\Providers\ReduceTokensCodeCleanupProvider.vb (4)
205If significantDigitsStr.Length > 1 AndAlso significantDigitsStr(1) = "."c Then 219If valueText.Length > 4 Then 220If valueText.Length = exponentIndex + 4 Then 267Dim fractionPartOpt As String = If(truncatedString.Length > 0, "." + truncatedString, "")
Rename\VisualBasicRenameRewriterLanguageService.vb (4)
985Debug.Assert(AttributeSuffixLength = AttributeSuffix.Length, "Assert (AttributeSuffixLength = AttributeSuffix.Length) failed.") 987If replacementText.Length > AttributeSuffixLength AndAlso CaseInsensitiveComparison.Equals(halfWidthReplacementText.Substring(halfWidthReplacementText.Length - AttributeSuffixLength), AttributeSuffix) Then 988Dim conflict = replacementText.Substring(0, replacementText.Length - AttributeSuffixLength)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\VisualBasic\Formatting\Engine\Trivia\TriviaDataFactory.Analyzer.vb (1)
66result.HasTrailingSpace = trivia.ToFullString().Length <> 3
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\VisualBasic\Formatting\Engine\Trivia\TriviaDataFactory.CodeShapeAnalyzer.vb (3)
117Dim currentSpaces = text.ConvertTabToSpace(_options.TabSize, Me._currentColumn, text.Length) 184If trivia.ToFullString().Length <> 3 Then 299If xmlCommentText.GetColumnFromLineOffset(xmlCommentText.Length - 3, tabSize) <> indentation Then
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\VisualBasic\Services\SyntaxFacts\VisualBasicSyntaxFacts.vb (2)
472Return IsIdentifier(token) AndAlso Not token.ContainsDiagnostics AndAlso token.ToString().Length = identifier.Length
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\VisualBasic\CodeGeneration\EnumMemberGenerator.vb (1)
114Dim lastTwoChars = numericText.Substring(numericText.Length - 2, 2)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\VisualBasic\CodeGeneration\ExpressionGenerator.StringPiece.vb (2)
82While i < value.Length 118If i < value.Length AndAlso value(i) = vbLf Then
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\VisualBasic\Extensions\StringExtensions.vb (5)
24Not (halfWidthValueText.Length = 10 AndAlso halfWidthValueText(0) = "_") Then 26withoutSuffix = identifierText.Substring(0, identifierText.Length - 9) 67If text.Length > 2 AndAlso MakeHalfWidthIdentifier(text.First()) = "[" AndAlso MakeHalfWidthIdentifier(text.Last()) = "]" Then 68unescaped = text.Substring(1, text.Length() - 2) 73Dim token = If(escaped.Length > 0 AndAlso escaped(0) = "["c,
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\VisualBasic\Utilities\VisualBasicSimplificationHelpers.vb (1)
11If identifierToken.Kind <> SyntaxKind.IdentifierToken OrElse identifierToken.ValueText.Length = 0 Then
Microsoft.CodeAnalysis.Workspaces (262)
Differencing\LongestCommonSubstring.cs (2)
27=> s_instance.GetEdits(oldValue, oldValue.Length, newValue, newValue.Length);
FindSymbols\FindReferences\Finders\AbstractReferenceFinder_GlobalSuppressions.cs (3)
218while (offsetOfReferenceInToken < valueText.Length) 266if (docCommentId.Length < 3) 273if (docCommentId.Length < 2)
FindSymbols\FindReferences\FindReferenceCache.cs (2)
203if (span.Start == index && span.Length == text.Length && isMatch(text, token, args)) 206var nextIndex = index + text.Length;
FindSymbols\SymbolTree\SymbolTreeInfo_Metadata.cs (1)
965if (containerName.Length == 0)
FindSymbols\SyntaxTree\SyntaxTreeIndex_Create.cs (1)
136if (valueText.Length != token.Width())
FindSymbols\TopLevelSyntaxTree\NavigateToSearchIndex.NavigateToSearchInfo.cs (7)
184maxNameLength = Math.Max(maxNameLength, info.Name.Length); 202AddNameData(info.Name, buffer[..info.Name.Length]); 223lengthBitset |= 1UL << Math.Min(name.Length, MaxSymbolNameLengthBitIndex); 291for (var i = 0; i < name.Length - 1; i++) 798Debug.Assert(text.Length >= 2); 801for (var i = 0; i < text.Length - 1; i++) 810if (text.Length >= SparseNgramGenerator.MinNgramLength)
LinkedFileDiffMerging\LinkedFileDiffMergingSession.cs (8)
228mergeConflictResolutionSpans.Add(new TextSpan(commentChangesList[commentChangeIndex].Span.Start + currentPositionDelta, commentChangesList[commentChangeIndex].NewText!.Length)); 229currentPositionDelta += commentChangesList[commentChangeIndex].NewText!.Length - commentChangesList[commentChangeIndex].Span.Length; 237currentPositionDelta += mergedChange.NewText!.Length - mergedChange.Span.Length; 246mergeConflictResolutionSpans.Add(new TextSpan(commentChangesList[commentChangeIndex].Span.Start + currentPositionDelta, commentChangesList[commentChangeIndex].NewText!.Length)); 247currentPositionDelta += commentChangesList[commentChangeIndex].NewText!.Length; 254currentPositionDelta += mergedChange.NewText!.Length - mergedChange.Span.Length; 261mergeConflictResolutionSpans.Add(new TextSpan(commentChangesList[commentChangeIndex].Span.Start + currentPositionDelta, commentChangesList[commentChangeIndex].NewText!.Length)); 263currentPositionDelta += commentChangesList[commentChangeIndex].NewText!.Length - commentChangesList[commentChangeIndex].Span.Length;
Log\WorkspaceStructureLogger.cs (1)
236s = s.Substring(0, index) + newValue + s.Substring(index + oldValue.Length);
PatternMatching\AllLowerCamelCaseMatcher.cs (2)
72if (patternIndex == patternChunkText.Length) 156var maxPatternHumpLength = patternChunkText.Length - patternIndex;
PatternMatching\FuzzyPatternMatcher.cs (1)
31_invalidPattern = string.IsNullOrWhiteSpace(pattern) || pattern.Length < WordSimilarityChecker.MinFuzzyLength;
PatternMatching\PatternMatcher.cs (12)
154for (var i = 0; i < pattern.Length; i++) 166for (var i = 0; i < pattern.Length; i++) 182var candidateLength = candidate.Length; 190if (patternChunk.Text.Length == candidateLength) 220PatternMatchKind.Prefix, punctuationStripped, isCaseSensitive, matchedSpan: GetMatchedSpan(0, patternChunk.Text.Length)); 245matchedSpan: GetMatchedSpan(caseSensitiveIndex, patternChunk.Text.Length)); 260matchedSpan: GetMatchedSpan(caseInsensitiveIndex, patternChunk.Text.Length)); 275matchedSpan: GetMatchedSpan(hump.Start, patternChunk.Text.Length)); 300if (patternIsLowercase && caseInsensitiveIndex > 0 && patternChunk.Text.Length >= 3) 307matchedSpan: GetMatchedSpan(caseSensitiveIndex, patternChunk.Text.Length)); 325for (var i = 0; i < text.Length; i++) 453=> PartStartsWith(candidate, candidatePart, pattern, new TextSpan(0, pattern.Length), compareOptions);
PatternMatching\PatternMatcher.PatternSegment.cs (2)
47for (var i = 0; i < pattern.Length; i++) 85for (var i = 0; i < pattern.Length; i++)
PatternMatching\RegexPatternMatcher.cs (1)
71var kind = bestMatch.Length == candidate.Length && bestMatch.Index == 0
PatternMatching\RegexQuery.cs (1)
71Debug.Assert(text.Length >= 2);
Rename\ConflictEngine\ConflictResolver.cs (9)
446while (index != -1 && index < oldMetadataName.Length) 459newMetadataNameBuilder.Append(newMetadataName, index + replacementText.Length, newMetadataName.Length - (index + replacementText.Length)); 475Debug.Assert(index <= str1.Length && index <= str2.Length, "Index cannot be greater than the string"); 512if (index + searchText.Length != metadataName.Length) 514var nextChar = metadataName[index + searchText.Length];
Rename\RenameUtilities.cs (2)
302Debug.Assert(subSpan.Start <= replaceInsideString.Length); 303Debug.Assert(subSpan.End <= replaceInsideString.Length);
Rename\SymbolicRenameLocations.ReferenceProcessing.cs (4)
406var renameTextLength = renameText.Length; 424var renameTextLength = renameText.Length; 460Debug.Assert(renameText.Length == match.Length); 461var matchTextSpan = new TextSpan(start, renameText.Length);
Shared\Extensions\SourceTextExtensions.cs (7)
81var length = text.Length - value.Length; 87for (var j = 0; j < normalized.Length; j++) 113startIndex = startIndex + normalized.Length > text.Length 114? text.Length - normalized.Length 120for (var j = 0; j < normalized.Length; j++) 148if (position + value.Length > text.Length) 153for (var i = 0; i < value.Length; i++)
Shared\Utilities\DocumentationComment.cs (2)
221if (trimmedLine.Length != 0) 222builder.Append(trimmedLine, maxPrefix, trimmedLine.Length - maxPrefix);
Shared\Utilities\XmlFragmentParser.cs (9)
150_position = s_rootStart.Length; 173_position += EncodeAndAdvance(s_currentStart, _position - s_rootStart.Length, buffer, ref index, ref count); 176_position += EncodeAndAdvance(_text, _position - s_rootStart.Length - s_currentStart.Length, buffer, ref index, ref count); 179_position += EncodeAndAdvance(s_currentEnd, _position - s_rootStart.Length - s_currentStart.Length - _text.Length, buffer, ref index, ref count); 193if (destCount == 0 || srcIndex < 0 || srcIndex >= src.Length) 198var charCount = Math.Min(src.Length - srcIndex, destCount);
src\roslyn\src\Compilers\Core\Portable\CodeAnalysisEventSource.Common.cs (1)
197Size = (value.Length + 1) * sizeof(char),
src\roslyn\src\Compilers\Core\Portable\FileSystem\FileUtilities.cs (2)
136if (path!.Length == 1) 178Debug.Assert(path.Length == 1 || !PathUtilities.IsDirectorySeparator(path[1]));
src\roslyn\src\Compilers\Core\Portable\FileSystem\PathUtilities.cs (36)
55int lastSeparator = s.Length; 61if (lastSeparator != s.Length) 74if (s.Length == 0 || IsAnyDirectorySeparator(s[s.Length - 1])) 163var rootLength = GetPathRoot(path, isUnixLike).Length; 164if (path.Length > rootLength) 166var i = path.Length; 237int length = path.Length; 312return path.Length > 0 && IsDirectorySeparator(path[0]) 339if (path.Length > 0 && path[0] == '.') 341if (path.Length == 1 || IsDirectorySeparator(path[1])) 348if (path.Length == 2 || IsDirectorySeparator(path[2])) 359if (path.Length >= 1 && IsDirectorySeparator(path[0])) 366if (path.Length >= 2 && path[1] == VolumeSeparatorChar && (path.Length <= 2 || !IsDirectorySeparator(path[2]))) 400return path.Length >= 2 && 411return path.Length >= 3 && path[1] == VolumeSeparatorChar && IsDirectorySeparator(path[2]); 465char c = root[root.Length - 1]; 504if (path.Length > 0 && IsDirectorySeparator(path[path.Length - 1])) 506return path.Substring(0, path.Length - 1); 633return parentPath.Length > 0 634&& childPath.Length > parentPath.Length 635&& PathsEqual(childPath, parentPath, parentPath.Length) 636&& (IsDirectorySeparator(parentPath[parentPath.Length - 1]) || IsDirectorySeparator(childPath[parentPath.Length])); 641var relativePath = childPath.Substring(parentPath.Length); 644int start = ConsumeDirectorySeparators(relativePath, relativePath.Length, 0); 673return PathsEqual(path1, path2, Math.Max(path1.Length, path2.Length)); 681if (path1.Length < length || path2.Length < length) 741if (!(oldPrefix?.Length > 0)) continue; 750var replacement = replacementPrefix + filePath.Substring(oldPrefix.Length); 870if (!isDriveRooted && !(p.Length > 1 && p[0] == AltDirectorySeparatorChar))
src\roslyn\src\Compilers\Core\Portable\InternalUtilities\CompilerOptionParseUtilities.cs (1)
42if (Environment.GetEnvironmentVariable(CachePathEnvironmentVariable) is not { Length: > 0 } cachePath)
src\roslyn\src\Compilers\Core\Portable\InternalUtilities\FileNameUtilities.cs (6)
122if (path.Length > 0 && path[path.Length - 1] == '.') 124return path.Substring(0, path.Length - 1); 149if (extension == null || path.Length == 0) 154if (extension.Length == 0 || extension[0] != '.') 173for (int i = path.Length - 1; i >= 0; i--)
src\roslyn\src\Compilers\Core\Portable\InternalUtilities\StringExtensions.cs (14)
41return name.Length >= 3 && name[0] == 'I' && char.IsUpper(name[1]) && char.IsLower(name[2]); 46return name.Length >= 3 && name[0] == 'T' && char.IsUpper(name[1]) && char.IsLower(name[2]); 154result = name[..^AttributeSuffix.Length]; 168return name.Length > AttributeSuffix.Length && name.EndsWith(AttributeSuffix, comparison); 174while (i < str.Length) 181if (i < str.Length && char.IsLowSurrogate(str[i])) 211if (arg.Length > 1 && arg[0] == '"' && arg[arg.Length - 1] == '"') 214return arg.Substring(1, arg.Length - 2); 226while (x < string1.Length && x < string2.Length && 238while (x < string1.Length && x < string2.Length &&
src\roslyn\src\Compilers\Core\Portable\InternalUtilities\StringTable.cs (4)
481if (array.Length != length) 487for (var i = 0; i < array.Length; i++) 500if (array.Length != text.Length) 538if (ascii.Length != text.Length)
src\roslyn\src\Compilers\Core\Portable\InternalUtilities\UnicodeCharacterUtilities.cs (1)
103int nameLength = name.Length;
src\roslyn\src\Compilers\Core\Portable\Syntax\SyntaxTreeExtensions.cs (2)
95var n1 = s1.Length; 96var n2 = s2.Length;
src\roslyn\src\Compilers\Core\Portable\Text\TextChangeRangeExtensions.cs (1)
105return new TextChangeRange(textChange.Span, textChange.NewText?.Length ?? 0);
src\roslyn\src\Dependencies\Collections\Extensions\IEnumerableExtensions.cs (2)
213return str.Length == 0; 236return source.Length == 0;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\CodeGeneration\ParameterName.cs (1)
42BestNameForParameter = trimmed.Length > 0 ? tryMakeCamelCase ? trimmed.ToCamelCase() : trimmed : nameBasedOnArgument;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\VirtualChars\AbstractVirtualCharService.cs (8)
30if (index + 1 < tokenText.Length) 118Debug.Assert(lastVC.Span.End == token.Span.End - "\"".Length, "Last span has to end right before the end of the string token."); 122Debug.Assert(lastVC.Span.End == token.Span.End - "\"u8".Length, "Last span has to end right before the end of the string token."); 145if (startDelimiter.Length > 0 && !tokenText.StartsWith(startDelimiter, StringComparison.Ordinal)) 151if (endDelimiter.Length > 0 && !tokenText.EndsWith(endDelimiter, StringComparison.Ordinal)) 157var startIndexInclusive = startDelimiter.Length; 158var endIndexExclusive = tokenText.Length - endDelimiter.Length;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\VirtualChars\AbstractVirtualCharService.ITextInfo.cs (1)
30public readonly int Length(string text) => text.Length;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\VirtualChars\VirtualCharGreenSequence.Chunks.cs (2)
78public override int Length => data.Length; 83return stringIndex >= 0 && stringIndex < data.Length ? stringIndex : null;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\StringExtensions.cs (13)
18for (var i = 0; i < line.Length; i++) 33for (var i = line.Length - 1; i >= 0; i--) 61return lastOffset.HasValue && lastOffset.Value < lineText.Length 71return lineText.GetColumnFromLineOffset(lineText.Length, tabSize); 74return text.ConvertTabToSpace(tabSize, initialColumn, text.Length) + initialColumn; 80Debug.Assert(endPosition >= 0 && endPosition <= textSnippet.Length); 107for (var i = 0; i < text.Length; i++) 156for (var i = 0; i < text.Length; i++) 164if (i + 1 == text.Length || text[i + 1] != '\n') 202return line.GetColumnFromLineOffset(line.Length, tabSize); 209Contract.ThrowIfFalse(0 <= endPosition && endPosition <= line.Length); 223for (var i = 0; i < line.Length; i++) 241return line.Length;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\TokenStream.cs (2)
337length = text.ConvertTabToSpace(_options.TabSize, initialColumn, text.Length); 341length = text.Length;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\TreeData.Node.cs (1)
30return lineText.GetColumnFromLineOffset(lineText.Length, tabSize);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\FormattingExtensions.cs (9)
130spaceOrIndentation = indentationString.GetColumnFromLineOffset(indentationString.Length, tabSize); 136spaceOrIndentation = text.ConvertTabToSpace(tabSize, baseToken.ToString().GetTextColumn(tabSize, initialColumn), text.Length); 156nonWhitespaceCharIndex = triviaText.Length; 164builder.Append(triviaText, nonWhitespaceCharIndex, triviaText.Length - nonWhitespaceCharIndex); 201builder.Append(line, nonWhitespaceCharIndex, line.Length - nonWhitespaceCharIndex); 226for (var i = 0; i < text.Length; i++) 245if (i >= newText.Length || text[i] != newText[i]) 252if (i == span.Length && text.Length == newText.Length)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\TriviaEngine\AbstractTriviaFormatter.cs (6)
145for (var i = 0; i < text.Length; i++) 611var tokenPosition = lastText.ConvertTabToSpace(Options.TabSize, initialColumn, lastText.Length); 741for (var i = this.OriginalString.Length - 1; i >= 0; i--) 889spaces: text.ConvertTabToSpace(Options.TabSize, lineColumn.With(whitespaceBetween).Column, text.Length), 925spaces: lineText.GetColumnFromLineOffset(lineText.Length, Options.TabSize), 931spaces: text.ConvertTabToSpace(Options.TabSize, initialColumn, text.Length),
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\Naming\IdentifierNameParts.cs (2)
47? newBaseName[prefix.Length..] 53? newBaseName[..^suffix.Length]
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\NamingStyle.cs (19)
89if (word.Length == 0) 107if (word.Length == 0) 137if (name.Length <= Prefix.Length + Suffix.Length) 147name = StripCommonPrefixes(name[Prefix.Length..], out var prefix); 160var spanToCheck = TextSpan.FromBounds(0, name.Length - Suffix.Length); 311name = StripCommonPrefixes(name.StartsWith(Prefix) ? name[Prefix.Length..] : name, out _); 346while (index + 1 < name.Length) 353if (index + 2 < name.Length && name[index + 1] == '_') 362if (index + 1 < name.Length && !char.IsDigit(name[index + 1])) 385if (Suffix.Length + Prefix.Length >= name.Length) 390name = name[Prefix.Length..^Suffix.Length]; 428for (var i = Suffix.Length; i > 0; i--) 455for (var i = 0; i < Prefix.Length; i++)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\NamingStyle.WordSpanEnumerator.cs (1)
52Current = new TextSpan(Current.End + _wordSeparator.Length, 0);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Serialization\ObjectWriter.cs (2)
504var bytes = new byte[(uint)value.Length * sizeof(char)]; 510WriteCompressedUInt((uint)value.Length);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\SyntaxFacts\AbstractDocumentationCommentService.cs (3)
90if (text.Length > maxBannerLength) 185=> tokenText.Length > 0 && char.IsWhiteSpace(tokenText[0]); 188=> tokenText.Length > 0 && char.IsWhiteSpace(tokenText[^1]);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\SyntaxFacts\ISyntaxFactsExtensions.cs (2)
251if (name.Length == 0) 261for (var i = 1; i < name.Length; i++)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.cs (1)
198Debug.Assert(reader.Position == symbolKey.Length);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.SymbolKeyReader.cs (1)
259while (Position < Data.Length)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\Base64Utilities.cs (2)
329decodedLength = (encodedString.Length * 3) / 4 - padding; 336var index = attributeData.Length - 1;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\BKTree.Builder.cs (3)
97var distinctValues = values.Where(v => v.Length > 0).Distinct(CaseInsensitiveComparison.Comparer).ToArray(); 98var charCount = distinctValues.Sum(v => v.Length); 107_wordSpans[i] = new TextSpan(characterIndex, value.Length);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\BKTree.cs (4)
74var lowerCaseCharacters = value.Length < 512 75? stackalloc char[value.Length] 76: new char[value.Length]; 78for (var i = 0; i < value.Length; i++)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\EditDistance.cs (8)
57var array = text.Length <= PooledArraySize 59: new char[text.Length]; 61for (var i = 0; i < text.Length; i++) 89var targetLowerCaseCharacters = target.Length < 512 90? stackalloc char[target.Length] 91: new char[target.Length]; 93for (var i = 0; i < target.Length; i++) 97_sourceLowerCaseCharacters.AsSpan(0, _source.Length),
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\PathMetadataUtilities.cs (2)
31if (rootNamespace is { Length: > 0 } && 69@namespace = @namespace[(rootNamespace.Length + 1)..];
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\StringEscapeEncoder.cs (4)
17while (startIndex < text.Length) 29builder?.Append(text, startIndex, text.Length - startIndex); 66while (startIndex < text.Length) 72builder?.Append(text, startIndex, text.Length - startIndex);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\WordSimilarityChecker.cs (6)
91=> GetThreshold(value.Length); 108if (_source.Length < MinFuzzyLength) 134if (Math.Abs(_source.Length - candidateText.Length) <= _threshold) 163var lengthDifference = Math.Abs(originalText.Length - candidateText.Length);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\ISymbolExtensions.cs (1)
841(symbol.Name.Length == 1 || uint.TryParse(symbol.Name[1..], out _) || symbol.Name.All(n => n.Equals('_')));
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\ITypeSymbolExtensions.cs (1)
370return shortName.Length == 0
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Extensions\ProjectExtensions.cs (2)
60analyzerConfigDirectory.Length > bestPath.Length)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Extensions\SyntaxGeneratorExtensions_CreateEqualsMethod.cs (1)
391if (name.Length > 0)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\LanguageServices\TypeInferenceService\AbstractTypeInferenceService.cs (3)
67if (name.Length == prefix.Length) 72var nextChar = name[prefix.Length];
Workspace\Host\PersistentStorage\IPersistentStorageConfiguration.cs (1)
87var prefix = fileName.Length > MaxLength ? fileName[..MaxLength] : fileName;
Workspace\ProjectSystem\ProjectSystemProject.cs (1)
1040private static bool DirectoryNameEndsWith(string fullPath, string ending) => fullPath.LastIndexOf(ending, StringComparison.OrdinalIgnoreCase) + ending.Length - 1 ==
Workspace\Solution\SolutionState.CachingFilePathComparer.cs (2)
81int length = obj.Length; 84Debug.Assert(src[obj.Length] == '\0', "src[this.Length] == '\\0'");
Microsoft.CodeAnalysis.Workspaces.MSBuild (2)
MSBuild\MSBuildProjectLoader.cs (2)
351_filename = Path.GetFileNameWithoutExtension(logFilePath) is { Length: > 0 } fileName 354_extension = Path.GetExtension(logFilePath) is { Length: > 0 } extension
Microsoft.CodeAnalysis.Workspaces.MSBuild.BuildHost (44)
MSBuild\ProjectFile\ProjectInstanceReader.cs (1)
278return normalizedPath[projectDirectory.Length..];
src\roslyn\src\Compilers\Core\Portable\FileSystem\FileUtilities.cs (2)
136if (path!.Length == 1) 178Debug.Assert(path.Length == 1 || !PathUtilities.IsDirectorySeparator(path[1]));
src\roslyn\src\Compilers\Core\Portable\FileSystem\PathUtilities.cs (34)
55int lastSeparator = s.Length; 61if (lastSeparator != s.Length) 74if (s.Length == 0 || IsAnyDirectorySeparator(s[s.Length - 1])) 163var rootLength = GetPathRoot(path, isUnixLike).Length; 164if (path.Length > rootLength) 166var i = path.Length; 237int length = path.Length; 312return path.Length > 0 && IsDirectorySeparator(path[0]) 339if (path.Length > 0 && path[0] == '.') 341if (path.Length == 1 || IsDirectorySeparator(path[1])) 348if (path.Length == 2 || IsDirectorySeparator(path[2])) 359if (path.Length >= 1 && IsDirectorySeparator(path[0])) 366if (path.Length >= 2 && path[1] == VolumeSeparatorChar && (path.Length <= 2 || !IsDirectorySeparator(path[2]))) 400return path.Length >= 2 && 411return path.Length >= 3 && path[1] == VolumeSeparatorChar && IsDirectorySeparator(path[2]); 465char c = root[root.Length - 1]; 504if (path.Length > 0 && IsDirectorySeparator(path[path.Length - 1])) 506return path.Substring(0, path.Length - 1); 633return parentPath.Length > 0 634&& childPath.Length > parentPath.Length 635&& PathsEqual(childPath, parentPath, parentPath.Length) 636&& (IsDirectorySeparator(parentPath[parentPath.Length - 1]) || IsDirectorySeparator(childPath[parentPath.Length])); 641var relativePath = childPath.Substring(parentPath.Length); 644int start = ConsumeDirectorySeparators(relativePath, relativePath.Length, 0); 673return PathsEqual(path1, path2, Math.Max(path1.Length, path2.Length)); 681if (path1.Length < length || path2.Length < length) 870if (!isDriveRooted && !(p.Length > 1 && p[0] == AltDirectorySeparatorChar))
src\roslyn\src\Compilers\Core\Portable\InternalUtilities\CompilerOptionParseUtilities.cs (1)
42if (Environment.GetEnvironmentVariable(CachePathEnvironmentVariable) is not { Length: > 0 } cachePath)
src\roslyn\src\Compilers\Core\Portable\InternalUtilities\FileNameUtilities.cs (6)
122if (path.Length > 0 && path[path.Length - 1] == '.') 124return path.Substring(0, path.Length - 1); 149if (extension == null || path.Length == 0) 154if (extension.Length == 0 || extension[0] != '.') 173for (int i = path.Length - 1; i >= 0; i--)
Microsoft.CSharp (8)
Microsoft\CSharp\RuntimeBinder\ComInterop\VariantArray.cs (1)
85int arity = int.Parse(t.Name.AsSpan("VariantArray".Length), provider: CultureInfo.InvariantCulture);
Microsoft\CSharp\RuntimeBinder\Syntax\NameManager.cs (1)
162Debug.Assert(key.Length >= length);
Microsoft\CSharp\RuntimeBinder\Syntax\NameTable.cs (6)
76int hashCode = key.Length; 78for (int i = 0; i < key.Length; i++) 95Debug.Assert(length <= key.Length); 117Debug.Assert(length <= key.Length); 118if (candidate.Length != length) 123for (int i = 0; i < candidate.Length; i++)
Microsoft.Data.Analysis (11)
DataFrame.cs (2)
551if (stringValue.Length == 0 && column.DataType != typeof(string)) 980longestColumnName = Math.Max(longestColumnName, Columns[i].Name.Length);
TextFieldParser.cs (9)
53int length = line.Length; 71if (_index + 1 < line.Length && line[_index + 1] == '"') 474if (line.Length < numberOfChars) 599if (trimmedLine.Length == 0) 816int endOfLine = line.Length; 824if (line.Length + newLine.Length > _maxLineSize) 911int length = line.Length; 1133if (token.Length == 1 && char.IsWhiteSpace(token[0]))
Microsoft.Data.Analysis.Tests (9)
src\Microsoft.Data.Analysis\TextFieldParser.cs (9)
53int length = line.Length; 71if (_index + 1 < line.Length && line[_index + 1] == '"') 474if (line.Length < numberOfChars) 599if (trimmedLine.Length == 0) 816int endOfLine = line.Length; 824if (line.Length + newLine.Length > _maxLineSize) 911int length = line.Length; 1133if (token.Length == 1 && char.IsWhiteSpace(token[0]))
Microsoft.Deployment.DotNet.Releases (11)
ReleaseVersion.cs (11)
517if (a.Length > b.Length) 522if (a.Length < b.Length) 532for (int i = a.Length - 1; i >= 0; i--) 587if (string.IsNullOrWhiteSpace(input) || (input[0] == '0' && input.Length > 1)) 607for (int i = 0; i < input.Length; ++i) 637for (int i = 0; i < input.Length; i++) 697if (prereleaseSeparatorIndex + 1 > input.Length) 714if (buildSeparatorIndex + 1 > input.Length) 730if (buildSeparatorIndex + 1 > input.Length)
Microsoft.Diagnostics.DataContractReader.Contracts (8)
Contracts\EcmaMetadata_1.cs (2)
182builder.WriteInt32(AlignUp(version.Length + 1, 4)); 312for (int i = stringEnd; i < bufferStart + AlignUp(value.Length + 1, 4); i++)
Contracts\ManagedTypeSource_1.cs (1)
321string candidate = ns.Length == 0 ? name : ns + "." + name;
Contracts\StackWalk\StackWalk_1.cs (1)
1194=> storage.RegisterName.Length != 0
PrintfStressMessageFormatter.cs (4)
213while (startIndex < formatString.Length) 224if (nextFormatter == formatString.Length - 1) 292if (startIndex < formatString.Length 304if (formatString.Length - startIndex >= 3
Microsoft.Diagnostics.DataContractReader.DataGenerator (2)
Emitter.cs (2)
564fqn = fqn.Substring(GlobalPrefix.Length); 568fqn = fqn.Substring(RootPrefix.Length);
Microsoft.Diagnostics.DataContractReader.Legacy (15)
ClrDataAppDomain.cs (1)
68uint requiredLen = (uint)friendlyName.Length + 1;
ClrDataExceptionState.cs (1)
233if (str is not null && bufLen < (uint)(message.Length + 1))
ClrDataModule.cs (3)
152int searchFrom = fullName.Length - 1; 167string methodName = fullName[Math.Min(dotPos + 1, fullName.Length - 1)..]; 880getModuleData->IsInMemory = contract.GetPath(moduleHandle).Length == 0 ? 1u : 0u;
ClrDataValue.cs (2)
549if (str is null || bufLen < value.Length + 1) 815if (nameBuf is not null && nameBufLen != 0 && nameBufLen < fieldName.Length + 1)
MetaDataImportImpl.cs (2)
1900pMetaData->cbLocale = (uint)(culture.Length + 1); 2002pMetaData->cbLocale = (uint)(culture.Length + 1);
SOSDacImpl.cs (5)
247if (friendlyName is null || friendlyName.Length == 0) 262*pNeeded = (uint)(friendlyName.Length + 1); 3443data->Size += (uint)objectContract.GetStringValue(objPtr).Length * data->dwComponentSize; 3559Debug.Assert(stringData == null || new ReadOnlySpan<char>(stringDataLocal, 0, new string(stringData).Length).SequenceEqual(new string(stringData))); 3949uint needed = (uint)(name.Length + 1);
TypeHandleExtensions.cs (1)
46if (typeNamespace.Length > 0)
Microsoft.Diagnostics.NETCore.Client (9)
BinaryWriterExtensions.cs (1)
19@this.Write(value != null ? (value.Length + 1) : 0);
DiagnosticsIpc\IpcEndpointConfig.cs (3)
197address = address.Substring(NamedPipeDefaultIPCRoot.Length); 201address = address.Substring(NamedPipeSchemaDefaultIPCRootPath.Length); 205address = address.Substring("/".Length);
DiagnosticsIpc\IpcServerTransport.cs (1)
107_pipeName = pipeName.StartsWith(PipePrefix) ? pipeName.Substring(PipePrefix.Length) : pipeName;
DiagnosticsIpc\IpcTransport.cs (3)
536int total_length = searchDirectory.Length + string.Format(_defaultAddressFormatNonWindows, pid, "##########").Length; 562address = address.Substring(IpcRootPath.Length);
DiagnosticsIpc\ProcessEnvironment.cs (1)
59env[pair.Substring(0, equalsIdx)] = equalsIdx != pair.Length - 1 ? pair.Substring(equalsIdx + 1) : "";
Microsoft.DiaSymReader (9)
Metadata\SymWriterMetadataAdapter.cs (1)
115int adjustedLength = Math.Min(nameStr.Length, nameBufferLength - 1);
Utilities\InteropUtilities.cs (6)
38int fullLength = (namespaceStr.Length > 0 ? namespaceStr.Length + 1 : 0) + nameStr.Length; 57if (namespaceStr.Length > 0) 59for (int i = 0; i < namespaceStr.Length && dst < dstEndPtr; i++) 72for (int i = 0; i < nameStr.Length && dst < dstEndPtr; i++)
Writer\SymUnmanagedWriterImpl.cs (2)
424while (i < str.Length) 431if (i < str.Length && char.IsLowSurrogate(str[i]))
Microsoft.DotNet.ApiCompat.Task (1)
src\sdk\src\Tasks\Common\Logger.cs (1)
79if (format.Length >= 12
Microsoft.DotNet.Arcade.Sdk (11)
src\DownloadFile.cs (1)
113var filePath = uri.Substring(FileUriProtocol.Length);
src\GenerateResxSource.cs (4)
128string docCommentString = value.Length > maxDocCommentLength ? value.Substring(0, maxDocCommentLength) + " ..." : value; 375var builder = new StringBuilder(name.Length); 438StringBuilder stringLiteral = new StringBuilder(original.Length + 3); 444for (var i = 0; i < original.Length; i++)
src\GenerateSourcePackageSourceLinkTargetsFile.cs (6)
51if (itemSpec.Length > projectDir.Length && itemSpec.StartsWith(projectDir, StringComparison.Ordinal)) 58innerMostRootItemSpec != null && itemSpec.Length <= innerMostRootItemSpec.Length) 91var relativePathToSourceRoot = projectDir.Substring(innerMostRootItemSpec.Length); 98char last = path[path.Length - 1];
Microsoft.DotNet.ArcadeLogging (1)
PipelinesLogger.cs (1)
64var result = new StringBuilder(value.Length);
Microsoft.DotNet.Build.Tasks.Feed (1)
src\PushToBuildStorage.cs (1)
553return targetPath.Substring(basePath.Length).TrimStart('/', '\\');
Microsoft.DotNet.Build.Tasks.Installers (9)
src\CpioWriter.cs (1)
36writer.Write((entry.Name.Length + 1).ToString("x8")); // This field should include the null terminator.
src\CreateMD5SumsFile.cs (1)
41string relativePath = file.ItemSpec.Substring(RootDirectory.Length).TrimStart(Path.DirectorySeparatorChar).Replace('\\', '/');
src\CreateRpmPackage.cs (3)
144.Where(p => p.Length > 0) 169$"the installed path '/{normalizedPath.Substring("./".Length)}'."); 215string.Join(", ", missingGhostFiles.Select(k => "/" + k.Substring("./".Length))) +
src\CreateWixBuildWixpack.cs (3)
753while (pos < input.Length) 894string innerVar = variableName.Substring(6, variableName.Length - 7); 900string innerConst = variableName.Substring(2, variableName.Length - 3);
src\RpmLead.cs (1)
58Encoding.UTF8.GetBytes(Name, 0, Name.Length, name, 0);
Microsoft.DotNet.Build.Tasks.Packaging (14)
Extensions.cs (1)
116return s.Length == 0 ? null : s;
GeneratePackageReport.cs (1)
155var refAssm = compileAssets.FirstOrDefault(r => !NuGetAssetResolver.IsPlaceholder(r))?.Substring(PackageId.Length + 1);
GetApplicableAssetsFromPackageReports.cs (1)
56if (TargetMoniker == null || TargetMoniker.Length == 0)
HarvestPackage.cs (4)
239var refAssm = compileAssets.FirstOrDefault(r => !NuGetAssetResolver.IsPlaceholder(r))?.Substring(PackageId.Length + 1); 305string harvestPackagePath = packageFile.Substring(pathToPackage.Length + 1).Replace('\\', '/'); 605return extension != null && extension.Length > 0 && s_includedExtensions.Contains(extension, StringComparer.OrdinalIgnoreCase); 616.Select(f => f.Substring(packageFolder.Length + 1).Replace('\\', '/'))
NugetPropertyStringProvider.cs (2)
52if (indexOfEquals == propertyString.Length - 1) 65var valueLength = propertyString.Length - valueStartIndex;
PackageItem.cs (1)
104return (value?.Length > 0) ? value : null;
ValidateHarvestVersionIsLatestForRelease.cs (1)
111startIndex += patternToSearchFor.Length;
ValidatePackage.cs (3)
501bool isExclusiveVersion = fxString.Length > 1 && fxString[0] == '[' && fxString[fxString.Length - 1] == ']'; 504fxString = fxString.Substring(1, fxString.Length - 2);
Microsoft.DotNet.Build.Tasks.TargetFramework (1)
TargetFrameworkResolver.cs (1)
63return bestTargetFrameworkString?.Remove(bestTargetFrameworkString.Length - 1);
Microsoft.DotNet.Build.Tasks.Templating (3)
GenerateFileFromTemplate.cs (3)
143for (int i = 0; i < template.Length; i++) 146char nextTemplateChar = i + 1 >= template.Length 173for (; i < template.Length; i++)
Microsoft.DotNet.Build.Tasks.VisualStudio (4)
OptProf\GenerateTrainingPropsFile.cs (1)
50var dropName = hasDropName ? ProductDropName.Substring(ProductDropNamePrefix.Length) : "dummy";
OptProf\GetRunSettingsSessionConfiguration.cs (2)
87return $"Tests/{dropUrl.Substring(prefix.Length)}"; 106return "ProfilingInputs/" + vsDropName.Substring(prefix.Length);
OptProf\IbcEntry.cs (1)
71=> path.StartsWith(prefix, StringComparison.OrdinalIgnoreCase) ? replacement + path.Substring(prefix.Length) : path;
Microsoft.DotNet.Build.Tasks.Workloads (4)
StringExtensions.cs (2)
19return str.StartsWith(trimString) ? str.Remove(0, trimString.Length) : str; 31return str.StartsWith(trimString, comparisonType) ? str.Remove(0, trimString.Length) : str;
Swix\SwixProjectBase.cs (1)
89if (relativePackagePath.Length > MaxRelativePackagePath)
WorkloadPackageBase.cs (1)
313packageId.Substring(packageId.IndexOf(separator) + separator.Length) :
Microsoft.DotNet.Cli.CoreUtils (8)
PathUtilities.cs (2)
17if (path.Length == 0 || path[path.Length - 1] == trailingCharacter)
SdkPaths.cs (6)
66if (AppContext.GetData(DataName) is string sdkRoot && sdkRoot.Length > 0) 82if (path.Length == 0) 88char last = path[path.Length - 1]; 89return path.Length > (root?.Length ?? 0) 91? path.Substring(0, path.Length - 1)
Microsoft.DotNet.Cli.Definitions (22)
Commands\Restore\RestoreCommandDefinition.cs (1)
96=> rid.Substring(rid.LastIndexOf("-", StringComparison.InvariantCulture) + 1, rid.Length - rid.LastIndexOf("-", StringComparison.InvariantCulture) - 1);
Common\TargetPlatformOptions.cs (1)
132=> rid.Substring(rid.LastIndexOf("-", StringComparison.InvariantCulture) + 1, rid.Length - rid.LastIndexOf("-", StringComparison.InvariantCulture) - 1);
Help\HelpBuilder.cs (14)
120int firstColumnWidth = items.Select(x => x.FirstColumnText.Length).Max(); 121int secondColumnWidth = items.Select(x => x.SecondColumnText.Length).Max(); 123if (firstColumnWidth + secondColumnWidth + Indent.Length + Indent.Length > windowWidth) 125int firstColumnMaxWidth = windowWidth / 2 - Indent.Length; 128firstColumnWidth = items.SelectMany(x => WrapText(x.FirstColumnText, firstColumnMaxWidth).Select(x => x.Length)).Max(); 130secondColumnWidth = windowWidth - firstColumnWidth - Indent.Length - Indent.Length; 144int padSize = firstColumnWidth - first.Length; 296if (part.Length <= maxWidth) 303for (int i = 0; i < part.Length;) 305if (part.Length - i < maxWidth) 313for (int j = 0; j + i < part.Length && j < maxWidth; j++) 486int maxWidth = MaxWidth - Indent.Length;
Help\HelpBuilder.Default.cs (1)
263if (rawAlias.Length > 1 && rawAlias[1] == '-')
src\sdk\src\Common\WorkloadSetVersion.cs (1)
72? workloadSetVersion.Substring(sections[0].Length)
Utilities\MSBuildPropertyParser.cs (4)
27char? Peek() => currentPos < input.Length ? input[currentPos] : null; 31if (input.Length > currentPos) 118bool AtEnd() => currentPos == input.Length; 148for (int i = input.Length - 1; i >= 0; i--)
Microsoft.DotNet.Cli.Telemetry (5)
Implementation\AzureMonitorLogSerializer.cs (1)
171var hasFullStack = stack is not null && stack.Length <= BreezeSchema.ExceptionStackMaxLength;
Implementation\AzureMonitorTelemetrySerializer.cs (1)
196var hasFullStack = exceptionStack is not null && exceptionStack.Length <= BreezeSchema.ExceptionStackMaxLength;
Implementation\BreezeSchema.cs (1)
75=> value is not null && value.Length > maxLength ? value.Substring(0, maxLength) : value;
Implementation\BreezeWriter.cs (1)
64if (tag.Value is null || key.Length > BreezeSchema.KvpMaxKeyLength || !seenKeys.Add(key))
Implementation\TelemetryResourceContextFactory.cs (1)
103return normalized.Length > 20 ? normalized.Substring(0, 20) : normalized;
Microsoft.DotNet.Cli.Utils (22)
AnsiConsole.cs (2)
91while (endIndex != message.Length && 100if (endIndex == message.Length)
ArgumentEscaper.cs (4)
93var length = arg.Length; 104while (i < arg.Length && arg[i] == '\\') 114if (i == arg.Length && isQuoted) 121else if (i == arg.Length)
BuiltInCommand.cs (1)
56if (_workingDirectory is not null && _workingDirectory.Length != 0)
EnvironmentProvider.cs (1)
63return Path.Combine(_userHomeDirectory.Value, path.Substring(tildeSlash.Length));
Extensions\StringExtensions.cs (1)
25return name.Length > 1 && name[1] == '-' ? 2 : 1;
PathUtility.cs (4)
42char lastChar = path[path.Length - 1]; 45path = path.Substring(0, path.Length - 1); 247return path.Substring(Path.GetDirectoryName(path)?.Length ?? 0).Trim(Path.DirectorySeparatorChar, Path.AltDirectorySeparatorChar); 305if (path[path.Length - 1] == Path.DirectorySeparatorChar)
RuntimeEnvironment.cs (2)
170VersionId = version.Substring("omnios-r".Length, 2) // e.g. 15 177VersionId = version.Substring("joyent_".Length, 4) // e.g. 2020
TypoCorrection.cs (7)
26var currentTokenLength = currentToken.Length; 27var possibleSuggestions = possibleTokens.Select((string possibleMatch) => new Suggestion(possibleMatch, possibleMatch.Length)).ToArray(); 43if (currentToken.Length >= minCurrentTokenLength) 97for (i = 0; i < first.Length && i < second.Length && first[i] == second[i]; i++) ; 120int n = first.Length, m = second.Length;
Microsoft.DotNet.HotReload.Utils.Generator.Frontend (5)
Frontend.cs (5)
61builder.ProjectPath = fn[msbuildOptPrefix.Length..]; 66if (s.IndexOf('=') is int j && j > 0 && j+1 < s.Length) { 77builder.ScriptPath = fn[scriptOptPrefix.Length..]; 79builder.OutputSummaryPath = fn[outputSummaryPrefix.Length..]; 81builder.EditAndContinueCapabilities.Add (fn[capabilitiesPrefix.Length..]);
Microsoft.DotNet.HotReload.Watch (16)
Build\ProjectGraphUtilities.cs (4)
59=> project.GetPropertyValue(PropertyNames.TargetPath) is { Length: >0 } path ? Path.GetDirectoryName(Path.Combine(project.Directory, NormalizeSeparators(path))) : null; 68=> project.GetPropertyValue(PropertyNames.IntermediateOutputPath) is { Length: >0 } path ? Path.Combine(project.Directory, NormalizeSeparators(path)) : null; 93=> project.GetPropertyValue(propertyName) is { Length: >0 } value ? bool.TryParse(value, out var result) && result : defaultValue; 96=> item.GetMetadataValue(metadataName) is { Length: > 0 } value ? bool.TryParse(value, out var result) && result : defaultValue;
Context\EnvironmentOptions.cs (1)
92? $"{Path.Combine(WorkingDirectory, options.BinaryLogPath)[..^".binlog".Length]}-dotnet-watch.{operationName}.{Path.GetFileName(projectPath)}.{Interlocked.Increment(ref _uniqueLogId)}.binlog"
FileWatcher\EventBasedDirectoryWatcher.cs (1)
68var oldLocation = Path.Combine(e.OldFullPath, newLocation.Substring(e.FullPath.Length + 1));
HotReload\HotReloadDotNetWatcher.cs (3)
1338if (path.StartsWith(workingDirectory, StringComparison.Ordinal) && path.Length > workingDirectory.Length) 1340relativePath = path.Substring(workingDirectory.Length);
src\sdk\src\Dotnet.Watch\HotReloadClient\Web\StaticWebAsset.cs (2)
68? assetFilePath.Substring(webRootDir.Length - webRoot.Length).Replace("\\", "/")
Utilities\CommandLineUtilities.cs (5)
37if (argument.Length != 0 && ContainsNoWhitespaceOrQuotes(argument)) 46while (idx < argument.Length) 52while (idx < argument.Length && argument[idx] == Backslash) 58if (idx == argument.Length) 97for (int i = 0; i < s.Length; i++)
Microsoft.DotNet.HotReload.WebAssembly.Browser (1)
src\sdk\src\Dotnet.Watch\HotReloadAgent\HotReloadAgent.cs (1)
122Debug.Assert(Capabilities.Length > 0);
Microsoft.DotNet.PackageValidation (2)
Filtering\TargetFrameworkFilter.cs (2)
41if (excludedTargetFramework.Length > 1 && 44string excludedTargetFrameworkWithoutWildcard = excludedTargetFramework.Substring(0, excludedTargetFramework.Length - 1);
Microsoft.DotNet.ProjectTools (1)
src\sdk\src\Cli\Microsoft.DotNet.FileBasedPrograms\VirtualProjectBuilder.cs (1)
123entryPointFilePath = projectPath[..^CsprojExtension.Length];
Microsoft.DotNet.SdkResolver (1)
VSSettings.cs (1)
133if (indexOfEquals < 0 || indexOfEquals == (line.Length - 1))
Microsoft.DotNet.SourceBuild.Tasks (7)
src\UsageReport\Usage.cs (2)
62.OrderByDescending(rid => rid.Length) 76.Remove(0, prefix.Length)
src\UsageReport\WritePackageUsageData.cs (1)
268return path.Substring(RootDir.Length).Replace(Path.DirectorySeparatorChar, '/');
src\UsageReport\WriteUsageReports.cs (4)
208SnapshotPrefix.Length, 209filename.Length - SnapshotPrefix.Length - SnapshotSuffix.Length),
Microsoft.DotNet.TemplateLocator (15)
src\sdk\src\Common\EnvironmentVariableNames.cs (1)
104var span = runtimeIdentifier.AsSpan(archStart, (archEnd > 0 ? archEnd : runtimeIdentifier.Length) - archStart);
src\sdk\src\Common\WorkloadSetVersion.cs (1)
72? workloadSetVersion.Substring(sections[0].Length)
src\sdk\src\Resolvers\Microsoft.DotNet.MSBuildSdkResolver\FXVersion.cs (6)
56char s1char = (s1.Pre.Length == i) ? '\0' : s1.Pre[i]; 57char s2char = (s2.Pre.Length == i) ? '\0' : s2.Pre[i]; 117for (int i = 0; i < id.Length; ++i) 151if (!buildMeta && id[0] == '0' && id.Length > 1 && int.TryParse(id, out _)) 196for (int i = startIndex; i < s.Length; ++i) 261if (patchStart + 1 < fxVersionString.Length && fxVersionString[patchStart] == '0')
src\sdk\src\Resolvers\Microsoft.NET.Sdk.WorkloadManifestReader\SdkDirectoryWorkloadManifestProvider.cs (4)
241firstDash = firstDash < 0 ? first.Length : firstDash; 242secondDash = secondDash < 0 ? second.Length : secondDash; 253var modifiedFirst = new ReleaseVersion(1, 1, 1, firstDash == first.Length ? null : first.Substring(firstDash)); 254var modifiedSecond = new ReleaseVersion(1, 1, 1, secondDash == second.Length ? null : second.Substring(secondDash));
src\sdk\src\Resolvers\Microsoft.NET.Sdk.WorkloadManifestReader\SdkFeatureBand.cs (1)
63char separator = workloadSetVersion[sections[0].Length];
src\sdk\src\Resolvers\Microsoft.NET.Sdk.WorkloadManifestReader\WorkloadManifestReader.Localization.cs (1)
55var cultureName = Path.GetFileNameWithoutExtension(filePath).Substring("WorkloadManifest.".Length);
src\sdk\src\Resolvers\Microsoft.NET.Sdk.WorkloadManifestReader\WorkloadSet.cs (1)
156char separator = setVersion[sections[0].Length];
Microsoft.DotNet.XliffTasks (9)
Model\UnstructuredDocument.cs (6)
41lastSpanEnd += TranslatableSpanMarker.Length; // account for the length of the end marker 42int spanLength = lastSpanEnd - spanStart - TranslatableSpanMarker.Length * 2; // trim off the marker start/end length 43string translatableSpan = text.Substring(spanStart + TranslatableSpanMarker.Length, spanLength); 51string source = translatableSpan.Substring(separatorIndex + TranslatableSpanSeparator.Length); 57spanStart = lastSpanEnd >= text.Length 62if (lastSpanEnd < text.Length)
Model\XamlRuleDocument.cs (1)
202return line.Substring(attributeName.Length).Trim(s_attrValueTrimChars);
Model\XDocumentExtensions.cs (1)
30if (element.Value.Length == 0)
Validation.cs (1)
17if (value.Length == 0)
Microsoft.Extensions.AI (4)
ChatCompletion\ChatResponse{T}.cs (1)
99var utf8SpanLength = Encoding.UTF8.GetBytes(json, 0, json.Length, buffer, 0);
Common\FunctionInvocationHelpers.cs (3)
32(displayName.Length == operationName.Length || displayName[operationName.Length] == ' ');
Microsoft.Extensions.AI.Abstractions (21)
ChatCompletion\ChatResponseExtensions.cs (5)
585if (update.MessageId is { Length: > 0 }) 596if (update.MessageId is { Length: > 0 }) 639if (update.ResponseId is { Length: > 0 }) 667s1 is { Length: > 0 } str1 && s2 is { Length: > 0 } str2 && str1 != str2;
Contents\AIContentExtensions.cs (1)
101if (text.Length > 0)
Contents\DataContent.cs (3)
219if (path.Length == 0 || Directory.Exists(path)) 233path = path.Length == 0 ? name! : Path.Combine(path, name); 386return uri.Length <= MaxLength ?
Contents\DataUriParser.cs (2)
39dataUri = dataUri.Slice(Scheme.Length); 58metadata = metadata.Slice(0, metadata.Length - ";base64".Length);
Files\HostedFileClientExtensions.cs (2)
108if (destinationPath.Length == 0 || Directory.Exists(destinationPath)) 122finalPath = destinationPath.Length == 0 ? fileName! : Path.Combine(destinationPath, fileName);
Functions\AIFunctionFactory.cs (6)
869(asyncIndex + AsyncSuffix.Length == name.Length || 870((asyncIndex + AsyncSuffix.Length < name.Length) && (name[asyncIndex + AsyncSuffix.Length] == '_')))) 876string.Concat(name.Substring(0, asyncIndex), name.Substring(asyncIndex + AsyncSuffix.Length));
Utilities\AIJsonUtilities.Schema.Create.cs (2)
299: $"#/{PropertiesPropertyName}/{parameterSchemaName}/{refUri.AsMemory("#/".Length)}"; 883StringBuilder sb = new(segment.Length + 2);
Microsoft.Extensions.AI.Abstractions.Tests (1)
Utilities\AIJsonUtilitiesTests.cs (1)
414AIFunction func = AIFunctionFactory.Create(([Range(1, 10)] int num, [StringLength(100, MinimumLength = 1)] string str) => num + str.Length, serializerOptions: options);
Microsoft.Extensions.AI.Evaluation.NLP (5)
Common\SimpleWordTokenizer.cs (5)
100text = text.Slice("&quot;".Length); 112text = text.Slice("&amp;".Length); 124text = text.Slice("&lt;".Length); 136text = text.Slice("&gt;".Length); 148text = text.Slice("&apos;".Length);
Microsoft.Extensions.AI.Evaluation.Quality (1)
Utilities\JsonOutputFixer.cs (1)
26int markerLength = JsonMarker.Length;
Microsoft.Extensions.AI.Evaluation.Reporting (2)
Formats\Html\HtmlReportWriter.cs (1)
95HtmlTemplateAfter = all.Substring(start + SearchString.Length);
Utilities\PathValidation.cs (1)
42if (segment.Length == 0
Microsoft.Extensions.AI.Evaluation.Reporting.Tests (2)
ScenarioRunResultTests.cs (2)
339Assert.True(defaultJson.Length > compactJson.Length);
Microsoft.Extensions.AI.Integration.Tests (5)
PromptBasedFunctionCallingChatClient.cs (1)
96if (toolCall.Length == 0)
VerbatimMultiPartHttpHandler.cs (4)
187int start = headers.IndexOf(NamePrefix) + NamePrefix.Length; 192end = headers.Length; 207start += FilenamePrefix.Length; 211end = headers.Length;
Microsoft.Extensions.AI.OpenAI (10)
MicrosoftExtensionsAIResponsesExtensions.cs (1)
110if (options?.Instructions is { Length: > 0 })
OpenAIChatClient.cs (2)
848if (name.Length == 0) 852else if (name.Length > MaxLength)
OpenAIClientExtensions.cs (3)
450(name.Length == ChatOperationName.Length || name[ChatOperationName.Length] == ' '))
OpenAIRealtimeClientSession.cs (1)
737if (commaIndex >= 0 && commaIndex < dataUri.Length - 1)
OpenAIResponsesChatClient.cs (2)
604case ReasoningResponseItem rri when rri.EncryptedContent is { Length: > 0 } encryptedContent: 817responsesMcpTool.AuthorizationToken = trimmedAuthHeader.Slice("Bearer ".Length).TrimStart().ToString();
RequestOptionsExtensions.cs (1)
76if (version.Length > 0)
Microsoft.Extensions.AI.OpenAI.Tests (1)
OpenAIResponseClientIntegrationTests.cs (1)
504if (TestRunnerConfiguration.Instance["RemoteMCP:ConnectorAccessToken"] is not string { Length: > 0 } accessToken)
Microsoft.Extensions.Caching.Hybrid (9)
Internal\DefaultHybridCache.cs (2)
293if (key.Length > _maximumKeyLength) 295_logger.MaximumKeyLengthExceeded(_maximumKeyLength, key.Length);
Internal\DefaultHybridCache.StampedeStateT.cs (1)
543int maxChars = Math.Max(key.Length, tags.MaxLength());
Internal\HybridCachePayload.cs (4)
72+ GetMaxStringLength(key.Length) // key 81length += GetMaxStringLength(tags.GetSinglePrechecked().Length); 86length += GetMaxStringLength(tag.Length); 164offset += Encoding.GetBytes(value, 0, value.Length, target, offset);
Internal\TagSet.cs (2)
206return single.Length; 211max = Math.Max(max, test.Length);
Microsoft.Extensions.Caching.Hybrid.Tests (1)
TagSetTests.cs (1)
175chars[i] = Alphabet[rand.Next(0, Alphabet.Length)];
Microsoft.Extensions.Compliance.Abstractions (2)
Classification\DataClassificationTypeConverter.cs (2)
90if (value.Length <= 1) 98if (index <= 0 || index >= (value.Length - 1))
Microsoft.Extensions.Compliance.Abstractions.Tests (12)
Classification\DataClassificationAttributeTests.cs (1)
25Assert.Equal(0, attribute.Notes.Length);
Redaction\RedactorTest.cs (8)
100var buffer = new char[data.Length]; 101var bufferDirect = new char[data.Length]; 137var buffer = new char[data.Length]; 138var bufferDirect = new char[data.Length]; 158var buffer = new char[data.Length]; 159var bufferDirect = new char[data.Length]; 176var buffer = new char[data.Length]; 177var bufferDirect = new char[data.Length];
Redaction\TestSpanFormattable.cs (3)
27if (destination.Length < _value.Length) 33for (var i = 0; i < _value.Length; i++) 38charsWritten = _value.Length;
Microsoft.Extensions.Compliance.Redaction (4)
HmacRedactor.cs (3)
48_redactedLength = Base64HashLength + _keyId.Length; 107return ConvertBytesToBase64(CreateSha256Hash(source, _hashKey), destination, RemainingBytesToPadForBase64Hash, _keyId.Length) + _keyId.Length;
parent\parent\parent\eng\MSBuild\parent\parent\src\Shared\Data.Validation\LengthAttribute.cs (1)
116count = s.Length;
Microsoft.Extensions.Compliance.Redaction.Tests (4)
HmacRedactorExtensionsTests.cs (2)
67Assert.True(expectedLength == 0 || expectedLength == Example.Length); 68Assert.True(actualLength == 0 || actualLength == Example.Length);
HmacRedactorTest.cs (2)
113Assert.Equal(result.Length, length); 138Assert.Equal(result.Length, length);
Microsoft.Extensions.Compliance.Testing (4)
FakeRedactor.cs (4)
79Throw.IfBufferTooSmall(destination.Length, str.Length, nameof(destination)); 84EventCollector.Append(new RedactedData(sourceString, destination.Slice(0, str.Length).ToString(), order)); 86return str.Length; 92return string.Format(CultureInfo.InvariantCulture, _format, input.ToString()).Length;
Microsoft.Extensions.Configuration (5)
ConfigurationProvider.cs (4)
80if (kv.Key.Length > parentPath.Length && 82kv.Key[parentPath.Length] == ':') 84results.Add(Segment(kv.Key, parentPath.Length + 1));
ConfigurationSectionDebugView.cs (1)
49int prefixLength = (current is IConfigurationSection rootSection) ? rootSection.Path.Length + 1 : 0;
Microsoft.Extensions.Configuration.Abstractions (1)
ConfigurationExtensions.cs (1)
58int prefixLength = (makePathsRelative && configuration is IConfigurationSection rootSection) ? rootSection.Path.Length + 1 : 0;
Microsoft.Extensions.Configuration.Binder (1)
ConfigurationBinder.cs (1)
651return missing.Length == 0;
Microsoft.Extensions.Configuration.Binder.SourceGeneration (4)
Specs\TypeIndex.cs (2)
132displayString = displayString.Substring(GlobalPrefix.Length); 135Debug.Assert(displayString.Length > 0);
src\runtime\src\libraries\Common\src\Roslyn\GetBestTypeByMetadataName.cs (2)
157return name.Length > AttributeSuffix.Length && name.EndsWith(AttributeSuffix, comparison);
Microsoft.Extensions.Configuration.EnvironmentVariables (10)
EnvironmentVariablesConfigurationProvider.cs (2)
156string normalizedKeyWithoutConnectionStringPrefix = Normalize(fullKey.Substring(connectionStringPrefix.Length)); 170data[normalizedKey.Substring(_normalizedPrefix.Length)] = value;
EnvironmentVariablesConfigurationSource.cs (3)
57while (index < name.Length) 59if (name[index] == '_' && index + 1 < name.Length && name[index + 1] == '_') 61if (index + 2 < name.Length && name[index + 2] == '_')
src\runtime\src\libraries\Common\src\System\Text\ValueStringBuilder.cs (5)
125int count = s.Length; 167if (s.Length == 1 && (uint)pos < (uint)_chars.Length) // very common case, e.g. appending strings from NumberFormatInfo like separators, percent symbols, etc. 181if (pos > _chars.Length - s.Length) 183Grow(s.Length); 191_pos += s.Length;
Microsoft.Extensions.Configuration.Ini (5)
IniStreamConfigurationProvider.cs (5)
49if (line[0] == '[' && line[line.Length - 1] == ']') 53sectionPrefix = string.Concat(line.AsSpan(1, line.Length - 2).Trim(), ConfigurationPath.KeyDelimiter); 71if (value.Length > 1 && value[0] == '"' && value[value.Length - 1] == '"') 73value = value.Substring(1, value.Length - 2);
Microsoft.Extensions.Configuration.KeyPerFile (2)
KeyPerFileConfigurationProvider.cs (2)
47? value.Substring(0, value.Length - Environment.NewLine.Length)
Microsoft.Extensions.Configuration.Xml (3)
XmlStreamConfigurationProvider.cs (3)
424_lengths.Push(value.Length + ConfigurationPath.KeyDelimiter.Length); 429_lengths.Push(value.Length);
Microsoft.Extensions.DataIngestion (9)
Chunkers\ElementsChunker.cs (4)
116AppendNewLineAndSpan(_currentChunk, tableBuilder.AsSpan(0, tableLength - Environment.NewLine.Length)); 140AppendNewLineAndSpan(_currentChunk, tableBuilder.AsSpan(0, tableLength - Environment.NewLine.Length)); 212startIndex: context.Length, 213length: _currentChunk.Length - context.Length);
Chunkers\ValueStringBuilder.cs (5)
125int count = s.Length; 167if (s.Length == 1 && (uint)pos < (uint)_chars.Length) // very common case, e.g. appending strings from NumberFormatInfo like separators, percent symbols, etc. 181if (pos > _chars.Length - s.Length) 183Grow(s.Length); 191_pos += s.Length;
Microsoft.Extensions.DataIngestion.Markdig (1)
MarkdownParser.cs (1)
130ReadOnlySpan<char> url = link.Url.AsSpan("data:".Length);
Microsoft.Extensions.DataIngestion.MarkItDown (1)
parent\Microsoft.Extensions.DataIngestion.Markdig\MarkdownParser.cs (1)
130ReadOnlySpan<char> url = link.Url.AsSpan("data:".Length);
Microsoft.Extensions.DependencyInjection (8)
DependencyInjectionEventSource.cs (6)
119int chunkCount = format.Length / MaxChunkSize + (format.Length % MaxChunkSize > 0 ? 1 : 0); 126format.Substring(i * MaxChunkSize, Math.Min(MaxChunkSize, format.Length - i * MaxChunkSize)), i, chunkCount, 248int chunkCount = descriptorString.Length / MaxChunkSize + (descriptorString.Length % MaxChunkSize > 0 ? 1 : 0); 254descriptorString.Substring(i * MaxChunkSize, Math.Min(MaxChunkSize, descriptorString.Length - i * MaxChunkSize)), i, chunkCount);
src\runtime\src\libraries\Common\src\Extensions\TypeNameHelper\TypeNameHelper.cs (2)
102builder.Replace(DefaultNestedTypeDelimiter, options.NestedTypeDelimiter, builder.Length - name.Length, name.Length);
Microsoft.Extensions.DependencyModel (5)
DependencyContextExtensions.cs (2)
120name = name.Substring(0, name.Length - NativeImageSufix.Length);
DependencyContextJsonReader.cs (1)
176if (separatorIndex > -1 && separatorIndex < runtimeTargetName.Length)
RuntimeAssembly.cs (2)
42assemblyName = assemblyName.Substring(0, assemblyName.Length - NativeImageSufix.Length);
Microsoft.Extensions.Diagnostics (8)
Metrics\ListenerSubscription.cs (4)
232if (rule.MeterName.Length != best.MeterName.Length) 234return rule.MeterName.Length > best.MeterName.Length;
Tracing\DefaultActivitySourceFactory.cs (4)
480if (rule.SourceName.Length != best.SourceName.Length) 482return rule.SourceName.Length > best.SourceName.Length;
Microsoft.Extensions.Diagnostics.Abstractions (2)
src\runtime\src\libraries\Common\src\Extensions\TypeNameHelper\TypeNameHelper.cs (2)
102builder.Replace(DefaultNestedTypeDelimiter, options.NestedTypeDelimiter, builder.Length - name.Length, name.Length);
Microsoft.Extensions.Diagnostics.ExceptionSummarization (1)
ExceptionSummary.cs (1)
81return AdditionalDetails.Length == 0
Microsoft.Extensions.Diagnostics.HealthChecks.ResourceUtilization (2)
Generated\Basic.CompilerLog.Util\Basic.CompilerLog.Util.Impl.BasicGeneratedFilesAnalyzerReference\Validators.g.cs (1)
196if (value is null or string { Length: 0 })
parent\parent\parent\eng\MSBuild\parent\parent\src\Shared\Data.Validation\LengthAttribute.cs (1)
116count = s.Length;
Microsoft.Extensions.Diagnostics.Probes (2)
Generated\Basic.CompilerLog.Util\Basic.CompilerLog.Util.Impl.BasicGeneratedFilesAnalyzerReference\Validators.g.cs (1)
151if (value is null or string { Length: 0 })
parent\parent\parent\eng\MSBuild\parent\parent\src\Shared\Data.Validation\LengthAttribute.cs (1)
116count = s.Length;
Microsoft.Extensions.Diagnostics.ResourceMonitoring (1)
parent\parent\parent\eng\MSBuild\parent\parent\src\Shared\Data.Validation\LengthAttribute.cs (1)
116count = s.Length;
Microsoft.Extensions.DotNetDeltaApplier (1)
src\sdk\src\Dotnet.Watch\HotReloadAgent\HotReloadAgent.cs (1)
122Debug.Assert(Capabilities.Length > 0);
Microsoft.Extensions.FileProviders.Embedded (12)
EmbeddedFileProvider.cs (7)
96var builder = new StringBuilder(_baseNamespace.Length + subpath.Length); 102subpath = subpath.Substring(1, subpath.Length - 1); 153if (subpath.Length != 0 && !string.Equals(subpath, "/", StringComparison.Ordinal)) 170resourceName.Substring(_baseNamespace.Length), 243for (var i = 1; i < subName.Length; i++) 293var everettId = new StringBuilder(name.Length);
Manifest\EmbeddedFilesManifest.cs (5)
72Debug.Assert(path.Length > 0); 74if (start == path.Length) 79var end = Array.IndexOf(_separators, path[path.Length - 1]) == -1 ? path.Length : path.Length - 1;
Microsoft.Extensions.FileProviders.Physical (9)
Internal\PathUtils.cs (2)
35path[path.Length - 1] != Path.DirectorySeparatorChar && 36path[path.Length - 1] != Path.AltDirectorySeparatorChar)
PhysicalFilesWatcher.cs (7)
121if (fswPath.Length > 0) 355string oldLocation = Path.Combine(e.OldFullPath, newLocation.Substring(e.FullPath.Length + 1)); 500string relativePath = fullPath.Substring(_root.Length); 814return path.Length > 0 && 815(path[path.Length - 1] == Path.DirectorySeparatorChar || 816path[path.Length - 1] == Path.AltDirectorySeparatorChar); 950ReadOnlySpan<char> remaining = target.AsSpan(existingAncestor.Length).TrimStart(PathUtils.PathSeparators);
Microsoft.Extensions.FileSystemGlobbing (13)
InMemoryDirectoryInfo.cs (3)
106int endPath = file.Length; 107int beginSegment = FullName.Length + 1; 136int rootDirLength = rootDir.Length;
Internal\PathSegments\WildcardPathSegment.cs (7)
46if (value.Length < wildcard.BeginsWith.Length + wildcard.EndsWith.Length) 61int beginRemaining = wildcard.BeginsWith.Length; 62int endRemaining = value.Length - wildcard.EndsWith.Length; 76beginRemaining = indexOf + containsValue.Length;
Internal\Patterns\PatternBuilder.cs (3)
34if (pattern.TrimEnd(_slashes).Length < pattern.Length) 48int endPattern = pattern.Length;
Microsoft.Extensions.Hosting (2)
HostingHostBuilderExtensions.cs (2)
245if (env.ApplicationName is { Length: > 0 }) 253if (env.IsDevelopment() && env.ApplicationName is { Length: > 0 })
Microsoft.Extensions.Hosting.Systemd (1)
SystemdNotifier.cs (1)
71socketPath = string.Create(socketPath.Length, socketPath, (buffer, state) =>
Microsoft.Extensions.Http (4)
src\runtime\src\libraries\Common\src\Extensions\TypeNameHelper\TypeNameHelper.cs (2)
102builder.Replace(DefaultNestedTypeDelimiter, options.NestedTypeDelimiter, builder.Length - name.Length, name.Length);
src\runtime\src\libraries\Common\src\System\Net\Http\UriRedactionHelper.cs (2)
41if (queryIndex >= 0 && queryIndex < (pathAndQuery.Length - 1)) 76queryIndex < pathAndQuery.Length - 1; // Query is not empty.
Microsoft.Extensions.Http.Diagnostics (8)
Generated\Basic.CompilerLog.Util\Basic.CompilerLog.Util.Impl.BasicGeneratedFilesAnalyzerReference\Validators.g.cs (1)
199if (value is null or string { Length: 0 })
Http\HttpDependencyMetadataResolver.cs (7)
126else if (routeSpan.Length != route.Length) 138for (int i = 0; i < route.Length; i++) 155if (ch == AsteriskChar && i < route.Length - 1) 162for (int j = 0; j < httpMethod.Length; j++) 307for (int i = hostNameSuffix.Length - 1; i >= 0; i--) 329for (int i = host.Length - 1; i >= 0; i--) 435for (int j = 0; j < httpMethod.Length; j++)
Microsoft.Extensions.Http.Diagnostics.Tests (3)
Logging\AcceptanceTests.cs (2)
692var length = Math.Min(limit, responseString.Length); 696responseString.Length.Should().Be(LengthOfContentInTextFile);
Logging\Internal\RandomStringGenerator.cs (1)
20.Select(s => s[_random.Next(s.Length)]).ToArray());
Microsoft.Extensions.Http.Resilience (2)
Generated\Basic.CompilerLog.Util\Basic.CompilerLog.Util.Impl.BasicGeneratedFilesAnalyzerReference\Validators.g.cs (1)
866if (value is null or string { Length: 0 })
parent\parent\parent\eng\MSBuild\parent\parent\src\Shared\Data.Validation\LengthAttribute.cs (1)
116count = s.Length;
Microsoft.Extensions.Http.Resilience.Tests (8)
Greet.cs (8)
126if (Name.Length != 0) hash ^= Name.GetHashCode(); 159if (Name.Length != 0) { 173if (Name.Length != 0) { 188if (other.Name.Length != 0) { 319if (Message.Length != 0) hash ^= Message.GetHashCode(); 352if (Message.Length != 0) { 366if (Message.Length != 0) { 381if (other.Message.Length != 0) {
Microsoft.Extensions.Identity.Core (3)
DefaultPersonalDataProtector.cs (1)
38if (split == -1 || split == data.Length - 1)
PasswordValidator.cs (1)
46if (string.IsNullOrWhiteSpace(password) || password.Length < options.RequiredLength)
UserManagerMetrics.cs (1)
222if (!result.Succeeded && result.Errors.FirstOrDefault()?.Code is { Length: > 0 } code)
Microsoft.Extensions.Identity.Stores (1)
UserStoreBase.cs (1)
921if (mergedCodes.Length > 0)
Microsoft.Extensions.Localization (1)
ResourceManagerStringLocalizerFactory.cs (1)
241return name.Substring(prefix.Length);
Microsoft.Extensions.Logging (2)
LoggerRuleSelector.cs (2)
103if (current.CategoryName.Length > rule.CategoryName.Length)
Microsoft.Extensions.Logging.Abstractions (8)
LogValuesFormatter.cs (1)
38int endIndex = format.Length;
src\runtime\src\libraries\Common\src\Extensions\TypeNameHelper\TypeNameHelper.cs (2)
102builder.Replace(DefaultNestedTypeDelimiter, options.NestedTypeDelimiter, builder.Length - name.Length, name.Length);
src\runtime\src\libraries\Common\src\System\Text\ValueStringBuilder.cs (5)
125int count = s.Length; 167if (s.Length == 1 && (uint)pos < (uint)_chars.Length) // very common case, e.g. appending strings from NumberFormatInfo like separators, percent symbols, etc. 181if (pos > _chars.Length - s.Length) 183Grow(s.Length); 191_pos += s.Length;
Microsoft.Extensions.Logging.AzureAppServices (1)
BlobAppendReferenceWrapper.cs (1)
90if (uriBuilder.Query != null && uriBuilder.Query.Length > 1)
Microsoft.Extensions.Logging.Console (9)
AnsiParser.cs (2)
109if (i < message.Length - 1) 115length = message.Length - startIndex;
SimpleConsoleFormatter.cs (2)
16private static readonly string _messagePadding = new string(' ', GetLogLevelString(LogLevel.Information).Length + LoglevelPadding.Length);
src\runtime\src\libraries\Common\src\System\Text\ValueStringBuilder.cs (5)
125int count = s.Length; 167if (s.Length == 1 && (uint)pos < (uint)_chars.Length) // very common case, e.g. appending strings from NumberFormatInfo like separators, percent symbols, etc. 181if (pos > _chars.Length - s.Length) 183Grow(s.Length); 191_pos += s.Length;
Microsoft.Extensions.Logging.EventLog (4)
EventLogLogger.cs (4)
44_beginOrEndMessageSegmentSize = EventLog.MaxMessageSize - ContinuationString.Length; 48_intermediateMessageSegmentSize = EventLog.MaxMessageSize - 2 * ContinuationString.Length; 128if (message.Length <= EventLog.MaxMessageSize) 153if ((message.Length - (startIndex + 1)) <= _beginOrEndMessageSegmentSize)
Microsoft.Extensions.Logging.EventSource (5)
LoggingEventSource.cs (5)
456if (loggerName.Length == 0) 461if (loggerName[loggerName.Length - 1] == '*') 463loggerName = loggerName.Substring(0, loggerName.Length - 1); 491if (levelString.Length == 0) 585eventData.Size = checked((str.Length + 1) * sizeof(char)); // size is specified in bytes, including null wide char
Microsoft.Extensions.Logging.Generators (6)
LoggerMessageGenerator.Emitter.cs (3)
134nestedIndentation = new string(' ', nestedIndentation.Length - 4); 185string formatMethodEnd = formatMethodBegin.Length > 0 ? ")" : ""; 600var sb = new StringBuilder(text.Length + 20);
LoggerMessageGenerator.Parser.cs (1)
844int endIndex = message.Length;
src\runtime\src\libraries\Common\src\Roslyn\GetBestTypeByMetadataName.cs (2)
157return name.Length > AttributeSuffix.Length && name.EndsWith(AttributeSuffix, comparison);
Microsoft.Extensions.Options (1)
ValidateOptionsResultBuilder.cs (1)
47Errors.Add(joinedMembers.Length != 0
Microsoft.Extensions.Options.SourceGeneration (8)
Emitter.cs (2)
104if (vt.Namespace.Length > 0) 155if (vt.Namespace.Length > 0)
Parser.cs (4)
826return "global::" + (reusable.Namespace.Length > 0 ? reusable.Namespace + "." + reusable.Name : reusable.Name); 865return "global::" + (result.Namespace.Length > 0 ? result.Namespace + "." + result.Name : result.Name); 1043var sb = new StringBuilder(s.Length); 1046while (index < s.Length)
src\runtime\src\libraries\Common\src\Roslyn\GetBestTypeByMetadataName.cs (2)
157return name.Length > AttributeSuffix.Length && name.EndsWith(AttributeSuffix, comparison);
Microsoft.Extensions.Primitives (9)
InplaceStringBuilder.cs (2)
62Append(value, 0, value.Length); 88ArgumentOutOfRangeException.ThrowIfGreaterThan(count, value.Length - offset, nameof(offset));
StringSegment.cs (3)
32Length = buffer?.Length ?? 0; 54if (buffer == null || (uint)offset > (uint)buffer.Length || (uint)length > (uint)(buffer.Length - offset))
StringValues.cs (4)
211if (value != null && value.Length > 0) 219length += value.Length; 230if (value != null && value.Length > 0) 240offset += value.Length;
Microsoft.Extensions.ServiceDiscovery (1)
Http\ResolvingHttpDelegatingHandler.cs (1)
78if (ep.AbsolutePath.Length > 1)
Microsoft.Extensions.ServiceDiscovery.Dns (4)
FallbackDnsResolver.cs (1)
97{ Length: > 0 } => $"No DNS SRV records were found for DNS name '{dnsName}': {errorMessage}.",
Resolver\DnsPrimitives.cs (1)
97if (name.Length > MaxDomainNameLength ||
Resolver\DnsResolver.cs (2)
970(name.Length == reservedName.Length || name[name.Length - reservedName.Length - 1] == '.'))
Microsoft.Extensions.ServiceDiscovery.Dns.Tests (5)
Resolver\DnsPrimitivesTests.cs (2)
27Assert.Equal(name.Length + 2, written); 45for (int i = 0; i < name.Length + 2; i++)
XunitLoggerFactoryExtensions.cs (3)
96var additionalLinePrefix = "|" + new string(' ', firstLinePrefix.Length - 1); 116message = message.Substring(0, message.Length - Environment.NewLine.Length);
Microsoft.Extensions.ServiceDiscovery.Yarp (1)
ServiceDiscoveryDestinationResolver.cs (1)
63var healthUri = originalConfig.Health is { Length: > 0 } health ? new Uri(health) : null;
Microsoft.Extensions.Telemetry (23)
Generated\Basic.CompilerLog.Util\Basic.CompilerLog.Util.Impl.BasicGeneratedFilesAnalyzerReference\Validators.g.cs (1)
207if (value is null or string { Length: 0 })
Http\HttpRouteFormatter.cs (1)
66var parameterTemplateLength = parameterContent.Length + 2;
Http\HttpRouteParser.cs (4)
70var parameterTemplateLength = parameterContent.Length + 2; 99var len = httpRoute.Length; 212bool isLastPosition = pos == httpRoute.Length - 1; 213bool isSecondToLastPosition = pos == httpRoute.Length - 2;
Latency\Internal\LatencyConsoleExporter.cs (5)
64nameColumnWidth = Math.Max(nameColumnWidth, latencyData.Checkpoints[i].Name.Length); 80nameColumnWidth = Math.Max(nameColumnWidth, latencyData.Tags[i].Name.Length); 96nameColumnWidth = Math.Max(nameColumnWidth, latencyData.Measures[i].Name.Length); 131nameColumnWidth = Math.Max(nameColumnWidth, nameHeader.Length); 138_ = sb.AppendLine(_dashes(valueHeader.Length + 1));
Logging\Import\LoggerRuleSelector.cs (2)
107if (current.CategoryName.Length > rule.CategoryName.Length)
Logging\JustInTimeRedactor.cs (6)
52if (_discriminator.Length == 0) 63if (_discriminator.Length == 0) 128int maxLenToRedact = inputAsSpan.Length + DiscriminatorSeparator.Length + _discriminator.Length + MaxDayOfYearLength; 142charsInWorkBuffer += DiscriminatorSeparator.Length; 145charsInWorkBuffer += _discriminator.Length;
parent\parent\parent\eng\MSBuild\parent\parent\src\Shared\Data.Validation\LengthAttribute.cs (1)
116count = s.Length;
parent\parent\parent\eng\MSBuild\parent\parent\src\Shared\LogBuffering\SerializedLogRecordFactory.cs (1)
80int charSize = str.Length * sizeof(char);
Sampling\LogSamplingRuleSelector.cs (2)
73if (current.CategoryName.Length > rule.CategoryName.Length)
Microsoft.Extensions.Telemetry.Abstractions (2)
Logging\LoggerMessageState.TagCollector.cs (2)
15string fullName = TagNamePrefix.Length > 0 ? TagNamePrefix + Separator + tagName : tagName; 22string fullName = TagNamePrefix.Length > 0 ? TagNamePrefix + Separator + tagName : tagName;
Microsoft.Extensions.Telemetry.Tests (2)
Logging\JustInTimeRedactorTests.cs (2)
124if (s.Length > destination.Length) 131charsWritten = s.Length;
Microsoft.Extensions.Validation.ValidationsGenerator (1)
Emitters\ValidationsGenerator.InfoClasses.Emitter.cs (1)
55if (line.Length == 0)
Microsoft.Extensions.WebEncoders (3)
Testing\HtmlTestEncoder.cs (1)
27if (value.Length == 0)
Testing\JavaScriptTestEncoder.cs (1)
27if (value.Length == 0)
Testing\UrlTestEncoder.cs (1)
27if (value.Length == 0)
Microsoft.Gen.BuildMetadata (4)
GeneratorUtilities.cs (2)
59_ = shortAttributeNames.Add(n.Substring(index, n.Length - index - "Attribute".Length));
RoslynExtensions.cs (2)
178return name.Length > AttributeSuffix.Length && name.EndsWith(AttributeSuffix, comparison);
Microsoft.Gen.BuildMetadata.Unit.Tests (1)
RoslynTestUtils.cs (1)
123start += seq.Length;
Microsoft.Gen.ComplianceReports (5)
GeneratorUtilities.cs (2)
59_ = shortAttributeNames.Add(n.Substring(index, n.Length - index - "Attribute".Length));
Parser.cs (3)
97result = result.Substring("global::".Length); 260name = name.Substring(0, name.Length - "Attribute".Length);
Microsoft.Gen.ComplianceReports.Unit.Tests (1)
RoslynTestUtils.cs (1)
123start += seq.Length;
Microsoft.Gen.ContextualOptions (2)
GeneratorUtilities.cs (2)
59_ = shortAttributeNames.Add(n.Substring(index, n.Length - index - "Attribute".Length));
Microsoft.Gen.ContextualOptions.Unit.Tests (1)
RoslynTestUtils.cs (1)
123start += seq.Length;
Microsoft.Gen.Logging (10)
Emitter.cs (1)
119? classificationAttr.Substring(GlobalNamespacePrefix.Length)
Emitter.Utils.cs (2)
28var sb = new StringBuilder(s.Length + 1); // we use +1 because we will add at least one symbol 31while (index < s.Length)
GeneratorUtilities.cs (2)
59_ = shortAttributeNames.Add(n.Substring(index, n.Length - index - "Attribute".Length));
RoslynExtensions.cs (2)
178return name.Length > AttributeSuffix.Length && name.EndsWith(AttributeSuffix, comparison);
TemplateProcessor.cs (3)
29var endIndex = message!.Length; 88var endIndex = message!.Length; 124_ = sb.Append(message, scanIndex, message.Length - scanIndex);
Microsoft.Gen.Logging.Generated.Tests (16)
LogPropertiesRedactionTests.cs (14)
36["p1.StringPropertyBase"] = new('-', classToRedact.StringPropertyBase.Length), 62["p1.StringPropertyBase"] = new('-', classToRedact.StringPropertyBase.Length), 84["classToLog.StringProperty"] = new('+', classToRedact.StringProperty.Length), 85["classToLog.StringPropertyBase"] = new('-', classToRedact.StringPropertyBase.Length), 87["classToLog.GetOnlyProperty"] = new('-', classToRedact.GetOnlyProperty.Length), 89["classToLog.TransitiveProp.TransitiveStringProp"] = new('-', classToRedact.TransitiveProp.TransitiveStringProp.Length), 91["classToLog.NonFormattableProperty"] = new('-', classToRedact.NonFormattableProperty.ToString().Length), 115["classToLog.StringProperty"] = new('+', classToRedact.StringProperty.Length), 116["classToLog.StringPropertyBase"] = new('-', classToRedact.StringPropertyBase.Length), 118["classToLog.GetOnlyProperty"] = new('-', classToRedact.GetOnlyProperty.Length), 120["classToLog.TransitiveProp.TransitiveStringProp"] = new('-', classToRedact.TransitiveProp.TransitiveStringProp.Length), 122["classToLog.NonFormattableProperty"] = new('-', classToRedact.NonFormattableProperty.ToString().Length), 146["complexParam.TransitiveStringProp"] = new('-', classToRedact.TransitiveStringProp.Length), 172["complexParam.TransitiveStringProp"] = new('-', classToRedact.TransitiveStringProp.Length),
SimpleRedactors.cs (2)
23return source!.ToString()!.Length; 28var len = source!.ToString()!.Length;
Microsoft.Gen.Logging.Unit.Tests (2)
RoslynTestUtils.cs (1)
123start += seq.Length;
TemplatesExtractorTests.cs (1)
20var result = TemplateProcessor.FindIndexOfAny(message, new[] { '\n', 'a', 'b', 'z' }, 0, message.Length);
Microsoft.Gen.MetadataExtractor (5)
GeneratorUtilities.cs (2)
59_ = shortAttributeNames.Add(n.Substring(index, n.Length - index - "Attribute".Length));
Parser.cs (3)
97result = result.Substring("global::".Length); 260name = name.Substring(0, name.Length - "Attribute".Length);
Microsoft.Gen.MetadataExtractor.Unit.Tests (1)
RoslynTestUtils.cs (1)
123start += seq.Length;
Microsoft.Gen.Metrics (5)
GeneratorUtilities.cs (2)
59_ = shortAttributeNames.Add(n.Substring(index, n.Length - index - "Attribute".Length));
MetricFactoryEmitter.cs (1)
47if (str.Length == 1)
RoslynExtensions.cs (2)
178return name.Length > AttributeSuffix.Length && name.EndsWith(AttributeSuffix, comparison);
Microsoft.Gen.Metrics.Unit.Tests (1)
RoslynTestUtils.cs (1)
123start += seq.Length;
Microsoft.Gen.MetricsReports (2)
GeneratorUtilities.cs (2)
59_ = shortAttributeNames.Add(n.Substring(index, n.Length - index - "Attribute".Length));
Microsoft.Gen.MetricsReports.Unit.Tests (1)
RoslynTestUtils.cs (1)
123start += seq.Length;
Microsoft.Interop.ComInterfaceGenerator (5)
IncrementalMethodStubGenerationContext.cs (1)
81return accessorName.Substring(GetterPrefix.Length);
src\runtime\src\libraries\Common\src\Roslyn\GetBestTypeByMetadataName.cs (2)
157return name.Length > AttributeSuffix.Length && name.EndsWith(AttributeSuffix, comparison);
src\runtime\src\libraries\System.Runtime.InteropServices\gen\Common\ConvertToSourceGeneratedInteropFixer.cs (1)
66if (optionKeyAndValue.Length != 2 || optionKeyAndValue[1].Length < 3)
VirtualMethodPointerStubGenerator.cs (1)
375callingConventions.Add(FunctionPointerUnmanagedCallingConvention(Identifier(callConvSymbol.Name.Substring("CallConv".Length))));
Microsoft.Interop.JavaScript.JSImportGenerator (3)
JSMarshalAsAttributeInfoParser.cs (3)
30string name = gt.Substring(gt.IndexOf("JSType") + "JSType.".Length); 37string argName = ta.Substring(ta.IndexOf("JSType") + "JSType.".Length); 46string name = st.Substring(st.IndexOf("JSType") + "JSType.".Length);
Microsoft.Interop.LibraryImportGenerator (3)
src\runtime\src\libraries\Common\src\Roslyn\GetBestTypeByMetadataName.cs (2)
157return name.Length > AttributeSuffix.Length && name.EndsWith(AttributeSuffix, comparison);
src\runtime\src\libraries\System.Runtime.InteropServices\gen\Common\ConvertToSourceGeneratedInteropFixer.cs (1)
66if (optionKeyAndValue.Length != 2 || optionKeyAndValue[1].Length < 3)
Microsoft.Interop.LibraryImportGenerator.Downlevel (2)
src\runtime\src\libraries\Common\src\Roslyn\GetBestTypeByMetadataName.cs (2)
157return name.Length > AttributeSuffix.Length && name.EndsWith(AttributeSuffix, comparison);
Microsoft.Interop.SourceGeneration (2)
src\runtime\src\libraries\Common\src\Roslyn\GetBestTypeByMetadataName.cs (2)
157return name.Length > AttributeSuffix.Length && name.EndsWith(AttributeSuffix, comparison);
Microsoft.Maui (9)
Converters\FlexEnumsConverters.cs (1)
283 strValue.AsSpan(0, strValue.Length - 1);
Core\Extensions\ITextInputExtensions.cs (1)
18 if (maxLength >= 0 && platformText.Length > maxLength)
Fonts\FontFile.cs (5)
84 fontFamilyName = fontFamilyName.Substring(0, fontFamilyName.Length - foundExtension.Length); 142 else if (multipleCaps && currentString.Length > 1) 144 var last = currentString[currentString.Length - 1]; 145 yield return currentString.Substring(0, currentString.Length - 1);
Handlers\HybridWebView\HybridWebViewQueryStringHelper.cs (1)
36 if (query != null && query.Length > 1)
StringExtensions.cs (1)
7 maxLength >= 0 && currentText?.Length > maxLength
Microsoft.Maui.Controls (22)
BindingExpression.cs (3)
220 if (p.Length == 1) 238 int rbIndex = part.Length - 1; 252 if (part.Length > 0)
GridLengthTypeConverter.cs (1)
30 if (strValue.EndsWith("*", StringComparison.Ordinal) && double.TryParse(strValue.Substring(0, strValue.Length - 1), NumberStyles.Number, CultureInfo.InvariantCulture, out var length))
Internals\ImageParser.cs (2)
473 if (blockSize >= NetscapeApplicationExtensionID.Length) 476 string identifier = global::System.Text.Encoding.UTF8.GetString(buffer, 0, NetscapeApplicationExtensionID.Length);
Internals\TextTransformUtilites.cs (1)
55 if ((string.IsNullOrEmpty(formsText) && platformText.Length == 0))
Items\ItemsLayoutTypeConverter.cs (4)
33 identifierLength = "VerticalGrid".Length; 38 identifierLength = "HorizontalGrid".Length; 43 if (strValue.Length == identifierLength) 45 else if (strValue.Length > identifierLength + 1 && strValue[identifierLength] == ',')
Shapes\PathFigureCollectionConverter.cs (5)
50 while ((curIndex < pathString.Length) && char.IsWhiteSpace(pathString, curIndex)) 55 if (curIndex < pathString.Length) 61 while ((curIndex < pathString.Length) && char.IsWhiteSpace(pathString, curIndex)) 68 if ((curIndex == pathString.Length) || 88 pathLength = pathString.Length;
Shell\ShellRouteParameters.cs (1)
49 var key = q.Key.Substring(prefix.Length);
Visuals\VisualTypeConverter.cs (2)
127 name = name.Substring(0, name.Length - 6); 128 fullName = fullName.Substring(0, fullName.Length - 6);
WebView\WebView.cs (3)
315 uniqueMatches.Sort((x, y) => y.Length.CompareTo(x.Length)); 321 var numberOfBackslashes = match.Length - 1;
Microsoft.Maui.Controls.Build.Tasks (10)
BindablePropertyReferenceExtensions.cs (2)
16 var bpName = bpRef.Name.Substring(0, bpRef.Name.Length - 8); 36 var bpName = bpRef.Name.EndsWith("Property", StringComparison.Ordinal) ? bpRef.Name.Substring(0, bpRef.Name.Length - 8) : bpRef.Name;
CompiledConverters\FlexBasisTypeConverter.cs (1)
28 && float.TryParse(value.Substring(0, value.Length - 1), NumberStyles.Number, CultureInfo.InvariantCulture, out float relflex))
CompiledConverters\GridLengthTypeConverter.cs (1)
32 if (value.EndsWith("*", StringComparison.OrdinalIgnoreCase) && double.TryParse(value.Substring(0, value.Length - 1), NumberStyles.Number, CultureInfo.InvariantCulture, out var length))
ExpandMarkupsVisitor.cs (2)
89 if (expression[expression.Length - 1] != '}') 95 if (expression.Length == 0)
SetPropertiesVisitor.cs (2)
700 if (indexArg.Length == 0) 707 if (p.Length > 0)
TypeReferenceExtensions.cs (2)
29 var xname = x.FullName.EndsWith("&", StringComparison.InvariantCulture) ? x.FullName.Substring(0, x.FullName.Length - 1) : x.FullName; 30 var yname = y.FullName.EndsWith("&", StringComparison.InvariantCulture) ? y.FullName.Substring(0, y.FullName.Length - 1) : y.FullName;
Microsoft.Maui.Controls.DesignTools (3)
ColorDesignTypeConverter.cs (1)
214 if (funcValues.Count == funcName.Length)
FlexEnumDesignTypeConverters.cs (1)
115 if (strValue.EndsWith("%", StringComparison.OrdinalIgnoreCase) && float.TryParse(strValue.Substring(0, strValue.Length - 1), NumberStyles.Number, CultureInfo.InvariantCulture, out float relflex))
GridLengthDesignTypeConverter.cs (1)
29 if (value.EndsWith("*", StringComparison.Ordinal) && double.TryParse(value.Substring(0, value.Length - 1), NumberStyles.Number, CultureInfo.InvariantCulture, out var len))
Microsoft.Maui.Controls.SourceGen (6)
src\Controls\src\Xaml\TypeArgumentsParser.cs (1)
40 for (pos = 0; pos < match.Length; pos++)
src\Controls\src\Xaml\XmlnsHelper.cs (5)
42 ns = decl.Substring(14, decl.Length - 14); 47 asm = decl.Substring(9, decl.Length - 9); 52 targetPlatform = decl.Substring(15, decl.Length - 15); 59 typeName = decl.Substring(nsind + 1, decl.Length - nsind - 1); 74 ns = decl.Substring(6, decl.Length - 6);
Microsoft.Maui.Controls.Xaml (27)
ExpandMarkupsVisitor.cs (2)
83 if (expression[expression.Length - 1] != '}') 98 if (expression.Length == 0)
MarkupExpressionParser.cs (10)
58 if (expression[expression.Length - 1] != '}') 66 if (expression.Length == 0) 75 if (expression.Length < 2) 91 for (i = 1; i < expression.Length; i++) 107 for (c = 0; c + i < expression.Length; c++) 113 if (i + c == expression.Length) 160 if (remaining.Length <= 0) 181 while (end < remaining.Length && 210 if (end == remaining.Length) 217 if (inString && end == remaining.Length)
TypeArgumentsParser.cs (1)
40 for (pos = 0; pos < match.Length; pos++)
XamlLoader.cs (8)
373 while (index >= 0 && index < xaml.Length) 399 index += xClass.Length; 405 while (index < xaml.Length && xaml[index] == ' ') 415 if (index < xaml.Length && xaml[index] != character) 426 if (index >= xaml.Length - fullName.Length) 431 var slice = xaml.AsSpan().Slice(index, fullName.Length); 437 index += fullName.Length;
XamlParser.cs (1)
75 name = new XmlName(reader.NamespaceURI, reader.Name.Substring(elementName.Length + 1));
XmlnsHelper.cs (5)
42 ns = decl.Substring(14, decl.Length - 14); 47 asm = decl.Substring(9, decl.Length - 9); 52 targetPlatform = decl.Substring(15, decl.Length - 15); 59 typeName = decl.Substring(nsind + 1, decl.Length - nsind - 1); 74 ns = decl.Substring(6, decl.Length - 6);
Microsoft.Maui.Essentials (8)
TextToSpeech\TextToSpeech.shared.cs (6)
77 if (text.Length <= max) 89 while (position != text.Length) 93 if (positionend >= text.Length) 96 p = text.Substring(positionbegin, text.Length - positionbegin); 119 Debug.WriteLine($"p.Length = {p.Length}"); 124 positionbegin = positionbegin + p.Length + 1;
Types\DeviceIdiom.shared.cs (1)
47 if (deviceIdiom.Length == 0)
Types\DevicePlatform.shared.cs (1)
70 if (devicePlatform.Length == 0)
Microsoft.Maui.Graphics (17)
Color.cs (1)
172 if (stringValue.Length == 1)
PathBuilder.cs (5)
88 var builder = new StringBuilder(value.Length); 139 if (entry.Length > 1) 144 if (entry.Length > 1) 218 var sb = new StringBuilder(input.Length, maxCapacity: 3 * input.Length);
Text\AttributedTextExtensions.cs (4)
22 var length = text.Length; 47 var length = text.Length; 68 var length = line.Length; 162 var end = text.Text.Length;
Text\TextColors.cs (6)
170 if (color.Length == 7) 177 else if (color.Length == 4) 184 else if (color.Length == 9) 213 if (color.Length == 7) 220 else if (color.Length == 4) 227 else if (color.Length == 9)
Text\XmlAttributedTextReader.cs (1)
64 var textLength = text.Length;
Microsoft.Maui.Graphics.Skia (1)
SkiaTextLayout.cs (1)
218 var length = _value.Length;
Microsoft.Maui.Graphics.Text.Markdig (1)
Renderer\AttributedTextRenderer.cs (1)
39 _runs.Optimize(value.Length);
Microsoft.Maui.Resizetizer (1)
GetMauiAssetPath.cs (1)
88 path = path.Substring(projectDirectory.Length);
Microsoft.ML.AutoML (11)
ColumnInference\ColumnTypeInference.cs (1)
214if (v.Length > 100)
Utils\StringEditDistance.cs (10)
23if (first.Length == 0 || second.Length == 0) 25return first.Length + second.Length; 30var rows = new int[second.Length + 1, second.Length + 1]; 32for (var j = 0; j <= second.Length; ++j) 37for (var i = 1; i <= first.Length; ++i) 40for (var j = 1; j <= second.Length; ++j) 61return rows[currentRow, second.Length];
Microsoft.ML.AutoML.SourceGenerator (31)
Template\EstimatorType.cs (6)
174if ((this.currentIndentField.Length == 0)) 185this.GenerationEnvironment.Append(textToAppend, 0, (textToAppend.Length - this.currentIndentField.Length)); 244this.indentLengths.Add(indent.Length); 258returnValue = this.currentIndentField.Substring((this.currentIndentField.Length - indentLength)); 259this.currentIndentField = this.currentIndentField.Remove((this.currentIndentField.Length - indentLength));
Template\SearchSpace.cs (6)
191if ((this.currentIndentField.Length == 0)) 202this.GenerationEnvironment.Append(textToAppend, 0, (textToAppend.Length - this.currentIndentField.Length)); 261this.indentLengths.Add(indent.Length); 275returnValue = this.currentIndentField.Substring((this.currentIndentField.Length - indentLength)); 276this.currentIndentField = this.currentIndentField.Remove((this.currentIndentField.Length - indentLength));
Template\SweepableEstimator_T_.cs (6)
198if ((this.currentIndentField.Length == 0)) 209this.GenerationEnvironment.Append(textToAppend, 0, (textToAppend.Length - this.currentIndentField.Length)); 268this.indentLengths.Add(indent.Length); 282returnValue = this.currentIndentField.Substring((this.currentIndentField.Length - indentLength)); 283this.currentIndentField = this.currentIndentField.Remove((this.currentIndentField.Length - indentLength));
Template\SweepableEstimator.cs (6)
193if ((this.currentIndentField.Length == 0)) 204this.GenerationEnvironment.Append(textToAppend, 0, (textToAppend.Length - this.currentIndentField.Length)); 263this.indentLengths.Add(indent.Length); 277returnValue = this.currentIndentField.Substring((this.currentIndentField.Length - indentLength)); 278this.currentIndentField = this.currentIndentField.Remove((this.currentIndentField.Length - indentLength));
Template\SweepableEstimatorFactory.cs (6)
169if ((this.currentIndentField.Length == 0)) 180this.GenerationEnvironment.Append(textToAppend, 0, (textToAppend.Length - this.currentIndentField.Length)); 239this.indentLengths.Add(indent.Length); 253returnValue = this.currentIndentField.Substring((this.currentIndentField.Length - indentLength)); 254this.currentIndentField = this.currentIndentField.Remove((this.currentIndentField.Length - indentLength));
Utils.cs (1)
51if (str.Length > 1)
Microsoft.ML.CodeGenerator (60)
Templates\Azure\Console\AzureModelBuilder.cs (6)
268if ((this.currentIndentField.Length == 0)) 279this.GenerationEnvironment.Append(textToAppend, 0, (textToAppend.Length - this.currentIndentField.Length)); 338this.indentLengths.Add(indent.Length); 352returnValue = this.currentIndentField.Substring((this.currentIndentField.Length - indentLength)); 353this.currentIndentField = this.currentIndentField.Remove((this.currentIndentField.Length - indentLength));
Templates\Azure\Model\AzureImageModelOutputClass.cs (6)
209if ((this.currentIndentField.Length == 0)) 220this.GenerationEnvironment.Append(textToAppend, 0, (textToAppend.Length - this.currentIndentField.Length)); 279this.indentLengths.Add(indent.Length); 293returnValue = this.currentIndentField.Substring((this.currentIndentField.Length - indentLength)); 294this.currentIndentField = this.currentIndentField.Remove((this.currentIndentField.Length - indentLength));
Templates\Azure\Model\AzureObjectDetectionModelOutputClass.cs (6)
209if ((this.currentIndentField.Length == 0)) 220this.GenerationEnvironment.Append(textToAppend, 0, (textToAppend.Length - this.currentIndentField.Length)); 279this.indentLengths.Add(indent.Length); 293returnValue = this.currentIndentField.Substring((this.currentIndentField.Length - indentLength)); 294this.currentIndentField = this.currentIndentField.Remove((this.currentIndentField.Length - indentLength));
Templates\Console\ConsumeModel.cs (6)
220if ((this.currentIndentField.Length == 0)) 231this.GenerationEnvironment.Append(textToAppend, 0, (textToAppend.Length - this.currentIndentField.Length)); 290this.indentLengths.Add(indent.Length); 304returnValue = this.currentIndentField.Substring((this.currentIndentField.Length - indentLength)); 305this.currentIndentField = this.currentIndentField.Remove((this.currentIndentField.Length - indentLength));
Templates\Console\ModelBuilder.cs (6)
585if ((this.currentIndentField.Length == 0)) 596this.GenerationEnvironment.Append(textToAppend, 0, (textToAppend.Length - this.currentIndentField.Length)); 655this.indentLengths.Add(indent.Length); 669returnValue = this.currentIndentField.Substring((this.currentIndentField.Length - indentLength)); 670this.currentIndentField = this.currentIndentField.Remove((this.currentIndentField.Length - indentLength));
Templates\Console\ModelInputClass.cs (6)
183if ((this.currentIndentField.Length == 0)) 194this.GenerationEnvironment.Append(textToAppend, 0, (textToAppend.Length - this.currentIndentField.Length)); 253this.indentLengths.Add(indent.Length); 267returnValue = this.currentIndentField.Substring((this.currentIndentField.Length - indentLength)); 268this.currentIndentField = this.currentIndentField.Remove((this.currentIndentField.Length - indentLength));
Templates\Console\ModelOutputClass.cs (6)
226if ((this.currentIndentField.Length == 0)) 237this.GenerationEnvironment.Append(textToAppend, 0, (textToAppend.Length - this.currentIndentField.Length)); 296this.indentLengths.Add(indent.Length); 310returnValue = this.currentIndentField.Substring((this.currentIndentField.Length - indentLength)); 311this.currentIndentField = this.currentIndentField.Remove((this.currentIndentField.Length - indentLength));
Templates\Console\ModelProject.cs (6)
215if ((this.currentIndentField.Length == 0)) 226this.GenerationEnvironment.Append(textToAppend, 0, (textToAppend.Length - this.currentIndentField.Length)); 285this.indentLengths.Add(indent.Length); 299returnValue = this.currentIndentField.Substring((this.currentIndentField.Length - indentLength)); 300this.currentIndentField = this.currentIndentField.Remove((this.currentIndentField.Length - indentLength));
Templates\Console\PredictProgram.cs (6)
242if ((this.currentIndentField.Length == 0)) 253this.GenerationEnvironment.Append(textToAppend, 0, (textToAppend.Length - this.currentIndentField.Length)); 312this.indentLengths.Add(indent.Length); 326returnValue = this.currentIndentField.Substring((this.currentIndentField.Length - indentLength)); 327this.currentIndentField = this.currentIndentField.Remove((this.currentIndentField.Length - indentLength));
Templates\Console\PredictProject.cs (6)
220if ((this.currentIndentField.Length == 0)) 231this.GenerationEnvironment.Append(textToAppend, 0, (textToAppend.Length - this.currentIndentField.Length)); 290this.indentLengths.Add(indent.Length); 304returnValue = this.currentIndentField.Substring((this.currentIndentField.Length - indentLength)); 305this.currentIndentField = this.currentIndentField.Remove((this.currentIndentField.Length - indentLength));
Microsoft.ML.Core (51)
CommandLine\CmdLexer.cs (6)
446if (!lex.Error && curs.Eof && sb.Length == ichDst + str.Length) 451if (ichSrc >= str.Length) 474if (lex.Error || !curs.Eof || res.Length != str.Length || res.ToString() != str) 487while (_ich < _str.Length) 521while (_ich < _str.Length && _str[_ich] == '\\') 525if (_ich >= _str.Length)
CommandLine\CmdParser.cs (22)
321if (inner.Length > 0) 447if (name.Length == 1) 453for (firstNonUpper = 0; firstNonUpper < name.Length && char.IsUpper(name[firstNonUpper]); ++firstNonUpper) 455Contracts.Assert(1 < firstNonUpper && firstNonUpper <= name.Length); 456if (firstNonUpper == name.Length) 604if (option.Length > 1 || str.Length <= 1 || str[1] != ':') 655if (IsCurlyGroup(value) && value.Length == 2) 717else if (ichLim > 0 && ichLim == str.Length - 1) 734if (close == option.Length - 1) 866maxParamLen = Math.Max(maxParamLen, helpString.Syntax.Length); 886int syntaxLength = helpStrings.Syntax.Length; 900while (index < helpStrings.Help.Length) 908if (endIndex >= helpStrings.Help.Length) 911endIndex = helpStrings.Help.Length; 931while (index < helpStrings.Help.Length && helpStrings.Help[index] == ' ') 936if (helpStrings.Help.Length == 0) 1043if (lex.Error || token.Length < 2 || token[0] != '@') 1165if (ich == 0 || str[str.Length - 1] != '}') 1683bool hasTag = tag != null && tag.Length > 2; 1685tag = hasTag ? tag.Substring(1, tag.Length - 2) : ""; 2141switch (HelpText[HelpText.Length - 1])
ComponentModel\ComponentCatalog.cs (3)
764if (kind.Length > "Signature".Length && kind.StartsWith("Signature")) 765kind = kind.Substring("Signature".Length);
Data\ModelHeader.cs (6)
180header.CbAssemblyName = (uint)loaderAssemblyName.Length * sizeof(char); 262Contracts.Check(sig.Length <= 24); 263for (int ich = 0; ich < sig.Length; ich++) 288Contracts.Check(sig.Length <= 24); 289for (int ich = 0; ich < sig.Length; ich++) 645for (int ich = 0; ich < modelSignature.Length; ich++)
Data\ModelLoadContext.cs (1)
166_ectx.CheckDecode(str.Length > 0);
Data\ReadOnlyMemoryUtils.cs (1)
28if (s.Length != memory.Length)
Data\Repository.cs (3)
258int ichSplit = root.Length; 259_ectx.Check(entityPath.Length > ichSplit && entityPath[ichSplit] == Path.DirectorySeparatorChar); 261if (createDir && DirTemp != null && parent.Length > ichSplit)
Environment\HostEnvironmentBase.cs (3)
546while (ichLim < message.Length && message[ichLim] != '\r' && message[ichLim] != '\n') 549if (ichLim == message.Length) 560if (ichMin < message.Length && message[ichLim] == '\r' && message[ichMin] == '\n')
Utilities\NormStr.cs (1)
106if ((int)Utils.GetLo(meta) == str.Length)
Utilities\TextReaderStream.cs (4)
125Contracts.Assert(_lineCur <= _line.Length); 127if (_lineCur == _line.Length) 140int charCount = Math.Min(_line.Length - _lineCur, _charBlockSize); 145Contracts.Assert(_lineCur <= _line.Length);
Utilities\Utils.cs (1)
51return x == null ? 0 : x.Length;
Microsoft.ML.Data (38)
DataLoadSave\Binary\Codecs.cs (1)
373Contracts.CheckDecode(_text.Length == (_boundaries[_entries] & LengthMask));
DataLoadSave\Text\TextLoader.cs (2)
178if (str.Length == 0) 1282if (sep.Length != 1 || ch < ' ' || '0' <= ch && ch <= '9' || ch == '"')
DataLoadSave\Text\TextLoaderCursor.cs (7)
257if (text.Length == 0) 263if (text.Length <= 2 || text[1] != '@') 549if (line.Length == 0) 553int ichLim = line.Length; 717if (text.Length > 0 && text[0] != '#' && !text.StartsWith("//")) 754if (text.Length >= 2) 760else if (text.Length == 0)
DataLoadSave\Text\TextSaver.cs (2)
635if (sb.Length != def.Length) 637for (int ich = 0; ich < def.Length; ich++)
Deprecated\Instances\HeaderSchema.cs (1)
261if (name.Length >= 2 && name[0] == 'f' && int.TryParse(name.Substring(1), out index) &&
Dirty\PredictionUtils.cs (2)
112if (sep.Length == 1) 149if (s.Length == 1)
Evaluators\EvaluatorUtils.cs (2)
1610rowDigitLen = Math.Max(confusionMatrix.PredictedClassesIndicators.Count - 1, 0).ToString().Length; 1722if (str.Length > totalLength)
Model\Pfa\ModelUtils.cs (4)
19if (name.Length == 1) 25for (firstNonUpper = 0; firstNonUpper < name.Length && char.IsUpper(name[firstNonUpper]); ++firstNonUpper) 27Contracts.Assert(1 < firstNonUpper && firstNonUpper <= name.Length); 28if (firstNonUpper == name.Length)
Transforms\ColumnBindingsBase.cs (6)
144if (0 < ich && ich < str.Length - 1) 174if (ich == 0 || ich >= str.Length - 1) 184else if (ich == ichMin || ich >= str.Length - 1) 808if (0 < ich && ich < str.Length - 1) 836if (ich == 0 || ich >= str.Length - 1) 853if (ich == ichMin || ich >= str.Length - 1)
Transforms\GenerateNumberTransform.cs (1)
67if (0 < ich && ich < str.Length - 1)
Transforms\SlotsDroppingTransformer.cs (3)
70if (ich <= 0 || ich >= str.Length - 1) 81if (str.Length == 0) 151if (ich == 0 || ich >= str.Length - 1)
Utilities\StreamUtils.cs (4)
75if (currentPattern.Length == 0) 87if (right.Length == 0) 90var pathEmpty = (path == null || path.Length == 0); 128if (path == null || path.Length == 0)
Utilities\TypeParsingUtils.cs (3)
36if (str[str.Length - 1] != ']') 38keyCount = KeyCount.Parse(str.Substring(ich + 1, str.Length - ich - 2)); 116if (str.Length == 0)
Microsoft.ML.EntryPoints (2)
JsonUtils\ExecuteGraphCommand.cs (2)
168string partialPath = path.Substring(0, path.Length - extension.Length);
Microsoft.ML.FastTree (5)
TreeEnsemble\InternalTreeEnsemble.cs (1)
207if (trainingParamsList[i].Length > 0)
Utils\Timer.cs (4)
138if (name.Length > MaxEventNameLen) 139MaxEventNameLen = name.Length; 143if (name.Length > MaxEventNameLen) 144MaxEventNameLen = name.Length;
Microsoft.ML.GenAI.Core (5)
Extension\ModuleExtension.cs (1)
152var childrenDeviceMap = deviceMap.Where(x => x.Key.StartsWith($"{key}.")).ToDictionary(x => x.Key.Substring($"{key}.".Length), x => x.Value);
Pipeline\CausalLMPipeline.cs (1)
286tokenString = duplicateTokenString.Substring(tokenString.Length);
Trainer\CausalLMDataset.cs (3)
41var lengthToKeep = outputPrompt.Length - inputPrompt.Length; 42outputPrompt = outputPrompt.Substring(inputPrompt.Length, lengthToKeep);
Microsoft.ML.GenAI.Mistral (3)
MistralCausalLMAgent.cs (3)
104if (!str.StartsWith("[TOOL_CALLS]".Substring(0, str.Length))) 145var json = content.Substring("[TOOL_CALLS]".Length).Trim(); 164.Select(s => s[random.Next(s.Length)]).ToArray());
Microsoft.ML.ImageAnalytics (1)
ImagePixelExtractor.cs (1)
551for (int i = 0; i < str.Length; i++)
Microsoft.ML.IntegrationTests (1)
IntrospectiveTraining.cs (1)
360slotNameString = slotNameString.Substring(1, slotNameString.Length - 2);
Microsoft.ML.InternalCodeAnalyzer (5)
NameFixProvider.cs (4)
65if (docName.Length - 3 == originalName.Length && docName.EndsWith(".cs", StringComparison.OrdinalIgnoreCase) 140if (sb.Length == prefix.Length) 171if (token.Length == 2 && char.IsUpper(token[0]) && char.IsUpper(token[1]))
Utils.cs (1)
30for (int i = min; i < name.Length; ++i)
Microsoft.ML.LightGbm (2)
WrappedLightGbmBooster.cs (2)
216var param = lines[i].Substring(1, lines[i].Length - 2).Split(':'); 235while (!lines[i].StartsWith("Tree=") && lines[i].Trim().Length != 0)
Microsoft.ML.Maml (4)
HelpCommand.cs (4)
376while (textIdx < text.Length) 378int screenLeft = screenWidth - indent.Length; 379int summaryLeft = text.Length - textIdx; 391spaceIdx = text.IndexOf(' ', startIdx, text.Length - startIdx);
Microsoft.ML.OnnxConverter (100)
OnnxMl.cs (100)
550if (Name.Length != 0) hash ^= Name.GetHashCode(); 551if (RefAttrName.Length != 0) hash ^= RefAttrName.GetHashCode(); 552if (DocString.Length != 0) hash ^= DocString.GetHashCode(); 582if (Name.Length != 0) 617if (DocString.Length != 0) 627if (RefAttrName.Length != 0) 648if (Name.Length != 0) 652if (RefAttrName.Length != 0) 656if (DocString.Length != 0) 708if (other.Name.Length != 0) 712if (other.RefAttrName.Length != 0) 716if (other.DocString.Length != 0) 1031if (Name.Length != 0) hash ^= Name.GetHashCode(); 1033if (DocString.Length != 0) hash ^= DocString.GetHashCode(); 1050if (Name.Length != 0) 1060if (DocString.Length != 0) 1075if (Name.Length != 0) 1083if (DocString.Length != 0) 1101if (other.Name.Length != 0) 1113if (other.DocString.Length != 0) 1351if (Name.Length != 0) hash ^= Name.GetHashCode(); 1352if (OpType.Length != 0) hash ^= OpType.GetHashCode(); 1353if (Domain.Length != 0) hash ^= Domain.GetHashCode(); 1355if (DocString.Length != 0) hash ^= DocString.GetHashCode(); 1374if (Name.Length != 0) 1379if (OpType.Length != 0) 1385if (DocString.Length != 0) 1390if (Domain.Length != 0) 1407if (Name.Length != 0) 1411if (OpType.Length != 0) 1415if (Domain.Length != 0) 1420if (DocString.Length != 0) 1440if (other.Name.Length != 0) 1444if (other.OpType.Length != 0) 1448if (other.Domain.Length != 0) 1453if (other.DocString.Length != 0) 1760if (ProducerName.Length != 0) hash ^= ProducerName.GetHashCode(); 1761if (ProducerVersion.Length != 0) hash ^= ProducerVersion.GetHashCode(); 1762if (Domain.Length != 0) hash ^= Domain.GetHashCode(); 1764if (DocString.Length != 0) hash ^= DocString.GetHashCode(); 1788if (ProducerName.Length != 0) 1793if (ProducerVersion.Length != 0) 1798if (Domain.Length != 0) 1808if (DocString.Length != 0) 1835if (ProducerName.Length != 0) 1839if (ProducerVersion.Length != 0) 1843if (Domain.Length != 0) 1851if (DocString.Length != 0) 1879if (other.ProducerName.Length != 0) 1883if (other.ProducerVersion.Length != 0) 1887if (other.Domain.Length != 0) 1895if (other.DocString.Length != 0) 2074if (Key.Length != 0) hash ^= Key.GetHashCode(); 2075if (Value.Length != 0) hash ^= Value.GetHashCode(); 2092if (Key.Length != 0) 2097if (Value.Length != 0) 2112if (Key.Length != 0) 2116if (Value.Length != 0) 2134if (other.Key.Length != 0) 2138if (other.Value.Length != 0) 2269if (TensorName.Length != 0) hash ^= TensorName.GetHashCode(); 2287if (TensorName.Length != 0) 2303if (TensorName.Length != 0) 2322if (other.TensorName.Length != 0) 2580if (Name.Length != 0) hash ^= Name.GetHashCode(); 2583if (DocString.Length != 0) hash ^= DocString.GetHashCode(); 2605if (Name.Length != 0) 2611if (DocString.Length != 0) 2632if (Name.Length != 0) 2638if (DocString.Length != 0) 2661if (other.Name.Length != 0) 2667if (other.DocString.Length != 0) 3094if (Name.Length != 0) hash ^= Name.GetHashCode(); 3095if (DocString.Length != 0) hash ^= DocString.GetHashCode(); 3132if (Name.Length != 0) 3144if (DocString.Length != 0) 3178if (Name.Length != 0) 3182if (DocString.Length != 0) 3228if (other.Name.Length != 0) 3232if (other.DocString.Length != 0) 4181if (Denotation.Length != 0) hash ^= Denotation.GetHashCode(); 4209if (Denotation.Length != 0) 4232if (Denotation.Length != 0) 4250if (other.Denotation.Length != 0) 4522if (Denotation.Length != 0) hash ^= Denotation.GetHashCode(); 4555if (Denotation.Length != 0) 4600if (Denotation.Length != 0) 4618if (other.Denotation.Length != 0) 5633if (Domain.Length != 0) hash ^= Domain.GetHashCode(); 5634if (Name.Length != 0) hash ^= Name.GetHashCode(); 5651if (Domain.Length != 0) 5656if (Name.Length != 0) 5671if (Domain.Length != 0) 5675if (Name.Length != 0) 5693if (other.Domain.Length != 0) 5697if (other.Name.Length != 0) 5844if (Domain.Length != 0) hash ^= Domain.GetHashCode(); 5862if (Domain.Length != 0) 5882if (Domain.Length != 0) 5904if (other.Domain.Length != 0)
Microsoft.ML.OnnxTransformer (100)
src\Microsoft.ML.OnnxConverter\OnnxMl.cs (100)
550if (Name.Length != 0) hash ^= Name.GetHashCode(); 551if (RefAttrName.Length != 0) hash ^= RefAttrName.GetHashCode(); 552if (DocString.Length != 0) hash ^= DocString.GetHashCode(); 582if (Name.Length != 0) 617if (DocString.Length != 0) 627if (RefAttrName.Length != 0) 648if (Name.Length != 0) 652if (RefAttrName.Length != 0) 656if (DocString.Length != 0) 708if (other.Name.Length != 0) 712if (other.RefAttrName.Length != 0) 716if (other.DocString.Length != 0) 1031if (Name.Length != 0) hash ^= Name.GetHashCode(); 1033if (DocString.Length != 0) hash ^= DocString.GetHashCode(); 1050if (Name.Length != 0) 1060if (DocString.Length != 0) 1075if (Name.Length != 0) 1083if (DocString.Length != 0) 1101if (other.Name.Length != 0) 1113if (other.DocString.Length != 0) 1351if (Name.Length != 0) hash ^= Name.GetHashCode(); 1352if (OpType.Length != 0) hash ^= OpType.GetHashCode(); 1353if (Domain.Length != 0) hash ^= Domain.GetHashCode(); 1355if (DocString.Length != 0) hash ^= DocString.GetHashCode(); 1374if (Name.Length != 0) 1379if (OpType.Length != 0) 1385if (DocString.Length != 0) 1390if (Domain.Length != 0) 1407if (Name.Length != 0) 1411if (OpType.Length != 0) 1415if (Domain.Length != 0) 1420if (DocString.Length != 0) 1440if (other.Name.Length != 0) 1444if (other.OpType.Length != 0) 1448if (other.Domain.Length != 0) 1453if (other.DocString.Length != 0) 1760if (ProducerName.Length != 0) hash ^= ProducerName.GetHashCode(); 1761if (ProducerVersion.Length != 0) hash ^= ProducerVersion.GetHashCode(); 1762if (Domain.Length != 0) hash ^= Domain.GetHashCode(); 1764if (DocString.Length != 0) hash ^= DocString.GetHashCode(); 1788if (ProducerName.Length != 0) 1793if (ProducerVersion.Length != 0) 1798if (Domain.Length != 0) 1808if (DocString.Length != 0) 1835if (ProducerName.Length != 0) 1839if (ProducerVersion.Length != 0) 1843if (Domain.Length != 0) 1851if (DocString.Length != 0) 1879if (other.ProducerName.Length != 0) 1883if (other.ProducerVersion.Length != 0) 1887if (other.Domain.Length != 0) 1895if (other.DocString.Length != 0) 2074if (Key.Length != 0) hash ^= Key.GetHashCode(); 2075if (Value.Length != 0) hash ^= Value.GetHashCode(); 2092if (Key.Length != 0) 2097if (Value.Length != 0) 2112if (Key.Length != 0) 2116if (Value.Length != 0) 2134if (other.Key.Length != 0) 2138if (other.Value.Length != 0) 2269if (TensorName.Length != 0) hash ^= TensorName.GetHashCode(); 2287if (TensorName.Length != 0) 2303if (TensorName.Length != 0) 2322if (other.TensorName.Length != 0) 2580if (Name.Length != 0) hash ^= Name.GetHashCode(); 2583if (DocString.Length != 0) hash ^= DocString.GetHashCode(); 2605if (Name.Length != 0) 2611if (DocString.Length != 0) 2632if (Name.Length != 0) 2638if (DocString.Length != 0) 2661if (other.Name.Length != 0) 2667if (other.DocString.Length != 0) 3094if (Name.Length != 0) hash ^= Name.GetHashCode(); 3095if (DocString.Length != 0) hash ^= DocString.GetHashCode(); 3132if (Name.Length != 0) 3144if (DocString.Length != 0) 3178if (Name.Length != 0) 3182if (DocString.Length != 0) 3228if (other.Name.Length != 0) 3232if (other.DocString.Length != 0) 4181if (Denotation.Length != 0) hash ^= Denotation.GetHashCode(); 4209if (Denotation.Length != 0) 4232if (Denotation.Length != 0) 4250if (other.Denotation.Length != 0) 4522if (Denotation.Length != 0) hash ^= Denotation.GetHashCode(); 4555if (Denotation.Length != 0) 4600if (Denotation.Length != 0) 4618if (other.Denotation.Length != 0) 5633if (Domain.Length != 0) hash ^= Domain.GetHashCode(); 5634if (Name.Length != 0) hash ^= Name.GetHashCode(); 5651if (Domain.Length != 0) 5656if (Name.Length != 0) 5671if (Domain.Length != 0) 5675if (Name.Length != 0) 5693if (other.Domain.Length != 0) 5697if (other.Name.Length != 0) 5844if (Domain.Length != 0) hash ^= Domain.GetHashCode(); 5862if (Domain.Length != 0) 5882if (Domain.Length != 0) 5904if (other.Domain.Length != 0)
Microsoft.ML.PerformanceTests (2)
BenchmarkBase.cs (1)
106columnSB.Append(characters[random.Next(characters.Length)]);
ImageClassificationBench.cs (1)
117for (int index = 0; index < label.Length; index++)
Microsoft.ML.Predictor.Tests (19)
CmdLine\CmdIndenterTest.cs (2)
56while (ichLim < text.Length) 61while (ichLim < text.Length && text[ichLim] != '$')
CmdLine\CmdLine.cs (2)
358while (ichLim < text.Length) 363while (ichLim < text.Length && text[ichLim] != '$')
CompareBaselines.cs (15)
205if (ich1 >= line1.Length || ich2 >= line2.Length) 207mismatch = ich1 < line1.Length || ich2 < line2.Length; 282while (ich < line.Length && line[ich] == ' ') 298if (ichLim < line.Length && line[ichLim] == '.') 309ich = ichLim + "NaN".Length; 315ich = ichLim + "Infinity".Length; 323if (ichLim < line.Length && (line[ichLim] == 'e' || line[ichLim] == 'E')) 344if (ich >= line.Length || !IsDigit(line[ich])) 348while (ich < line.Length && IsDigit(line[ich])) 361if (ich < line.Length && (line[ich] == '-' || line[ich] == '+')) 367if (ich > line.Length - val.Length || line[ich] != val[0]) 369for (int i = 1; i < val.Length; i++)
Microsoft.ML.ResultProcessor (2)
ResultProcessor.cs (2)
994nameValCols[1] = nameValCols[1].Substring(0, nameValCols[1].Length - 1); 1081TextWriter outStream = (cmd.OutputFile != null && cmd.OutputFile.Length > 1
Microsoft.ML.Samples (7)
Dynamic\Trainers\MulticlassClassification\ImageClassification\ImageClassificationDefault.cs (2)
184for (int index = 0; index < label.Length; index++) 220for (int index = 0; index < label.Length; index++)
Dynamic\Trainers\MulticlassClassification\ImageClassification\LearningRateSchedulingCifarResnetTransferLearning.cs (2)
212for (int index = 0; index < label.Length; index++) 250for (int index = 0; index < label.Length; index++)
Dynamic\Trainers\MulticlassClassification\ImageClassification\ResnetV2101TransferLearningEarlyStopping.cs (1)
208for (int index = 0; index < label.Length; index++)
Dynamic\Trainers\MulticlassClassification\ImageClassification\ResnetV2101TransferLearningTrainTestSplit.cs (2)
193for (int index = 0; index < label.Length; index++) 229for (int index = 0; index < label.Length; index++)
Microsoft.ML.Samples.GPU (7)
docs\e4e90a0f3c9b109a\LearningRateSchedulingCifarResnetTransferLearning.cs (2)
212for (int index = 0; index < label.Length; index++) 250for (int index = 0; index < label.Length; index++)
docs\samples\Microsoft.ML.Samples\Dynamic\Trainers\MulticlassClassification\ImageClassification\ImageClassificationDefault.cs (2)
184for (int index = 0; index < label.Length; index++) 220for (int index = 0; index < label.Length; index++)
docs\samples\Microsoft.ML.Samples\Dynamic\Trainers\MulticlassClassification\ImageClassification\ResnetV2101TransferLearningEarlyStopping.cs (1)
208for (int index = 0; index < label.Length; index++)
docs\samples\Microsoft.ML.Samples\Dynamic\Trainers\MulticlassClassification\ImageClassification\ResnetV2101TransferLearningTrainTestSplit.cs (2)
193for (int index = 0; index < label.Length; index++) 229for (int index = 0; index < label.Length; index++)
Microsoft.ML.StandardTrainers (3)
Optimizer\OptimizationMonitor.cs (1)
90for (int i = 0; i < _checkingMessage.Length; i++)
Standard\LinearPredictorUtils.cs (1)
76if (name.Length == 0)
Standard\LogisticRegression\MulticlassLogisticRegression.cs (1)
1075Host.CheckDecode(str.Length > 0);
Microsoft.ML.Sweeper (1)
Parameters.cs (1)
549if (scaleStr.Length < 1)
Microsoft.ML.TensorFlow (3)
TensorflowTransform.cs (2)
322if (p != -1 && p != operation.Length - 1) 481var relativePath = fullPath.Substring(_savedModelPath.Length + 1);
TensorflowUtils.cs (1)
572if (p != -1 && p != operation.Length - 1)
Microsoft.ML.TensorFlow.Tests (1)
TensorflowTests.cs (1)
1916for (int index = 0; index < label.Length; index++)
Microsoft.ML.TestFramework (8)
PasteArguments.cs (6)
26if (argument.Length != 0 && ContainsNoWhitespaceOrQuotes(argument)) 35while (idx < argument.Length) 41while (idx < argument.Length && argument[idx] == Backslash) 47if (idx == argument.Length) 86for (int i = 0; i < s.Length; i++) 132if (argument.Length == 0 || hasWhitespace)
SubComponent.cs (2)
61return _kind.Length == 0 && _settings.Length == 0; 177if (ich == 0 || str[str.Length - 1] != '}')
Microsoft.ML.TestFrameworkCommon (2)
TestLogger.cs (2)
33value = value.Substring(0, value.Length - 2); 40format = format.Substring(0, format.Length - 2);
Microsoft.ML.Tests (2)
ExpressionLanguageTests\ExpressionLanguageTests.cs (2)
128for (; ichLim < text.Length; ichLim++) 133while (ichLim < text.Length && text[ichLim] != '$')
Microsoft.ML.Tokenizers (134)
Model\BpeOptions.cs (2)
77if (line.StartsWith("#version", StringComparison.Ordinal) || line.Length == 0) 84if (index < 0 || index == line.Length - 1 || line.IndexOf(' ', index + 1) >= 0)
Model\BPETokenizer.cs (18)
177if (index < 0 || index == merge.Length - 1 || merge.IndexOf(' ', index + 1) >= 0) 361int prefixLen = ContinuingSubwordPrefix is null ? 0 : ContinuingSubwordPrefix.Length; 378if (mergeValues.b.Length <= prefixLen) 860span = span.Slice(0, span.Length - EndOfWordSuffix.Length); 865span = span.Slice(ContinuingSubwordPrefix.Length); 919bool continuingSubwordPrefix = ContinuingSubwordPrefix is not null && ContinuingSubwordPrefix.Length > 0; 920bool endOfWordSuffix = EndOfWordSuffix is not null && EndOfWordSuffix.Length > 0; 951sSpan = sSpan.Slice(ContinuingSubwordPrefix!.Length); 957sSpan = sSpan.Slice(0, sSpan.Length - EndOfWordSuffix!.Length); 1036span = span.Slice(0, span.Length - EndOfWordSuffix.Length); 1041span = span.Slice(ContinuingSubwordPrefix.Length); 1159if (line.StartsWith("#version", StringComparison.Ordinal) || line.Length == 0) 1165if (index < 0 || index == line.Length - 1 || line.IndexOf(' ', index + 1) >= 0) 1217if (ContinuingSubwordPrefix.Length + s.Length <= buffer.Length) 1220s.CopyTo(buffer.Slice(ContinuingSubwordPrefix.Length)); 1221s = buffer.Slice(0, ContinuingSubwordPrefix.Length + s.Length); 1237if (s.Length + EndOfWordSuffix.Length <= buffer.Length) 1241s = buffer.Slice(0, s.Length + EndOfWordSuffix.Length);
Model\CodeGenTokenizer.cs (17)
1149int length = text is not null ? text.Length : textSpan.Length; 1213int length = text is not null ? text.Length : textSpan.Length; 1291int bytesCountToEncode = Encoding.UTF8.GetMaxByteCount(specialToken.Length); 1297bool removePrefixSpace = firstToken && hasPrefixSpace && specialToken.Length > 0 && specialToken[0] == ' '; 1307ReadOnlySpan<char> span = firstToken && hasPrefixSpace && s.Length > 0 && s[0] == _transformedSpace ? s.AsSpan(1) : s.AsSpan(); 1379if (BeginningOfSentenceToken!.Length > buffer.Length) 1385buffer = buffer.Slice(BeginningOfSentenceToken.Length); 1386charsWritten += BeginningOfSentenceToken.Length; 1402if (EndOfSentenceToken!.Length > buffer.Length) 1408buffer = buffer.Slice(EndOfSentenceToken.Length); 1409charsWritten += EndOfSentenceToken.Length; 1425if (UnknownToken!.Length > buffer.Length) 1431buffer = buffer.Slice(UnknownToken.Length); 1432charsWritten += UnknownToken.Length; 1447if (firstToken && hasPrefixSpace && specialToken.Length > 0 && specialToken[0] == ' ') 1469ReadOnlySpan<char> span = firstToken && hasPrefixSpace && s.Length > 0 && s[0] == _transformedSpace ? s.AsSpan(1) : s.AsSpan(); 1785if (index < 1 || index == line.Length - 1 || line.IndexOf(' ', index + 1) != -1)
Model\EnglishRobertaTokenizer.cs (13)
217if (index < 1 || index == line.Length - 1 || line.IndexOf(' ', index + 1) != -1) 283char[] buffer = ArrayPool<char>.Shared.Rent(v.Length); 287for (int j = 0; j < v.Length; j++) 808if (s.Length > buffer.Length) 814buffer = buffer.Slice(s.Length); 815charsWritten += s.Length; 917Debug.Assert(index + tokens[i].Value.Length <= indexMapping.Length); 919if (tokens[i].Offset.Start.Value != indexMapping[index] || tokens[i].Offset.End.Value != indexMapping[index] + tokens[i].Value.Length) 929list.Add(new EncodedToken(tokens[j].Id, tokens[j].Value, new Range(indexMapping[index], indexMapping[index] + tokens[j].Value.Length))); 930index += tokens[j].Value.Length; 936index += tokens[i].Value.Length; 1050tokens.Add(new EncodedToken(_vocab[new StringSpanOrdinalKey(w)], w, new Range(indexMapping[index], indexMapping[index] + w.Length))); 1051index += w.Length;
Model\SentencePieceBaseModel.cs (6)
355if (token.Length == 0) 369if (token[token.Length - 1] == prefixSuffixChar) 645if (buffer.Length < specialToken!.Length) 651charsWritten += specialToken.Length; 711if (token.Length == 0) 770if (buffer.Length < token.Length - delta)
Model\SentencePieceTokenizer.cs (2)
131CharsConsumed = normalizedText?.Length ?? text?.Length ?? textSpan.Length
Model\SentencePieceUnigramModel.cs (5)
638int tokenLength = stringToken.Length; 1189charsConsumed += _vocabReverse[ids[index]].Piece.Length; 1484charsConsumed += _vocabReverse[ids[i].Id].Piece.Length; 1570return normalizedText is not null ? normalizedText.Length - charConsumedFromEnd : 0; 1705consumedCharacters += _vocabReverse[node.Id].Piece.Length;
Model\TiktokenTokenizer.cs (7)
144_cache!.Add(specialToken.Key, new[] { (Id: specialToken.Value, TokenIndex0: 0, TokenLength: specialToken.Key.Length) }); 174if (!Helpers.TryParseInt32(line, capacity.Length, out suggestedCapacity)) 187while (line is not null && line.Length == 0) 198if (line.Length > 0) 208if (line.Length > 0) 211if (spaceIndex <= 0 || spaceIndex >= line.Length - 1 || line.IndexOf(' ', spaceIndex + 1) >= 0) 319tokens.Add(new EncodedToken(mappedId.Id, mappedId.Token, new Range(offset, offset + mappedId.Token.Length)));
Model\WordPieceTokenizer.cs (21)
108if (line.Length != 0) 323int maxLength = MaxInputCharsPerWord + ContinuingSubwordPrefix.Length; 345subStr.CopyTo(buffer.Slice(ContinuingSubwordPrefix.Length)); 346subStr = buffer.Slice(0, ContinuingSubwordPrefix.Length + subStr.Length); 463int maxLength = MaxInputCharsPerWord + ContinuingSubwordPrefix.Length; 486subStr.CopyTo(buffer.Slice(ContinuingSubwordPrefix.Length)); 487subStr = buffer.Slice(0, ContinuingSubwordPrefix.Length + subStr.Length); 696sb.Append(token.AsSpan().Slice(ContinuingSubwordPrefix.Length)); 755if (token.Length - ContinuingSubwordPrefix.Length > buffer.Length) 759token.AsSpan().Slice(ContinuingSubwordPrefix.Length).CopyTo(buffer); 760buffer = buffer.Slice(token.Length - ContinuingSubwordPrefix.Length); 761charsWritten += token.Length - ContinuingSubwordPrefix.Length; 767if (token.Length + 1 > buffer.Length) 774buffer = buffer.Slice(token.Length + 1); 775charsWritten += token.Length + 1; 779if (token.Length > buffer.Length) 785buffer = buffer.Slice(token.Length); 786charsWritten += token.Length;
Normalizer\BertNormalizer.cs (3)
42char[] buffer = ArrayPool<char>.Shared.Rent(original.Length); 45for (int i = 0; i < original.Length; i++) 56if (char.IsHighSurrogate(c) && i + 1 < original.Length && char.IsLowSurrogate(original[i + 1]))
Normalizer\SentencePieceNormalizationStep.cs (11)
46for (int i = 0; i < text.Length; i++) 52lone = i + 1 >= text.Length || !char.IsLowSurrogate(text[i + 1]); 65sb ??= new StringBuilder(text, 0, i, text.Length); 277if (text.Length == 0) 285while (i < decomposed.Length) 289int charCount = char.IsHighSurrogate(decomposed[i]) && i + 1 < decomposed.Length && char.IsLowSurrogate(decomposed[i + 1]) ? 2 : 1; 294sb = new StringBuilder(decomposed.Length); 314public override string Normalize(string text) => text.Length == 0 ? text : ReplaceLoneSurrogates(text).Normalize(_form); 321public override string Normalize(string text) => _prefix.Length == 0 ? text : _prefix + text; 342for (int i = 0; i < text.Length; i++) 368var sb = new StringBuilder(text.Length);
Normalizer\SentencePieceNormalizer.cs (6)
116byte[] inputArray = ArrayPool<byte>.Shared.Rent(Encoding.UTF8.GetMaxByteCount(text.Length)); 117byte[]? poolArray = ArrayPool<byte>.Shared.Rent(Math.Max(64, Encoding.UTF8.GetMaxByteCount(text.Length) * 2)); 260var tokenLength = token.Length; 295var tokenLength = token.Length; 396if (chained.Length == 0) 401byte[] chainedBytes = ArrayPool<byte>.Shared.Rent(Encoding.UTF8.GetMaxByteCount(chained.Length));
PreTokenizer\CompositePreTokenizer.cs (1)
86foreach ((int Offset, int Length) range in SplitText(text, _preTokenizers, preTokenizerIndex: 0, beginning, text.Length - beginning))
PreTokenizer\PreTokenizer.cs (1)
36while (TryGetMatch(regex, text, beginning, text.Length - beginning, out match))
PreTokenizer\RegexPreTokenizer.cs (2)
67if (!TryGetMatch(specialTokensRegex, text, beginning, text.Length - beginning, out specialMatch)) 83while (TryGetMatch(regex, text, beginning, text.Length - beginning, out match))
Tokenizer.cs (4)
257return tokens.NormalizedText?.Length ?? textSpan.Length; 447fullTextLength = normalizedText.Length; 469fullTextLength = normalizedText.Length; 478fullTextLength = text.Length;
Utils\OrdinalUtf8StringComparer.cs (6)
29int minLength = Math.Min(x.Length, y.Length); 52int xLen = x.Length - i; 53int yLen = y.Length - i; 91return x.Length - y.Length;
Utils\ValueStringBuilder.cs (9)
159int oldLength = oldValue.Length; 160int newLength = newValue.Length; 201_pos -= value.Length; 220int valueLength = value.Length; 249int count = s.Length; 291if (s.Length == 1 && (uint)pos < (uint)_chars.Length) // very common case, e.g. appending strings from NumberFormatInfo like separators, percent symbols, etc. 305if (pos > _chars.Length - s.Length) 307Grow(s.Length); 315_pos += s.Length;
Microsoft.ML.Tokenizers.Tests (133)
BpeTests.cs (11)
331char[] destinationBuffer = new char[expectedDecoded.Length]; 345Assert.True(charactersWritten < expectedDecoded.Length); 354Assert.Equal(expectedDecoded.Length, charactersWritten); 490Assert.Equal(text.Length, length); 493Assert.Equal(text.Length, length); 848char[] destinationBuffer = new char[beginningOfSentenceToken.Length + text.Length]; 855Assert.Equal(OperationStatus.DestinationTooSmall, tokenizer.Decode(ids, destinationBuffer.AsSpan(0, text.Length - 1), considerSpecialTokens: false, out idsConsumed, out charsWritten)); 857Assert.True(charsWritten < text.Length); 858Assert.Equal(OperationStatus.DestinationTooSmall, tokenizer.Decode(ids, destinationBuffer.AsSpan(0, text.Length), considerSpecialTokens: true, out idsConsumed, out charsWritten)); 860Assert.True(charsWritten <= text.Length);
CodeGenTests.cs (72)
304char[] destinationBuffer = new char[expectedDecoded.Length]; 318Assert.True(charactersWritten < expectedDecoded.Length); 327Assert.Equal(expectedDecoded.Length, charactersWritten); 381Assert.Equal(text.Length, length); 384Assert.Equal(text.Length, length); 388Assert.Equal(text.Length, length); 391Assert.Equal(text.Length, length); 395Assert.Equal(text.Length, length); 398Assert.Equal(text.Length, length); 468int expectedIndex = offsets.Length > 1 && offsets[offsets.Length - 1].Index == offsets[offsets.Length - 2].Index ? text.Length : offsets[offsets.Length - 1].Index; 469int expectedTokenCount = expectedIndex == text.Length ? 0 : 1; 484expectedIndex = offsets.Length > 1 && expectedOffsetsWithSpace[expectedOffsetsWithSpace.Length - 1].Index == expectedOffsetsWithSpace[expectedOffsetsWithSpace.Length - 2].Index ? text.Length : expectedOffsetsWithSpace[expectedOffsetsWithSpace.Length - 1].Index; 485expectedTokenCount = expectedIndex == text.Length ? 0 : 1; 640Assert.Equal(text.Length, length); 643Assert.Equal(text.Length, length); 646Assert.Equal(text.Length, length); 649Assert.Equal(text.Length, length); 652Assert.Equal(text.Length, length); 655Assert.Equal(text.Length, length); 691Assert.Equal(new Range(text.Length, text.Length), encoding[encoding.Count - 1].Offset); 696Assert.Equal(new Range(text.Length, text.Length), encoding[encoding.Count - 1].Offset); 701Assert.Equal(new Range(text.Length, text.Length), encoding[encoding.Count - 1].Offset); 706Assert.Equal(new Range(text.Length, text.Length), encoding[encoding.Count - 1].Offset); 715Assert.Equal(new Range(text.Length, text.Length), encoding[encoding.Count - 1].Offset); 720Assert.Equal(new Range(text.Length, text.Length), encoding[encoding.Count - 1].Offset); 725Assert.NotEqual(new Range(text.Length, text.Length), encoding[encoding.Count - 1].Offset); 730Assert.NotEqual(new Range(text.Length, text.Length), encoding[encoding.Count - 1].Offset); 735Assert.NotEqual(new Range(text.Length, text.Length), encoding[encoding.Count - 1].Offset); 740Assert.NotEqual(new Range(text.Length, text.Length), encoding[encoding.Count - 1].Offset); 773Assert.Equal(text.Length, length); 776Assert.Equal(text.Length, length); 779Assert.Equal(text.Length, length); 782Assert.Equal(text.Length, length); 785Assert.Equal(text.Length, length); 788Assert.Equal(text.Length, length); 827Assert.Equal(new Range(text.Length, text.Length), encoding[encoding.Count - 1].Offset); 833Assert.Equal(new Range(text.Length, text.Length), encoding[encoding.Count - 1].Offset); 839Assert.Equal(new Range(text.Length, text.Length), encoding[encoding.Count - 1].Offset); 845Assert.Equal(new Range(text.Length, text.Length), encoding[encoding.Count - 1].Offset); 857Assert.Equal(new Range(text.Length, text.Length), encoding[encoding.Count - 1].Offset); 863Assert.Equal(new Range(text.Length, text.Length), encoding[encoding.Count - 1].Offset); 869Assert.NotEqual(new Range(text.Length, text.Length), encoding[encoding.Count - 1].Offset); 875Assert.NotEqual(new Range(text.Length, text.Length), encoding[encoding.Count - 1].Offset); 881Assert.NotEqual(new Range(text.Length, text.Length), encoding[encoding.Count - 1].Offset); 887Assert.NotEqual(new Range(text.Length, text.Length), encoding[encoding.Count - 1].Offset); 927Assert.Equal(text.Length, length); 930Assert.Equal(text.Length, length); 933Assert.Equal(text.Length, length); 936Assert.Equal(text.Length, length); 939Assert.Equal(text.Length, length); 942Assert.Equal(text.Length, length); 1017calculatedLengthUsingOffsets = expectedTokenCountFromEnd > 0 ? offsets[offsets.Length - expectedTokenCountFromEnd].Index : input.Length;
EnglishRobertaTests.cs (5)
196Assert.Equal(text.Length, length); 199Assert.Equal(text.Length, length); 310char[] destinationBuffer = new char[expectedDecoded.Length]; 323Assert.True(charactersWritten < expectedDecoded.Length); 330Assert.Equal(expectedDecoded.Length, charactersWritten);
LlamaTests.cs (20)
300char[] destinationBuffer = new char[expectedDecoded.Length]; 314Assert.True(charactersWritten < expectedDecoded.Length); 323Assert.Equal(expectedDecoded.Length, charactersWritten); 387Span<char> destinationBuffer = stackalloc char[llamaTokenizer.EndOfSentenceToken.Length]; 389Assert.Equal(llamaTokenizer.EndOfSentenceToken.Length, charactersWritten); 536expectedOffsets1 = addEndOfSentence ? expectedOffsets1.Concat(new[] { (normalizedText.Length, 0) }).ToArray() : expectedOffsets1; 560Assert.Equal(normalizedText.Length, length); 563Assert.Equal(normalizedText.Length, length); 594Assert.Equal(normalizedText.Length, length); 692Assert.Equal(index, accumulatedString.Length); 701Assert.Equal(index, normalizedText!.Length - accumulatedStringFromEnd.Length); 841char[] destinationBuffer = new char[decodedWithNoSpecialTokens.Length]; 855Assert.Equal(decodedWithNoSpecialTokens.Length, charactersWritten); 858destinationBuffer = new char[textWithSpecialTokens.Length]; 869Assert.Equal(textWithSpecialTokens.Length, charactersWritten); 883destinationBuffer = new char[decodedWithNoSpecialTokens.Length + 1]; // one extra for suffix 894Assert.Equal(decodedWithNoSpecialTokens.Length, charactersWritten); 897destinationBuffer = new char[textWithSpecialTokens.Length + 1]; 913Assert.Equal(textWithSpecialTokens.Length, charactersWritten);
src\Microsoft.ML.Tokenizers\Utils\OrdinalUtf8StringComparer.cs (6)
29int minLength = Math.Min(x.Length, y.Length); 52int xLen = x.Length - i; 53int yLen = y.Length - i; 91return x.Length - y.Length;
TiktokenTests.cs (6)
171char[] destinationBuffer = new char[expectedDecoded.Length]; 185Assert.True(charactersWritten < expectedDecoded.Length); 194Assert.Equal(expectedDecoded.Length, charactersWritten); 653Assert.Equal(text.Length, length); 656Assert.Equal(text.Length, length); 797Assert.Equal(text.Length, index);
TokenizerTests.cs (3)
141Assert.True(processedText is null || charsConsumed <= processedText.Length); 195if (index1 != s.Length) 199Assert.True(index1 < s.Length);
UnigramTests.cs (8)
305Assert.True(writableTokens[writableTokens.Count - 1].Offset.Equals(new Range(normalized.Length, normalized.Length))); 500IReadOnlyList<int> ids2 = index < normalized.Length ? _unigramTokenizer.EncodeToIds(normalized!.Substring(index), addBeginningOfSentence: false, addEndOfSentence: false, considerNormalization: false) : new List<int>(); 506ids2 = index < normalized.Length ? _unigramTokenizer.EncodeToIds(normalized!.Substring(index).AsSpan(), addBeginningOfSentence: false, addEndOfSentence: false, considerNormalization: false) : new List<int>(); 512ids2 = index < normalized.Length ? _unigramTokenizer.EncodeToIds(normalized!.Substring(index), addBeginningOfSentence: false, addEndOfSentence: false, considerNormalization: false) : new List<int>(); 518ids2 = index < normalized.Length ? _unigramTokenizer.EncodeToIds(normalized!.Substring(index).AsSpan(), addBeginningOfSentence: false, addEndOfSentence: false, considerNormalization: false) : new List<int>(); 540char[] buffer = new char[decodedString.Length]; 547for (int i = 0; i < decodedString.Length - 1; i++)
WordPieceTests.cs (2)
98Span<char> buffer = stackalloc char[text.Length]; 99for (int i = 0; i < text.Length - 1; i++)
Microsoft.ML.TorchSharp (5)
NasBert\NerTrainer.cs (1)
114internal static bool TokenStartsWithSpace(string token) => token is null || (token.Length != 0 && token[0] == StartChar);
Roberta\QATrainer.cs (4)
445for (var (i, j, tid) = (0, 0, 0); i < text.Length && tid < tokens.Count;) 448if (j >= tokens[tid].Length) 454else if (i + 1 < text.Length && char.IsSurrogatePair(text[i], text[i + 1])) 471else if (i + 1 < text.Length && tokens[tid][j] == '"'
Microsoft.ML.Transforms (5)
Expression\CharCursor.cs (1)
28: this(Contracts.CheckRef(text, nameof(text)).ToCharArray(), text.Length)
Expression\KeyWordTable.cs (1)
67for (int cch = str.Length; --cch > 0;)
Expression\Tokens.cs (2)
187for (int i = 0; i < s.Length; i++) 227for (; ich < str.Length; ich++)
Text\TextNormalizing.cs (1)
314Contracts.Assert(_combinedDiacriticsPairs[i].Length == 2);
Microsoft.ML.Vision (2)
DnnRetrainTransform.cs (2)
564if (p != -1 && p != operation.Length - 1) 714var relativePath = fullPath.Substring(_modelLocation.Length + 1);
Microsoft.NET.Build.Containers (15)
AuthHandshakeMessageHandler.cs (1)
306host.Length > 1 && host[^1] == '.' ? host[..^1] : host;
ContainerHelpers.cs (1)
315for (int i = 0; i < containerRepository.Length; i++)
ImageIndexGenerator.cs (1)
73size = images[i].Manifest.Length,
LocalDaemons\ContainerArchive.cs (5)
64await WriteImageLayersAsync(writer, image, sourceReference, d => $"{d.Substring("sha256:".Length)}/layer.tar", cancellationToken, layerTarballPaths) 204string manifestPath = $"{BlobsPath}/{image.ManifestDigest.Substring("sha256:".Length)}"; 227image.Manifest.Length, 254await WriteImageLayersAsync(writer, image, sourceReference, d => $"{BlobsPath}/{d.Substring("sha256:".Length)}", cancellationToken) 289multiArchImage.ImageIndex.Length,
LocalDaemons\DockerCli.cs (5)
316await WriteImageLayers(writer, image, sourceReference, d => $"{d.Substring("sha256:".Length)}/layer.tar", cancellationToken, layerTarballPaths) 454string manifestPath = $"{_blobsPath}/{image.ManifestDigest.Substring("sha256:".Length)}"; 476image.Manifest.Length, 496await WriteImageLayers(writer, image, sourceReference, d => $"{_blobsPath}/{d.Substring("sha256:".Length)}", cancellationToken) 558multiArchImage.ImageIndex.Length,
Registry\HttpExtensions.cs (1)
56if ((uri.Authority.Contains(".ecr.") || uri.Authority.Contains(".ecr-")) && accountId.Length == 12 && long.TryParse(accountId, out _))
Tasks\CreateNewImage.cs (1)
232if (ContainerUser is { Length: > 0 } user)
Microsoft.NET.Build.Extensions.Tasks (10)
src\sdk\src\Tasks\Common\ConflictResolution\ConflictItem.cs (5)
80if (assemblyVersionString.Length != 0) 144if (fileVersionString.Length != 0) 184return _packageId.Length == 0 ? null : _packageId; 201if (packageVersionString.Length != 0) 224return _sourcePath.Length == 0 ? null : _sourcePath;
src\sdk\src\Tasks\Common\ConflictResolution\PackageRank.cs (1)
21if (preferredPackageId is not null && preferredPackageId.Length != 0)
src\sdk\src\Tasks\Common\ConflictResolution\PlatformManifestReader.cs (3)
34if (line is null || line.Length == 0 || line[0] == '#') 58if (assemblyVersionString.Length != 0 && !Version.TryParse(assemblyVersionString, out assemblyVersion)) 68if (fileVersionString.Length != 0 && !Version.TryParse(fileVersionString, out fileVersion))
src\sdk\src\Tasks\Common\Logger.cs (1)
79if (format.Length >= 12
Microsoft.NET.Build.Tasks (39)
AssetsFileResolver.cs (2)
127destPath = Path.GetDirectoryName(libraryPath.Substring(pkgRoot.Length)); 130if (destPath != null && destPath[destPath.Length - 1] != Path.DirectorySeparatorChar)
DependencyContextBuilder.cs (2)
248referenceAssembliesPath[referenceAssembliesPath.Length - 1] == Path.DirectorySeparatorChar) 436resolvedPath = referenceAssembly.FullPath.Substring(_referenceAssembliesPath.Length);
GenerateRuntimeConfigurationFiles.cs (2)
399char lastChar = path[path.Length - 1]; 402path = path.Substring(0, path.Length - 1);
GetPackageDirectory.cs (1)
93packageDirectory = originalRoot + packageDirectory.Substring(packageRoot.Length);
LockFileExtensions.cs (1)
128for (int i = 0; i < s.Length; i++)
ProjectContext.cs (1)
104if (PlatformLibrary.Name.Length > 0 && !string.Equals(PlatformLibrary.Name, NetCorePlatformLibrary, StringComparison.OrdinalIgnoreCase))
ResolvePackageAssets.cs (3)
1040int compilerVersionStart = compilerNameStart + _compilerNameSearchString.Length; 1092for (int i = 0; i < compilerApiVersion.Length; i++) 1115TryParseVersion(value, startIndex, value.Length - startIndex, out version);
src\sdk\src\Common\EnvironmentVariableNames.cs (1)
104var span = runtimeIdentifier.AsSpan(archStart, (archEnd > 0 ? archEnd : runtimeIdentifier.Length) - archStart);
src\sdk\src\Common\NuGetUtils.NuGet.cs (2)
19if (path.Length == 3) 24char separator = path[path.Length - 4];
src\sdk\src\Common\WorkloadSetVersion.cs (1)
72? workloadSetVersion.Substring(sections[0].Length)
src\sdk\src\Resolvers\Microsoft.DotNet.MSBuildSdkResolver\FXVersion.cs (6)
56char s1char = (s1.Pre.Length == i) ? '\0' : s1.Pre[i]; 57char s2char = (s2.Pre.Length == i) ? '\0' : s2.Pre[i]; 117for (int i = 0; i < id.Length; ++i) 151if (!buildMeta && id[0] == '0' && id.Length > 1 && int.TryParse(id, out _)) 196for (int i = startIndex; i < s.Length; ++i) 261if (patchStart + 1 < fxVersionString.Length && fxVersionString[patchStart] == '0')
src\sdk\src\Resolvers\Microsoft.NET.Sdk.WorkloadManifestReader\SdkDirectoryWorkloadManifestProvider.cs (4)
241firstDash = firstDash < 0 ? first.Length : firstDash; 242secondDash = secondDash < 0 ? second.Length : secondDash; 253var modifiedFirst = new ReleaseVersion(1, 1, 1, firstDash == first.Length ? null : first.Substring(firstDash)); 254var modifiedSecond = new ReleaseVersion(1, 1, 1, secondDash == second.Length ? null : second.Substring(secondDash));
src\sdk\src\Resolvers\Microsoft.NET.Sdk.WorkloadManifestReader\SdkFeatureBand.cs (1)
63char separator = workloadSetVersion[sections[0].Length];
src\sdk\src\Resolvers\Microsoft.NET.Sdk.WorkloadManifestReader\WorkloadManifestReader.Localization.cs (1)
55var cultureName = Path.GetFileNameWithoutExtension(filePath).Substring("WorkloadManifest.".Length);
src\sdk\src\Resolvers\Microsoft.NET.Sdk.WorkloadManifestReader\WorkloadSet.cs (1)
156char separator = setVersion[sections[0].Length];
src\sdk\src\Tasks\Common\ConflictResolution\ConflictItem.cs (5)
80if (assemblyVersionString.Length != 0) 144if (fileVersionString.Length != 0) 184return _packageId.Length == 0 ? null : _packageId; 201if (packageVersionString.Length != 0) 224return _sourcePath.Length == 0 ? null : _sourcePath;
src\sdk\src\Tasks\Common\ConflictResolution\PackageRank.cs (1)
21if (preferredPackageId is not null && preferredPackageId.Length != 0)
src\sdk\src\Tasks\Common\ConflictResolution\PlatformManifestReader.cs (3)
34if (line is null || line.Length == 0 || line[0] == '#') 58if (assemblyVersionString.Length != 0 && !Version.TryParse(assemblyVersionString, out assemblyVersion)) 68if (fileVersionString.Length != 0 && !Version.TryParse(fileVersionString, out fileVersion))
src\sdk\src\Tasks\Common\Logger.cs (1)
79if (format.Length >= 12
Microsoft.NET.HostModel (3)
Bundle\Manifest.cs (2)
143Debug.Assert(id.Length == BundleIdLength); 188Debug.Assert(dummyBundleId.Length == BundleIdLength);
src\runtime\src\coreclr\tools\Common\Compiler\Win32Resources\ResourceData.cs (1)
247dataBuilder.EmitUShort(checked((ushort)name.Key.Length));
Microsoft.Net.Http.Headers (41)
HeaderUtilities.cs (7)
190if (current < headerValue.Length && headerValue[current] == '=') 202return headerValue.Length; 247while (current < segment.Length) 252if (tokenLength == targetValue.Length 303while (current < segment.Length) 308if (tokenLength == targetDirectives.Length 335if (startIndex >= headerValue.Length - 1 || headerValue[startIndex] != '=')
HttpHeaderParser.cs (2)
82while (!string.IsNullOrEmpty(value) && index < value.Length) 144while (!string.IsNullOrEmpty(value) && index < value.Length)
SetCookieHeaderValue.cs (31)
191var length = _name.Length + EqualsToken.Length + _value.Length; 198length += SeparatorToken.Length + ExpiresToken.Length + EqualsToken.Length + ExpiresDateLength; 204length += SeparatorToken.Length + MaxAgeToken.Length + EqualsToken.Length + maxAge.Length; 209length += SeparatorToken.Length + DomainToken.Length + EqualsToken.Length + Domain.Length; 214length += SeparatorToken.Length + PathToken.Length + EqualsToken.Length + Path.Length; 219length += SeparatorToken.Length + SecureToken.Length; 226length += SeparatorToken.Length + SameSiteToken.Length + EqualsToken.Length + sameSite.Length; 231length += SeparatorToken.Length + SameSiteToken.Length + EqualsToken.Length + sameSite.Length; 236length += SeparatorToken.Length + SameSiteToken.Length + EqualsToken.Length + sameSite.Length; 241length += SeparatorToken.Length + HttpOnlyToken.Length; 248length += SeparatorToken.Length + extension.Length;
src\aspnetcore\src\Http\Shared\CookieHeaderParserShared.cs (1)
33while (!string.IsNullOrEmpty(value) && index < value.Length)
Microsoft.NET.Sdk.BlazorWebAssembly.Tasks (3)
BrotliCompress.cs (1)
56if (string.IsNullOrEmpty(path) || (path[0] == '\"' && path[path.Length - 1] == '\"'))
src\sdk\src\StaticWebAssetsSdk\Tasks\Data\StaticWebAsset.cs (1)
479if (eqIdx <= 0 || eqIdx == requirement.Length - 1)
UpgradeLegacyWasmStaticWebAssets.cs (1)
36var relatedPath = legacyAsset.RelativePath.Substring(0, legacyAsset.RelativePath.Length - 3);
Microsoft.NET.Sdk.Publish.Tasks (19)
MsDeploy\CommonUtility.cs (5)
644if (value is not null && value.Length != 0) 1551StringBuilder strBuilder = new(e.Message.Length * 4); 1729str = str.Substring(0, str.Length - 1); 1801if (strVersionsToTry is not null && strVersionsToTry.Length != 0) 1854StringBuilder stringBuilder = new(text.Length * 2);
MsDeploy\VsMSDeployObject.cs (1)
137if (linkExtensionsString is not null && linkExtensionsString.Length != 0)
src\sdk\src\Common\EnvironmentVariableNames.cs (1)
104var span = runtimeIdentifier.AsSpan(archStart, (archEnd > 0 ? archEnd : runtimeIdentifier.Length) - archStart);
Tasks\GenerateEnvTransform.cs (1)
56if (webConfigEnvironmentVariables is null || webConfigEnvironmentVariables.Length == 0)
Tasks\MsDeploy\CreateManifestFile.cs (1)
104if (ManifestFile is not null && ManifestFile.Length != 0)
Tasks\MsDeploy\CreateParameterFile.cs (3)
289if (DeclareParameterFile is not null && DeclareParameterFile.Length != 0) 293if (SetParameterFile is not null && SetParameterFile.Length != 0) 298if (DeclareSetParameterFile is not null && DeclareSetParameterFile.Length != 0)
Tasks\MsDeploy\MSDeploy.cs (1)
916if (args is not null && args.Length != 0)
Tasks\MsDeploy\NormalizeServiceUrl.cs (1)
175iSpot = "http://".Length;
Tasks\OneDeploy\CreatePackageFile.cs (1)
41if (ContentToPackage is null || ContentToPackage.Length == 0
Tasks\OneDeploy\OneDeploy.cs (1)
200if (publishUrl is null || publishUrl.Length == 0 ||
Tasks\TransformWebConfig.cs (1)
86if (ProjectFullPath is not null && ProjectFullPath.Length != 0 && PublishDir is not null)
Tasks\ZipDeploy\ZipDeploy.cs (1)
62if (publishUrl is not null && publishUrl.Length != 0)
WebConfigTransform.cs (1)
238arguments = arguments.Remove(position, templateLauncherArg.Length);
Microsoft.NET.Sdk.Razor.Tasks (7)
src\sdk\src\RazorSdk\Tool\CommandLine\ArgumentEscaper.cs (6)
35for (int i = 0; i < arg.Length; ++i) 40while (i < arg.Length && arg[i] == '\\') 46if (i == arg.Length && isQuoted) 52else if (i == arg.Length) 94if (argument.Length <= 1) 99return argument[0] == '"' && argument[argument.Length - 1] == '"';
src\sdk\src\RazorSdk\Tool\ServerProtocol\ServerProtocol.cs (1)
31writer.Write(value.Length);
Microsoft.NET.Sdk.StaticWebAssets.Tasks (17)
Compression\DiscoverPrecompressedAssets.cs (1)
83var identityWithoutExtension = candidate.Identity.Substring(0, candidate.Identity.Length - 3); // We take advantage we know the extension is .br or .gz.
ComputeReferenceStaticWebAssetItems.cs (1)
153.Where(s => s.Length > 0)
Data\StaticWebAsset.cs (1)
479if (eqIdx <= 0 || eqIdx == requirement.Length - 1)
Data\StaticWebAssetEndpoint.cs (6)
627var remaining = endpoint.Route.Length > normalizedOldBase.Length 628? endpoint.Route.Substring(normalizedOldBase.Length).TrimStart('/') 665var labelRemaining = property.Value.Length > normalizedOldBase.Length 666? property.Value.Substring(normalizedOldBase.Length).TrimStart('/')
DefineStaticWebAssets.cs (5)
144var withSeparator when withSeparator[withSeparator.Length - 1] == Path.DirectorySeparatorChar || withSeparator[withSeparator.Length - 1] == Path.AltDirectorySeparatorChar => normalizedDirectoryPath.Length, 145_ => normalizedDirectoryPath.Length + 1 507var result = normalizedAssetPath.Substring(normalizedContentRoot.Length);
GenerateStaticWebAssetsDevelopmentManifest.cs (1)
324return StaticWebAsset.Normalize(asset.Identity[asset.ContentRoot.Length..]);
ScopedCss\RewriteCss.cs (2)
188Edits.Add(new DeleteContentEdit { Position = firstDeepCombinator.Start, DeleteLength = DeepCombinatorText.Length }); 406for (var i = 0; i < text.Length; i++)
Microsoft.NET.Sdk.WorkloadManifestReader (15)
SdkDirectoryWorkloadManifestProvider.cs (4)
241firstDash = firstDash < 0 ? first.Length : firstDash; 242secondDash = secondDash < 0 ? second.Length : secondDash; 253var modifiedFirst = new ReleaseVersion(1, 1, 1, firstDash == first.Length ? null : first.Substring(firstDash)); 254var modifiedSecond = new ReleaseVersion(1, 1, 1, secondDash == second.Length ? null : second.Substring(secondDash));
SdkFeatureBand.cs (1)
63char separator = workloadSetVersion[sections[0].Length];
src\sdk\src\Common\EnvironmentVariableNames.cs (1)
104var span = runtimeIdentifier.AsSpan(archStart, (archEnd > 0 ? archEnd : runtimeIdentifier.Length) - archStart);
src\sdk\src\Common\WorkloadSetVersion.cs (1)
72? workloadSetVersion.Substring(sections[0].Length)
src\sdk\src\Resolvers\Microsoft.DotNet.MSBuildSdkResolver\FXVersion.cs (6)
56char s1char = (s1.Pre.Length == i) ? '\0' : s1.Pre[i]; 57char s2char = (s2.Pre.Length == i) ? '\0' : s2.Pre[i]; 117for (int i = 0; i < id.Length; ++i) 151if (!buildMeta && id[0] == '0' && id.Length > 1 && int.TryParse(id, out _)) 196for (int i = startIndex; i < s.Length; ++i) 261if (patchStart + 1 < fxVersionString.Length && fxVersionString[patchStart] == '0')
WorkloadManifestReader.Localization.cs (1)
55var cultureName = Path.GetFileNameWithoutExtension(filePath).Substring("WorkloadManifest.".Length);
WorkloadSet.cs (1)
156char separator = setVersion[sections[0].Length];
Microsoft.NET.StringTools (11)
FowlerNollVo1aHash.cs (4)
36for (int i = 0; i < text.Length; i++) 66for (int i = 0; i < text.Length; i++) 91for (int i = 0; i < text.Length; i++) 113for (int i = 0; i < text.Length; i++)
InternableString.cs (2)
143Length = str.Length; 183if (other.Length != Length)
SpanBasedStringBuilder.cs (1)
221Length += value!.Length;
WeakStringCacheInterner.cs (4)
140result.AppendLine($"\n{new string('=', 41 - (title.Length / 2))}{title}{new string('=', 41 - (title.Length / 2))}"); 151.OrderByDescending(kv => kv.Value * kv.Key.Length) 154.Select(kv => string.Format(CultureInfo.InvariantCulture, "({1} instances x each {2} chars)\n{0}", kv.Key, kv.Value, kv.Key.Length));
Microsoft.Private.Windows.Core (18)
src\winforms\src\Microsoft.Private.Windows.Polyfills\System\StringExtensions.cs (4)
20if (destination.Length < stringValue.Length) 49Span<char> resultSpan = new(firstChar, result.Length); 69Span<char> resultSpan = new(firstChar, result.Length); 103Span<char> resultSpan = new(firstChar, result.Length);
System\Private\Windows\Ole\Composition.ManagedToNativeAdapter.cs (7)
337sizeInBytes += (uint)(file.Length + 1) * sizeof(char); 367fileBuffer[file.Length] = '\0'; 368fileBuffer = fileBuffer[(file.Length + 1)..]; 378int byteCount = PInvokeCore.WideCharToMultiByte(PInvokeCore.CP_ACP, 0, value, value.Length, null, 0, null); 386PInvokeCore.WideCharToMultiByte(PInvokeCore.CP_ACP, 0, value, value.Length, (PSTR)buffer.Pointer, byteCount, null); 396uint byteCount = (uint)value.Length * sizeof(char) + sizeof(char); 408span[value.Length] = '\0';
System\Private\Windows\Ole\DragDropHelper.cs (2)
346if (message.Length >= (int)PInvokeCore.MAX_PATH) 351if (messageReplacementToken.Length >= (int)PInvokeCore.MAX_PATH)
System\Text\ValueStringBuilder.cs (5)
173int count = s.Length; 216if (s.Length == 1 && (uint)pos < (uint)_chars.Length) 231if (pos > _chars.Length - s.Length) 233Grow(s.Length); 237_pos += s.Length;
Microsoft.SourceLink.AzureDevOpsServer.Git (8)
src\sourcelink\src\Common\AzureDevOps\AzureDevOpsUrlParser.cs (1)
154if (account.Length == 0)
src\sourcelink\src\Common\GitProvider\GetSourceLinkUrlGitTask.cs (2)
128if (revisionId == null || revisionId.Length != 40 || !revisionId.All(IsHexDigit)) 140relativeUrl = relativeUrl[..^GitUrlSuffix.Length];
src\sourcelink\src\Common\Utilities\Hash.cs (1)
294return GetFNVHashCode(text, start, length: text.Length - start);
src\sourcelink\src\Common\Utilities\PathUtilities.cs (1)
44var last = path[path.Length - 1];
src\sourcelink\src\Common\Utilities\UriUtilities.cs (3)
44if (relativeUrl.Length == 0 || relativeUrl == "/") 59var end = relativeUrl.Length - 1; 66return !parts.Any(part => part.Length == 0);
Microsoft.SourceLink.AzureRepos.Git (9)
src\sourcelink\src\Common\AzureDevOps\AzureDevOpsUrlParser.cs (1)
154if (account.Length == 0)
src\sourcelink\src\Common\GitProvider\GetSourceLinkUrlGitTask.cs (2)
128if (revisionId == null || revisionId.Length != 40 || !revisionId.All(IsHexDigit)) 140relativeUrl = relativeUrl[..^GitUrlSuffix.Length];
src\sourcelink\src\Common\Utilities\Hash.cs (1)
294return GetFNVHashCode(text, start, length: text.Length - start);
src\sourcelink\src\Common\Utilities\PathUtilities.cs (1)
44var last = path[path.Length - 1];
src\sourcelink\src\Common\Utilities\UriUtilities.cs (3)
44if (relativeUrl.Length == 0 || relativeUrl == "/") 59var end = relativeUrl.Length - 1; 66return !parts.Any(part => part.Length == 0);
TranslateRepositoryUrls.cs (1)
37var result = host[prefix.Length..];
Microsoft.SourceLink.Bitbucket.Git (7)
src\sourcelink\src\Common\GitProvider\GetSourceLinkUrlGitTask.cs (2)
128if (revisionId == null || revisionId.Length != 40 || !revisionId.All(IsHexDigit)) 140relativeUrl = relativeUrl[..^GitUrlSuffix.Length];
src\sourcelink\src\Common\Utilities\Hash.cs (1)
294return GetFNVHashCode(text, start, length: text.Length - start);
src\sourcelink\src\Common\Utilities\PathUtilities.cs (1)
44var last = path[path.Length - 1];
src\sourcelink\src\Common\Utilities\UriUtilities.cs (3)
44if (relativeUrl.Length == 0 || relativeUrl == "/") 59var end = relativeUrl.Length - 1; 66return !parts.Any(part => part.Length == 0);
Microsoft.SourceLink.Common (5)
src\sourcelink\src\Common\Utilities\Hash.cs (1)
294return GetFNVHashCode(text, start, length: text.Length - start);
src\sourcelink\src\Common\Utilities\PathUtilities.cs (1)
44var last = path[path.Length - 1];
src\sourcelink\src\Common\Utilities\UriUtilities.cs (3)
44if (relativeUrl.Length == 0 || relativeUrl == "/") 59var end = relativeUrl.Length - 1; 66return !parts.Any(part => part.Length == 0);
Microsoft.SourceLink.Gitea (7)
src\sourcelink\src\Common\GitProvider\GetSourceLinkUrlGitTask.cs (2)
128if (revisionId == null || revisionId.Length != 40 || !revisionId.All(IsHexDigit)) 140relativeUrl = relativeUrl[..^GitUrlSuffix.Length];
src\sourcelink\src\Common\Utilities\Hash.cs (1)
294return GetFNVHashCode(text, start, length: text.Length - start);
src\sourcelink\src\Common\Utilities\PathUtilities.cs (1)
44var last = path[path.Length - 1];
src\sourcelink\src\Common\Utilities\UriUtilities.cs (3)
44if (relativeUrl.Length == 0 || relativeUrl == "/") 59var end = relativeUrl.Length - 1; 66return !parts.Any(part => part.Length == 0);
Microsoft.SourceLink.Gitee (7)
src\sourcelink\src\Common\GitProvider\GetSourceLinkUrlGitTask.cs (2)
128if (revisionId == null || revisionId.Length != 40 || !revisionId.All(IsHexDigit)) 140relativeUrl = relativeUrl[..^GitUrlSuffix.Length];
src\sourcelink\src\Common\Utilities\Hash.cs (1)
294return GetFNVHashCode(text, start, length: text.Length - start);
src\sourcelink\src\Common\Utilities\PathUtilities.cs (1)
44var last = path[path.Length - 1];
src\sourcelink\src\Common\Utilities\UriUtilities.cs (3)
44if (relativeUrl.Length == 0 || relativeUrl == "/") 59var end = relativeUrl.Length - 1; 66return !parts.Any(part => part.Length == 0);
Microsoft.SourceLink.GitHub (7)
src\sourcelink\src\Common\GitProvider\GetSourceLinkUrlGitTask.cs (2)
128if (revisionId == null || revisionId.Length != 40 || !revisionId.All(IsHexDigit)) 140relativeUrl = relativeUrl[..^GitUrlSuffix.Length];
src\sourcelink\src\Common\Utilities\Hash.cs (1)
294return GetFNVHashCode(text, start, length: text.Length - start);
src\sourcelink\src\Common\Utilities\PathUtilities.cs (1)
44var last = path[path.Length - 1];
src\sourcelink\src\Common\Utilities\UriUtilities.cs (3)
44if (relativeUrl.Length == 0 || relativeUrl == "/") 59var end = relativeUrl.Length - 1; 66return !parts.Any(part => part.Length == 0);
Microsoft.SourceLink.GitLab (7)
src\sourcelink\src\Common\GitProvider\GetSourceLinkUrlGitTask.cs (2)
128if (revisionId == null || revisionId.Length != 40 || !revisionId.All(IsHexDigit)) 140relativeUrl = relativeUrl[..^GitUrlSuffix.Length];
src\sourcelink\src\Common\Utilities\Hash.cs (1)
294return GetFNVHashCode(text, start, length: text.Length - start);
src\sourcelink\src\Common\Utilities\PathUtilities.cs (1)
44var last = path[path.Length - 1];
src\sourcelink\src\Common\Utilities\UriUtilities.cs (3)
44if (relativeUrl.Length == 0 || relativeUrl == "/") 59var end = relativeUrl.Length - 1; 66return !parts.Any(part => part.Length == 0);
Microsoft.SourceLink.GitWeb (7)
src\sourcelink\src\Common\GitProvider\GetSourceLinkUrlGitTask.cs (2)
128if (revisionId == null || revisionId.Length != 40 || !revisionId.All(IsHexDigit)) 140relativeUrl = relativeUrl[..^GitUrlSuffix.Length];
src\sourcelink\src\Common\Utilities\Hash.cs (1)
294return GetFNVHashCode(text, start, length: text.Length - start);
src\sourcelink\src\Common\Utilities\PathUtilities.cs (1)
44var last = path[path.Length - 1];
src\sourcelink\src\Common\Utilities\UriUtilities.cs (3)
44if (relativeUrl.Length == 0 || relativeUrl == "/") 59var end = relativeUrl.Length - 1; 66return !parts.Any(part => part.Length == 0);
Microsoft.SourceLink.Tools.Package (6)
SourceLinkMap.cs (6)
125list.Sort((left, right) => -left.FilePath.Path.Length.CompareTo(right.FilePath.Path.Length)); 139if (key.Length == 0) 145if (filePathStar == key.Length - 1) 214var escapedPath = string.Join("/", path.Substring(file.Path.Length).Split(new[] { '/', '\\' }).Select(Uri.EscapeDataString)); 221Debug.Assert(mappedUri.Suffix.Length == 0);
Microsoft.TemplateEngine.Cli (29)
ChoiceTemplateParameter.cs (2)
53if (standardUsage.Length > context.HelpBuilder.MaxWidth / 3) 59if (updatedFirstColumn.Length <= context.HelpBuilder.MaxWidth / 3)
CliTemplateParameter.cs (6)
251if ((alias.Length - GetPrefixLength(alias)) > (name.Length - GetPrefixLength(name))) 263return alias.Length > 1 && alias[1] == '-' ? 2 : 1; 442if (value.Length < 3) 473int longestChoiceLength = choice.Choices.Keys.Max(x => x.Length); 477displayValue.Append(Indent + choiceInfo.Key.PadRight(longestChoiceLength + Indent.Length));
Commands\AliasAssignmentCoordinator.cs (3)
183if (parts[i].Length > buckets[i].Length) 185buckets[i] = parts[i].Substring(0, buckets[i].Length + 1);
Commands\create\InvalidTemplateOptionResult.cs (1)
156int longestChoiceLength = possibleValues.Keys.Max(x => x.Length);
TabularOutput\TabularOutput.cs (8)
334MinWidth = minWidth + _settings.ShrinkReplacement.Length; //we need to add required width for shrink replacement 387while (position < text.Length) 396position = newlineIndex + newLine.Length; 405GetLineText(text, lines, maxWidth, text.Length - 1, ref position); 434if (text.Substring(position, text.Length - position).GetUnicodeLength() < maxLength) 437position = text.Length; 455int properMax = Math.Min(maxLength - 1, text.Length - position); 472int desiredLength = maxLength - _shrinkReplacement.Length;
TabularOutput\UnicodeLength.cs (1)
11for (int i = 0; i < s.Length; i++)
TemplateInvoker.cs (1)
281int longestChangeTextLength = destructiveChanges.Max(x => GetChangeString(x.ChangeKind).Length);
TemplateResolution\CliFilters.cs (4)
53if (nameIndex == 0 && templateGroup.Name.Length == name.Length) 64if (shortNameIndex == 0 && shortName.Length == name.Length)
TemplateSearch\CliTemplateSearchCoordinator.cs (3)
212var packageIdLength = packageName.Length; 219formattedOutput = packageOwners.Length > maxPackageOwnerLength 281if (!string.IsNullOrWhiteSpace(commandArgs.SearchNameCriteria) && commandArgs.SearchNameCriteria.Length < 2)
Microsoft.TemplateEngine.Core (4)
Expressions\Cpp\CppStyleEvaluatorDefinition.cs (3)
534if (literal.Length < 2 || literal[0] != literal[literal.Length - 1] || !SupportedQuotes.Contains(literal[0])) 572return literal.Substring(1, literal.Length - 2);
Expressions\Shared\XmlStyleConverters.cs (1)
16for (int i = 0; i < arg.Length; ++i)
Microsoft.TemplateEngine.Edge (20)
Mount\Archive\ZipFileDirectory.cs (2)
26return _mountPoint.Universe.Values.Where(x => x.FullPath.StartsWith(FullPath, StringComparison.Ordinal) && x.FullPath.Length != FullPath.Length && r.IsMatch(x.Name)).Where(x => searchOption == SearchOption.AllDirectories || x.FullPath.TrimEnd('/').Count(y => y == '/') == FullPath.Count(y => y == '/'));
Mount\FileSystem\FileSystemDirectory.cs (8)
35string baseName = x.Substring(fileSystemMountPoint.MountPointRootPath.Length).Replace(Path.DirectorySeparatorChar, '/'); 37if (baseName.Length == 0) 47if (_fileSystem.DirectoryExists(x) && baseName[baseName.Length - 1] != '/') 60string baseName = x.Substring(((FileSystemMountPoint)MountPoint).MountPointRootPath.Length).Replace(Path.DirectorySeparatorChar, '/'); 62if (baseName.Length == 0) 72if (baseName[baseName.Length - 1] != '/') 85string baseName = x.Substring(((FileSystemMountPoint)MountPoint).MountPointRootPath.Length).Replace(Path.DirectorySeparatorChar, '/'); 87if (baseName.Length == 0)
Mount\FileSystemInfoBase.cs (2)
42if (FullPath == "/" || FullPath.Length < 2) 47int lastSlash = FullPath.LastIndexOf('/', FullPath.Length - 2);
Settings\SettingsFilePaths.cs (2)
45foreach (string p in EnumerateFiles(path, "*", SearchOption.AllDirectories).OrderBy(x => x.Length)) 47string localPath = p.Substring(path.Length).TrimStart('\\', '/');
Template\WellKnownSearchFilters.cs (6)
23if (nameIndex == 0 && template.Name.Length == name.Length) 34if (shortNameIndex == 0 && shortName.Length == name.Length) 207if (authorIndex == 0 && template.Author.Length == author.Length)
Microsoft.TemplateEngine.Orchestrator.RunnableProjects (14)
DirectoryBasedTemplate.cs (4)
138string localeStr = filename.Substring(LocalizationFilePrefix.Length, filename.Length - LocalizationFilePrefix.Length - LocalizationFileExtension.Length);
Macros\GuidMacro.cs (1)
35for (int i = 0; i < config.Format.Length; ++i)
OperationConfig\ConditionalBlockCommentConfig.cs (3)
52if (endToken is null || endToken.Length < 2) 60pseudoEndComment = endToken.Substring(0, endToken.Length - 1) + " " + endToken.Substring(endToken.Length - 1);
ParameterConverter.cs (1)
249if (literal.Length < 3)
UnicodeCharacterUtilities.cs (1)
101int nameLength = name.Length;
ValueForms\DefaultSafeNamespaceValueFormFactory.cs (4)
23StringBuilder safeValueStr = new(value.Length); 25for (int i = 0; i < value.Length; i++) 27if (i < value.Length - 1 && char.IsSurrogatePair(value[i], value[i + 1])) 47(safeValueStr.Length > 0 && i < value.Length - 1 && value[i] == '.'))
Microsoft.TemplateEngine.Utils (35)
Glob.cs (11)
40if (pattern.Length > 0 && pattern[0] == '!') 46for (int i = start; i < pattern.Length; ++i) 51if (i < pattern.Length - 1) 72for (; i < pattern.Length; ++i) 76if (i < pattern.Length - 1) 102if (pattern.Length > i + 1 && pattern[i + 1] == '*') 104if (pattern.Length > i + 2 && pattern[i + 2] == '/') 147while (i < test.Length) 172if (i < test.Length) 181if (currentMatcher == _matchers.Count && i == test.Length) 212return i == test.Length && currentMatcher == _matchers.Count;
InMemoryFileSystem.cs (14)
39string rel = path.Substring(_root.FullPath.Length).Trim('/', '\\'); 69string rel = path.Substring(_root.FullPath.Length).Trim('/', '\\'); 104string rel = path.Substring(_root.FullPath.Length).Trim('/', '\\'); 142string rel = directory.Substring(_root.FullPath.Length).Trim('/', '\\'); 179string rel = path.Substring(_root.FullPath.Length).Trim('/', '\\'); 259string rel = path.Substring(_root.FullPath.Length).Trim('/', '\\'); 341string rel = directoryName.Substring(_root.FullPath.Length).Trim('/', '\\'); 443string rel = path.Substring(_root.FullPath.Length).Trim('/', '\\'); 469string rel = file.Substring(_root.FullPath.Length).Trim('/', '\\'); 499string rel = path.Substring(_root.FullPath.Length).Trim('/', '\\'); 557string rel = file.Substring(_root.FullPath.Length).Trim('/', '\\'); 589string rel = file.Substring(_root.FullPath.Length).Trim('/', '\\'); 620string rel = file.Substring(_root.FullPath.Length).Trim('/', '\\'); 651string rel = file.Substring(_root.FullPath.Length).Trim('/', '\\');
InstallRequestPathResolution.cs (2)
56if (baseDir[baseDir.Length - 1] is '/' or '\\') 58baseDir = baseDir.Substring(0, baseDir.Length - 1);
PhysicalFileSystem.cs (1)
141resultPath = target.Substring(relativeTo.Length + 1);
RangeVersionSpecification.cs (1)
57string endVersion = parts[1].Substring(0, parts[1].Length - 1);
WellKnownSearchFilters.cs (6)
48if (nameIndex == 0 && template.Name.Length == name.Length) 59if (shortNameIndex == 0 && shortName.Length == name.Length) 211if (authorIndex == 0 && template.Author.Length == author!.Length)
Microsoft.TestPlatform.AdapterUtilities (19)
Helpers\ReflectionHelpers.cs (4)
27for (int i = 0; i < escapedString.Length; i++) 41if (end != 0 && end < escapedString.Length) 43stringBuilder.Append(escapedString, end, escapedString.Length - end); 52for (int i = pos; i < escapedStringSegment.Length; i++)
ManagedNameUtilities\ManagedNameHelper.Reflection.cs (7)
405for (int i = 0; i <= namespaceString.Length; i++) 407if (i == namespaceString.Length || namespaceString[i] == '.') 440var arityString = name.Substring(arityStart, name.Length - arityStart); 472for (int i = 0; i < name.Length; i++) 513for (int i = typeName.Length - 1; i > 0; i--) 517stars = typeName.Length - i - 1; 567for (int i = 0; i < s.Length; i++)
ManagedNameUtilities\ManagedNameParser.cs (8)
71if (pos != managedMethodName.Length) 89for (; i < managedMethodName.Length; i++) 130for (; i < managedMethodName.Length; i++) 144if (start == managedMethodName.Length) 153for (; i < managedMethodName.Length; i++) 183for (i = start; i < managedMethodName.Length; i++) 218for (int i = start; i < managedMethodName.Length; i++) 243for (int i = start; i < managedMethodName.Length; i++)
Microsoft.TestPlatform.Build (4)
Tasks\VSTestTask2.cs (4)
80singleLine = singleLine.Substring(_ansiReset.Length); 288var sb = new StringBuilder(input.Length); 289for (int i = 0; i < input.Length; i++) 291if (input[i] == '%' && i + 1 < input.Length)
Microsoft.TestPlatform.CommunicationUtilities (3)
Json\Jsonite\Jsonite.cs (1)
1143for (int i = 0; i < text.Length; i++)
JsonDataSerializer.cs (2)
101if (rawMessage.Length < 31) 170var length = rawMessage.Length;
Microsoft.TestPlatform.CoreUtilities (1)
Extensions\StringBuilderExtensions.cs (1)
34if (result.Length + data.Length >= result.MaxCapacity)
Microsoft.TestPlatform.CrossPlatEngine (1)
Utilities\TestCaseFilterDeterminer.cs (1)
12string shortenTestCaseFilter = testCaseFilter.Length > MaxLengthOfTestCaseFilterToShow
Microsoft.TestPlatform.Filter.Source (7)
Condition.cs (3)
326for (int i = 0; i < s.Length; ++i) 366if (next < s.Length && s[next] == '=') 372else if (next < s.Length && s[next] == '~')
FilterExpression.cs (1)
425for (int i = 0; i < s.Length; ++i)
FilterHelper.cs (3)
59for (int i = 0; i < str.Length; ++i) 89for (int i = 0; i < str.Length; ++i) 94if (++i == str.Length || !SpecialCharactersSet.Contains(currentChar = str[i]))
Microsoft.TestPlatform.Utilities (6)
CommandLineUtilities.cs (5)
24while (index < args.Length) 36while (index < args.Length && args[index] != '\n') 54if (index == args.Length) 74if (index <= args.Length && args[index] == '"') 84if (index <= args.Length)
StringExtensions.cs (1)
38if (buffer.Length > 0 || input[input.Length - 1] == separator)
Microsoft.VisualBasic.Core (154)
Microsoft\VisualBasic\CompilerServices\CharType.vb (1)
17If (Value Is Nothing) OrElse (Value.Length = 0) Then
Microsoft\VisualBasic\CompilerServices\Conversions.vb (11)
1535(.CurrencyDecimalSeparator.Length = 1) AndAlso 1536(.NumberDecimalSeparator.Length = 1) AndAlso 1537(.CurrencyGroupSeparator.Length = 1) AndAlso 1538(.NumberGroupSeparator.Length = 1) AndAlso 1549(.CurrencyDecimalSeparator.Length = .NumberDecimalSeparator.Length) AndAlso 1552(.CurrencyGroupSeparator.Length = .NumberGroupSeparator.Length) Then 1555For i = 0 To .CurrencyDecimalSeparator.Length - 1 1559For i = 0 To .CurrencyGroupSeparator.Length - 1 2041If (Value Is Nothing) OrElse (Value.Length = 0) Then
Microsoft\VisualBasic\CompilerServices\DecimalType.vb (10)
158(.CurrencyDecimalSeparator.Length = 1) AndAlso 159(.NumberDecimalSeparator.Length = 1) AndAlso 160(.CurrencyGroupSeparator.Length = 1) AndAlso 161(.NumberGroupSeparator.Length = 1) AndAlso 173(.CurrencyDecimalSeparator.Length = .NumberDecimalSeparator.Length) AndAlso 176(.CurrencyGroupSeparator.Length = .NumberGroupSeparator.Length) Then 179For i = 0 To .CurrencyDecimalSeparator.Length - 1 183For i = 0 To .CurrencyGroupSeparator.Length - 1
Microsoft\VisualBasic\CompilerServices\IOUtils.vb (7)
26If PathName.Length > 0 AndAlso PathName.Chars(PathName.Length - 1) = Path.DirectorySeparatorChar Then 30If PathName.Length = 0 Then 36If (FileName Is Nothing) OrElse (FileName.Length = 0) OrElse (FileName = ".") Then 41If (DirName Is Nothing) OrElse (DirName.Length = 0) Then 46If DirName.Chars(DirName.Length - 1) <> Path.DirectorySeparatorChar Then 51If DirName.Chars(DirName.Length - 1) <> Path.DirectorySeparatorChar Then
Microsoft\VisualBasic\CompilerServices\LikeOperator.vb (2)
257PatternLength = Pattern.Length 263SourceLength = Source.Length
Microsoft\VisualBasic\CompilerServices\ObjectType.vb (2)
850If s2.Length() > 0 Then 856If s1.Length() > 0 Then
Microsoft\VisualBasic\CompilerServices\Operators.vb (2)
846If Right.Length() = 0 Then 854If Left.Length() = 0 Then
Microsoft\VisualBasic\CompilerServices\StringType.vb (8)
173If sRight.Length() = 0 Then 181If sLeft.Length() = 0 Then 228PatternEndIndex = Pattern.Length 234SourceEndIndex = Source.Length 405PatternEndIndex = Pattern.Length 411SourceEndIndex = Source.Length 764DestLength = sDest.Length 770InsertLength = sInsert.Length
Microsoft\VisualBasic\CompilerServices\Utils.LateBinder.vb (3)
264length = value.Length 302length = value.Length 692Dim length As Integer = sRank.Length
Microsoft\VisualBasic\CompilerServices\VB6BinaryFile.vb (1)
128If s.Length > 0 Then
Microsoft\VisualBasic\CompilerServices\VB6File.vb (5)
1030If ByteLength = s.Length Then 1733FixedStringLength = obj.ToString().Length 1864If ByteLength = sTemp.Length Then 2114If NegativeSign.Length = 1 Then 2119ElseIf Left(s, NegativeSign.Length) = NegativeSign Then
Microsoft\VisualBasic\CompilerServices\VB6InputFile.vb (4)
84If sInput.Chars(0) = CChar("#") AndAlso sInput.Length <> 1 Then 86sInput = sInput.Substring(1, sInput.Length - 2) 100If sInput.Length > 6 Then 172If s.Length > 0 Then
Microsoft\VisualBasic\CompilerServices\VB6OutputFile.vb (3)
94If (s Is Nothing) OrElse (s.Length = 0) Then 100(m_lCurrentColumn <> 0 AndAlso (m_lCurrentColumn + s.Length) > m_lWidth) Then 111m_lCurrentColumn += s.Length
Microsoft\VisualBasic\CompilerServices\VB6RandomFile.vb (1)
332len = DirectCast(obj, String).Length
Microsoft\VisualBasic\CompilerServices\VBBinder.vb (1)
1981If (name.Length = 0) Then
Microsoft\VisualBasic\Conversion.vb (3)
532If s.Length > 0 AndAlso s.Chars(0) <> "-"c Then 550iLen = InputStr.Length 719iLen = InputStr.Length
Microsoft\VisualBasic\DateAndTime.vb (2)
524If Result.Length = 0 Then 563If Result.Length = 0 Then
Microsoft\VisualBasic\ErrObject.vb (4)
111If Msg Is Nothing OrElse Msg.Length = 0 Then 113ElseIf System.String.CompareOrdinal("Exception from HRESULT: 0x", 0, Msg, 0, Math.Min(Msg.Length, 26)) = 0 Then 177If HelpLink Is Nothing OrElse HelpLink.Length = 0 Then 192If iContext < HelpLink.Length Then
Microsoft\VisualBasic\FileIO\FileSystem.vb (12)
933If TargetDirectoryFullPath.Length > SourceDirectoryFullPath.Length AndAlso 934TargetDirectoryFullPath.Substring(0, SourceDirectoryFullPath.Length).Equals( 936Debug.Assert(TargetDirectoryFullPath.Length > SourceDirectoryFullPath.Length, "Target path should be longer") 938If TargetDirectoryFullPath.Chars(SourceDirectoryFullPath.Length) = IO.Path.DirectorySeparatorChar Then 1299Dim MaxByteDetectedEncoding As Integer = DetectedEncoding.GetMaxByteCount(Text.Length) 2214If CharBuffer.Length > m_SearchText.Length Then 2215If m_PreviousCharBuffer.Length <> m_SearchText.Length Then 2216ReDim m_PreviousCharBuffer(m_SearchText.Length - 1) 2218Array.Copy(sourceArray:=CharBuffer, sourceIndex:=(CharBuffer.Length - m_SearchText.Length), 2219destinationArray:=m_PreviousCharBuffer, destinationIndex:=0, length:=m_SearchText.Length)
Microsoft\VisualBasic\FileIO\TextFieldParser.vb (8)
403If Line.Length < numberOfChars Then 623If TrimmedLine.Length = 0 Then 931EndOfLine = Line.Length 942If Line.Length + NewLine.Length > m_MaxLineSize Then 1072Dim Length As Integer = Line.Length 1621Dim Length As Integer = Line.Length 1638If m_Index + 1 < Line.Length And Line(m_Index + 1) = """"c Then
Microsoft\VisualBasic\FileSystem.vb (10)
61If (Path Is Nothing) OrElse (Path.Length = 0) Then 98If Drive Is Nothing OrElse Drive.Length = 0 Then 202If Path Is Nothing OrElse Path.Length = 0 Then 218If Path Is Nothing OrElse Path.Length = 0 Then 256If (Source Is Nothing) OrElse (Source.Length = 0) Then 260If (Destination Is Nothing) OrElse (Destination.Length = 0) Then 366If Path.GetFileName(PathName).Length = 0 Then 388If (DirName Is Nothing) OrElse (DirName.Length = 0) Then 454If (PathName Is Nothing) OrElse (PathName.Length = 0) Then 1388If (FileName Is Nothing) OrElse (FileName.Length = 0) Then
Microsoft\VisualBasic\Information.vb (1)
398Dim LastChar As Integer = typename.Length - 1
Microsoft\VisualBasic\Interaction.vb (10)
44If (s Is Nothing) OrElse (s.Length = 0) Then 61LengthOfAppName = Environment.GetCommandLineArgs(0).Length 70If j = 0 OrElse j > s.Length Then 109If Expression.Length = 0 Then 331If IsNothing(Key) OrElse (Key.Length = 0) Then 483If IsNothing(sApp) OrElse (sApp.Length = 0) Then 485ElseIf IsNothing(sSect) OrElse (sSect.Length = 0) Then 493If (s Is Nothing) OrElse (s.Length = 0) Then 508If ProgId.Length = 0 Then 512If ServerName Is Nothing OrElse ServerName.Length = 0 Then
Microsoft\VisualBasic\Strings.vb (43)
215If ([String] Is Nothing) OrElse ([String].Length = 0) Then 225If ([String] Is Nothing) OrElse ([String].Length = 0) Then 330If Match Is Nothing OrElse Match.Length = 0 Then 400SrcLength = sSrc.Length 409If (sFind Is Nothing) OrElse (sFind.Length = 0) Then 420lSrcLen = sSrc.Length 429If (sFind Is Nothing) OrElse (sFind.Length = 0) Then 447lStrLen = StringCheck.Length 462If StringMatch.Length = 0 Then 600Return Expression.Length 641Return Expression.ToString().Length 673If (Expression Is Nothing) OrElse (Start > Expression.Length) Then 685If Find.Length = 0 OrElse Count = 0 Then 691Count = Expression.Length 708Dim ExpressionLength As Integer = Expression.Length 709Dim FindLength As Integer = Find.Length 780If Expression.Length = 0 Then 788Limit = Expression.Length + 1 794iDelLen = Delimiter.Length 826iFindLen = sFind.Length 832iSrcLen = sSrc.Length 927If Length > Source.Length Then 941If Length > Source.Length Then 963If s.Length = 0 Then 995If Character Is Nothing OrElse Character.Length = 0 Then 1006ElseIf Expression.Length <= 1 Then 1015Dim Output(Expression.Length - 1) As Char 1032Expression.CopyTo(LastSrcIndex, Output, 0, Expression.Length - LastSrcIndex) 1068Dim StyleLength As Integer = Style.Length 1246If Style Is Nothing OrElse Style.Length = 0 Then 1253If Style.Length > 0 Then 1303If Style Is Nothing OrElse Style.Length = 0 Then 1320If Style Is Nothing OrElse Style.Length = 0 Then 1825ElseIf (Index > [str].Length) Then 1846If Length >= [str].Length Then 1855If str Is Nothing OrElse str.Length = 0 Then 1873Return Mid([str], Start, [str].Length) 1898lStrLen = [str].Length 1920lStrLen = [str].Length 1931If [str] Is Nothing OrElse str.Length = 0 Then 1936ch = str.Chars(str.Length - 1) 1949If str Is Nothing OrElse str.Length = 0 Then 1957ch = str.Chars(str.Length - 1)
Microsoft.VisualBasic.Forms (1)
Microsoft\VisualBasic\Logging\FileLogTraceListener.vb (1)
512Dim length As Integer = STACK_DELIMITER.Length
Microsoft.VisualStudio.TestPlatform.Common (14)
DataCollection\DataCollectionManager.cs (1)
165if (settingsXml.Length == 0)
Logging\InternalTestLoggerEvents.cs (1)
424size += msg.Text.Length;
src\vstest\src\Microsoft.TestPlatform.Filter.Source\Condition.cs (3)
326for (int i = 0; i < s.Length; ++i) 366if (next < s.Length && s[next] == '=') 372else if (next < s.Length && s[next] == '~')
src\vstest\src\Microsoft.TestPlatform.Filter.Source\FilterExpression.cs (1)
425for (int i = 0; i < s.Length; ++i)
Utilities\SimpleJSON.cs (8)
476if (sb.Capacity < aText.Length + aText.Length / 10) 477sb.Capacity = aText.Length + aText.Length / 10; 523if (token.Length <= 5) 544while (i < aJSON.Length) 688if (AllowLineComments && !quoteMode && i + 1 < aJSON.Length && aJSON[i + 1] == '/') 690while (++i < aJSON.Length && aJSON[i] != '\n' && aJSON[i] != '\r') ;
Microsoft.VisualStudio.TestPlatform.Extensions.Trx.TestLogger (14)
Utility\Converter.cs (3)
600fullyQualifiedName.Substring(0, fullyQualifiedName.Length - testName.Length) : 656var testMethodName = fullyQualifiedName.StartsWith($"{className}.", StringComparison.Ordinal) ? fullyQualifiedName.Remove(0, $"{className}.".Length) : fullyQualifiedName;
Utility\TrxFileHelper.cs (6)
76StringBuilder result = new(fileName.Length); 77result.Length = fileName.Length; 80for (int i = 0; i < fileName.Length; ++i) 87if (replaced.Length == 0) 201for (i = 0; i < max && pathTokens[i].Length == 0 && basePathTokens[i].Length == 0; i++)
XML\XmlPersistence.cs (5)
589string defaultFieldLocation = fieldName.StartsWith("m_", StringComparison.Ordinal) ? fieldName.Substring(2, fieldName.Length - 2) : fieldName; 691for (int i = 0; i < str.Length; i++) 711builder ??= new StringBuilder(str, 0, i, GetInvalidXmlCharBuilderCapacity(str.Length)); 749string attributeName = location.Substring(1, location.Length - 1); 866if (part != "." && part != ".." && !part.Contains(":") && (part.Length > 0) && (!part.StartsWith("@", StringComparison.Ordinal)))
Microsoft.VisualStudio.TestPlatform.ObjectModel (10)
DataCollector\Common\FileHelper.cs (1)
44for (int i = 0; i < fileName.Length; i++)
Nuget.Frameworks\FrameworkNameHelpers.cs (1)
60if (versionString.Length < 2)
Nuget.Frameworks\FrameworkNameProvider.cs (2)
171if (versionString.Length < 2) 529var trimmed = profile.Substring(7, profile.Length - 7);
Nuget.Frameworks\NuGetFrameworkFactory.cs (3)
305while (versionStart < platformChars.Length 311string? platformVersionString = versionStart > 0 ? profileShort.Substring(versionStart, profileShort.Length - versionStart) : null; 463profile = s.Substring(actualProfileStart, s.Length - actualProfileStart);
src\vstest\src\Microsoft.TestPlatform.Filter.Source\FilterHelper.cs (3)
59for (int i = 0; i < str.Length; ++i) 89for (int i = 0; i < str.Length; ++i) 94if (++i == str.Length || !SpecialCharactersSet.Contains(currentChar = str[i]))
Microsoft.Web.Xdt.Extensions (1)
src\aspnetcore\src\Shared\ThrowHelpers\ArgumentNullThrowHelper.cs (1)
47else if (argument.Length == 0)
Microsoft.Web.XmlTransform (9)
XmlAttributePreservationDict.cs (2)
68xmlDocString = elementStartTag.Substring(0, elementStartTag.Length-1) + "/>" ; 83int lastCharacter = elementStartTag.Length;
XmlFileInfoDocument.cs (1)
210if (value.Length > 0) {
XmlFormatter.cs (3)
290for (int i = whitespace.Length - 1; i >= 0; i--) { 424return currentIndentNode.Value.Substring(previousIndentNode.Value.Length); 435for (int index = 0; index < indent.Length - 1; index++) {
XmlTransformation.cs (1)
296if (attribute.NamespaceURI.Length == 0) {
XmlTransforms.cs (2)
400System.Text.StringBuilder strbuilder = new StringBuilder(transformValue.Length); 515System.Text.StringBuilder strbuilder = new StringBuilder(transformValue.Length);
Microsoft.Win32.Registry (9)
Microsoft\Win32\Registry.cs (2)
41int length = i != -1 ? i : keyName.Length; 57subKeyName = (i == -1 || i == keyName.Length) ?
Microsoft\Win32\RegistryKey.cs (7)
240if (subkey.Length == 0) 333if (subkey.Length == 0 && IsSystemKey()) 1237if (name != null && name.Length > MaxValueLength) 1270checked(data.Length * 2 + 2)); 1292sizeInChars = checked(sizeInChars + (dataStrings[i].Length + 1)); 1302int length = dataStrings[i].Length; 1523if ((name.Length - current) > MaxKeyLength)
Mono.Cecil (18)
Mono.Cecil.Cil\Symbols.cs (1)
986 var bytesHeader = reader.ReadBytes (nativePdbHeader.Length);
Mono.Cecil.Metadata\Buffers.cs (6)
415 for (int i = x.Length - 1, j = y.Length - 1; i >= 0 & j >= 0; i--, j--) { 425 return y.Length.CompareTo (x.Length); 479 WriteCompressedUInt32 ((uint) @string.Length * 2 + 1); 483 for (int i = 0; i < @string.Length; i++) {
Mono.Cecil.Metadata\StringHeap.cs (1)
39 if (@string.Length != 0)
Mono.Cecil.PE\ImageWriter.cs (4)
354 for (int i = 0; i < sect_name.Length; i++) 546 return (@string.Length + 1 + 3) & ~3; 556 return GetString (@string, @string.Length); 562 for (int i = 0; i < @string.Length; i++)
Mono.Cecil\AssemblyNameReference.cs (2)
174 if (fullName.Length == 0) 203 name.PublicKeyToken = new byte [pk_token.Length / 2];
Mono.Cecil\AssemblyWriter.cs (1)
2669 for (int i = 0; i < path.Length; i++) {
Mono.Cecil\ModuleDefinition.cs (1)
1095 name = name.Substring (0, name.Length - 4);
Mono.Cecil\TypeParser.cs (1)
41 this.length = fullname.Length;
Mono.Cecil\WindowsRuntimeProjections.cs (1)
417 type.Name = type.Name.Substring ("<CLR>".Length);
Mono.Cecil.Pdb (1)
Mono.Cecil.Pdb\ModuleMetadata.cs (1)
615 var length = Math.Min (name.Length, bufferLength - 1);
Mono.Cecil.Rocks (1)
Mono.Cecil.Rocks\DocCommentId.cs (1)
263 return type.Name.LastIndexOf ('`') == name.Length;
MSBuild (34)
CommandLine\CommandLineParser.cs (7)
235if (unquotedCommandLineArg.Length > 0) 338if (responseFile.Length == 0) 438if (switchParameters.Length == 0) 482(switchParameters.Length > 1) || 487if (switchParameters.Length > 0) 625((terminalDoubleQuote == -1) || (terminalDoubleQuote == (commandLineArg.Length - 1)))) 652return envVar.StartsWith("%", StringComparison.Ordinal) && envVar.EndsWith("%", StringComparison.Ordinal) && envVar.Length > 1;
CommandLine\CommandLineSwitches.cs (1)
572if (switchParameters.Length > 0)
src\msbuild\src\Shared\StringExtensions.cs (5)
38var builder = new StringBuilder(aString.Length - oldValue.Length + newValue.Length); 46endOfPreviousOccurrence = currentOccurrence + oldValue.Length; 50builder.Append(aString, endOfPreviousOccurrence, aString.Length - endOfPreviousOccurrence);
src\msbuild\src\Shared\TypeLoader.cs (9)
170if (typeName1.Length != typeName2.Length) 176if (typeName1.Length > typeName2.Length) 190int matchIndex = longerTypeName.Length - shorterTypeName.Length; 516if ((_assemblyLoadInfo.AssemblyName != null) && (typeName.Length > 0)) 550if (typeName.Length == 0 || IsPartialTypeNameMatch(desiredTypeInAssembly.Key, typeName)) 602if (IsDesiredType(publicType) && (typeName.Length == 0 || IsPartialTypeNameMatch(publicType.FullName, typeName)))
XMake.cs (12)
609Console.WriteLine("\n{0}{1}{0}", new string('=', 41 - ("Process".Length / 2)), "Process"); 1076if (getResultOutputFile.Length == 0) 1160if (getResultOutputFile.Length == 0) 2629bool minimizeStdOutOutput = getProperty.Length + getItem.Length + getTargetResult.Length > 0 && getResultOutputFile.Length == 0; 3043return indexOfColon < 0 || indexOfColon == val.Length - 1; 3709InitializationException.VerifyThrow(extension?.Length >= 2, "InvalidExtensionToIgnore", extension); 3783CommandLineSwitchException.VerifyThrow((parameterSections[0].Length > 0) && (parameterSections.Length == 2), 3904if (!string.IsNullOrEmpty(result) && result[result.Length - 1] != ';') 4375CommandLineSwitchException.VerifyThrow(loggerSpec[0].Length > 0, 4412CommandLineSwitchException.VerifyThrow(loggerAssemblySpec.Length > 0, 4618if (toolsVersionList.Length > 0) 4620toolsVersionList = toolsVersionList.Substring(0, toolsVersionList.Length - 2);
MyFrontend (24)
artifacts\obj\MyFrontend\Debug\net8.0\Basket.cs (24)
148if (Id.Length != 0) hash ^= Id.GetHashCode(); 181if (Id.Length != 0) { 195if (Id.Length != 0) { 210if (other.Id.Length != 0) { 359if (BuyerId.Length != 0) hash ^= BuyerId.GetHashCode(); 394if (BuyerId.Length != 0) { 409if (BuyerId.Length != 0) { 425if (other.BuyerId.Length != 0) { 583if (BuyerId.Length != 0) hash ^= BuyerId.GetHashCode(); 618if (BuyerId.Length != 0) { 633if (BuyerId.Length != 0) { 649if (other.BuyerId.Length != 0) { 850if (Id.Length != 0) hash ^= Id.GetHashCode(); 903if (Id.Length != 0) { 933if (Id.Length != 0) { 960if (other.Id.Length != 0) { 1158if (BuyerId.Length != 0) hash ^= BuyerId.GetHashCode(); 1191if (BuyerId.Length != 0) { 1205if (BuyerId.Length != 0) { 1220if (other.BuyerId.Length != 0) { 1517if (BuyerId.Length != 0) hash ^= BuyerId.GetHashCode(); 1550if (BuyerId.Length != 0) { 1564if (BuyerId.Length != 0) { 1579if (other.BuyerId.Length != 0) {
NuGet.Build.Tasks (4)
GetRestoreSolutionProjectsTask.cs (2)
75projectPath = projectPath.Substring(0, projectPath.Length - MetaProjExtension.Length);
TaskLoggingQueue.cs (2)
61if (message.Length >= 2 && message[0] == '{' && message[message.Length - 1] == '}')
NuGet.Build.Tasks.Pack (2)
PackTaskLogic.cs (2)
1151if (index > 0 && index < item.Length - 1) 1158else if (index == item.Length - 1)
NuGet.CommandLine.XPlat (11)
Commands\PackageSearch\Table.cs (7)
53_columns.Add(new Column { Header = header, Width = header.Length }); 69_columns[i].Width = Math.Min(_maxColumnWidth, Math.Max(_columns[i].Width, row[i]?.Length ?? 0)); 151if (CharacterIndex >= value.Length) 163if (CharacterIndex < value.Length) 173if (CharacterIndex == value.Length - 1) 213for (int i = 0; i < substring.Length; i++) 217index += substring.Length;
Utility\TableParser.cs (2)
157if ((formattedDataCell.Value?.Length ?? 0) > maxColumnsWidth[colIndex]) 159maxColumnsWidth[colIndex] = formattedDataCell.Value.Length;
Utility\XPlatUtility.cs (2)
150var lastFourCharacters = extension.Length >= 4 151? extension.Substring(extension.Length - 4)
NuGet.Commands (20)
CommandRunners\PackCommandRunner.cs (1)
748path = path.Substring(index + basePath.Length).TrimStart(Path.DirectorySeparatorChar);
MSBuildProjectFactory.cs (3)
256projectDirectory = projectDirectory.Substring(0, projectDirectory.Length - 1); 276relativePath = relativePath.Substring(1, relativePath.Length - 1); 280relativePath = relativePath.Substring(0, relativePath.Length - 1);
RestoreCommand\CompatibilityChecker.cs (1)
196var withoutNi = name.Substring(0, name.Length - 3);
RestoreCommand\ContentFiles\ContentFileUtils.cs (5)
83var rootFolderPathLength = ContentFilesFolderName.Length; 119if (file.Length > rootFolderPathLength) 121var relativePath = file.Substring(rootFolderPathLength, file.Length - rootFolderPathLength); 241destination = destination.Substring(0, destination.Length - 3); 251lockFileItem.Path.AsSpan().Slice(0, lockFileItem.Path.Length - 3));
RestoreCommand\Utility\BuildAssetsUtils.cs (2)
121path = $"$({macroName})" + $"{path.Substring(macroValue.Length)}"; 373path = $"$(NuGetPackageRoot){absolutePath.Substring(repositoryRoot.Length)}";
RestoreCommand\Utility\LockFileUtils.cs (4)
857return segment.Length > roslynPrefix.Length 859&& char.IsDigit(segment[roslynPrefix.Length]); 988var emptyDir = firstItem.Path.Substring(0, firstItem.Path.Length - fileName.Length)
RestoreCommand\Utility\MSBuildRestoreUtility.cs (4)
1205if (s.Length >= (prefixWithoutSlashes.Length + 2) 1210return s.Substring(0, prefixWithoutSlashes.Length) + slashes + s.Substring(prefixWithoutSlashes.Length + 1);
NuGet.Common (21)
MsBuildStringUtility.cs (2)
35.Where(entry => entry.Length != 0) 53return s.Length == 0 ? null : s;
PathUtil\PathResolver.cs (4)
221searchPath = searchPath.Substring(parentDirectoryPath.Length); 237return path != null && path.Length > 1 && 238(path[path.Length - 1] == Path.DirectorySeparatorChar || 239path[path.Length - 1] == Path.AltDirectorySeparatorChar);
PathUtil\PathUtility.cs (10)
115if (path.Length == 0 116|| path[path.Length - 1] == trailingCharacter) 124return path.Substring(0, path.Length - 1) + trailingCharacter; 154return IsDirectorySeparatorChar(path![path.Length - 1]); 304return path.Substring(fullDirectoryPath.Length).Trim(Path.DirectorySeparatorChar, Path.AltDirectorySeparatorChar); 371if (path.Length <= maxWidth) 387var remainingWidth = maxWidth - root.Length - 3; // 3 = length(ellipsis) 390if (folder.Length >= remainingWidth) 397folder.Substring(folder.Length - remainingWidth)); 515filename = filename.Substring(currentDirectoryPath.Length);
PathUtil\ProjectJsonPathUtilities.cs (2)
124var prefixLength = file.Length - ProjectConfigFileName.Length - 1;
Tokenizer\Tokenizer.cs (3)
44if (_index >= _text.Length) 78while (_index < _text.Length) 120while (_index < _text.Length && _text[_index] != '$')
NuGet.Configuration (14)
PackageSourceMapping\SearchTree.cs (5)
42if (packagePattern.Length > PackageSourceMapping.PackageIdMaxLength) 50for (int i = 0; i < packagePattern.Length; i++) 124for (; i < term.Length; i++) 141if (i == term.Length && currentNode.PackageSources != null) 168for (; i < term.Length; i++)
Settings\Items\MinPublishAgeExceptionItem.cs (1)
34if (value.Length > PackageSourceMapping.PackageIdMaxLength)
Settings\Settings.cs (2)
670if (combinedPath.Length == 0) 800&& root.Length == 1
Utility\FileSystemUtility.cs (3)
99return fullPath.Substring(root.Length).TrimStart(Path.DirectorySeparatorChar); 120if (path.Length == 0 121|| path[path.Length - 1] == trailingCharacter)
Utility\XElementUtility.cs (3)
63textBeforeOrNull.Value = textBeforeOrNull.Value.Substring(0, textBeforeOrNull.Value.Length - oneIndentLevel.Length); 82var indentLevel = Math.Max(1, indentString.Length / depth);
NuGet.DependencyResolver.Core (4)
Remote\RemoteDependencyWalker.cs (4)
486var lengthToCompare = Math.Min(nearRelease.Length, farRelease.Length); 512return nearRelease.Length <= farRelease.Length;
NuGet.Frameworks (6)
FrameworkNameHelpers.cs (1)
60if (versionString.Length < 2)
FrameworkNameProvider.cs (2)
178if (versionString.Length < 2) 541var trimmed = profile.Substring(7, profile.Length - 7);
NuGetFrameworkFactory.cs (3)
302while (versionStart < platformChars.Length 308string? platformVersionString = versionStart > 0 ? profileShort.Substring(versionStart, profileShort.Length - versionStart) : null; 460profile = s.Substring(actualProfileStart, s.Length - actualProfileStart);
NuGet.LibraryModel (10)
LibraryDependencyTargetUtils.cs (10)
30var segment = StringSegment.CreateTrimmed(flag, 0, flag.Length - 1); 59if (start >= flag.Length) 68end = flag.Length; 79if ("package".Length == flag.Length && string.Compare(flag.String, flag.Start, "package", 0, flag.Length, StringComparison.OrdinalIgnoreCase) == 0) 83else if ("project".Length == flag.Length && string.Compare(flag.String, flag.Start, "project", 0, flag.Length, StringComparison.OrdinalIgnoreCase) == 0) 87else if ("externalproject".Length == flag.Length && string.Compare(flag.String, flag.Start, "externalproject", 0, flag.Length, StringComparison.OrdinalIgnoreCase) == 0) 91else if ("reference".Length == flag.Length && string.Compare(flag.String, flag.Start, "reference", 0, flag.Length, StringComparison.OrdinalIgnoreCase) == 0) 95else if ("assembly".Length == flag.Length && string.Compare(flag.String, flag.Start, "assembly", 0, flag.Length, StringComparison.OrdinalIgnoreCase) == 0) 99else if ("winmd".Length == flag.Length && string.Compare(flag.String, flag.Start, "winmd", 0, flag.Length, StringComparison.OrdinalIgnoreCase) == 0) 103else if ("all".Length == flag.Length && string.Compare(flag.String, flag.Start, "all", 0, flag.Length, StringComparison.OrdinalIgnoreCase) == 0)
NuGet.PackageManagement (16)
Utility\FileSystemUtility.cs (8)
186if (filePath.Length > root.Length) 188trimmedPaths.Add(filePath.Substring(root.Length).TrimStart(Path.DirectorySeparatorChar)); 278orderby directory.Length descending 489if (fullPath.Length <= root.Length) 493return fullPath.Substring(root.Length).TrimStart(Path.DirectorySeparatorChar); 498return fullPath.Substring(root.Length).TrimStart(Path.DirectorySeparatorChar);
Utility\MSBuildNuGetProjectSystemUtility.cs (5)
234orderby directory.Length descending 566truncatedPath = effectivePath.Substring(0, effectivePath.Length - extension.Length); 589effectivePathForContentFile = effectivePathForContentFile.Substring((PackagingConstants.Folders.Content + Path.DirectorySeparatorChar).Length); 596if (effectivePathForContentFile.Length > frameworkFolderEndIndex + 1)
Utility\XElementExtensions.cs (3)
330textBeforeOrNull.Value = textBeforeOrNull.Value.Substring(0, textBeforeOrNull.Value.Length - oneIndentLevel.Length); 353var indentLevel = Math.Max(1, indentString.Length / depth);
NuGet.Packaging (72)
ContentModel\ContentItemCollection.cs (2)
57Path = "ref/any" + path.Substring("lib/contract".Length) 359for (var i = 1; i < path.Length; i++)
ContentModel\Infrastructure\Parser.cs (12)
27for (var scanIndex = 0; scanIndex < pattern.Length;) 29var beginToken = pattern.Length; 30var endToken = pattern.Length; 31for (var i = scanIndex; i < pattern.Length; i++) 34if (beginToken == pattern.Length) 54var delimiter = endToken + 1 < pattern.Length ? pattern[endToken + 1] : '\0'; 82if (startIndex == path.Length) 134if (path.Length >= startIndex + _length) 183for (var scanIndex = startIndex; scanIndex != path.Length;) 185var delimiterIndex = path.Length; 186for (var i = scanIndex + 1; i < path.Length; i++) 195if (delimiterIndex == path.Length
Licenses\LicenseExpressionTokenizer.cs (6)
54while (processingToken.Length > 0 && (processingToken[0] == '(' || processingToken[0] == ')')) 61while (processingToken.Length > 0 && (processingToken[processingToken.Length - 1] == '(' || processingToken[processingToken.Length - 1] == ')')) 68tokensAfterValue.Add(ParseBracket(processingToken[processingToken.Length - 1])); 69processingToken = processingToken.Substring(0, processingToken.Length - 1);
Licenses\NuGetLicense.cs (2)
60if (licenseIdentifier[licenseIdentifier.Length - 1] == '+') 62var cleanIdentifier = licenseIdentifier.Substring(0, licenseIdentifier.Length - 1);
PackageCreation\Authoring\ManifestMetadata.cs (1)
307if (Id!.Length > PackageIdValidator.MaxPackageIdLength)
PackageCreation\Authoring\PackageBuilder.cs (3)
973if (warningMessage.Length > Environment.NewLine.Length) 975warningMessage.Length -= Environment.NewLine.Length; 1050packagePath = fullPath.Substring(searchDirectory.Length).TrimStart(Path.DirectorySeparatorChar);
PackageCreation\Utility\FrameworkNameUtility.cs (8)
20if (filePath.Length > folderPrefix.Length && 23string frameworkPart = filePath.Substring(folderPrefix.Length); 78effectivePath = path.Substring(targetFrameworkString.Length + 1); 90if (filePath.Length > folderPrefix.Length && 93string frameworkPart = filePath.Substring(folderPrefix.Length); 148effectivePath = path.Substring(targetFrameworkString.Length + 1);
PackageCreation\Utility\PackageIdValidator.cs (4)
53if (packageId.Length > MaxPackageIdLength) 71if (packageId.Length == 0 || packageId.Length > MaxPackageIdLength) 83for (int i = 1; i < packageId.Length; i++)
PackageExtraction\PackageHelper.cs (2)
109localRuntimePackageId = packageId.Substring(0, packageId.Length - packageLanguage!.Length - 1);
PackageExtraction\PackagePathHelper.cs (3)
99return name.Length > packageId.Length && 100NuGetVersion.TryParse(name.Substring(packageId.Length + 1), out parsedVersion) &&
PackageExtraction\StreamExtensions.cs (1)
75if (Path.GetFileName(fileFullPath).Length == 0)
PackageReaderBase.cs (2)
558if (!fullPath.StartsWith(normalizedDestination, PathUtility.GetStringComparisonBasedOnOS()) || fullPath.Length == normalizedDestination.Length)
Rules\AccidentallyCompatibleWithAllFrameworksRule.cs (2)
116int estimatedLength = possibleFrameworks.Count * "-lib//_.)".Length + possibleFrameworks.Sum(f => f.Length);
Rules\PathTooLongRule.cs (1)
26if (Path.Combine(installedPath, file).Length > _pathLenghtWarningThreshold)
Rules\UpholdBuildConventionRule.cs (3)
138if (file.StartsWith(buildFolder, StringComparison.Ordinal) && file[buildFolder.Length] == '/') 157if (filePath[filePath.Length - 1] != '/' && filePath[filePath.Length - 1] != '\\')
Signing\DerEncoding\DerEncoder.cs (5)
450if (oidValue.Length < 3 /* "1.1" is the shortest value */) 491List<byte> encodedBytes = new List<byte>(oidValue.Length / 2); 495while (startPos < oidValue.Length) 968Debug.Assert(startIndex < oidValue.Length); 974endIndex = oidValue.Length;
Signing\DerEncoding\DerGeneralizedTime.cs (4)
25if (string.IsNullOrEmpty(decodedTime) || decodedTime.Length < minimumValidLength) 30if (decodedTime[decodedTime.Length - 1] != 'Z') 51var fractionalSecondDigits = decodedTime.Length - 2 - decimalIndex; 60if (decodedTime[decodedTime.Length - 2] == '0')
Signing\DerEncoding\DerSequenceReader.cs (5)
457if (value.Length > 0) 459int newLength = value.Length; 466if (newLength != value.Length) 484decodedTime[decodedTime.Length - 1] == 'Z', 485$"The date doesn't follow the X.690 format, ending with {decodedTime[decodedTime.Length - 1]}");
Signing\Timestamp\Rfc3161TimestampUtils.cs (3)
26if (algorithmIdentifier == null || algorithmIdentifier.Length < 3) 111byte[] bytes = new byte[hexString.Length / 2]; 113for (int i = 0; i < hexString.Length; i += 2)
Signing\TrustStore\FallbackCertificateBundleX509ChainFactory.cs (1)
62if (AppContext.GetData("Microsoft.DotNet.Sdk.Root") is string sdkRoot && sdkRoot.Length > 0)
Signing\Utility\CertificateUtility.cs (2)
421switch (certificateFingerprint.Length) 456for (var i = 0; i < certificateFingerprint.Length; ++i)
NuGet.ProjectModel (8)
LazyStringSplit.cs (2)
82while (_index != _input.Length) 89_index = _input.Length;
MacroStringsUtility.cs (2)
58return macroName + originalString.Substring(macroValue.Length); 67return macroValue + originalString.Substring(macroName.Length);
PackageSpecUtility.cs (3)
22version = version.Substring(0, version.Length - 2); 26version = version.Substring(0, version.Length - 1) + snapshotValue; 46return NuGetVersion.TryParse(version.Substring(0, version.Length - 2), out _);
StringExtensions.cs (1)
24index >= s.Length - 1 ?
NuGet.Protocol (10)
LegacyFeed\LegacyFeedCapabilityResourceV2Feed.cs (1)
203if (lastIndex > 0 && lastIndex < packageEntityName.Length)
PackagesFolder\NuGetv3LocalRepository.cs (1)
184var versionPart = fullVersionDir.Substring(packageIdRoot.Length).TrimStart(Path.DirectorySeparatorChar);
Plugins\StandardOutputReceiver.cs (1)
109if (!IsClosed && line != null && line.Length > 0)
Resources\OwnerDetailsUriTemplateResourceV3.cs (1)
34if (uriTemplate.OriginalString.Length == 0
Resources\VulnerabilityInfoResourceV3.cs (2)
224if (name.Length > maxNameLength) 232for (int j = 0; j < name.Length; j++)
Utility\CachingUtility.cs (2)
27var trailing = value.Length > 32 ? value.Substring(value.Length - 32) : value;
Utility\LocalFolderUtility.cs (1)
600var versionString = idVersionString.Substring(prefix.Length);
Utility\MetadataReferenceCache.cs (1)
30if (s.Length == 0)
NuGet.Versioning (26)
FloatRange.cs (8)
224if (versionString.Length == 1 241lastStarPosition == versionString.Length - 1 && // Last star is at the end of the full string 268releasePrefix = releaseVersion.Substring(0, releaseVersion.Length - 1); 270if (releasePrefix.Length == 0 || releasePrefix.EndsWith(".", StringComparison.Ordinal)) 286else if (lastStarPosition == versionString.Length - 1 && IndexOf(versionString, '+') == -1) 290var actualVersion = versionString.Substring(0, versionString.Length - 1); 322if (releasePrefix.Length == 0 || actualVersion.EndsWith(".", StringComparison.Ordinal)) 368for (var i = 0; i < line.Length; i++)
NuGetVersionFactory.cs (8)
149lastParsedPosition == str.Length; 166if (start == str.Length) 174for (end = start; end < str.Length; ++end) 196for (; end < str.Length; ++end) 221if (end == str.Length) 248if (end == str.Length) 256for (; end < str.Length; ++end) 265if (end == str.Length)
SemanticVersionFactory.cs (6)
127if (s.Length == 0) 136&& s.Length > 1 143for (int i = 1; i < s.Length; i++) 159for (int i = 0; i < s.Length; i++) 187for (var i = 0; i < value.Length; i++) 189end = (i == value.Length - 1);
VersionRange.cs (2)
380fixedReleaseLabel = lastLabel.Substring(0, lastLabel.Length - 2); 385fixedReleaseLabel = lastLabel.Substring(0, lastLabel.Length - 1);
VersionRangeFactory.cs (1)
174trimmedValue = trimmedValue.Substring(1, trimmedValue.Length - 2);
VersionRangeFormatter.cs (1)
41for (var i = 0; i < format!.Length; i++)
PresentationBuildTasks (129)
Microsoft\Build\Tasks\Windows\MarkupCompilePass1.cs (2)
1062if (relPath.Length > 0) 1309if (ApplicationFile != null && ApplicationFile.Length > 0)
Microsoft\Build\Tasks\Windows\MarkupCompilePass2.cs (1)
525if (relPath.Length > 0)
Microsoft\Build\Tasks\Windows\UidManager.cs (3)
520reader.LinePosition + reader.Name.Length, 1263get { return (Index == Content.Length); } 1291Index = Content.Length;
MS\Internal\MarkupCompiler\MarkupCompiler.cs (38)
246if (cu.ApplicationFile.Path != null && cu.ApplicationFile.Path.Length > 0) 251if (ApplicationFile.Length > 0) 273if (SourceFileInfo.RelativeSourceFilePath.Length > 0) 469if (TargetPath.Length > 0) 482if (targetPath.Length > 0 && !Directory.Exists(targetPath)) 634if (codeProvider.Supports(GeneratorSupport.PartialTypes) && _ccRoot.SubClass.Length == 0) 1302if (ReferenceAssemblyList[i] is ReferenceAssembly refasm && refasm.Path.Length > 0) 1319if (ReferenceAssemblyList[i] is ReferenceAssembly refasm && refasm.Path.Length > 0) 1333asmMissing += $"{(asmMissing.Length > 0 ? ", " : string.Empty)}PresentationCore"; 1337asmMissing += $"{(asmMissing.Length > 0 ? ", " : string.Empty)}PresentationFramework"; 1340if (asmMissing.Length > 0) 1385if (ns != null && ns.Length > 0) 1422if (className.Length > 0) 1442if (typeArgs.Length == 0) 1501if (className.Length == 0 ||!NameValidationHelper.IsValidIdentifierName(className)) 1511if (ns.Length > 0) 1542if (handler.Length == 0) 1603string relPath = TargetPath.Substring(SourceFileInfo.SourcePath.Length); 1636if (_private.Length == 0) 1702if (modifier.Length > 0) 1704if (_privateClass.Length == 0) 1914bool subClassed = _ccRoot.SubClass.Length > 0; 1959bool subClassed = _ccRoot.SubClass.Length > 0; 2015Debug.Assert(_ccRoot != null && _ccRoot.SubClass.Length > 0); 2222if (codeText == null || codeText.Trim().Length == 0) 2249if (localTypeArgNamespace.Length == 0 && localTypeArgClassName.Length == 0) 2288if (genericName.Length > 0 || t.IsGenericType) 2290Debug.Assert(genericName.Length > 0 || t.IsGenericTypeDefinition); 2294Debug.Assert(genericName.Length == 0 && typeArgsList != null); 2455else if (baseClassFullName.Length > 0) 2511else if (IsCompilingEntryPointClass && className.Length == 0) 2999if (className.Length > 0) 3003else if (subClassFullName.Length > 0) 3007else if (modifier.Length > 0) 3030if (subClassFullName.Length > 0) 3138string appClassName = _ccRoot.SubClass.Length > 0 ? _ccRoot.SubClass 3214if (ApplicationFile.Length > 0)
MS\Internal\MarkupCompiler\ParserExtension.cs (4)
195if (localElementFullName.Length > 0 && !_pass2) 242if (xamlUnknownAttributeNode.OwnerTypeFullName.Length > 0) 338if (localTagFullName.Length > 0 && !_pass2) 751if ((xamlPIMappingNode.AssemblyName == null) || (xamlPIMappingNode.AssemblyName.Length == 0))
MS\Internal\MarkupCompiler\PathInternal.cs (9)
56int relativeToLength = relativeTo.Length; 61int pathLength = path.Length; 140if (commonChars == first.Length 141&& (commonChars == second.Length || IsDirectorySeparator(second[commonChars]))) 144if (commonChars == second.Length && IsDirectorySeparator(first[commonChars])) 265char* leftEnd = l + first.Length; 266char* rightEnd = r + second.Length; 345=> path != null && path.Length > 0 && PathInternal.IsDirectorySeparator(path[path.Length - 1]);
MS\Internal\MarkupCompiler\VersionHelper.cs (1)
118for (var idx = 0; idx < elements[i].Length; idx++)
MS\Internal\Tasks\CompilerState.cs (2)
260Debug.Assert(src[str.Length] == '\0', "src[str.Length] == '\\0'"); 267int length = str.Length;
MS\Internal\Tasks\CompilerWrapper.cs (1)
404relPath = fullFilePath.Substring(_sourceDir.Length);
MS\Internal\Tasks\TaskHelper.cs (4)
104relPath = fullpath2.Substring (fullpath1.Length); 122if (str != null && str.Length > 0) 145if (str != null && str.Length > 0) 169if (name != null && name.Length > 0)
src\wpf\src\Microsoft.DotNet.Wpf\src\PresentationCore\MS\internal\Media\XamlSerializationHelper.cs (2)
372List<ThreeDoublesMarkup> resource = new List<ThreeDoublesMarkup>( source.Length/ 8 ) ; // SWAG the length of the collection. 398List<Point> resource = new List<Point>(source.Length/ 8 ); // SWAG the length of the collection.
src\wpf\src\Microsoft.DotNet.Wpf\src\PresentationCore\System\Windows\Media\Knowncolors.cs (1)
283switch (colorString.Length)
src\wpf\src\Microsoft.DotNet.Wpf\src\PresentationCore\System\Windows\Media\ParsersCommon.cs (5)
113while ((curIndex < pathString.Length) && Char.IsWhiteSpace(pathString, curIndex)) 119if (curIndex < pathString.Length) 127while ((curIndex < pathString.Length) && Char.IsWhiteSpace(pathString, curIndex)) 134if ((curIndex == pathString.Length) || 519_pathLength = pathString.Length;
src\wpf\src\Microsoft.DotNet.Wpf\src\PresentationFramework\MS\Internal\Globalization\LocalizationComments.cs (3)
86for (int i = 0; i < input.Length; i++) 211for (int i = 0; i < input.Length; i++) 357enumName = enumName.Substring(_enumPrefix.Length);
src\wpf\src\Microsoft.DotNet.Wpf\src\PresentationFramework\System\Windows\Markup\BamlMapTable.cs (1)
1004Debug.Assert(assemblyFullName.Length != 0, "empty assembly");
src\wpf\src\Microsoft.DotNet.Wpf\src\PresentationFramework\System\Windows\Markup\MarkupExtensionParser.cs (5)
113if (attrValue.Length < 2) 339int length = attrValue.Length; 933int length = args.Length; 1616for (int i = 0; i < value.Length; i++) 1622builder = new StringBuilder(value.Length);
src\wpf\src\Microsoft.DotNet.Wpf\src\PresentationFramework\System\Windows\Markup\ParserContext.cs (1)
426if (parserContext.XmlSpace != null && parserContext.XmlSpace.Length != 0)
src\wpf\src\Microsoft.DotNet.Wpf\src\PresentationFramework\System\Windows\Markup\StyleXamlParser.cs (4)
169if (localElementFullName.Length == 0 || !IsLocalPass1) 253if (xamlUnknownAttributeNode.OwnerTypeFullName.Length > 0) 313if (localTagFullName.Length == 0 || !IsLocalPass1) 1181for (int i = 0; i< xamlTextNode.Text.Length; i++)
src\wpf\src\Microsoft.DotNet.Wpf\src\PresentationFramework\System\Windows\Markup\TemplateXamlParser.cs (4)
184if (localElementFullName.Length == 0 || !IsLocalPass1) 290if (xamlUnknownAttributeNode.OwnerTypeFullName.Length > 0) 350if (localTagFullName.Length == 0 || !IsLocalPass1) 1312for (int i = 0; i< xamlTextNode.Text.Length; i++)
src\wpf\src\Microsoft.DotNet.Wpf\src\PresentationFramework\System\Windows\Markup\XamlBrushSerializer.cs (1)
133if (stringValue.Length > 3)
src\wpf\src\Microsoft.DotNet.Wpf\src\PresentationFramework\System\Windows\Markup\XamlParser.cs (1)
733if (xamlPIMappingNode.AssemblyName.Length == 0)
src\wpf\src\Microsoft.DotNet.Wpf\src\PresentationFramework\System\Windows\Markup\XamlReaderHelper.cs (12)
2212prefix = attribName.Substring(NamespacePrefix.Length); 2360MappingParser parser = new MappingParser(mappingUri, MappingProtocol.Length); 2369bool isLocalAssembly = assemblyName == null || assemblyName.Length < 1; 2499return len == value.Length && string.CompareOrdinal(value, 0, _text, _start, len) == 0; 3204$"Set{methodInfo.Name.Substring("Get".Length)}", 3516null != methodInfo.DeclaringType.GetMethod($"Set{methodInfo.Name.Substring("Get".Length)}", 5476for (int i = 0; i < text.Length; i++) 5491Debug.Assert(currentPos > 0 && currentPos < s.Length - 1); 5563int textLength = text.Length; 5574StringBuilder collapsedTextStringBuilder = new StringBuilder(text.Length); 6379if (null != textFlowData.TextNode && textFlowData.TextNode.Text.Length > 0) 6390if (collapsedText.Length > 0)
src\wpf\src\Microsoft.DotNet.Wpf\src\PresentationFramework\System\Windows\Markup\XamlTypeMapper.cs (7)
722for (int i = 0; i < attribValue.Length; i++) 1851if( xmlLangPropertyName != null && xmlLangPropertyName.Length > 0) 2100return methodInfo.Name.Substring("Get".Length); 2270else if (!isTypeExpected && prefix.Length == 0) 3616if (keyString.Length > 0 && 3618Char.IsWhiteSpace(keyString[keyString.Length-1]))) 4332if (null == _assembly && _assemblyName.Length > 0)
src\wpf\src\Microsoft.DotNet.Wpf\src\PresentationFramework\System\Windows\Markup\XmlnsDictionary.cs (4)
709if (xmlNamespace.Length > 0 || prefix.Length > 0) 734if (prefix.Length > 0 || _nsDeclarations[thisDecl].Uri.Length > 0)
src\wpf\src\Microsoft.DotNet.Wpf\src\PresentationFramework\System\Windows\SystemResourceKey.cs (1)
385srkField = memberName.Remove(memberName.Length - 3);
src\wpf\src\Microsoft.DotNet.Wpf\src\Shared\MS\Internal\ReflectionUtils.cs (4)
110assemblyVersion = assemblyName.Slice(versionIndex + Version.Length, tokenLength - Version.Length); 122assemblyToken = assemblyName.Slice(tokenIndex + PublicKeyToken.Length, tokenLength - PublicKeyToken.Length);
src\wpf\src\Microsoft.DotNet.Wpf\src\Shared\MS\Internal\ResourceIDHelper.cs (1)
72resourceID = sourcePath.Substring(basePath.Length);
src\wpf\src\Microsoft.DotNet.Wpf\src\Shared\MS\Internal\TokenizerHelper.cs (2)
65_strLen = str == null ? 0 : str.Length; 317if ((numberFormat.NumberDecimalSeparator.Length > 0) && (numericSeparator == numberFormat.NumberDecimalSeparator[0]))
src\wpf\src\Microsoft.DotNet.Wpf\src\Shared\System\Windows\Markup\RuntimeIdentifierPropertyAttribute.cs (1)
96for (int i = 0; i < name.Length; i++)
src\wpf\src\Microsoft.DotNet.Wpf\src\Shared\System\Windows\Markup\TypeConverterHelper.cs (1)
89$"Get{methodInfo.Name.Substring("Set".Length)}",
src\wpf\src\Microsoft.DotNet.Wpf\src\Shared\System\Windows\Markup\XmlCompatibilityReader.cs (1)
961int length = pair.Length;
src\wpf\src\Microsoft.DotNet.Wpf\src\WindowsBase\MS\Internal\IO\Packaging\CompoundFile\ContainerUtilities.cs (1)
115strByteLen = outputString.Length * 2;
src\wpf\src\Microsoft.DotNet.Wpf\src\WindowsBase\System\IO\Packaging\CompoundFile\FormatVersion.cs (1)
75if (featureId.Length == 0)
PresentationCore (127)
MS\Internal\FontCache\CanonicalFontFamilyReference.cs (1)
173if (familyNameIndex < normalizedString.Length)
MS\Internal\FontCache\DWriteFactory.cs (2)
71if (string.Equals((localPath.Length > 0 && localPath[localPath.Length - 1] != Path.DirectorySeparatorChar) ? localPath + Path.DirectorySeparatorChar : localPath, Util.WindowsFontsUriObject.LocalPath, StringComparison.OrdinalIgnoreCase))
MS\Internal\FontCache\FamilyCollection.cs (4)
330if (familyName == null || familyName.Length == 0) 396if (familyName.Length != originalFamilyName.Length) 399int faceNameIndex = familyName.Length + 1;
MS\Internal\FontCache\FontCacheUtil.cs (4)
427length = s.Length; 616return NormalizeFontFamilyReference(fontFamilyReference, 0, fontFamilyReference.Length); 717int aLength = a.Length; 718int bLength = b.Length;
MS\Internal\FontCache\FontResourceCache.cs (4)
73escapedPath = escapedPath.Substring(0, escapedPath.Length - FakeFileName.Length); 100return path.Length == 0 || path[path.Length - 1] == '/';
MS\Internal\FontCache\FontSourceCollection.cs (1)
74_isFileSystemFolder = localPath[localPath.Length - 1] == Path.DirectorySeparatorChar;
MS\Internal\FontFace\CompositeFontInfo.cs (1)
169if (matchingLanguage.IetfLanguageTag.Length == 0)
MS\Internal\FontFace\CompositeFontParser.cs (1)
127if (s.Length > 1 && s[1] == '}')
MS\Internal\FontFace\FontFamilyIdentifier.cs (1)
292int length = friendlyName.Length;
MS\Internal\IListConverters.cs (4)
98List<double> list = new List<double>(Math.Min(256, value.Length / EstimatedCharCountPerItem + 1)); 141List<ushort> list = new List<ushort>(Math.Min(256, value.Length / EstimatedCharCountPerItem + 1)); 182List<bool> list = new List<bool>(Math.Min(256, value.Length / EstimatedCharCountPerItem + 1)); 224List<Point> list = new List<Point>(Math.Min(256, value.Length / EstimatedCharCountPerItem + 1));
MS\Internal\IO\Packaging\ByteRangeDownloader.cs (4)
55if (tempFileName.Length <= 0) 777if (contentRange.Length == 0 792int firstByteOffset = Int32.Parse(contentRange.AsSpan(ByteRangeUnit.Length, 793index - ByteRangeUnit.Length),
MS\Internal\Text\TextInterface\Factory.cs (1)
311uint collectionKeySize = (uint)((uriString.Length + 1) * sizeof(char));
MS\Internal\TextFormatting\NumberSubstitution.cs (3)
212if (d.Length != 1 || d[0] != (char)('0' + i)) 612if (s.Length == 1) 616else if (s.Length == 2 &&
MS\Internal\TextFormatting\TextMarkerSource.cs (1)
271int b = numericSymbols.Length;
MS\Internal\WindowsRuntime\Windows\UI\ViewManagement\InputPaneRcw.cs (1)
25Marshal.ThrowExceptionForHR(NativeMethods.WindowsCreateString(typeName, typeName.Length, out hstring));
MS\Internal\WindowsRuntime\Windows\UI\ViewManagement\UISettingsRcw.cs (1)
20int hr = NativeMethods.WindowsCreateString(typeName, typeName.Length, out hstring);
src\wpf\src\Microsoft.DotNet.Wpf\src\Shared\MS\Internal\CharacterBuffer.cs (4)
295get { return _string.Length; } 344Debug.Assert(characterOffset >= 0 && characterOffset < _string.Length, "Invalid character index"); 347|| characterOffset + characterLength > _string.Length) 349characterLength = _string.Length - characterOffset;
System\Windows\DataFormat.cs (1)
20if (name.Length == 0)
System\Windows\FontStretches.cs (1)
70switch (s.Length)
System\Windows\FontWeights.cs (1)
99switch (s.Length)
System\Windows\Ink\StrokeCollectionConverter.cs (1)
80if (text.Length != 0)
System\Windows\Input\AccessKeyManager.cs (2)
287if ((text == null) || (text.Length == 0)) 292if ((text != null) && (text.Length > 0))
System\Windows\Input\Command\KeyGestureConverter.cs (1)
80if (fullName.Length == 0)
System\Windows\Input\Command\MouseGestureConverter.cs (1)
58if (fullName.Length == 0)
System\Windows\Input\Command\RoutedCommand.cs (1)
48if (name.Length == 0)
System\Windows\Input\DefaultTextStore.cs (2)
136if (result.Length > 0) 167if (comp.Length > 0)
System\Windows\Input\TextComposition.cs (1)
305Debug.Assert((_resultText.Length == 1) && Char.IsControl(_resultText[0]));
System\Windows\InterOp\HwndSource.cs (1)
2042if ((text != null) && (text.Length > 0))
System\Windows\Markup\XamlSerializerUtil.cs (1)
52for (int i = 0; i < s.Length; i++)
System\Windows\Markup\XmlLanguage.cs (13)
226if (_lowerCaseTag.Length == 0 || string.Equals(_lowerCaseTag, "und", StringComparison.Ordinal)) 234if (culture.IetfLanguageTag.Length == 0) 420if (languageTag.Length > 0) 431int tagLength = languageTag.Length; 537else if (_current.IetfLanguageTag.Length == 0) 630return (prefix.Length == 0 || prefix.Length == longTag.Length || longTag[prefix.Length] == '-'); 672if (languageTag.Length == 0) 677int i = languageTag.Length - 1; 711if (ietfLanguageTag.Length > 0) 798int length = tag.Length;
System\Windows\Media\Animation\KeyTimeConverter.cs (1)
82else if (stringValue[stringValue.Length - 1] == '%')
System\Windows\Media\Animation\RepeatBehaviorConverter.cs (2)
79else if ( stringValue.Length > 0 80&& stringValue[stringValue.Length - 1] == _iterationCharacter)
System\Windows\Media\CharacterMetrics.cs (3)
141while (i < s.Length && s[i] == ' ') 146while (j < s.Length && s[j] != ',') 176if (j < s.Length)
System\Windows\Media\CharacterMetricsDictionary.cs (1)
491if (!FontFamilyMap.ParseHexNumber(s, ref i, out value) || i < s.Length)
System\Windows\Media\FamilyMap.cs (7)
228while (index < unicodeRanges.Length) 238if (index < unicodeRanges.Length) 248index < unicodeRanges.Length && 264(index<unicodeRanges.Length && unicodeRanges[index] !=',')) 282while (index<numString.Length && numString[index] == ' ') 291while (index < numString.Length) 316while (index < numString.Length && numString[index] == ' ')
System\Windows\Media\FontFamilyConverter.cs (2)
45return fontFamily != null && fontFamily.Source != null && fontFamily.Source.Length != 0; 71if (s == null || s.Length == 0)
System\Windows\Media\FontFamilyValueSerializer.cs (1)
48return fontFamily != null && fontFamily.Source != null && fontFamily.Source.Length != 0;
System\Windows\Media\FormattedText.cs (22)
225_latestPosition = _formatRuns.SetValue(0, _text.Length, runProps, _latestPosition); 287ArgumentOutOfRangeException.ThrowIfGreaterThan(startIndex, _text.Length); 291if (count < 0 || limit < startIndex || limit > _text.Length) 309SetForegroundBrush(foregroundBrush, 0, _text.Length); 358SetFontFamily(fontFamily, 0, _text.Length); 380SetFontFamily(fontFamily, 0, _text.Length); 434SetFontSize(emSize, 0, _text.Length); 486SetCulture(culture, 0, _text.Length); 541SetNumberSubstitution(numberSubstitution, 0, _text.Length); 604SetFontWeight(weight, 0, _text.Length); 654SetFontStyle(style, 0, _text.Length); 705SetFontStretch(stretch, 0, _text.Length); 756SetFontTypeface(typeface, 0, _text.Length); 806SetTextDecorations(textDecorations, 0, _text.Length); 964if (_that._text.Length == 0) 1009if (_textStorePosition + _currentLine.Length < _that._text.Length) 1086Debug.Assert(_that._text.Length > 0 && textSourcePosition + line.Length <= _that._text.Length + 1); 1091Math.Min(textSourcePosition + line.Length - 1, _that._text.Length - 1) 1538return BuildHighlightGeometry(origin, 0, _text.Length); 1709if (_text.Length == 0) 1815if (textSourceCharacterIndex >= _that._text.Length)
System\Windows\Media\GlyphsSerializer.cs (1)
306Debug.Assert(caretStopStringLength == sb.ToString().Length);
System\Windows\Media\Knowncolors.cs (5)
225if (((trimmedString.Length == 4) || 226(trimmedString.Length == 5) || 227(trimmedString.Length == 7) || 228(trimmedString.Length == 9)) && 283switch (colorString.Length)
System\Windows\Media\Parsers.cs (7)
43if ( trimmedColor.Length > 7 ) 50else if ( trimmedColor.Length > 5) 56else if (trimmedColor.Length > 4) 90string tokens = trimmedColor.Substring(s_ContextColor.Length); 98tokens = tokens.Substring(preSplit[0].Length); 146string tokens = trimmedColor.Substring(3, trimmedColor.Length - 3); 247if (trimmedColor.Length == 0)
System\Windows\Media\ParsersCommon.cs (5)
113while ((curIndex < pathString.Length) && Char.IsWhiteSpace(pathString, curIndex)) 119if (curIndex < pathString.Length) 127while ((curIndex < pathString.Length) && Char.IsWhiteSpace(pathString, curIndex)) 134if ((curIndex == pathString.Length) || 519_pathLength = pathString.Length;
System\Windows\Media\SolidColorBrush.cs (1)
100if (stringValue.Length > 3)
System\Windows\Media\textformatting\CharacterString.cs (1)
131charString.Length
System\Windows\Media\textformatting\TextCharacters.cs (1)
60(characterString == null) ? 0 : characterString.Length,
System\Windows\Navigation\BaseUriHelper.cs (2)
383string.Compare(uri.OriginalString, 0, Uri.UriSchemeFile, 0, Uri.UriSchemeFile.Length, StringComparison.OrdinalIgnoreCase) != 0) 612int byteCount = assemblyKey.Length / 2;
PresentationFramework (414)
Microsoft\Win32\FileDialog.cs (6)
276else if (value.Length == 0) // Normalize empty strings to null. 576Invariant.Assert(currentExtension.Length == 0 || currentExtension.StartsWith('.'), 591newFilename = fileName.Substring(0, fileName.Length - currentExtension.Length); 595newFilename = $"{fileName.AsSpan(0, fileName.Length - currentExtension.Length)}.{extension}";
MS\Internal\Annotations\Anchoring\DataIdProcessor.cs (2)
372return (newValue != null && newValue.Length == 0) ? null : value; 389if ((nodeId == null) || (nodeId.Length == 0))
MS\Internal\AppModel\ResourceContainer.cs (6)
266int totalLength = assemblyName.Length + assemblyVersion.Length + assemblyToken.Length; 269assemblyVersion.CopyTo(key.Slice(assemblyName.Length)); 270assemblyToken.CopyTo(key.Slice(assemblyName.Length + assemblyVersion.Length));
MS\Internal\Data\PathParser.cs (2)
86_n = _path.Length; 200SourceValueInfo info = (name.Length > 0)
MS\Internal\Data\XmlBindingWorker.cs (4)
60if (XPath.Length > 0) 125if (XPath.Length == 0) 447if (XPath.Length == 0) 566int n = xpath.Length;
MS\Internal\Globalization\BamlResourceContent.cs (4)
28StringBuilder builder = new(content.Length * 2); 29for (int i = 0; i < content.Length; i++) 192for (int i = 0; i < input.Length; i++) 244if (tokenStart < input.Length)
MS\Internal\Globalization\BamlTreeMap.cs (6)
427|| assembly == null || assembly.Length == 0 428|| className == null || className.Length == 0) 461|| assembly == null || assembly.Length == 0 462|| className == null || className.Length == 0 463|| property == null || property.Length == 0) 520if (className == null || className.Length == 0)
MS\Internal\Globalization\LocalizableResourceBuilder.cs (1)
353if (className == null || className.Length == 0)
MS\Internal\Globalization\LocalizationComments.cs (3)
86for (int i = 0; i < input.Length; i++) 211for (int i = 0; i < input.Length; i++) 357enumName = enumName.Substring(_enumPrefix.Length);
MS\Internal\Interop\InternalDispatchObject.cs (1)
118int dispid = int.Parse(name.AsSpan(8, name.Length-9), CultureInfo.InvariantCulture);
MS\Internal\IO\Packaging\indexingfiltermarshaler.cs (4)
97if ((uint)(s.Length) > bufCharacterCount - 1) 101bufCharacterCount = (UInt32)s.Length + 1; 104Marshal.Copy(s.ToCharArray(), 0, p, s.Length); 107Marshal.WriteInt16(p, s.Length * _int16Size, 0);
MS\Internal\IO\Packaging\PackageFilter.cs (1)
550Debug.Assert(contentType != null && contentType.ToString().Length > 0);
MS\Internal\IO\Packaging\XamlFilter.cs (7)
278int numCharactersToReturn = _currentContent.Length - _countOfCharactersReturned; 603if (title != null && title.Length > 0) 621if (content != null && content.Length > 0) 754if (textContent == null || textContent.Length == 0) 788if (_xamlReader.XmlLang.Length > 0) 835if (languageString.Length == 0) 851if (languageString.Length == 0)
MS\Internal\IO\Packaging\XmlGlyphRunInfo.cs (1)
169if (languageString != null && languageString.Length > 0)
MS\Internal\LayoutDump.cs (1)
600int cpEnd = content.Length;
MS\Internal\Markup\StaticExtension.cs (1)
92Member = Member.Substring(dotIndex + 1, Member.Length - dotIndex - 1);
MS\Internal\Printing\Win32PrintDialog.cs (1)
110bool isRtlCaption = caption != null && caption.Length > 0 && caption[0] == RightToLeftMark;
MS\Internal\PtsHost\Line.cs (1)
200precedingText = new CharacterBufferRange(precedingTextString, 0, precedingTextString.Length);
MS\Internal\PtsHost\ListMarkerSourceInfo.cs (3)
159int b = numericSymbols.Length; 293if (romanString.Length > largestIndexSize) 296largestIndexSize = romanString.Length;
MS\Internal\PtsHost\OptimalTextSource.cs (1)
151precedingText = new CharacterBufferRange(precedingTextString, 0, precedingTextString.Length);
MS\Internal\Text\ComplexLine.cs (1)
97precedingText = new CharacterBufferRange(precedingTextString, 0, precedingTextString.Length);
MS\Internal\Text\SimpleLine.cs (3)
38if (dcp < _content.Length) 53run = new TextCharacters(_content, dcp, _content.Length - dcp, _textProps); 80Math.Min(dcp, _content.Length)
MS\Internal\TraceData.cs (2)
270name = name.Substring(0, name.Length - suffix.Length);
MS\Internal\Utility\BindUriHelper.cs (1)
159if (frag != null && frag.Length > 0)
MS\Internal\WindowsRuntime\Generated\WinRT\ComWrappersSupport.cs (1)
158type = Projections.FindCustomPublicTypeForAbiType(type) ?? type.Assembly.GetType(type.FullName.Substring("ABI.".Length)) ?? type;
MS\Internal\WindowsRuntime\Generated\WinRT\ExceptionHelpers.cs (1)
187if (Platform.WindowsCreateString(message, message.Length, &hstring) != 0)
MS\Internal\WindowsRuntime\Generated\WinRT\Marshalers.cs (2)
55(char*)chars, value.Length, (IntPtr*)header, (IntPtr*)handle)); 107Platform.WindowsCreateString(value, value.Length, &handle));
MS\Internal\WindowsRuntime\Generated\WinRT\TypeExtensions.cs (1)
78return ns.Substring(NamespacePrefix.Length);
System\Windows\Annotations\Annotation.cs (1)
517if (reader.Prefix.Length == 0)
System\Windows\Annotations\Storage\XmlStreamStore.cs (1)
543Invariant.Assert(queryExpression != null && queryExpression.Length > 0,
System\Windows\Automation\Peers\HyperlinkAutomationPeer.cs (1)
52if (name.Length == 0)
System\Windows\Automation\Peers\WindowAutomationPeer.cs (1)
29if(name.Length == 0)
System\Windows\ColorConvertedBitmapExtension.cs (1)
43if (str.Length > 0)
System\Windows\Controls\AccessText.cs (6)
110return (_accessKey != null && _accessKey.Text.Length > 0) ? _accessKey.Text[0] : (char)0; 584if(index != -1 && index < text.Length - 1) 587TextPointer keyEnd = navigator.GetPositionAtOffset(index + 1 + keyText.Length); 635TextPointer keyEnd = new TextPointer(navigator, text.Length); 661int lenght = text.Length; 684if (index >=0 && index < text.Length - 1)
System\Windows\Controls\ComboBox.cs (2)
697if (selectionStart == newText.Length && 797EditableTextBoxSite.SelectionStart = matchedText.Length - matchedTextInfo.TextExcludingPrefixLength;
System\Windows\Controls\DataGridClipboardHelper.cs (2)
119int length = s.Length; 180int cb = s.Length;
System\Windows\Controls\DataGridHelper.cs (1)
729for (int i = 0, count = text.Length; i < count; i++)
System\Windows\Controls\DataGridHyperlinkColumn.cs (1)
223textBox.Select(inputText.Length, 0);
System\Windows\Controls\DataGridLengthConverter.cs (2)
222strLenUnit = unitString.Length; 236strLenUnit = pixelUnit.Name.Length;
System\Windows\Controls\DataGridTextColumn.cs (1)
179textBox.Select(inputText.Length, 0);
System\Windows\Controls\DefinitionBase.cs (2)
550while (++i < id.Length) 563if (i == id.Length)
System\Windows\Controls\ItemContainerGenerator.cs (2)
109if (label == null || label.Length == 0) 1121ReadOnlySpan<char> token = aqn.AsSpan(index + PublicKeyToken.Length);
System\Windows\Controls\PasswordBox.cs (1)
181for (int i = 0; i < value.Length; i++)
System\Windows\Controls\PasswordTextContainer.cs (2)
82for (i = 0; i < textData.Length; i++) 87OnPasswordChange(offset, textData.Length);
System\Windows\Controls\Primitives\DatePickerTextBox.cs (1)
107Select(0, this.Text.Length);
System\Windows\Controls\TextBlock.cs (2)
2824if (!whitespacesIgnorable || text.Trim().Length > 0) 3910if (content != null && content.Length > 0)
System\Windows\Controls\TextBox.cs (19)
981&& textBox.Text.Length > 0; 987if (Text.Length > 0) 1692if (oldText.Length > 0 && index >= 0) 1698if (oldIndex == oldText.Length) 1699return newText.Length; 1708prefix < oldText.Length && prefix < newText.Length; 1715suffix < oldText.Length && suffix < newText.Length; 1718if (oldText[oldText.Length - 1 - suffix ] != newText[newText.Length - 1 - suffix]) 1723if ( 2*(prefix + suffix) >= Math.Min(oldText.Length, newText.Length)) 1729if (oldIndex >= oldText.Length - suffix) 1730return newText.Length - (oldText.Length - oldIndex); 1758index < newText.Length && oldIndex + (index - anchorIndex) < oldText.Length; 1778return (bestIndex < 0) ? newText.Length : bestIndex;
System\Windows\Controls\TextRangeAdaptor.cs (2)
1749if (text.Length == 0) 1860return (text.Length <= maxLength || maxLength == -1) ? text : text.Substring(0, maxLength);
System\Windows\Controls\TextSearch.cs (10)
271Prefix = prefix.Substring(0, prefix.Length - lastChar.Length); 300if (matchedText.Length < newText.Length) 302matchedPrefixLength = matchedText.Length; 308int i = newText.Length; 323textExcludingPrefixLength = matchedText.Length - i; 327if (j <= matchedText.Length) 333textExcludingPrefixLength = matchedText.Length - j; 340} while (i >= 1 || j <= matchedText.Length);
System\Windows\Controls\VirtualizingStackPanel.cs (1)
12514if (dotIndex < 0) dotIndex = filename.Length;
System\Windows\Controls\WebBrowser.cs (1)
173MemoryStream ms = new MemoryStream(text.Length);
System\Windows\Data\XmlDataProvider.cs (1)
160return (_xPath != null) && (_xPath.Length != 0);
System\Windows\Documents\FixedFindEngine.cs (1)
40if (findPattern.Length == 0)
System\Windows\Documents\FixedPage.cs (2)
636int fragmentLength = (fragment == null) ? 0 : fragment.Length; 1095int fragmentLength = (fragment == null) ? 0 : fragment.Length;
System\Windows\Documents\FixedSchema.cs (3)
163if (uriAttr.Length > 0) 423attrValue = attrValue.Substring(_colorConvertedBitmap.Length); 440attrValueSpan = attrValueSpan.Slice(_contextColor.Length).Trim();
System\Windows\Documents\FixedSOMElement.cs (1)
74if (glyphs.UnicodeString.Length > 0)
System\Windows\Documents\FixedSOMPageConstructor.cs (6)
401if (s.Length == 0 || 431charIndex = s.IndexOf(" ", charIndex+1, s.Length - charIndex -1, StringComparison.Ordinal); 468if ((charIndex == 0 || s[charIndex-1] == ' ') && (charIndex != s.Length - 1)) 486} while (charIndex >= 0 && charIndex < s.Length-1); 488if (textRunStartIndex < s.Length) 499s.Length);
System\Windows\Documents\FixedSOMTextRun.cs (5)
149startIndex == 0 && endIndex == s.Length 154run.Text = string.Create(run.Text.Length, run.Text, (destination, runText) => 158destination[i] = runText[runText.Length - 1 - i]; 163if (s == "" && glyphs.Indices != null && glyphs.Indices.Length > 0) 170for (int i = 0; i < s.Length; i++)
System\Windows\Documents\FixedTextBuilder.cs (8)
662if (strPrev.Length == 0 || strCurrent.Length == 0) 669int textLength = strPrev.Length; 943if (namedNode != null && namedNode.Name != null && namedNode.Name.Length != 0) 1656Debug.Assert(run.EndIndex - run.StartIndex == run.Text.Length); 1664if (addSpace && run.Text.Length>0 && !run.Text.EndsWith(" ", StringComparison.Ordinal) && !IsHyphen(run.Text[run.Text.Length - 1])) 1686offset += textRun.Text.Length;
System\Windows\Documents\FixedTextView.cs (3)
441int characterCount = (g.UnicodeString == null ? 0 : g.UnicodeString.Length); 601lastIndex = ((Glyphs)element).UnicodeString.Length; 994charCount = g.UnicodeString.Length;
System\Windows\Documents\Glyphs.cs (11)
219caretStopCount = glyphRunProperties.unicodeString.Length + 1; 515clusterMap = new ushort[unicodeString.Length]; 516estimatedNumberOfGlyphs = unicodeString.Length; 525estimatedNumberOfGlyphs = Math.Max(estimatedNumberOfGlyphs, glyphsProp.Length / 5); 539for (int i = 0; i <= glyphsProp.Length; i++) 542char c = i < glyphsProp.Length ? glyphsProp[i] : '\0'; 545if ((c == ',') || (c == ';') || (i == glyphsProp.Length)) 568if (unicodeString.Length <= parsedCharacterCount) 626if ((c == ';') || (i == glyphsProp.Length)) 658while (parsedCharacterCount < unicodeString.Length) 663if (unicodeString.Length <= parsedCharacterCount)
System\Windows\Documents\ImmComposition.cs (9)
838RecordCaretOffset(caretOffset, attributes, compositionString.Length); 929return (compositionString.Length == originalLength) ? compositionString : null; 1100_caretOffset = Math.Min(_caretOffset, text.Length); 1324int requestSize = Marshal.SizeOf(typeof(NativeMethods.RECONVERTSTRING)) + (target.Length * sizeof(short)) + ((_maxSrounding + 1) * sizeof(short) * 2); 1337reconv.dwStrLen = surrounding.Length; // in char count 1339reconv.dwCompStrLen = target.Length; // in char count 1341reconv.dwTargetStrLen = target.Length; // in char count 1369Marshal.Copy(surrounding.ToCharArray(), 0, new IntPtr((void*)p), surrounding.Length); 1428offsetStart = surrounding.Length;
System\Windows\Documents\RtfToXamlReader.cs (57)
3385if (Name != null && Name.Length > 0) 3387byte[] rgBytes = new byte[Name.Length * 6]; 3388char[] rgChars = new char[Name.Length * 6]; 3394int cb = e.GetBytes(Name, 0, Name.Length, rgBytes, 0); 3397if (cch == Name.Length) 3716if (name.Length > 0 && value.Length > 0) 3728lhs_tag = name.Substring(i + 1, name.Length - i - 1); 3734rhs_tag = value.Substring(i + 1, value.Length - i - 1); 3736if (lhs_name.Length > 0 && rhs_name.Length > 0) 3740if (lhs_tag.Length > 0 && rhs_tag.Length > 0) 3749else if (lhs_tag.Length == 0 && rhs_tag.Length == 0) 3751if (lhs_name.Length > rhs_name.Length) 3753ReadOnlySpan<char> s = lhs_name.AsSpan(0, rhs_name.Length); 3762else if (lhs_tag.Length > 0 && rhs_tag.Length == 0) 4819if (entry.Name.Length > 32) 4899if (text == null || text.Length == 0) 4907for (; i < text.Length; i++) 4910for (; i < text.Length; i++) 4914if ((i + 1 == text.Length) // and no trail char 4928if (iStart != 0 || i != text.Length) 4956while (index < text.Length) 4960while (currentIndex < text.Length) 4982if (currentIndex < text.Length) 5309if (NavigateUri != null && NavigateUri.Length > 0) 5725return textdata.Length == 0; 8114if (instructionName.Length > 0 && instructionName[0] == ' ') 8330pictureUri = instructionName.Substring(uriIndex, instructionName.Length - uriIndex - 1); 8362while (i < instr.Length) 8374if (i < instr.Length) 8379for (; iEnd < instr.Length; iEnd++) 8410if (i < instr.Length) 8453return dn.NavigateUri.Length > 0 ? dn : null; 8468while (i < instr.Length) 8479if (instr[i] == '0' && i < instr.Length - 1 && instr[i + 1] == 'x') 8484for (; i < instr.Length && instr[i] != ' ' && instr[i] != '\\'; i++) 8495for (; i < instr.Length && instr[i] != ' ' && instr[i] != '\\'; i++) 8508if (i < instr.Length) 8528return (dn.Xaml != null && dn.Xaml.Length > 0) ? dn : null; 8550if (i < instr.Length && instr[i] == ' ') 8554for (; i < instr.Length && instr[i] != ' '; i++) 8584if (i < instr.Length && instr[i] == ' ') 8588if (i < instr.Length && instr[i] == '"') 8593for (; i < instr.Length && instr[i] != '"'; i++) 8600if (name != null && name.Length > 0) 9724if (token.Text.Length == 0) 11276if (entry != null && tokenName.Length > 0 && !entry.IsNameSealed) 11339while (nStart < text.Length) 11342while (nEnd < text.Length) 11352if (nStart == 0 && nEnd == text.Length) 11363while (nEnd < text.Length && (text[nEnd] == 0x0d || text[nEnd] == 0x0a)) 11367if (nEnd + 1 < text.Length && text[nEnd] == 0x0d && text[nEnd] == 0x0a)
System\Windows\Documents\TextContainer.cs (1)
1530length = textString.Length;
System\windows\Documents\TextEditor.cs (3)
1181if (textData.Length > extraCharsAllowed) 1192if (textData.Length == extraCharsAllowed && Char.IsHighSurrogate(textData, extraCharsAllowed - 1)) 1200if (string.IsNullOrEmpty(textAdjacent) || !Char.IsHighSurrogate(textAdjacent, textAdjacent.Length - 1))
System\windows\Documents\TextEditorContextMenu.cs (1)
530if (suggestion.Length == 1)
System\windows\Documents\TextEditorCopyPaste.cs (8)
103if (xamlTextWithImages.Length > 0) 139if (xamlText.Length > 0) 586args.CanExecute = formatToApply.Length > 0; 905if (pasteXaml.Length == 0) 939if (pastedText.Length > 0) 956for (int i = 0; i < pastedText.Length; i++) 979if (pastedText[i] == '\r' && i + 1 < pastedText.Length && pastedText[i + 1] == '\n') 986end.InsertTextInRun(pastedText.Substring(currentLineStart, pastedText.Length - currentLineStart));
System\windows\Documents\TextEditorDragDrop.cs (1)
473dropPosition = (indexInWord < (wordText.Length / 2)) ? wordSegment.Start : wordSegment.End;
System\windows\Documents\TextEditorSpelling.cs (2)
147caretPosition = textStart.CreatePointer(+correctedText.Length, LogicalDirection.Forward); 352for (int i = 0; i < text.Length && !isSelectionIgnoringErrors; i++)
System\windows\Documents\TextEditorTyping.cs (3)
367(e.Text == null || e.Text.Length == 0)) 1515for (int i = 0; i < textData.Length; i++) 1525if (filteredText.Length == 0)
System\Windows\Documents\TextElement.cs (1)
881if (text.Trim().Length > 0)
System\Windows\Documents\TextFindEngine.cs (18)
111SafeNativeMethods.GetStringTypeEx(0 /* ignored */, SafeNativeMethods.CT_CTYPE1, [findPattern[findPattern.Length - 1]], new Span<UInt16>(ref endCharType1)); 206int textBlockLength = Math.Max(TextBlockLength, findPattern.Length * 2 * 2); 228if (!matchDiacritics || findTextLength >= findPattern.Length) 279if (findTextLength > findPattern.Length) 283navigator.MoveByOffset(matchLast ? - findTextPositionMap[findText.Length - findTextLength + findPattern.Length] : findTextPositionMap[findTextLength - findPattern.Length]); 414int searchLength = textString.Length; 424matchLength = findPattern.Length; 444searchLength = textString.Length - searchStart; 469int startIndex = matchLast ? textString.Length - 1 : 0; 470int endIndex = matchLast ? -1 : textString.Length; 521for (int j = i; j < textString.Length; j++) 551for (int j = i; j < textString.Length; j++) 553if (compareInfo.Compare(textString, i, j - i + 1, findPattern, 0, findPattern.Length, options) == 0 && 575sourceString, sourceString.Length, findString, findString.Length, out found); 783for (int index = 0; index < textString.Length; index++) 822int textLength = textString.Length;
System\Windows\Documents\TextRangeBase.cs (5)
216if (textFromWordStart.Length >= autoWord.Length) 1024int b = numericSymbols.Length; 1297textData.Length > 0) 1345if (textData.Length > 0)
System\Windows\Documents\TextStore.cs (10)
1471if (result.Length > 0) 1493int cnt = result.Length; 1952if (text.Length != composition.Text.Length) 1964Invariant.Assert(text.Length == composition.CompositionText.Length); 3264if (newText.Length != text.Length) 3812if (textData.Length > extraCharsAllowed) 4989if (dotIndex < 0) dotIndex = filename.Length;
System\Windows\Documents\WinRTSpellerInteropExtensions.cs (7)
113predictedNextTokenStartPosition < text.Length) 121text.Length - predictedNextTokenStartPosition), 172int altFormsCount = Math.Min(missingFragmentText.Length, AlternateFormsMaximumCount); 178var altForm = documentText.Substring(lastToken.TextRange.Start, lastTokenText.Length + i).TrimEnd('\0').TrimEnd(); 180if (altForm.Length > previousAltForm.Length) 188altForm.Length);
System\Windows\Documents\XamlToRtfParser.cs (17)
273if (_xamlIndex < _xaml.Length) 327if (token.Text.Length == 0) 352return ((_xamlIndex + index) <= _xaml.Length); 520if (top.Length == 0) 525if (string.Compare(xamlTag, xamlTag.Length, top, top.Length, top.Length, StringComparison.OrdinalIgnoreCase) == 0) 780if (xaml.Length < 2 || xaml[0] != '<' || xaml[xaml.Length - 1] != '>') 811while (xamlIndex < xaml.Length) 820if (xamlIndex == xaml.Length - 1) 828if (xamlIndex == xaml.Length - 2) 851if (xamlIndex < xaml.Length) 860if (xamlIndex == xaml.Length || xaml[xamlIndex] != '=') 884for (; xamlIndex < xaml.Length && xaml[xamlIndex] != quoteChar; xamlIndex++) 889if (xamlIndex == xaml.Length) 984if (xamlIndex == xaml.Length - 1)
System\Windows\Documents\XamlToRtfWriter.cs (25)
841for (int i = 0; i < documentNode.NavigateUri.Length; i++) 2442while (xamlToRtfError == XamlToRtfError.None && index < characters.Length) 2445while (index < characters.Length && IsNewLine(characters[index])) 2452while (end < characters.Length && !IsNewLine(characters[end])) 2625for (int i = 0; i < xaml.Length; ) 2630for (; iEnd < xaml.Length; iEnd++) 2634if (xaml[iEnd] == '\r' && iEnd + 1 < xaml.Length && xaml[iEnd + 1] == '\n') 2646if (iStart == 0 && iEnd == xaml.Length) 2675i = (iEnd == xaml.Length) ? iEnd : iRestart; 2736if (name.Length >= 5) 2739bool ret = Converters.HexStringToInt(name.AsSpan(3, name.Length - 4), ref i); 2749if (name.Length >= 4) 2751ReadOnlySpan<char> num = name.AsSpan(2, name.Length - 3); 3057if (xamlTag == XamlTag.XTHyperlink && valueString.Length > 0) 3478if (tagName.Length == 0) 3490if (s.Length == 0) 3502if (attributeName.Length == 0) 3514if (attributeName.Length == 0) 3596if (brush.Length == 0) 3612for (; brushStringIndex < brush.Length && brushStringIndex < 9; brushStringIndex++) 3687if (dirName.Length == 0) 3780if (styleName.Length == 0) 3866if (alignName.Length == 0) 3878if (stretchName.Length == 0) 3900for (int i = 0; i < s.Length; i++)
System\Windows\Documents\ZoomPercentageConverter.cs (3)
153if ((!culture.IsNeutralCulture) && (zoomString.Length > 0) && (culture.NumberFormat != null)) 161if (zoomString.Length - 1 == zoomString.LastIndexOf( 165zoomString = zoomString.Substring(0, zoomString.Length - 1);
System\Windows\FrameworkElement.cs (1)
465if( targetName == null || targetName.Length == 0 )
System\Windows\Input\Command\CommandValueSerializer.cs (1)
115if (value.Length != 0)
System\Windows\Interop\ActiveXHost.cs (1)
214Debug.Assert(args.Key.Length > 0, "got an empty access key");
System\Windows\LengthConverter.cs (1)
204valueSpan = valueSpan.Slice(0, valueSpan.Length - pixelUnit.Name.Length);
System\Windows\Markup\Baml2006\Baml2006Reader.cs (1)
1008for (int i = 0; i < value.Length; i++)
System\Windows\Markup\Baml2006\WpfGeneratedKnownProperties.cs (1)
294for (int i = 1; i < 15 && i < typeName.Length; i++)
System\Windows\Markup\Baml2006\WpfGeneratedKnownTypes.cs (1)
785for (int i = 0; i < 26 && i < typeName.Length; i++)
System\Windows\Markup\BamlMapTable.cs (1)
1004Debug.Assert(assemblyFullName.Length != 0, "empty assembly");
System\Windows\Markup\BamlReader.cs (2)
1758for (int i=0; i<value.Length; i++) 1764builder = new StringBuilder(value.Length+2);
System\Windows\Markup\BamlRecordReader.cs (4)
3809value = OptionallyMakeNullable(methodInfo.GetParameters()[1].ParameterType, value, methodInfo.Name.Substring("Set".Length)); 4204string resourceName = resourceNameString.Substring(1, resourceNameString.Length-2); 5838return this.AttachedPropertySetter.Name.Substring("Set".Length); 5842return this.AttachedPropertyGetter.Name.Substring("Get".Length);
System\Windows\Markup\MarkupExtensionParser.cs (5)
113if (attrValue.Length < 2) 339int length = attrValue.Length; 933int length = args.Length; 1616for (int i = 0; i < value.Length; i++) 1622builder = new StringBuilder(value.Length);
System\Windows\Markup\ParserContext.cs (3)
106if (xmlParserContext.BaseURI != null && xmlParserContext.BaseURI.Length > 0) 130if( xmlReader.BaseURI != null && xmlReader.BaseURI.Length != 0 ) 426if (parserContext.XmlSpace != null && parserContext.XmlSpace.Length != 0)
System\Windows\Markup\Primitives\ExtensionSimplifierMarkupObject.cs (1)
325resultBuilder.Append(typeName, 0, typeName.Length - EXTENSIONLENGTH);
System\Windows\Markup\Primitives\MarkupWriter.cs (7)
475name = name.Substring(0, name.Length - EXTENSIONLENGTH); 1043name = name.Substring(0, name.Length - EXTENSIONLENGTH); 1240for (int textIndex = 0; textIndex < value.Length; textIndex++) 1586(null != newPrefix && previousBestPrefix.Length > newPrefix.Length) ) 1638ReadOnlySpan<char> ns = uri.AsSpan(clrUriPrefix.Length, uri.IndexOf(';') - clrUriPrefix.Length);
System\Windows\Markup\XamlFigureLengthSerializer.cs (3)
194strLenUnit = UnitStrings[i].Name.Length; 205strLenUnit = UnitStrings[i].Name.Length; 221strLenUnit = pixelUnit.Name.Length;
System\Windows\Markup\XamlGridLengthSerializer.cs (3)
194strLenUnit = UnitStrings[i].Length; 205strLenUnit = UnitStrings[i].Length; 221strLenUnit = pixelUnit.Name.Length;
System\Windows\Markup\XamlSerializerUtil.cs (1)
35for (int i = 0; i < s.Length; i++)
System\Windows\Markup\XamlTypeMapper.cs (8)
722for (int i = 0; i < attribValue.Length; i++) 1851if( xmlLangPropertyName != null && xmlLangPropertyName.Length > 0) 2100return methodInfo.Name.Substring("Get".Length); 2168typeName = typeName.Substring(colonIndex+1, typeName.Length-colonIndex-1); 2270else if (!isTypeExpected && prefix.Length == 0) 3616if (keyString.Length > 0 && 3618Char.IsWhiteSpace(keyString[keyString.Length-1]))) 4332if (null == _assembly && _assemblyName.Length > 0)
System\Windows\Markup\XamlTypeMapperSchemaContext.cs (4)
260clrNsIndex += XamlReaderHelper.MappingProtocol.Length; 261if (clrNsIndex <= xmlNamespace.Length) 272assemblyIndex += XamlReaderHelper.MappingAssembly.Length; 273if (assemblyIndex <= xmlNamespace.Length)
System\Windows\Markup\XmlnsDictionary.cs (4)
709if (xmlNamespace.Length > 0 || prefix.Length > 0) 734if (prefix.Length > 0 || _nsDeclarations[thisDecl].Uri.Length > 0)
System\Windows\MultiDataTrigger.cs (1)
107if (_conditions[i].SourceName != null && _conditions[i].SourceName.Length > 0)
System\Windows\PropertyPath.cs (4)
567name = name.Substring(1, name.Length-2); 894return (name != null && name.Length > 1 && name[0] == '(' && (name[name.Length - 1] == ')')); 903toParse = name.AsSpan(1, name.Length - 2);
System\Windows\PropertyPathConverter.cs (3)
169for (int i=0; i<originalPath.Length; ++i) 175for (j=i+1; j<originalPath.Length; ++j) 287if (start < originalPath.Length)
System\Windows\Shell\JumpList.cs (1)
924if (jumpTask.IconResourcePath.Length >= Win32Constant.MAX_PATH)
System\Windows\Shell\ThumbButtonInfo.cs (1)
108if (text != null && text.Length >= 260)
System\Windows\Standard\Debug.cs (1)
167if (value.Trim().Length == 0)
System\Windows\Style.cs (1)
794if( eventTrigger.SourceName != null && eventTrigger.SourceName.Length > 0 )
System\Windows\StyleHelper.cs (2)
1823if (label == null || label.Length == 0) 1863if (label == null || label.Length == 0)
System\Windows\SystemResourceKey.cs (1)
385srkField = memberName.Remove(memberName.Length - 3);
System\Windows\SystemResources.cs (1)
766StringBuilder sb = new StringBuilder(_assemblyName.Length + 10);
System\Windows\ThemeDictionaryExtension.cs (1)
99StringBuilder uri = new StringBuilder(assemblyName.Length + 50);
System\Windows\TriggerBase.cs (1)
189if (target.Length == 0)
PresentationUI (1)
MS\Internal\Documents\FindToolBar.xaml.cs (1)
216if (FindTextBox.Text.Length >= 1)
Publishers.AppHost (1)
DistributedApplicationBuilderExtensions.cs (1)
110if (appNameInput?.Value is not null && appNameInput.Value.Length < 3)
ReachFramework (24)
AlphaFlattener\PrimitiveList.cs (1)
42if (s.Length > 1)
MS\Internal\Printing\Configuration\DevMode.cs (1)
628int charsToWrite = Math.Min(value.Length, maxCharsToWrite - 1);
Packaging\XpsFixedPageReaderWriter.cs (2)
1223if (0 == mimeType.Length) 2038if(_resourceStream.ToString().Length > 0)
Packaging\XpsManager.cs (1)
298if (0 == contentType.ToString().Length)
PrintConfig\PrtCap_Reader.cs (1)
249if ((_currentElementTextValue == null) || (_currentElementTextValue.Length == 0))
PrintConfig\PrtTicket_Base.cs (1)
705(fullRefName.Length != 0) &&
PrintConfig\PrtTicket_Editor.cs (4)
56if ((version == null) || (version.Length == 0)) 114if ((childName == null) || (childName.Length == 0)) 270(childName.Length != 0) && 334(childName.Length != 0) &&
Serialization\Manager\NGCSerializer.cs (1)
44if (jobName == null || jobName.Length == 0)
Serialization\Manager\NullPackagingPolicy.cs (1)
794if(_resourceXmlWriter.ToString().Length > 0)
Serialization\Manager\ReachDocumentSequenceSerializer.cs (1)
149(attributeValue.Length > 0) )
Serialization\Manager\ReachDocumentSequenceSerializerAsync.cs (1)
187(attributeValue.Length > 0) )
Serialization\Manager\ReachFixedDocumentSerializer.cs (1)
220(attributeValue.Length > 0) )
Serialization\Manager\ReachFixedDocumentSerializerAsync.cs (1)
260(attributeValue.Length > 0) )
Serialization\Manager\ReachFixedPageSerializer.cs (1)
297(attributeValue.Length > 0) )
Serialization\Manager\ReachFixedPageSerializerAsync.cs (1)
269(attributeValue.Length > 0) )
Serialization\Manager\XpsOMFixedPageSerializer.cs (1)
262(attributeValue.Length > 0))
Serialization\Manager\XpsOMPackagingPolicy.cs (1)
377if (_currentResourceStream.ToString().Length > 0)
Serialization\VisualSerializer.cs (2)
1677Debug.Assert(_nameAttr.Length > 0, "Empty _nameAttr"); 2346Debug.Assert(nameAttr == null || nameAttr.Length > 0, "Bad name attribute");
Serialization\VisualTreeFlattener.cs (1)
140index = m_mainFile.Length;
RepoTasks (2)
src\aspnetcore\src\Shared\CertificateGeneration\CertificateManager.cs (1)
236if ((byteArray.Length == AspNetHttpsOidFriendlyName.Length && byteArray[0] == (byte)'A') || byteArray.Length == 0)
src\aspnetcore\src\Shared\CertificateGeneration\UnixCertificateManager.cs (1)
361? Path.Combine("$HOME", certDir[homeDirectoryWithSlash.Length..])
ResultsOfTGenerator (1)
Program.cs (1)
1074public static string TitleCase(this string value) => string.Create(value.Length, value, (c, s) =>
Roslyn.Diagnostics.Analyzers (194)
AbstractRunIterations`1.cs (1)
102ReplaceName(syntaxGenerator, attribute, name[0..^"FactAttribute".Length] + "TheoryAttribute"));
src\roslyn\src\Compilers\Core\Portable\FileSystem\FileUtilities.cs (2)
136if (path!.Length == 1) 178Debug.Assert(path.Length == 1 || !PathUtilities.IsDirectorySeparator(path[1]));
src\roslyn\src\Compilers\Core\Portable\FileSystem\PathUtilities.cs (36)
55int lastSeparator = s.Length; 61if (lastSeparator != s.Length) 74if (s.Length == 0 || IsAnyDirectorySeparator(s[s.Length - 1])) 163var rootLength = GetPathRoot(path, isUnixLike).Length; 164if (path.Length > rootLength) 166var i = path.Length; 237int length = path.Length; 312return path.Length > 0 && IsDirectorySeparator(path[0]) 339if (path.Length > 0 && path[0] == '.') 341if (path.Length == 1 || IsDirectorySeparator(path[1])) 348if (path.Length == 2 || IsDirectorySeparator(path[2])) 359if (path.Length >= 1 && IsDirectorySeparator(path[0])) 366if (path.Length >= 2 && path[1] == VolumeSeparatorChar && (path.Length <= 2 || !IsDirectorySeparator(path[2]))) 400return path.Length >= 2 && 411return path.Length >= 3 && path[1] == VolumeSeparatorChar && IsDirectorySeparator(path[2]); 465char c = root[root.Length - 1]; 504if (path.Length > 0 && IsDirectorySeparator(path[path.Length - 1])) 506return path.Substring(0, path.Length - 1); 633return parentPath.Length > 0 634&& childPath.Length > parentPath.Length 635&& PathsEqual(childPath, parentPath, parentPath.Length) 636&& (IsDirectorySeparator(parentPath[parentPath.Length - 1]) || IsDirectorySeparator(childPath[parentPath.Length])); 641var relativePath = childPath.Substring(parentPath.Length); 644int start = ConsumeDirectorySeparators(relativePath, relativePath.Length, 0); 673return PathsEqual(path1, path2, Math.Max(path1.Length, path2.Length)); 681if (path1.Length < length || path2.Length < length) 741if (!(oldPrefix?.Length > 0)) continue; 750var replacement = replacementPrefix + filePath.Substring(oldPrefix.Length); 870if (!isDriveRooted && !(p.Length > 1 && p[0] == AltDirectorySeparatorChar))
src\roslyn\src\Compilers\Core\Portable\InternalUtilities\CompilerOptionParseUtilities.cs (1)
42if (Environment.GetEnvironmentVariable(CachePathEnvironmentVariable) is not { Length: > 0 } cachePath)
src\roslyn\src\Compilers\Core\Portable\InternalUtilities\FileNameUtilities.cs (6)
122if (path.Length > 0 && path[path.Length - 1] == '.') 124return path.Substring(0, path.Length - 1); 149if (extension == null || path.Length == 0) 154if (extension.Length == 0 || extension[0] != '.') 173for (int i = path.Length - 1; i >= 0; i--)
src\roslyn\src\Compilers\Core\Portable\InternalUtilities\StringExtensions.cs (14)
41return name.Length >= 3 && name[0] == 'I' && char.IsUpper(name[1]) && char.IsLower(name[2]); 46return name.Length >= 3 && name[0] == 'T' && char.IsUpper(name[1]) && char.IsLower(name[2]); 154result = name[..^AttributeSuffix.Length]; 168return name.Length > AttributeSuffix.Length && name.EndsWith(AttributeSuffix, comparison); 174while (i < str.Length) 181if (i < str.Length && char.IsLowSurrogate(str[i])) 211if (arg.Length > 1 && arg[0] == '"' && arg[arg.Length - 1] == '"') 214return arg.Substring(1, arg.Length - 2); 226while (x < string1.Length && x < string2.Length && 238while (x < string1.Length && x < string2.Length &&
src\roslyn\src\Compilers\Core\Portable\InternalUtilities\StringTable.cs (5)
481if (array.Length != length) 487for (var i = 0; i < array.Length; i++) 500if (array.Length != text.Length) 517for (var i = array.Length - 1; i >= 0; i--) 538if (ascii.Length != text.Length)
src\roslyn\src\Compilers\Core\Portable\InternalUtilities\UnicodeCharacterUtilities.cs (1)
103int nameLength = name.Length;
src\roslyn\src\Compilers\Core\Portable\Syntax\SyntaxTreeExtensions.cs (2)
95var n1 = s1.Length; 96var n2 = s2.Length;
src\roslyn\src\Compilers\Core\Portable\Text\TextChangeRangeExtensions.cs (1)
105return new TextChangeRange(textChange.Span, textChange.NewText?.Length ?? 0);
src\roslyn\src\Dependencies\Collections\Extensions\IEnumerableExtensions.cs (2)
213return str.Length == 0; 236return source.Length == 0;
src\roslyn\src\RoslynAnalyzers\Utilities\Compiler\CodeMetrics\CodeAnalysisMetricData.cs (1)
141if (index >= 0 && index < symbolName.Length)
src\roslyn\src\RoslynAnalyzers\Utilities\Compiler\Extensions\StringExtensions.cs (1)
15return Encoding.UTF8.GetByteCount(value) == value.Length;
src\roslyn\src\RoslynAnalyzers\Utilities\Compiler\Options\AnalyzerOptionsExtensions.cs (2)
357if (trimmedSuffix.Length >= 2 && 361for (int i = 1; i < trimmedSuffix.Length - 2; i++)
src\roslyn\src\RoslynAnalyzers\Utilities\Compiler\Options\SymbolNamesWithValueOption.cs (2)
109parts.SymbolName.Length == 1)) 145Debug.Assert(parts.SymbolName.Length >= 2);
src\roslyn\src\RoslynAnalyzers\Utilities\Compiler\RulesetToEditorconfigConverter.cs (2)
208if (comment.Length > 0) 213if (trimmedCommentPart.Length > 0)
src\roslyn\src\RoslynAnalyzers\Utilities\Compiler\WellKnownTypeProvider.cs (1)
220for (int i = 0; i < fullTypeName.Length; i++)
src\roslyn\src\RoslynAnalyzers\Utilities\Compiler\WordParser.cs (3)
108_buffer = new StringBuilder(text.Length); 556while (_index < _text.Length) 574for (int index = _index; index < _text.Length; index++)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\CodeGeneration\ParameterName.cs (1)
42BestNameForParameter = trimmed.Length > 0 ? tryMakeCamelCase ? trimmed.ToCamelCase() : trimmed : nameBasedOnArgument;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\VirtualChars\AbstractVirtualCharService.cs (8)
30if (index + 1 < tokenText.Length) 118Debug.Assert(lastVC.Span.End == token.Span.End - "\"".Length, "Last span has to end right before the end of the string token."); 122Debug.Assert(lastVC.Span.End == token.Span.End - "\"u8".Length, "Last span has to end right before the end of the string token."); 145if (startDelimiter.Length > 0 && !tokenText.StartsWith(startDelimiter, StringComparison.Ordinal)) 151if (endDelimiter.Length > 0 && !tokenText.EndsWith(endDelimiter, StringComparison.Ordinal)) 157var startIndexInclusive = startDelimiter.Length; 158var endIndexExclusive = tokenText.Length - endDelimiter.Length;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\VirtualChars\AbstractVirtualCharService.ITextInfo.cs (1)
30public readonly int Length(string text) => text.Length;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\VirtualChars\VirtualCharGreenSequence.Chunks.cs (2)
78public override int Length => data.Length; 83return stringIndex >= 0 && stringIndex < data.Length ? stringIndex : null;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\StringExtensions.cs (13)
18for (var i = 0; i < line.Length; i++) 33for (var i = line.Length - 1; i >= 0; i--) 61return lastOffset.HasValue && lastOffset.Value < lineText.Length 71return lineText.GetColumnFromLineOffset(lineText.Length, tabSize); 74return text.ConvertTabToSpace(tabSize, initialColumn, text.Length) + initialColumn; 80Debug.Assert(endPosition >= 0 && endPosition <= textSnippet.Length); 107for (var i = 0; i < text.Length; i++) 156for (var i = 0; i < text.Length; i++) 164if (i + 1 == text.Length || text[i + 1] != '\n') 202return line.GetColumnFromLineOffset(line.Length, tabSize); 209Contract.ThrowIfFalse(0 <= endPosition && endPosition <= line.Length); 223for (var i = 0; i < line.Length; i++) 241return line.Length;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\TokenStream.cs (2)
337length = text.ConvertTabToSpace(_options.TabSize, initialColumn, text.Length); 341length = text.Length;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\TreeData.Node.cs (1)
30return lineText.GetColumnFromLineOffset(lineText.Length, tabSize);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\FormattingExtensions.cs (9)
130spaceOrIndentation = indentationString.GetColumnFromLineOffset(indentationString.Length, tabSize); 136spaceOrIndentation = text.ConvertTabToSpace(tabSize, baseToken.ToString().GetTextColumn(tabSize, initialColumn), text.Length); 156nonWhitespaceCharIndex = triviaText.Length; 164builder.Append(triviaText, nonWhitespaceCharIndex, triviaText.Length - nonWhitespaceCharIndex); 201builder.Append(line, nonWhitespaceCharIndex, line.Length - nonWhitespaceCharIndex); 226for (var i = 0; i < text.Length; i++) 245if (i >= newText.Length || text[i] != newText[i]) 252if (i == span.Length && text.Length == newText.Length)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\TriviaEngine\AbstractTriviaFormatter.cs (6)
145for (var i = 0; i < text.Length; i++) 611var tokenPosition = lastText.ConvertTabToSpace(Options.TabSize, initialColumn, lastText.Length); 741for (var i = this.OriginalString.Length - 1; i >= 0; i--) 889spaces: text.ConvertTabToSpace(Options.TabSize, lineColumn.With(whitespaceBetween).Column, text.Length), 925spaces: lineText.GetColumnFromLineOffset(lineText.Length, Options.TabSize), 931spaces: text.ConvertTabToSpace(Options.TabSize, initialColumn, text.Length),
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\Naming\IdentifierNameParts.cs (2)
47? newBaseName[prefix.Length..] 53? newBaseName[..^suffix.Length]
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\NamingStyle.cs (19)
89if (word.Length == 0) 107if (word.Length == 0) 137if (name.Length <= Prefix.Length + Suffix.Length) 147name = StripCommonPrefixes(name[Prefix.Length..], out var prefix); 160var spanToCheck = TextSpan.FromBounds(0, name.Length - Suffix.Length); 311name = StripCommonPrefixes(name.StartsWith(Prefix) ? name[Prefix.Length..] : name, out _); 346while (index + 1 < name.Length) 353if (index + 2 < name.Length && name[index + 1] == '_') 362if (index + 1 < name.Length && !char.IsDigit(name[index + 1])) 385if (Suffix.Length + Prefix.Length >= name.Length) 390name = name[Prefix.Length..^Suffix.Length]; 428for (var i = Suffix.Length; i > 0; i--) 455for (var i = 0; i < Prefix.Length; i++)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\NamingStyle.WordSpanEnumerator.cs (1)
52Current = new TextSpan(Current.End + _wordSeparator.Length, 0);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Serialization\ObjectWriter.cs (2)
504var bytes = new byte[(uint)value.Length * sizeof(char)]; 510WriteCompressedUInt((uint)value.Length);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\SyntaxFacts\AbstractDocumentationCommentService.cs (3)
90if (text.Length > maxBannerLength) 185=> tokenText.Length > 0 && char.IsWhiteSpace(tokenText[0]); 188=> tokenText.Length > 0 && char.IsWhiteSpace(tokenText[^1]);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\SyntaxFacts\ISyntaxFactsExtensions.cs (2)
251if (name.Length == 0) 261for (var i = 1; i < name.Length; i++)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.cs (1)
198Debug.Assert(reader.Position == symbolKey.Length);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.SymbolKeyReader.cs (1)
259while (Position < Data.Length)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\Base64Utilities.cs (2)
329decodedLength = (encodedString.Length * 3) / 4 - padding; 336var index = attributeData.Length - 1;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\BKTree.Builder.cs (3)
97var distinctValues = values.Where(v => v.Length > 0).Distinct(CaseInsensitiveComparison.Comparer).ToArray(); 98var charCount = distinctValues.Sum(v => v.Length); 107_wordSpans[i] = new TextSpan(characterIndex, value.Length);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\BKTree.cs (4)
74var lowerCaseCharacters = value.Length < 512 75? stackalloc char[value.Length] 76: new char[value.Length]; 78for (var i = 0; i < value.Length; i++)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\EditDistance.cs (8)
57var array = text.Length <= PooledArraySize 59: new char[text.Length]; 61for (var i = 0; i < text.Length; i++) 89var targetLowerCaseCharacters = target.Length < 512 90? stackalloc char[target.Length] 91: new char[target.Length]; 93for (var i = 0; i < target.Length; i++) 97_sourceLowerCaseCharacters.AsSpan(0, _source.Length),
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\PathMetadataUtilities.cs (2)
31if (rootNamespace is { Length: > 0 } && 69@namespace = @namespace[(rootNamespace.Length + 1)..];
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\StringEscapeEncoder.cs (4)
17while (startIndex < text.Length) 29builder?.Append(text, startIndex, text.Length - startIndex); 66while (startIndex < text.Length) 72builder?.Append(text, startIndex, text.Length - startIndex);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\WordSimilarityChecker.cs (6)
91=> GetThreshold(value.Length); 108if (_source.Length < MinFuzzyLength) 134if (Math.Abs(_source.Length - candidateText.Length) <= _threshold) 163var lengthDifference = Math.Abs(originalText.Length - candidateText.Length);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\ISymbolExtensions.cs (1)
841(symbol.Name.Length == 1 || uint.TryParse(symbol.Name[1..], out _) || symbol.Name.All(n => n.Equals('_')));
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\ITypeSymbolExtensions.cs (1)
370return shortName.Length == 0
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Extensions\ProjectExtensions.cs (2)
60analyzerConfigDirectory.Length > bestPath.Length)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Extensions\SyntaxGeneratorExtensions_CreateEqualsMethod.cs (1)
391if (name.Length > 0)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\LanguageServices\TypeInferenceService\AbstractTypeInferenceService.cs (3)
67if (name.Length == prefix.Length) 72var nextChar = name[prefix.Length];
Roslyn.Diagnostics.CSharp.Analyzers (36)
CSharpAvoidOptSuffixForNullableEnableCodeCodeFixProvider.cs (3)
46if (variableSymbol == null || variableSymbol.Name.Length <= CSharpAvoidOptSuffixForNullableEnableCode.OptSuffix.Length) 51var newName = variableSymbol.Name[..^CSharpAvoidOptSuffixForNullableEnableCode.OptSuffix.Length];
NumberCommentsRefactoring.cs (7)
119cursor = eolOrEofIndex + newLine.Length; 121while (cursor < text.Length); 202return text.Length - 1; 205return text.Length; 217cursor += prefix.Length; 235builder.Append(text, cursor, eolOrEofIndex + newLine.Length - cursor); 238cursor = eolOrEofIndex + newLine.Length;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\EmbeddedLanguages\VirtualChars\CSharpVirtualCharService.cs (12)
136var endIndexExclusive = tokenText.Length; 141endIndexExclusive -= "u8".Length; 233if (startDelimiter.Length > 0 && !tokenText.StartsWith(startDelimiter)) 239if (endDelimiter.Length > 0 && !tokenText.EndsWith(endDelimiter, StringComparison.OrdinalIgnoreCase)) 245var startIndexInclusive = startDelimiter.Length; 246var endIndexExclusive = tokenText.Length - endDelimiter.Length; 435result.Add(new VirtualCharGreen((char)highSurrogate, offset: startIndex, width: prefix.Length)); 436result.Add(new VirtualCharGreen((char)lowSurrogate, offset: startIndex + prefix.Length, width: 4)); 439return @"\UAAAABBBB".Length; 465var width = @"\uAAAA".Length; 482for (var i = 0; i < 4 && endIndex < tokenText.Length; i++)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\SyntaxTriviaExtensions.cs (2)
109textBuilder.Remove(textBuilder.Length - newLine.Length, newLine.Length);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Engine\Trivia\TriviaDataFactory.CodeShapeAnalyzer.cs (2)
147_indentation += text.ConvertTabToSpace(_options.TabSize, _indentation, text.Length); 345if (xmlCommentText.GetColumnFromLineOffset(xmlCommentText.Length - 3, tabSize) != indentation)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Engine\Trivia\TriviaDataFactory.cs (1)
128return textSnippet.ConvertTabToSpace(Options.TabSize, initialColumn, textSnippet.Length);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\FormattingHelpers.cs (1)
30var start = lastNewLinePos + NewLine.Length;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Services\SyntaxFacts\CSharpSyntaxFacts.cs (4)
460return this.IsIdentifier(token) && !token.ContainsDiagnostics && token.ToString().Length == identifier.Length; 466return this.IsIdentifier(token) && !token.ContainsDiagnostics && token.ToString().Length == identifier.Length && token.IsVerbatimIdentifier();
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\CSharpCodeGenerationHelpers.cs (2)
132if (tokenText.Length <= 2 || tokenText.Last() != '"') 141if (tokenText.Length <= 1 || tokenText.Last() != '"')
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\ITypeSymbolExtensions.TypeSyntaxGeneratorVisitor.cs (1)
153? null : symbol.Signature.UnmanagedCallingConventionTypes.Select(type => GetConventionForString(type.Name["CallConv".Length..])),
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\StringExtensions.cs (1)
37if (escaped.Length == 0 || escaped[0] != '@')
Roslyn.Diagnostics.VisualBasic.Analyzers (9)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\VisualBasic\Formatting\Engine\Trivia\TriviaDataFactory.CodeShapeAnalyzer.vb (1)
299If xmlCommentText.GetColumnFromLineOffset(xmlCommentText.Length - 3, tabSize) <> indentation Then
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\VisualBasic\Services\SyntaxFacts\VisualBasicSyntaxFacts.vb (1)
472Return IsIdentifier(token) AndAlso Not token.ContainsDiagnostics AndAlso token.ToString().Length = identifier.Length
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\VisualBasic\CodeGeneration\EnumMemberGenerator.vb (1)
114Dim lastTwoChars = numericText.Substring(numericText.Length - 2, 2)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\VisualBasic\CodeGeneration\ExpressionGenerator.StringPiece.vb (2)
82While i < value.Length 118If i < value.Length AndAlso value(i) = vbLf Then
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\VisualBasic\Extensions\StringExtensions.vb (4)
26withoutSuffix = identifierText.Substring(0, identifierText.Length - 9) 67If text.Length > 2 AndAlso MakeHalfWidthIdentifier(text.First()) = "[" AndAlso MakeHalfWidthIdentifier(text.Last()) = "]" Then 68unescaped = text.Substring(1, text.Length() - 2) 73Dim token = If(escaped.Length > 0 AndAlso escaped(0) = "["c,
rzc (14)
CommandLine\AnsiConsole.cs (2)
74while (endIndex != message.Length && 83if (endIndex == message.Length)
CommandLine\ArgumentEscaper.cs (6)
35for (int i = 0; i < arg.Length; ++i) 40while (i < arg.Length && arg[i] == '\\') 46if (i == arg.Length && isQuoted) 52else if (i == arg.Length) 94if (argument.Length <= 1) 99return argument[0] == '"' && argument[argument.Length - 1] == '"';
CommandLine\CommandLineApplication.cs (3)
474var maxArgLen = arguments.Max(a => a.Name.Length); 490var maxOptLen = options.Max(o => o.Template.Length); 506var maxCmdLen = commands.Max(c => c.Name.Length);
CommandLine\CommandOption.cs (2)
27if (optName.Length == 1 && !IsEnglishLetter(optName[0])) 38ValueName = part.Substring(1, part.Length - 2);
ServerProtocol\ServerProtocol.cs (1)
31writer.Write(value.Length);
sdk-tasks (3)
src\sdk\src\Common\WorkloadSetVersion.cs (1)
72? workloadSetVersion.Substring(sections[0].Length)
src\sdk\src\Resolvers\Microsoft.NET.Sdk.WorkloadManifestReader\SdkFeatureBand.cs (1)
63char separator = workloadSetVersion[sections[0].Length];
ZipFileCreateFromDirectory.cs (1)
121int chop = root.Length;
SelectTests (14)
ChangedFileFilter.cs (2)
56.Where(line => line.Length > 0 && !line.StartsWith('#')) 104var sb = new StringBuilder(withPlaceholders.Length + 8);
GraphAffectedProjects.cs (2)
152.OrderByDescending(d => d.Length) 461.Where(line => line.Length > 0);
Program.cs (7)
371error = $"git merge-base {from} {head} exited {exitCode}{(stderr.Trim().Length > 0 ? $": {stderr.Trim()}" : " (no common ancestor)")}"; 376if (mergeBase.Length == 0) 400.Where(l => l.Length > 0) 450.Where(d => d.Length > 0) 573var name = "run_" + job["job:".Length..].Replace('-', '_'); 886=> token.StartsWith("job:", StringComparison.Ordinal) ? token["job:".Length..] : token; 1127t => t.StartsWith("job:", StringComparison.Ordinal) ? t["job:".Length..] : t,
TestSelector.cs (1)
478target.StartsWith("test:", StringComparison.Ordinal) ? target["test:".Length..] : target;
TriggerMap.cs (2)
147var core = hasGlobSuffix ? pattern[..^"/**".Length] : pattern; 156var after = core[(nameIndex + "<name>".Length)..];
Shared (2)
Data.Validation\LengthAttribute.cs (1)
116count = s.Length;
LogBuffering\SerializedLogRecordFactory.cs (1)
80int charSize = str.Length * sizeof(char);
Stress.AppHost (3)
CommandResources.cs (2)
178SecretLength = arguments.Secret?.Length ?? 0, 339.Sum(i => i.Value?.Length ?? 0),
InteractionCommands.cs (1)
118if (!string.IsNullOrEmpty(input.Value) && input.Value.Length < 3)
Stress.TelemetryService (84)
artifacts\obj\Stress.TelemetryService\Debug\net8.0\opentelemetry\proto\collector\logs\v1\LogsService.cs (4)
584if (ErrorMessage.Length != 0) hash ^= ErrorMessage.GetHashCode(); 625if (ErrorMessage.Length != 0) { 642if (ErrorMessage.Length != 0) { 660if (other.ErrorMessage.Length != 0) {
artifacts\obj\Stress.TelemetryService\Debug\net8.0\opentelemetry\proto\collector\metrics\v1\MetricsService.cs (4)
586if (ErrorMessage.Length != 0) hash ^= ErrorMessage.GetHashCode(); 627if (ErrorMessage.Length != 0) { 644if (ErrorMessage.Length != 0) { 662if (other.ErrorMessage.Length != 0) {
artifacts\obj\Stress.TelemetryService\Debug\net8.0\opentelemetry\proto\collector\trace\v1\TraceService.cs (4)
585if (ErrorMessage.Length != 0) hash ^= ErrorMessage.GetHashCode(); 626if (ErrorMessage.Length != 0) { 643if (ErrorMessage.Length != 0) { 661if (other.ErrorMessage.Length != 0) {
artifacts\obj\Stress.TelemetryService\Debug\net8.0\opentelemetry\proto\common\v1\Common.cs (12)
1121if (Key.Length != 0) hash ^= Key.GetHashCode(); 1159if (Key.Length != 0) { 1177if (Key.Length != 0) { 1195if (other.Key.Length != 0) { 1404if (Name.Length != 0) hash ^= Name.GetHashCode(); 1405if (Version.Length != 0) hash ^= Version.GetHashCode(); 1449if (Name.Length != 0) { 1453if (Version.Length != 0) { 1472if (Name.Length != 0) { 1475if (Version.Length != 0) { 1494if (other.Name.Length != 0) { 1497if (other.Version.Length != 0) {
artifacts\obj\Stress.TelemetryService\Debug\net8.0\opentelemetry\proto\logs\v1\Logs.cs (12)
467if (SchemaUrl.Length != 0) hash ^= SchemaUrl.GetHashCode(); 510if (SchemaUrl.Length != 0) { 528if (SchemaUrl.Length != 0) { 550if (other.SchemaUrl.Length != 0) { 751if (SchemaUrl.Length != 0) hash ^= SchemaUrl.GetHashCode(); 794if (SchemaUrl.Length != 0) { 812if (SchemaUrl.Length != 0) { 834if (other.SchemaUrl.Length != 0) { 1198if (SeverityText.Length != 0) hash ^= SeverityText.GetHashCode(); 1278if (SeverityText.Length != 0) { 1326if (SeverityText.Length != 0) { 1366if (other.SeverityText.Length != 0) {
artifacts\obj\Stress.TelemetryService\Debug\net8.0\opentelemetry\proto\metrics\v1\Metrics.cs (20)
567if (SchemaUrl.Length != 0) hash ^= SchemaUrl.GetHashCode(); 610if (SchemaUrl.Length != 0) { 628if (SchemaUrl.Length != 0) { 650if (other.SchemaUrl.Length != 0) { 851if (SchemaUrl.Length != 0) hash ^= SchemaUrl.GetHashCode(); 894if (SchemaUrl.Length != 0) { 912if (SchemaUrl.Length != 0) { 934if (other.SchemaUrl.Length != 0) { 1324if (Name.Length != 0) hash ^= Name.GetHashCode(); 1325if (Description.Length != 0) hash ^= Description.GetHashCode(); 1326if (Unit.Length != 0) hash ^= Unit.GetHashCode(); 1393if (Name.Length != 0) { 1397if (Description.Length != 0) { 1401if (Unit.Length != 0) { 1435if (Name.Length != 0) { 1438if (Description.Length != 0) { 1441if (Unit.Length != 0) { 1471if (other.Name.Length != 0) { 1474if (other.Description.Length != 0) { 1477if (other.Unit.Length != 0) {
artifacts\obj\Stress.TelemetryService\Debug\net8.0\opentelemetry\proto\trace\v1\Trace.cs (28)
413if (SchemaUrl.Length != 0) hash ^= SchemaUrl.GetHashCode(); 456if (SchemaUrl.Length != 0) { 474if (SchemaUrl.Length != 0) { 496if (other.SchemaUrl.Length != 0) { 697if (SchemaUrl.Length != 0) hash ^= SchemaUrl.GetHashCode(); 740if (SchemaUrl.Length != 0) { 758if (SchemaUrl.Length != 0) { 780if (other.SchemaUrl.Length != 0) { 1235if (TraceState.Length != 0) hash ^= TraceState.GetHashCode(); 1237if (Name.Length != 0) hash ^= Name.GetHashCode(); 1335if (TraceState.Length != 0) { 1343if (Name.Length != 0) { 1394if (TraceState.Length != 0) { 1400if (Name.Length != 0) { 1445if (other.TraceState.Length != 0) { 1451if (other.Name.Length != 0) { 1836if (Name.Length != 0) hash ^= Name.GetHashCode(); 1884if (Name.Length != 0) { 1906if (Name.Length != 0) { 1928if (other.Name.Length != 0) { 2174if (TraceState.Length != 0) hash ^= TraceState.GetHashCode(); 2230if (TraceState.Length != 0) { 2255if (TraceState.Length != 0) { 2280if (other.TraceState.Length != 0) { 2481if (Message.Length != 0) hash ^= Message.GetHashCode(); 2519if (Message.Length != 0) { 2537if (Message.Length != 0) { 2555if (other.Message.Length != 0) {
SuperFileCheck (1)
Program.cs (1)
332return lineStr.Substring(0, index) + $"{transformSuffix}: {{{{^ *}}}}" + lineStr.Substring(index + syntaxDirective.Length) + "{{$}}";
System.CodeDom (45)
Microsoft\CSharp\CSharpCodeGenerator.cs (16)
93var b = new StringBuilder(value.Length + 5); 101while (i < value.Length) 143if (char.IsHighSurrogate(value[i]) && (i < value.Length - 1) && char.IsLowSurrogate(value[i + 1])) 148if (i != value.Length - 1) 173var b = new StringBuilder(value.Length + 5); 177for (int i = 0; i < value.Length; i++) 195if (value.Length < 256 || value.Length > 1500 || value.Contains('\0')) 865for (int i = 0; i < value.Length; i++) 2655if (value.Length > 512) 2716if (s.Length == 0) 2762var sb = new StringBuilder(s.Length + 10); 2772for (int i = 0; i < baseType.Length; i++) 2788while (i < baseType.Length && baseType[i] >= '0' && baseType[i] <= '9') 2799if (i < baseType.Length && (baseType[i] == '+' || baseType[i] == '.')) 2810if (lastIndex < baseType.Length)
Microsoft\VisualBasic\VBCodeGenerator.cs (18)
287StringBuilder b = new StringBuilder(value.Length + 5); 295while (i < value.Length) 313if (i < value.Length - 1 && value[i + 1] == '\n') 353&& (i < value.Length - 1) 1231for (int i = 0; i < value.Length; i++) 1608if (e.ReturnType.BaseType.Length == 0 || string.Equals(e.ReturnType.BaseType, typeof(void).FullName, StringComparison.OrdinalIgnoreCase)) 1953if (del.ReturnType.BaseType.Length > 0 && !string.Equals(del.ReturnType.BaseType, "System.Void", StringComparison.OrdinalIgnoreCase)) 1961if (del.ReturnType.BaseType.Length > 0 && !string.Equals(del.ReturnType.BaseType, "System.Void", StringComparison.OrdinalIgnoreCase)) 2379if (value.Length > 1023) 2384if (value[0] != '[' || value[value.Length - 1] != ']') 2393value = value.Substring(1, value.Length - 2); 2397if (value.Length == 1 && value[0] == '_') 2427if (baseType.Length == 0) 2471var sb = new StringBuilder(baseType.Length + 10); 2479for (int i = 0; i < baseType.Length; i++) 2495while (i < baseType.Length && baseType[i] >= '0' && baseType[i] <= '9') 2506if (i < baseType.Length && (baseType[i] == '+' || baseType[i] == '.')) 2517if (lastIndex < baseType.Length)
src\runtime\src\libraries\Common\src\System\CodeDom\CodeTypeReference.cs (3)
135int end = typeName.Length - 1; 363int end = typeName.Length - 1; 367while (start < typeName.Length && char.IsWhiteSpace(typeName[start])) start++;
src\runtime\src\libraries\Common\src\System\CSharpHelpers.cs (2)
131if (value.Length < 3) 152for (int i = 0; i < value.Length; i++)
StringExtensions.cs (1)
10return index < value.Length && value[index] == character;
System\CodeDom\Compiler\CodeValidator.cs (2)
625for (int i = 0; i < baseType.Length; i++) 631while (i < baseType.Length && baseType[i] >= '0' && baseType[i] <= '9')
System\CodeDom\Compiler\CompilerError.cs (1)
33public override string ToString() => FileName.Length > 0 ?
System\Collections\Specialized\FixedStringLookup.cs (2)
19int length = value.Length; 42while (pos < value.Length)
System.Collections.Immutable (35)
System\Collections\Frozen\FrozenDictionary.cs (5)
219if (key.Length < minLength) minLength = key.Length; 220if (key.Length > maxLength) maxLength = key.Length; 221lengthFilter |= (1UL << (key.Length % 64));
System\Collections\Frozen\FrozenSet.cs (5)
150if (s.Length < minLength) minLength = s.Length; 151if (s.Length > maxLength) maxLength = s.Length; 152lengthFilter |= (1UL << (s.Length % 64));
System\Collections\Frozen\String\KeyAnalyzer.cs (10)
112static (string s, int index, int count) => s.AsSpan(s.Length + index, count)); 258public override bool Equals(string? x, string? y) => x.AsSpan(IsLeft ? Index : (x!.Length + Index), Count).SequenceEqual(y.AsSpan(IsLeft ? Index : (y!.Length + Index), Count)); 259public override int GetHashCode(string s) => Hashing.GetHashCodeOrdinal(s.AsSpan(IsLeft ? Index : (s.Length + Index), Count)); 264public override bool Equals(string? x, string? y) => x.AsSpan(IsLeft ? Index : (x!.Length + Index), Count).Equals(y.AsSpan(IsLeft ? Index : (y!.Length + Index), Count), StringComparison.OrdinalIgnoreCase); 265public override int GetHashCode(string s) => Hashing.GetHashCodeOrdinalIgnoreCase(s.AsSpan(IsLeft ? Index : (s.Length + Index), Count)); 270public override bool Equals(string? x, string? y) => x.AsSpan(IsLeft ? Index : (x!.Length + Index), Count).Equals(y.AsSpan(IsLeft ? Index : (y!.Length + Index), Count), StringComparison.OrdinalIgnoreCase); 271public override int GetHashCode(string s) => Hashing.GetHashCodeOrdinalIgnoreCaseAscii(s.AsSpan(IsLeft ? Index : (s.Length + Index), Count));
System\Collections\Frozen\String\LengthBuckets.cs (1)
52int startIndex = (key.Length - minLength) * MaxPerLength;
System\Collections\Frozen\String\LengthBucketsFrozenDictionary.cs (1)
62int bucketIndex = (key.Length - _minLength) * LengthBuckets.MaxPerLength;
System\Collections\Frozen\String\LengthBucketsFrozenSet.cs (1)
58int bucketIndex = (item.Length - _minLength) * LengthBuckets.MaxPerLength;
System\Collections\Frozen\String\OrdinalStringFrozenDictionary_RightJustifiedCaseInsensitiveAsciiSubstring.cs (1)
27private protected override int GetHashCode(string s) => Hashing.GetHashCodeOrdinalIgnoreCaseAscii(s.AsSpan(s.Length + HashIndex, HashCount));
System\Collections\Frozen\String\OrdinalStringFrozenDictionary_RightJustifiedCaseInsensitiveSubstring.cs (1)
27private protected override int GetHashCode(string s) => Hashing.GetHashCodeOrdinalIgnoreCase(s.AsSpan(s.Length + HashIndex, HashCount));
System\Collections\Frozen\String\OrdinalStringFrozenDictionary_RightJustifiedSingleChar.cs (1)
26private protected override int GetHashCode(string s) => s[s.Length + HashIndex];
System\Collections\Frozen\String\OrdinalStringFrozenDictionary_RightJustifiedSubstring.cs (1)
27private protected override int GetHashCode(string s) => Hashing.GetHashCodeOrdinal(s.AsSpan(s.Length + HashIndex, HashCount));
System\Collections\Frozen\String\OrdinalStringFrozenDictionary.cs (2)
85if ((uint)(key.Length - _minimumLength) <= (uint)_maximumLengthDiff) 87if (CheckLengthQuick((uint)key.Length))
System\Collections\Frozen\String\OrdinalStringFrozenSet_RightJustifiedCaseInsensitiveAsciiSubstring.cs (1)
26private protected override int GetHashCode(string s) => Hashing.GetHashCodeOrdinalIgnoreCaseAscii(s.AsSpan(s.Length + HashIndex, HashCount));
System\Collections\Frozen\String\OrdinalStringFrozenSet_RightJustifiedCaseInsensitiveSubstring.cs (1)
26private protected override int GetHashCode(string s) => Hashing.GetHashCodeOrdinalIgnoreCase(s.AsSpan(s.Length + HashIndex, HashCount));
System\Collections\Frozen\String\OrdinalStringFrozenSet_RightJustifiedSingleChar.cs (1)
23private protected override int GetHashCode(string s) => s[s.Length + HashIndex];
System\Collections\Frozen\String\OrdinalStringFrozenSet_RightJustifiedSubstring.cs (1)
24private protected override int GetHashCode(string s) => Hashing.GetHashCodeOrdinal(s.AsSpan(s.Length + HashIndex, HashCount));
System\Collections\Frozen\String\OrdinalStringFrozenSet.cs (2)
75(uint)(item.Length - _minimumLength) <= (uint)_maximumLengthDiff) 77if (CheckLengthQuick((uint)item.Length))
System.CommandLine (37)
Completions\CompletionAction.cs (1)
25int position = !string.IsNullOrEmpty(parsedValues) ? int.Parse(parsedValues) : rawInput?.Length ?? 0;
Completions\CompletionContext.cs (3)
63if (position > rawInput.Length) 66position = Math.Min(rawInput.Length, position.Value); 71position = rawInput.Length;
Completions\TextCompletionContext.cs (1)
22string commandLineText) : this(parseResult, commandLineText, commandLineText.Length)
Help\HelpBuilder.cs (14)
207int maxWidth = MaxWidth - Indent.Length; 230int firstColumnWidth = items.Select(x => x.FirstColumnText.Length).Max(); 231int secondColumnWidth = items.Select(x => x.SecondColumnText.Length).Max(); 233if (firstColumnWidth + secondColumnWidth + Indent.Length + Indent.Length > windowWidth) 235int firstColumnMaxWidth = windowWidth / 2 - Indent.Length; 238firstColumnWidth = items.SelectMany(x => WrapText(x.FirstColumnText, firstColumnMaxWidth).Select(x => x.Length)).Max(); 240secondColumnWidth = windowWidth - firstColumnWidth - Indent.Length - Indent.Length; 254int padSize = firstColumnWidth - first.Length; 355if (part.Length <= maxWidth) 362for (int i = 0; i < part.Length;) 364if (part.Length - i < maxWidth) 372for (int j = 0; j + i < part.Length && j < maxWidth; j++)
Help\HelpBuilderExtensions.cs (1)
36'-' when rawAlias.Length > 1 && rawAlias[1] is '-' => ("--", rawAlias[2..]),
Invocation\ParseErrorAction.cs (4)
168for (i = 0; i < first.Length && i < second.Length && first[i] == second[i]; i++) 193int n = first.Length, m = second.Length;
ParseResult.cs (1)
391if (textCompletionContext.WordToComplete.Length > 0)
Parsing\ParseOperation.cs (1)
350ReadOnlySpan<char> withoutBrackets = token.Value.AsSpan(1, token.Value.Length - 2);
Parsing\StringExtensions.cs (7)
75if (arg.Length > 2 && 79arg[arg.Length - 1] == ']') 84: arg.Substring(1, arg.Length - 2); // [name] is a legal directive 200=> arg.Length > 2 304arg.Length > 1 && arg[0] == '@' 319if (rest.Length == 0) 384if (arg.Length == 0 || arg[0] == '#')
RootCommand.cs (3)
119&& injectedName.Length > 0) 126if (path.Length > 0) 131if (AppContext.GetData("System.CommandLine.ExecutableName") is string name && name.Length > 0)
Symbol.cs (1)
91for (var i = 0; i < value.Length; i++)
System.CommandLine.StaticCompletions (3)
HelpGenerationExtensions.cs (3)
109public static bool IsUpperCaseSingleCharacterFlag(this string name) => name.Length == 2 && char.IsUpper(name[1]); 111public static bool IsLongAlias(this string name) => name.Length > 2 && name[0] == '-' && name[1] == '-'; 112public static bool IsShortAlias(this string name) => name.Length == 2 && name[0] == '-' && char.IsAsciiLetter(name[1]);
System.ComponentModel.Annotations (12)
System\ComponentModel\DataAnnotations\CreditCardAttribute.cs (1)
32for (int i = ccValue.Length - 1; i >= 0; i--)
System\ComponentModel\DataAnnotations\EmailAddressAttribute.cs (1)
41index != valueAsString.Length - 1 &&
System\ComponentModel\DataAnnotations\EnumDataTypeAttribute.cs (1)
38if (stringValue?.Length == 0)
System\ComponentModel\DataAnnotations\LengthAttribute.cs (1)
63length = str.Length;
System\ComponentModel\DataAnnotations\MaxLengthAttribute.cs (1)
80length = str.Length;
System\ComponentModel\DataAnnotations\MinLengthAttribute.cs (1)
63length = str.Length;
System\ComponentModel\DataAnnotations\PhoneAttribute.cs (3)
73lastIndexOfExtension + ExtensionAbbreviationExtDot.Length); 85lastIndexOfExtension + ExtensionAbbreviationExt.Length); 97lastIndexOfExtension + ExtensionAbbreviationX.Length);
System\ComponentModel\DataAnnotations\RangeAttribute.cs (1)
137if (value is null or string { Length: 0 })
System\ComponentModel\DataAnnotations\RegularExpressionAttribute.cs (1)
73return m.Index == 0 && m.Length == stringValue.Length;
System\ComponentModel\DataAnnotations\StringLengthAttribute.cs (1)
57int length = ((string)value).Length;
System.ComponentModel.Composition (8)
Microsoft\Internal\Requires.cs (1)
117if (value.Length == 0)
System\ComponentModel\Composition\ExceptionBuilder.cs (5)
39if (memberName.Length == 0) 53if (parameterName.Length == 0) 68if (parameterName.Length == 0) 92if (parameterName.Length == 0) 106if (typeName.Length == 0)
System\ComponentModel\Composition\ReflectionModel\ReflectionProperty.cs (1)
66if (name.Length <= 4)
System\Composition\Diagnostics\CompositionTrace.cs (1)
47if (fileName.Length == 0)
System.ComponentModel.TypeConverter (30)
src\runtime\src\libraries\Common\src\System\Drawing\ColorConverterCommon.cs (7)
18if (text.Length == 0) 41if (text.Length >= 2 && (text[0] == '\'' || text[0] == '"') && text[0] == text[text.Length - 1]) 44string colorName = text.Substring(1, text.Length - 2); 47else if ((text.Length == 7 && text[0] == '#') || 48(text.Length == 8 && (text.StartsWith("0x") || text.StartsWith("0X"))) || 49(text.Length == 8 && (text.StartsWith("&h") || text.StartsWith("&H"))))
System\ComponentModel\CharConverter.cs (3)
46if (text.Length > 1) 51if (text.Length > 0) 53if (text.Length != 1)
System\ComponentModel\ComponentResourceManager.cs (2)
150int idx = objectName.Length; 151if (key.Length <= idx || (key[idx] != '.' && key[idx] != '-'))
System\ComponentModel\DateOnlyConverter.cs (1)
40if (text.Length == 0)
System\ComponentModel\DateTimeConverter.cs (1)
44if (text.Length == 0)
System\ComponentModel\DateTimeOffsetConverter.cs (1)
44if (text.Length == 0)
System\ComponentModel\Design\DesignerOptionService.cs (1)
35if (name.Length == 0)
System\ComponentModel\Design\DesigntimeLicenseContext.cs (1)
52Debug.Assert(fileName != null && fileName.Length > 0, "Cannot get local path, fileName is not valid");
System\ComponentModel\ExtendedPropertyDescriptor.cs (1)
100if (providerName != null && providerName.Length > 0)
System\ComponentModel\LicFileLicenseProvider.cs (1)
77if (type.Assembly.Location.Length != 0)
System\ComponentModel\MaskedTextProvider.cs (7)
305for (int maskPos = 0; maskPos < Mask.Length; maskPos++) 875if (input.Length == 0) // nothing to add. 1268if (input.Length == 0) // nothing to insert. 1786if (input.Length == 0) // remove the character at position. 1828if (input.Length == 0) // remove character at position. 1997if (input.Length == 0) // Clearing the input text. 2426if (input.Length == 0)
System\ComponentModel\MemberDescriptor.cs (1)
45if (name.Length == 0)
System\ComponentModel\PropertyDescriptor.cs (2)
78if (attr.ConverterTypeName != null && attr.ConverterTypeName.Length > 0) 107if (attr.ConverterTypeName != null && attr.ConverterTypeName.Length > 0)
System\ComponentModel\TimeOnlyConverter.cs (1)
40if (text.Length == 0)
System.Composition.Convention (9)
System\Composition\Convention\ExportConventionBuilder.cs (3)
58if (contractName.Length == 0) 89if (name.Length == 0) 110if (name.Length == 0)
System\Composition\Convention\ImportConventionBuilder.cs (3)
35if (contractName.Length == 0) 97if (name.Length == 0) 118if (name.Length == 0)
System\Composition\Convention\PartConventionBuilder.cs (3)
343if (sharingBoundary.Length == 0) 368if (name.Length == 0) 389if (name.Length == 0)
System.Configuration.ConfigurationManager (65)
System\Configuration\AppSettingsReader.cs (3)
60return val.Substring(1, val.Length - 2); 71string displayString = (val.Length == 0) ? SR.AppSettingsReaderEmptyString : val; 80int len = val.Length;
System\Configuration\AppSettingsSection.cs (1)
93if (!(File?.Length > 0)) return;
System\Configuration\BaseConfigurationRecord.cs (10)
2330if ((parentConfigKey.Length == 0) && !inLocation) 2356if ((parentConfigKey.Length > 0) || inLocation) 2811if (this is RuntimeConfigurationRecord && (host != null) && (locationSubPath.Length != 0) && 3077if (trimmedSubPath.Length != subPath.Length) 3087if (trimmedSubPath.Length != subPath.Length) 3091if (InvalidLastSubPathCharacters.Contains(subPath[subPath.Length - 1])) 3198if (trimmedConfigSource.Length != configSource.Length)
System\Configuration\ClientConfigPaths.cs (3)
58if (exeAssembly?.Location.Length == 0) 336if ((lastDot != -1) && (lastDot < ns.Length - 1)) ProductName = ns.Substring(lastDot + 1); 386validated = validated.Length > MaxLengthToUse
System\Configuration\ClientConfigurationHost.cs (2)
351return configPath.Length <= allowedConfigPath.Length;
System\Configuration\ConfigPathUtility.cs (3)
26for (int examine = 0; examine <= configPath.Length; examine++) 30ch = examine < configPath.Length ? configPath[examine] : SeparatorChar; 96Debug.Assert(index != configPath.Length - 1);
System\Configuration\ConfigurationElement.cs (1)
1571if ((e.Filename == null) || (e.Filename.Length == 0))
System\Configuration\ConfigurationElementCollection.cs (4)
100if (RemoveElementName.Length != 0) 102if (ClearElementName.Length != 0) 293EmitClear = ((saveMode == ConfigurationSaveMode.Full) && (_clearElement.Length != 0)) || 1039if (_emitClearTag && (_clearElement.Length != 0))
System\Configuration\ConfigurationLockCollection.cs (1)
52if (_seedList.Length != 0)
System\Configuration\DpapiProtectedConfigurationProvider.cs (2)
61if (clearText == null || clearText.Length < 1) 77if (encText == null || encText.Length < 1)
System\Configuration\GenericEnumConverter.cs (2)
30if ((data is string value) && (value.Length > 0)) 34(!char.IsWhiteSpace(value[0])) && (!char.IsWhiteSpace(value[value.Length - 1])))
System\Configuration\MgmtConfigurationRecord.cs (3)
863if (configKey.Length == 0) configKeyAncestor = string.Empty; 880if (configKey.Length == 0) configKeyAncestor = string.Empty; 965Debug.Assert(filename.Length > 0, "The caller should make sure that filename is not empty");
System\Configuration\NameValueFileSectionHandler.cs (1)
29if (fileAttribute != null && fileAttribute.Value.Length != 0)
System\Configuration\Provider\ProviderBase.cs (1)
30if (name.Length == 0)
System\Configuration\Provider\ProviderCollection.cs (1)
44if ((provider.Name == null) || (provider.Name.Length < 1))
System\Configuration\SectionUpdates.cs (1)
39if (group.Length != 0)
System\Configuration\SettingsPropertyValue.cs (2)
176if (type == typeof(string) && (serializedValue == null || serializedValue.Length < 1 || serializeAs == SettingsSerializeAs.String)) 180if (serializedValue == null || serializedValue.Length < 1)
System\Configuration\StringAttributeCollection.cs (1)
46if (trimmedItem.Length != 0) Add(trimmedItem);
System\Configuration\StringValidator.cs (1)
37int len = data?.Length ?? 0;
System\Configuration\UrlPath.cs (6)
30int lDir = dir.Length; 33int lSubdir = subdir.Length; 75int lPath = path.Length; 78int lSubpath = subpath.Length; 101if ((path == null) || (path.Length < 3)) 110if ((path == null) || (path.Length < 3))
System\Configuration\XmlUtil.cs (5)
574linePosition = Reader.LinePosition + Reader.Name.Length; 622linePosition = Reader.LinePosition + Reader.Name.Length; 743linePosition = Reader.LinePosition + Reader.Name.Length; 803int closeLinePosition = Reader.LinePosition - startOffset - close.Length; 1049lineWidth += reader.Name.Length + 2;
System\Configuration\XmlUtilWriter.cs (9)
88for (int i = 0; i < s.Length; i++) 97return s.Length; 124for (int i = 0; i < s.Length; i++) 174return entityRef.Length + 2; 185return numberToWrite.Length + 4; 193return cdata.Length + 12; 203return name.Length + value.Length + 5; 211return comment.Length + 7;
System\Diagnostics\TraceUtils.cs (2)
23if (className.Length == 0) 146string name = className.Substring(SystemDiagnostics.Length);
System.Console (14)
src\runtime\src\libraries\Common\src\System\Text\ValueStringBuilder.cs (5)
125int count = s.Length; 167if (s.Length == 1 && (uint)pos < (uint)_chars.Length) // very common case, e.g. appending strings from NumberFormatInfo like separators, percent symbols, etc. 181if (pos > _chars.Length - s.Length) 183Grow(s.Length); 191_pos += s.Length;
System\ConsolePal.Unix.cs (2)
1131if (value.Length <= 256) // except for extremely rare cases, ANSI escape strings are very short 1133data = stackalloc byte[Encoding.UTF8.GetMaxByteCount(value.Length)];
System\TerminalFormatStrings.cs (4)
168if (entry.Key.Length > MaxKeyFormatLength) 170MaxKeyFormatLength = entry.Key.Length; 172if (entry.Key.Length < MinKeyFormatLength) 174MinKeyFormatLength = entry.Key.Length;
System\TermInfo.cs (3)
118for (; pos < format.Length; pos++) 170if (printfFormat.Length > 1 && printfFormat[1] == ':') 184stack.Push(stack.Pop().String.Length);
System.Data.Common (190)
src\runtime\src\libraries\Common\src\System\Data\Common\AdapterUtil.cs (7)
134int prefixLength = quotePrefix != null ? quotePrefix.Length : 0; 135int suffixLength = quoteSuffix != null ? quoteSuffix.Length : 0; 149int quotedStringLength = quotedString.Length; 361var resultString = new StringBuilder(unQuotedString.Length + quoteSuffix.Length + quoteSuffix.Length); 379buffer.Replace(quoteSuffix, quoteSuffix + quoteSuffix, start, unQuotedString.Length);
src\runtime\src\libraries\Common\src\System\Data\Common\DbConnectionOptions.Common.cs (13)
206int length = connectionString.Length; 368char tmpChar = keyvalue[keyvalue.Length - 1]; 392if ((';' == currentChar) && (currentPosition < connectionString.Length)) 414Debug.Assert(((0 < keyname.Length) && (';' != keyname[0]) && !char.IsWhiteSpace(keyname[0]) && !keyname.Contains('\u0000')) == compValue, "IsValueValid mismatch with regex"); 416return ((0 < keyname.Length) && (';' != keyname[0]) && !char.IsWhiteSpace(keyname[0]) && !keyname.Contains('\u0000')); 434if (!match.Success || (match.Length != connectionString.Length)) 444if (0 < keyvalue.Length) 451keyvalue = keyvalue.Substring(1, keyvalue.Length - 2).Replace("\"\"", "\""); 454keyvalue = keyvalue.Substring(1, keyvalue.Length - 2).Replace("\'\'", "\'"); 545int endPosition = connectionString.Length; 603StringBuilder builder = new StringBuilder(_usersConnectionString.Length); 619next = new NameValuePair(current.Name, "*", current.Name.Length + equalstar.Length);
src\runtime\src\libraries\Common\src\System\Data\Common\MultipartIdentifier.cs (4)
71if (leftQuote.Contains(separator) || rightQuote.Contains(separator) || leftQuote.Length != rightQuote.Length) 80StringBuilder sb = new StringBuilder(name.Length); // String buffer to hold the string being currently built, init the string builder so it will never be resized 83for (int index = 0; index < name.Length; ++index)
System\Data\Common\AdapterUtil.Common.cs (3)
50if (0 == value.Length) 788if ((null != columnName) && (0 < columnName.Length)) 807if (0 == columnName.Length)
System\Data\Common\DBCommandBuilder.cs (14)
97if (columnName.Length > _adjustedParameterNameMaxLength) 242(null != _isNullPrefix ? _isNullPrefix.Length : 0), 243(null != _originalPrefix ? _originalPrefix.Length : 0) 244) + _dbCommandBuilder.GetParameterName("").Length; 393return (((null != catalogSeparator) && (0 < catalogSeparator.Length)) ? catalogSeparator : NameSeparator); 500return (((null != schemaSeparator) && (0 < schemaSeparator.Length)) ? schemaSeparator : NameSeparator); 673if ((null == tableName) || (0 == tableName.Length)) 709if (0 == baseServerName.Length) 713if (0 == baseCatalogName.Length) 718if (0 == baseSchemaName.Length) 724if ((null == baseTableName) || (0 == baseTableName.Length)) 833if ((null == row) || (0 == row.BaseColumnName.Length) || !IncludeInInsertValues(row)) 922if ((null == row) || (0 == row.BaseColumnName.Length) || !IncludeInUpdateSet(row)) 1011if ((null == row) || (0 == row.BaseColumnName.Length) || !IncludeInWhereClause(row))
System\Data\Common\DbConnectionOptions.cs (3)
43if (0 < _usersConnectionString.Length) 89if ((0 < keyValue.Length) && 138var builder = new StringBuilder(_usersConnectionString.Length);
System\Data\Common\ObjectStorage.cs (1)
374if (null != xsdTypeName && xsdTypeName.Length > 0)
System\Data\Common\SQLTypes\SQLStringStorage.cs (1)
141return ((value.IsNull) ? 0 : value.Value.Length);
System\Data\Common\StringStorage.cs (1)
159return ((null != value) ? value.Length : 0);
System\Data\Constraint.cs (1)
48if (_name.Length != 0)
System\Data\ConstraintCollection.cs (3)
123if (constraint.ConstraintName.Length == 0) 315if (constraint.ConstraintName.Length == 0) 623if ((null != constraintName) && (0 < constraintName.Length))
System\Data\DataColumn.cs (5)
367if (value.Length == 0) 373if (_columnName.Length != 0) 724if (value.Length > 0) 1683if (value != null && value != DBNull.Value && ((string)value).Length > MaxLength) 1693if (!DataStorage.IsObjectNull(value) && ((SqlString)value).Value.Length > MaxLength)
System\Data\DataColumnCollection.cs (2)
334if (column.ColumnName.Length == 0) 694if ((null != columnName) && (0 < columnName.Length))
System\Data\DataError.cs (1)
35internal bool HasErrors => _rowError.Length != 0 || _count != 0;
System\Data\DataException.cs (2)
487column.Length == 0 ? 630public static Exception RemovePrimaryKey(DataTable table) => table.TableName.Length == 0 ?
System\Data\DataRelation.cs (3)
369if (value.Length == 0) 375if (_relationName.Length != 0) 565if (CheckMultipleNested && ChildTable._tableNamespace != null && ChildTable._tableNamespace.Length == 0)
System\Data\DataRelationCollection.cs (2)
336if ((null != name) && (0 < name.Length)) 775if (relation._relationName.Length == 0)
System\Data\DataSet.cs (6)
1223if (col.Expression.Length != 0) 1281int rowBytes = (Tables[i].TableName.Length + 4) << 2; 1285rowBytes += ((table.Columns[j].ColumnName.Length + 4) << 2); 2254if ((rootNodeSimpleContent != null && rootNodeSimpleContent.Length > 0)) 2261if ((rootNodeSimpleContent != null && rootNodeSimpleContent.Length > 0)) 2285Tables.Contains(root.Name, (root.NamespaceURI.Length == 0) ? null : root.NamespaceURI, false, true))
System\Data\DataTable.cs (17)
680if (0 != expr.Length) 1785if (value.Length == 0) 1818if (_tableName.Length != 0) 2261if (targetRow.RowError.Length == 0) 2940int leng1 = s1.Length; 2941int leng2 = s2.Length; 3216for (i = 0; (i < name.Length) && (0x3000 > name[i]); ++i) ; 3218if (name.Length == i) 3708if ((null != sortString) && (0 < sortString.Length)) 3718int length = current.Length; 3735current = current.Substring(1, current.Length - 2); 5278if (dataRow.RowError.Length == 0) 5397if (_tableName.Length == 0) 5543if (dc.Expression.Length != 0) 5570if (_tableName.Length == 0) 6530qTableName = (Namespace.Length > 0) ? (Namespace + ":" + _tableName) : _tableName; 6635if (dc.Expression.Length != 0)
System\Data\DataTableCollection.cs (3)
292if (table.TableName.Length == 0) 631if ((null != tableName) && (0 < tableName.Length)) 668if ((null != tableName) && (0 < tableName.Length))
System\Data\DataTableReader.cs (1)
822if (dc.Expression.Length != 0)
System\Data\DataView.cs (4)
416if (_sort.Length == 0 && _applyDefaultSort && _table != null && _table._primaryIndex.Length > 0) 490if (value != null && value.TableName.Length == 0) 618if (sort.Length == 0) 949bool IBindingList.IsSorted => Sort.Length != 0;
System\Data\Filter\BinaryNode.cs (1)
1596int length = pat.Length;
System\Data\Filter\ExpressionParser.cs (1)
134length = data.Length;
System\Data\Filter\FunctionNode.cs (2)
419return ((string)argumentValues[0]).Length; 449int src_length = ((string)argumentValues[0]).Length;
System\Data\LinqDataView.cs (1)
281return !(base.SortComparison == null && base.Sort.Length == 0);
System\Data\ProviderBase\SchemaMapping.cs (2)
214if (0 == columns[i].Expression.Length) 234if (0 == columns[i].Expression.Length)
System\Data\Select.cs (1)
44if (filterExpression != null && filterExpression.Length > 0)
System\Data\SimpleType.cs (5)
72if (_baseSimpleType != null && _baseSimpleType.Name != null && _baseSimpleType.Name.Length > 0) 81if (_baseType == null || _baseType.Length == 0) 208if (_ns.Length == 0) 247if (_baseSimpleType.Namespace != null && _baseSimpleType.Namespace.Length > 0) 333(BaseSimpleType.HasConflictingDefinition(otherSimpleType.BaseSimpleType)).Length != 0)
System\Data\SQLTypes\SQLBinary.cs (1)
434if (base64.Length == 0)
System\Data\SQLTypes\SQLBytes.cs (1)
546if (base64.Length == 0)
System\Data\SQLTypes\SQLString.cs (4)
393int cwchX = rgchX.Length; 394int cwchY = rgchY.Length; 779int cwchX = rgDataX.Length; 780int cwchY = rgDataY.Length;
System\Data\XDRSchema.cs (7)
193if (occurs != null && occurs.Length > 0) 201if (occurs != null && occurs.Length > 0) 327if (instanceName == null || instanceName.Length == 0) 363if (strRef != null && strRef.Length > 0) 479if (targetNamespace != null && targetNamespace.Length > 0) 497if (occurs != null && occurs.Length > 0) 506if (occurs != null && occurs.Length > 0)
System\Data\XmlDataLoader.cs (3)
1185if (typeName != null && typeName.Length > 0) 1249if (0 == text.Length) 1346if (0 == text.Length && xsiNilString != null && XmlConvert.ToBoolean(xsiNilString))
System\Data\xmlsaver.cs (38)
203else if ((dt.Length == 0) || bImplementsInullable || ((dt == Keywords.XSD_ANYTYPE) && (col.XmlDataType != Keywords.XSD_ANYTYPE)) || (col.DataType == typeof(DateTimeOffset))) 626if (_ds.Namespace.Length == 0) 703if (((_ds != null) && (_ds.Namespace.Length != 0)) && string.IsNullOrEmpty(top[i].Namespace)) 973if (_ds.Namespace.Length == 0) 987if (dt.Namespace.Length == 0) 1027_dsElement.SetAttribute(Keywords.MSD_MAINDATATABLE, Keywords.MSDNS, XmlConvert.EncodeLocalName(((dt!.Namespace.Length == 0) ? dt.TableName : (dt.Namespace + ":" + dt.TableName)))); 1049_dsElement.SetAttribute(Keywords.MSD_MAINDATATABLE, Keywords.MSDNS, XmlConvert.EncodeLocalName(((dt.Namespace.Length == 0) ? dt.TableName : (dt.Namespace + ":" + dt.TableName)))); 1270if (stNode.BaseSimpleType != null && stNode.BaseSimpleType.Namespace != null && stNode.BaseSimpleType.Namespace.Length > 0) 1279if (prefix != null && prefix.Length > 0) 1308if (stNode.BaseSimpleType != null && stNode.BaseSimpleType.Namespace != null && stNode.BaseSimpleType.Namespace.Length > 0) 1317else if (col.XmlDataType != null && col.XmlDataType.Length != 0 && XSDSchema.IsXsdType(col.XmlDataType)) 1348if ((col.IsSqlType && ((dt.Length == 0) || col.ImplementsINullable)) || (typeof(SqlXml) == col.DataType) || col.DataType == typeof(DateTimeOffset) || col.DataType == typeof(System.Numerics.BigInteger)) 1352else if ((dt.Length == 0) || col.ImplementsINullable || ((dt == Keywords.XSD_ANYTYPE) && (col.XmlDataType != Keywords.XSD_ANYTYPE))) 1366if (col.Expression.Length != 0) 1383if (col.Prefix.Length != 0) 1439if (col.Namespace.Length == 0) 1511if ((col.Namespace != (col.Table!.TypeName.IsEmpty ? col.Table.Namespace : col.Table.TypeName.Namespace)) && (col.Namespace.Length != 0)) 1743if (table.Namespace.Length == 0) 1954if ((childTable.Namespace == table.Namespace) || (childTable.Namespace.Length == 0) || _schFormat == SchemaFormat.Remoting) 1989string xpathprefix = (_ds != null) ? (_ds.Namespace.Length != 0 ? Keywords.MSTNS_PREFIX : string.Empty) : string.Empty; 1993xpathprefix = table.Namespace.Length != 0 ? (string)_prefixes[table.Namespace]! + ':' : string.Empty; 2441string prefix = (table.Namespace.Length != 0) ? table.Prefix : string.Empty; 2442if ((row.HasErrors) && (row.RowError.Length > 0)) 2460string columnPrefix = (column.Namespace.Length != 0) ? column.Prefix : string.Empty; 2520string tablePrefix = (table.Namespace.Length != 0) ? table.Prefix : string.Empty; 2563string colPrefix = (col.Namespace.Length != 0) ? col.Prefix : string.Empty; 2781if ((row.HasErrors) && (row.RowError.Length > 0)) 2811string prefix = (_ds != null) ? ((_ds.Namespace.Length == 0) ? "" : _ds.Prefix) : ((_dt!.Namespace.Length == 0) ? "" : _dt.Prefix); 2835throw ExceptionBuilder.MultipleParentRows(tempTable.Namespace.Length == 0 ? tempTable.TableName : tempTable.Namespace + tempTable.TableName); 2856string prefix = (_ds != null) ? ((_ds.Namespace.Length == 0) ? "" : _ds.Prefix) : ((_dt!.Namespace.Length == 0) ? "" : _dt.Prefix); 2914throw ExceptionBuilder.MultipleParentRows(dt.Namespace.Length == 0 ? dt.TableName : (dt.Namespace + dt.TableName)); 2945string prefix = (row.Table.Namespace.Length == 0) ? "" : row.Table.Prefix; 2976string colPrefix = (col.Namespace.Length == 0) ? "" : col.Prefix; 3005string colPrefix = (col.Namespace.Length == 0) ? "" : col.Prefix; 3110if (tempValue.Length == 0) 3114for (int i = 0; i < tempValue.Length; i++)
System\Data\XMLSchema.cs (20)
231if (errorStr.Length != 0) 544if (((XmlSchemaElement)el).RefName.Name.Length != 0) 694if (dc.SimpleType != null && dc.SimpleType.Name != null && dc.SimpleType.Name.Length != 0) 755if (sel.RefName.Name.Length != 0) 1544Debug.Assert((instanceName != null) && (instanceName.Length != 0), "instanceName cannot be null or empty. There's an error in the XSD compiler"); 1589if (value.Length == 0) 1593if (0 < value.Length) 1604if (0 < value.Length) 2044if ((column.Expression != null) && (column.Expression.Length != 0)) 2050if (xsdType != null && xsdType.Name != null && xsdType.Name.Length > 0) 2158if ((column.Expression != null) && (column.Expression.Length != 0)) 2287if ((column.Expression != null) && (column.Expression.Length != 0)) 2292if (xsdType != null && xsdType.Name != null && xsdType.Name.Length > 0) 2479if (xsdType != null && xsdType.Name != null && xsdType.Name.Length > 0) 2568if (0 != value.Length) 2632if (((XmlSchemaElement)el).RefName.Name.Length != 0) 2676if ((((XmlSchemaElement)choiceEl).RefName.Name.Length != 0) && (!FromInference && ((XmlSchemaElement)choiceEl).MaxOccurs != decimal.One && !(((XmlSchemaElement)choiceEl).SchemaType is XmlSchemaComplexType))) 2748if ((prefix == null) || (prefix.Length == 0)) 2771if ((QualifiedTableName == null) || (QualifiedTableName.Length == 0)) 2790if ((tableName == null) || (tableName.Length == 0))
System\Xml\DataPointer.cs (2)
483if (prefix != null && prefix.Length > 0) 485if (lname != null && lname.Length > 0)
System\Xml\DataSetMappper.cs (1)
117Debug.Assert(a.Prefix != null && a.Prefix.Length == 0);
System\Xml\XmlDataDocument.cs (2)
2473if (value.Length == 0 && (((xsi_attrVal = rowElement.GetAttribute(XSI_NIL)) == "1") || xsi_attrVal == "true")) 2509if (value.Length == 0 && (((xsi_attrVal = e.GetAttribute(XSI_NIL)) == "1") || xsi_attrVal == "true"))
System\Xml\XPathNodePointer.cs (1)
1366if (name != null && name.Length == 0)
System.Data.Odbc (86)
Common\System\Data\Common\AdapterUtil.Odbc.cs (2)
81if (0 == value.Length) 656return ((null != inputString) ? inputString.Length : 0);
Common\System\Data\Common\DbConnectionOptions.cs (8)
51if (0 < _usersConnectionString.Length) 150if (keyValue.Length > 0 && 289int fileNamePosition = DataDirectory.Length; // filename starts right after the '|datadirectory|' keyword 290bool rootFolderEndsWith = (0 < rootFolderPath.Length) && rootFolderPath[rootFolderPath.Length - 1] == '\\'; 291bool fileNameStartsWith = (fileNamePosition < value.Length) && value[fileNamePosition] == '\\'; 322StringBuilder builder = new StringBuilder(_usersConnectionString.Length); 418StringBuilder builder = new StringBuilder(_usersConnectionString.Length);
Common\System\Data\Common\DBConnectionString.cs (4)
468StringBuilder buffer = new StringBuilder(restrictions.Length); 471int endPosition = restrictions.Length; 501if ((0 == prev.Length) || (prev == restrictions[i])) 507if (0 == restrictions[restrictions.Length - 1]!.Length)
Common\System\Data\ProviderBase\DbBuffer.cs (1)
72Validate(offset, (2 * (value!.Length + 1)));
src\runtime\src\libraries\Common\src\System\Data\Common\AdapterUtil.cs (7)
134int prefixLength = quotePrefix != null ? quotePrefix.Length : 0; 135int suffixLength = quoteSuffix != null ? quoteSuffix.Length : 0; 149int quotedStringLength = quotedString.Length; 361var resultString = new StringBuilder(unQuotedString.Length + quoteSuffix.Length + quoteSuffix.Length); 379buffer.Replace(quoteSuffix, quoteSuffix + quoteSuffix, start, unQuotedString.Length);
src\runtime\src\libraries\Common\src\System\Data\Common\DbConnectionOptions.Common.cs (13)
206int length = connectionString.Length; 368char tmpChar = keyvalue[keyvalue.Length - 1]; 392if ((';' == currentChar) && (currentPosition < connectionString.Length)) 414Debug.Assert(((0 < keyname.Length) && (';' != keyname[0]) && !char.IsWhiteSpace(keyname[0]) && !keyname.Contains('\u0000')) == compValue, "IsValueValid mismatch with regex"); 416return ((0 < keyname.Length) && (';' != keyname[0]) && !char.IsWhiteSpace(keyname[0]) && !keyname.Contains('\u0000')); 434if (!match.Success || (match.Length != connectionString.Length)) 444if (0 < keyvalue.Length) 451keyvalue = keyvalue.Substring(1, keyvalue.Length - 2).Replace("\"\"", "\""); 454keyvalue = keyvalue.Substring(1, keyvalue.Length - 2).Replace("\'\'", "\'"); 545int endPosition = connectionString.Length; 603StringBuilder builder = new StringBuilder(_usersConnectionString.Length); 619next = new NameValuePair(current.Name, "*", current.Name.Length + equalstar.Length);
src\runtime\src\libraries\Common\src\System\Data\Common\MultipartIdentifier.cs (4)
71if (leftQuote.Contains(separator) || rightQuote.Contains(separator) || leftQuote.Length != rightQuote.Length) 80StringBuilder sb = new StringBuilder(name.Length); // String buffer to hold the string being currently built, init the string builder so it will never be resized 83for (int index = 0; index < name.Length; ++index)
src\runtime\src\libraries\Common\src\System\Data\ProviderBase\DbMetaDataFactory.cs (1)
408if ((restrictions[i]?.Length > 4096))
System\Data\Odbc\OdbcCommand.cs (1)
566if ((CommandText == null) || (CommandText.Length == 0))
System\Data\Odbc\OdbcConnection.cs (7)
227if (ProviderInfo.DriverVersion != null && ProviderInfo.DriverVersion.Length >= 2) 267Debug.Assert((escapeCharString.Length <= 1), "Can't handle multichar quotes"); 268ProviderInfo.EscapeChar = (escapeCharString.Length == 1) ? escapeCharString[0] : QuoteChar(method)[0]; 280Debug.Assert((quoteCharString.Length <= 1), "Can't handle multichar quotes"); 281ProviderInfo.QuoteChar = (1 == quoteCharString.Length) ? quoteCharString : "\0"; 944if (1024 < value.Length * 2 + 2) 952ODBC32.SQLRETURN retcode = connectionHandle.SetConnectionAttribute3(ODBC32.SQL_ATTR.CURRENT_CATALOG, value, checked((int)value.Length * 2));
System\Data\Odbc\OdbcDataReader.cs (22)
1161int cachedObjectLength = isCharsBuffer ? ((string)cachedObj).Length : ((byte[])cachedObj).Length; 2747if ((localcmdtext.Length > 0) && (localcmdtext[0] == ',')) 2751if ((localcmdtext.Length == 2) && 2758if ((localcmdtext.Length > 0) && (localcmdtext[0] == ',')) 2846if ((str != null) && (str.Length > 0)) 2851Debug.Assert(str.Length > 1, "Illegal string, only one char that is a quote"); 2852Debug.Assert(str[str.Length - 1] == quoteChar, "Missing quote at end of string that begins with quote"); 2853if (str.Length > 1 && str[str.Length - 1] == quoteChar) 2855str = str.Substring(1, str.Length - 2); 2884for (parts = 0; (parts < qualifiers.Length) && (currentPos < name.Length); ++parts) 2889if (useQuotes && (name.IndexOf(quotePrefix!, currentPos, quotePrefix!.Length, StringComparison.Ordinal) == currentPos)) 2893currentPos += quotePrefix.Length; // move past the quotePrefix 2896while (currentPos < name.Length) 2902currentPos = name.Length; 2907currentPos += quoteSuffix.Length; // move past the quoteSuffix 2910if ((currentPos < name.Length) && (name.IndexOf(quoteSuffix, currentPos, quoteSuffix.Length, StringComparison.Ordinal) == currentPos)) 2913currentPos += quoteSuffix.Length; // move past the second quoteSuffix 2925if (currentPos < name.Length) 2931currentPos = name.Length; 2936currentPos += Separator.Length;
System\Data\Odbc\OdbcMetaDataFactory.cs (1)
731if (stringValue.Length == 1)
System\Data\Odbc\OdbcParameter.cs (9)
347cch = ((string)value).Length - offset; 430cch = ((string)value).Length - offset; 493ccb = (((string)value).Length - offset) * 2 + 2; 515if ((value is string) && (ccb < ((string)value).Length) && (_bindtype == _originalbindtype)) 518ccb = ((string)value).Length; 640if (offset > ((string)value).Length) 685size = ((string)value).Length; 699size = ((string)value).Length; 710size = ((string)value).Length;
System\Data\Odbc\OdbcParameterCollectionHelper.cs (2)
314if (0 == name.Length) 325&& int.TryParse(lastParameter.ParameterName.AsSpan(ADP.Parameter.Length), out int lastIndex))
System\Data\Odbc\OdbcParameterHelper.cs (1)
242string svalue => svalue.Length,
System\Data\Odbc\OdbcUtils.cs (3)
172length = Math.Max(0, ((string)value).Length - valueOffset); 367_len = (0 > iNul) ? text.Length : iNul; 538if ((_len - tempidx) < tokenString.Length)
System.Data.OleDb (60)
ColumnBinding.cs (5)
654LengthValue(value.Length * 2); /* bytecount*/ 740int length = ((ValueBindingOffset < value.Length) ? (value.Length - ValueBindingOffset) : 0); 1208int charCount = ((ValueBindingOffset < value.Length) ? Math.Min(value.Length - ValueBindingOffset, (ColumnBindingMaxLen - 2) / 2) : 0);
DbConnectionOptions.cs (20)
137if (0 < _usersConnectionString.Length) 215if ((0 < keyValue.Length) && 363int fileNamePosition = DataDirectory.Length; // filename starts right after the '|datadirectory|' keyword 364bool rootFolderEndsWith = (0 < rootFolderPath.Length) && rootFolderPath[rootFolderPath.Length - 1] == '\\'; 365bool fileNameStartsWith = (fileNamePosition < value.Length) && value[fileNamePosition] == '\\'; 396StringBuilder builder = new StringBuilder(_usersConnectionString.Length); 559int length = connectionString.Length; 721char tmpChar = keyvalue[keyvalue.Length - 1]; 745if ((';' == currentChar) && (currentPosition < connectionString.Length)) 767Debug.Assert(((0 < keyname.Length) && (';' != keyname[0]) && !char.IsWhiteSpace(keyname[0]) && !keyname.Contains('\u0000')) == compValue, "IsValueValid mismatch with regex"); 769return ((0 < keyname.Length) && (';' != keyname[0]) && !char.IsWhiteSpace(keyname[0]) && !keyname.Contains('\u0000')); 787if (!match.Success || (match.Length != connectionString.Length)) 797if (0 < keyvalue.Length) 804keyvalue = keyvalue.Substring(1, keyvalue.Length - 2).Replace("\"\"", "\""); 807keyvalue = keyvalue.Substring(1, keyvalue.Length - 2).Replace("\'\'", "\'"); 895int endPosition = connectionString.Length; 949StringBuilder builder = new StringBuilder(_usersConnectionString.Length); 964next = new NameValuePair(current.Name, "*", current.Name.Length + equalstar.Length);
DbParameterHelper.cs (1)
247return svalue.Length;
OleDbConnection.cs (1)
140if ((null == value) || ((value is string) && (0 == (value as string)!.Length)))
OleDbConnectionString.cs (5)
302int hdrlength = ADP.CharSize * UDL.Header.Length; 365if (0 < progid.Length) 374if (0 < progid.Length) 392if ((null != classid) && (0 < classid.Length)) 440if (ODB.MaxProgIdLength <= progid.Length)
OleDbDataReader.cs (4)
896return value.Length; 900int charCount = Math.Min(value.Length - srcIndex, length); 903throw ADP.InvalidSourceBufferIndex(value.Length, srcIndex, "dataIndex"); 1936if ((null != info.baseTableName) && (0 < info.baseTableName.Length))
OleDbMetaDataFactory.cs (1)
328if (quoteSuffix.Length == 1)
OleDbParameterCollectionHelper.cs (1)
315if (0 == name.Length)
RowBinding.cs (1)
257ptr = Interop.OleAut32.SysAllocStringLen(value, (uint)value.Length);
SafeHandles.cs (2)
100internal StringMemHandle(string? value) : base((null != value) ? checked(2 + 2 * value.Length) : 0) 105WriteCharArray(0, value.ToCharArray(), 0, value.Length);
src\runtime\src\libraries\Common\src\System\Data\Common\MultipartIdentifier.cs (4)
71if (leftQuote.Contains(separator) || rightQuote.Contains(separator) || leftQuote.Length != rightQuote.Length) 80StringBuilder sb = new StringBuilder(name.Length); // String buffer to hold the string being currently built, init the string builder so it will never be resized 83for (int index = 0; index < name.Length; ++index)
System\Data\Common\AdapterUtil.cs (8)
198if (0 == value.Length) 1064StringBuilder tempstring = new StringBuilder(rootPath.Length + config.Length + value.Length); 1194prefixLength = quotePrefix.Length; 1204suffixLength = quoteSuffix.Length; 1219int quotedStringLength = quotedString.Length; 1311return ((null == str) || (0 == str.Length));
System\Data\ProviderBase\DbConnectionPoolCounters.cs (6)
249if (result.Length > CounterInstanceNameMaxLength) 256int firstPartLength = (CounterInstanceNameMaxLength - insertString.Length) / 2; 257int lastPartLength = CounterInstanceNameMaxLength - firstPartLength - insertString.Length; 258result = $"{result.Substring(0, firstPartLength)}{insertString}{result.Substring(result.Length - lastPartLength, lastPartLength)}"; 260Debug.Assert(result.Length == CounterInstanceNameMaxLength, 261$"wrong calculation of the instance name: expected {CounterInstanceNameMaxLength}, actual: {result.Length}");
System\Data\ProviderBase\DbMetaDataFactory.cs (1)
424if ((restrictions[i]?.Length > 4096))
System.Diagnostics.DiagnosticSource (48)
src\runtime\src\libraries\Common\src\System\Text\ValueStringBuilder.cs (5)
125int count = s.Length; 167if (s.Length == 1 && (uint)pos < (uint)_chars.Length) // very common case, e.g. appending strings from NumberFormatInfo like separators, percent symbols, etc. 181if (pos > _chars.Length - s.Length) 183Grow(s.Length); 191_pos += s.Length;
System\Diagnostics\Activity.cs (6)
1088return id.Length == 55 && 1369Debug.Assert(ParentId.Length != 0); 1375char lastChar = parentId[parentId.Length - 1]; 1404rootEnd = id.Length; 1415if (parentId.Length + suffix.Length < RequestIdMaxLength)
System\Diagnostics\Activity.GenerateRootId.netcoreapp.cs (3)
16Debug.Assert(s_uniqSuffix.Length < 50); // Ensure stackalloc not too large 17Span<char> result = stackalloc char[1 + 16 + s_uniqSuffix.Length]; // max length needed 22return new string(result.Slice(0, 1 + charsWritten + s_uniqSuffix.Length));
System\Diagnostics\DsesFilterAndTransform.cs (13)
59int endIdx = filterAndPayloadSpecs.Length; 112Debug.Assert(filterAndPayloadSpec != null && startIdx >= 0 && startIdx <= endIdx && endIdx <= filterAndPayloadSpec.Length); 219int colonIdx = filterAndPayloadSpec.IndexOf(':', startIdx + c_ActivitySourcePrefix.Length, endIdx - startIdx - c_ActivitySourcePrefix.Length); 222startIdx + c_ActivitySourcePrefix.Length, 223(colonIdx >= 0 ? colonIdx : endIdx) - startIdx - c_ActivitySourcePrefix.Length) 253|| !double.TryParse(suffixPart.Slice(c_ParentRatioSamplerPrefix.Length, endingLocation - c_ParentRatioSamplerPrefix.Length), NumberStyles.Float, CultureInfo.InvariantCulture, out double ratio)) 267suffixPart.Slice(c_ParentRateLimitingSamplerPrefix.Length, endingLocation - c_ParentRateLimitingSamplerPrefix.Length), 326if (activityName.Length > 0 && activitySourceName.Length == 1 && activitySourceName[0] == '*') 603Debug.Assert(transformSpec != null && startIdx >= 0 && startIdx < endIdx && endIdx <= transformSpec.Length); 1020newSerializableArgs = new TransformSpec(eventSource, property.Name, 0, property.Name.Length, newSerializableArgs);
System\Diagnostics\LegacyPropagator.cs (11)
100while (currentIndex < baggageString.Length && (baggageString[currentIndex] == Space || baggageString[currentIndex] == Tab)) 105if (currentIndex >= baggageString.Length) 113while (currentIndex < baggageString.Length && baggageString[currentIndex] != Space && baggageString[currentIndex] != Tab && baggageString[currentIndex] != '=') 118if (currentIndex >= baggageString.Length) 128while (currentIndex < baggageString.Length && (baggageString[currentIndex] == Space || baggageString[currentIndex] == Tab)) 133if (currentIndex >= baggageString.Length) 147while (currentIndex < baggageString.Length && (baggageString[currentIndex] == Space || baggageString[currentIndex] == Tab)) 152if (currentIndex >= baggageString.Length) 160while (currentIndex < baggageString.Length && baggageString[currentIndex] != Space && baggageString[currentIndex] != Tab && 176while (currentIndex < baggageString.Length && baggageString[currentIndex] != Comma) 182} while (currentIndex < baggageString.Length);
System\Diagnostics\Metrics\MetricsEventSource.cs (4)
724else if (spec.MeterName.Length > 0 725&& spec.MeterName[spec.MeterName.Length - 1] == '*') 727if (spec.MeterName.Length == 1) 734spec.MeterName.Substring(0, spec.MeterName.Length - 1));
System\Diagnostics\W3CPropagator.cs (6)
47if (activity.TraceStateString is { Length: > 0 } traceState) 72if (traceId!.Length > TraceParentCoreLength) 163using ValueStringBuilder vsb = new ValueStringBuilder(stackalloc char[Math.Min(traceState.Length, MaxTraceStateEncodedLength)]); 580if (traceParent is null || traceParent.Length < TraceParentCoreLength) 593if (traceParent.Length != TraceParentCoreLength) 605if (traceParent.Length > TraceParentCoreLength && traceParent[TraceParentCoreLength] != '-')
System.Diagnostics.EventLog (21)
src\runtime\src\libraries\Common\src\System\Diagnostics\NetFrameworkUtils.cs (1)
181if (majorVersion.Length > 1 && majorVersion[0] == 'v' && majorVersion.Contains('.'))
System\Diagnostics\EventLog.cs (11)
265if (source.Length + EventLogKey.Length > 254) 266throw new ArgumentException(SR.Format(SR.ParameterTooLong, nameof(source), 254 - EventLogKey.Length)); 304if (logName.Length == 8 && ( 827for (int i = 0; i < formatString.Length; i++) 831if (formatString.Length > i + 1) 842while (i + 1 < formatString.Length && char.IsDigit(formatString[i + 1])) 963if (logName.Length == 0 && !ignoreEmpty) 1060if (source.Length + EventLogKey.Length > 254) 1061throw new ArgumentException(SR.Format(SR.ParameterTooLong, nameof(source), 254 - EventLogKey.Length));
System\Diagnostics\EventLogEntry.cs (3)
338int msgLength = msg.Length; 420if (fileNames[i].Length >= 2 && fileNames[i][1] == ':') 427result.Append(fileNames[i], 2, fileNames[i].Length - 2);
System\Diagnostics\EventLogInternal.cs (5)
1236if (logName.Length == 0 && !ignoreEmpty) 1306if (Source.Length == 0) 1329if (Source.Length == 0) 1367if (strings[i]!.Length > 32766) 1372if (Source.Length == 0)
System\Diagnostics\Reader\NativeWrapper.cs (1)
1029pointer = new IntPtr((long)pointer + (s.Length * 2) + 2);
System.Diagnostics.PerformanceCounter (39)
src\runtime\src\libraries\Common\src\System\Diagnostics\NetFrameworkUtils.cs (1)
181if (majorVersion.Length > 1 && majorVersion[0] == 'v' && majorVersion.Contains('.'))
System\Diagnostics\InstanceDataCollection.cs (1)
47if (instanceName.Length == 0)
System\Diagnostics\PerformanceCounter.cs (2)
469if (currentCategoryName.Length == 0) 471if (_counterName.Length == 0)
System\Diagnostics\PerformanceCounterCategory.cs (13)
48if (categoryName.Length == 0) 73if (value.Length == 0) 167if (categoryName.Length == 0) 250if (categoryName.Length > (1024 - SharedPerformanceCounter.DefaultFileMappingName.Length)) 265if (id.Length == 0 || id.Length > maxLength) 268for (int index = 0; index < id.Length; ++index) 272if ((index == 0 || index == (id.Length - 1)) && current == ' ') 289if (help.Length > MaxHelpLength) 410if (categoryName.Length == 0) 462if (instanceName.Length != 0 && !InstanceExists(instanceName)) 541if (categoryName.Length == 0)
System\Diagnostics\PerformanceCounterLib.cs (1)
1733if (instanceName.Length > SharedPerformanceCounter.InstanceNameMaxLength)
System\Diagnostics\PerformanceData\CounterSet.cs (2)
131if (counterName.Length == 0) 177if (instanceName.Length == 0)
System\Diagnostics\PerformanceData\CounterSetInstance.cs (1)
25if (instanceName.Length == 0)
System\Diagnostics\PerformanceData\CounterSetInstanceCounterDataSet.cs (1)
230if (counterName.Length == 0)
System\Diagnostics\SharedPerformanceCounter.cs (17)
98if (instanceName != null && instanceName.Length > InstanceNameMaxLength) 210categoryNameLength = (_categoryName.Length + 1) * 2; 214totalSize += (((string)_categoryData.CounterNames[i]).Length + 1) * 2; 236instanceNameLength = (instanceName.Length + 1) * 2; 300nextPtr += (counterName.Length + 1) * 2; 314nextPtr += (counterName.Length + 1) * 2; 360instanceNameLength = (instanceName.Length + 1) * 2; 366totalSize += (((string)_categoryData.CounterNames[i]).Length + 1) * 2; 438nextPtr += (counterName.Length + 1) * 2; 471int counterNameLength = (counterName.Length + 1) * 2; 571for (uint i = 0; i < wstr.Length; i++) 602for (i = 0; i < stringA.Length; i++) 1127Debug.Assert(((instanceName.Length + 1) * 2) <= InstanceNameSlotSize, "The instance name length should always fit in our slot size"); 1139hasFit = (length == instanceName.Length); 1778char[] tmp = new char[str.Length + 1]; 1779str.CopyTo(0, tmp, 0, str.Length); 1780tmp[str.Length] = '\0'; // make sure the char[] is null terminated
System.Diagnostics.Process (26)
src\runtime\src\libraries\Common\src\Interop\Linux\cgroups\Interop.cgroups.cs (4)
76bool foundFieldValue = ulong.TryParse(line.AsSpan(fieldName.Length), out val); 140while (currentCGroupMemoryPath!.Length != cgroupMemoryHierarchyMountPath.Length); 285int commonPathPrefixLength = hierarchyRoot.Length;
src\runtime\src\libraries\Common\src\Interop\Linux\procfs\Interop.ProcMountInfo.cs (1)
42if (mount.MountPoint.Length == path.Length)
src\runtime\src\libraries\Common\src\Interop\Linux\procfs\Interop.ProcMountInfo.TryParseMountInfoLine.cs (1)
59line = line.Slice(endOfOptionalFields + Separator.Length);
src\runtime\src\libraries\Common\src\System\IO\StringParser.cs (2)
56if (_endIndex >= _buffer.Length) 64_endIndex = nextSeparator >= 0 ? nextSeparator : _buffer.Length;
src\runtime\src\libraries\Common\src\System\Text\ValueStringBuilder.cs (5)
125int count = s.Length; 167if (s.Length == 1 && (uint)pos < (uint)_chars.Length) // very common case, e.g. appending strings from NumberFormatInfo like separators, percent symbols, etc. 181if (pos > _chars.Length - s.Length) 183Grow(s.Length); 191_pos += s.Length;
src\runtime\src\libraries\System.Private.CoreLib\src\System\PasteArguments.cs (5)
23if (argument.Length != 0 && ContainsNoWhitespaceOrQuotes(argument)) 32while (idx < argument.Length) 38while (idx < argument.Length && argument[idx] == Backslash) 44if (idx == argument.Length) 83for (int i = 0; i < s.Length; i++)
System\Diagnostics\ProcessStartInfo.cs (1)
432if (FileName.Length == 0)
System\Diagnostics\ProcessUtils.Unix.cs (7)
342for (int i = 0; i < arguments.Length; i++) 344while (i < arguments.Length && (arguments[i] == ' ' || arguments[i] == '\t')) 347if (i == arguments.Length) 359while (i < arguments.Length) 363while (i < arguments.Length && arguments[i] == '\\') 371if (i >= arguments.Length || arguments[i] != '"') 400if (inQuotes && i < arguments.Length - 1 && arguments[i + 1] == '"')
System.Diagnostics.TextWriterTraceListener (9)
System\Diagnostics\DelimitedListTraceListener.cs (1)
256sb.Append(message, lastindex, message.Length - lastindex);
System\Diagnostics\XmlWriterTraceListener.cs (8)
71int length = detailMessage != null ? message.Length + 1 + detailMessage.Length : message.Length; 80dst[prefix.Length] = ' '; 83detail.CopyTo(dst.Slice(prefix.Length + 1, detail.Length)); 334for (int i = 0; i < str.Length; i++) 375InternalWrite(str.AsSpan(lastIndex, str.Length - lastIndex));
System.Diagnostics.TraceSource (1)
System\Diagnostics\DefaultTraceListener.cs (1)
148if (NeedIndent && message.Length != 0)
System.DirectoryServices (175)
Interop\AdsValueHelper2.cs (2)
144if (s.Length == 1) 168return $"S:{strValue.Length}:{strValue}:{Marshal.PtrToStringUni(dns.pszDNString)}";
src\runtime\src\libraries\Common\src\Interop\Windows\Advapi32\Interop.LsaOpenPolicy.cs (2)
50systemNameUnicode.Length = checked((ushort)(SystemName.Length * sizeof(char))); 51systemNameUnicode.MaximumLength = checked((ushort)(SystemName.Length * sizeof(char)));
System\DirectoryServices\ActiveDirectory\ActiveDirectorySchema.cs (2)
223if (commonName.Length == 0) 296if (commonName.Length == 0)
System\DirectoryServices\ActiveDirectory\ActiveDirectorySchemaClass.cs (2)
69if (ldapDisplayName.Length == 0) 238if (ldapDisplayName.Length == 0)
System\DirectoryServices\ActiveDirectory\ActiveDirectorySchemaProperty.cs (5)
123if (ldapDisplayName.Length == 0) 293if (ldapDisplayName.Length == 0) 502if (value != null && value.Length == 0) 549if (value != null && value.Length == 0) 621if (value != null && value.Length == 0)
System\DirectoryServices\ActiveDirectory\ActiveDirectorySite.cs (6)
927if (Utils.Compare(objectCategoryValue, 0, ocValue.Length, ocValue, 0, ocValue.Length) == 0) 936if (Utils.Compare(objectCategoryValue, 0, ocValue.Length, ocValue, 0, ocValue.Length) != 0) 1127if (siteName.Length == 0) 1340if (domainName != null && domainName.Length > 0)
System\DirectoryServices\ActiveDirectory\ActiveDirectorySiteLink.cs (1)
687if (siteLinkName.Length == 0)
System\DirectoryServices\ActiveDirectory\ActiveDirectorySiteLinkBridge.cs (1)
343if (bridgeName.Length == 0)
System\DirectoryServices\ActiveDirectory\ActiveDirectorySubnet.cs (2)
154if (siteName.Length == 0) 397if (subnetName.Length == 0)
System\DirectoryServices\ActiveDirectory\ActiveDirectorySubnetCollection.cs (2)
281for (int i = 0; i < rdn.Length; i++) 291return str.ToString() + "," + subnetDN.Substring(rdn.Length + 1);
System\DirectoryServices\ActiveDirectory\ADAMInstance.cs (9)
177if (partitionName.Length == 0) 203if (partitionName.Length == 0) 319if (partition.Length == 0) 353if (partition.Length == 0) 392if (objectPath.Length == 0) 409if (partition.Length == 0) 415if (sourceServer.Length == 0) 431if (partition.Length == 0) 447if (partition.Length == 0)
System\DirectoryServices\ActiveDirectory\ApplicationPartition.cs (8)
183if (distinguishedName.Length == 0) 331Debug.Assert(domainControllerInfo.DomainControllerName.Length > 2, "ApplicationPartition:FindByName - domainControllerInfo.DomainControllerName.Length <= 2"); 863if (distinguishedName.Length == 0) 898if (objectClass.Length == 0) 1147if (siteName != null && siteName.Length == 0) 1176Debug.Assert(domainControllerInfo.DomainControllerName.Length > 2, "ApplicationPartition:FindDirectoryServerInternal - domainControllerInfo.DomainControllerName.Length <= 2"); 1189if (siteName != null && siteName.Length == 0) 1212if (siteName != null && siteName.Length == 0)
System\DirectoryServices\ActiveDirectory\ConfigSet.cs (8)
443if ((bindingInfo.Length > prefix.Length) && (string.Equals(bindingInfo.Substring(0, prefix.Length), prefix, StringComparison.OrdinalIgnoreCase))) 445adamInstanceNames.Add(bindingInfo.Substring(prefix.Length)); 479if (partitionName != null && partitionName.Length == 0) 484if (siteName != null && siteName.Length == 0) 502if (partitionName != null && partitionName.Length == 0) 507if (siteName != null && siteName.Length == 0)
System\DirectoryServices\ActiveDirectory\DirectoryContext.cs (2)
126if (name.Length == 0) 157if (name.Length == 0)
System\DirectoryServices\ActiveDirectory\DirectoryServer.cs (1)
83if (siteName.Length == 0)
System\DirectoryServices\ActiveDirectory\Domain.cs (14)
474if (siteName.Length == 0) 504if (targetDomainName.Length == 0) 528if (targetDomainName.Length == 0) 541if (targetDomainName.Length == 0) 554if (targetDomainName.Length == 0) 567if (targetDomainName.Length == 0) 580if (targetDomainName.Length == 0) 608if (targetDomainName.Length == 0) 658if (targetDomainName.Length == 0) 667if (trustPassword.Length == 0) 710if (targetDomainName.Length == 0) 716if (newTrustPassword.Length == 0) 729if (targetDomainName.Length == 0) 738if (newTrustPassword.Length == 0)
System\DirectoryServices\ActiveDirectory\DomainController.cs (10)
443if (partition.Length == 0) 477if (partition.Length == 0) 516if (objectPath.Length == 0) 533if (partition.Length == 0) 539if (sourceServer.Length == 0) 555if (partition.Length == 0) 571if (partition.Length == 0) 963if (siteName != null && siteName.Length == 0) 994Debug.Assert(domainControllerInfo.DomainControllerName.Length > 2); 1007if (siteName != null && siteName.Length == 0)
System\DirectoryServices\ActiveDirectory\Exception.cs (1)
166(Name.Length == 0)))
System\DirectoryServices\ActiveDirectory\Forest.cs (14)
295if (siteName.Length == 0) 317if (targetForestName.Length == 0) 340if (targetForestName.Length == 0) 353if (targetForestName.Length == 0) 366if (targetForestName.Length == 0) 379if (targetForestName.Length == 0) 392if (targetForestName.Length == 0) 420if (targetForestName.Length == 0) 470if (targetForestName.Length == 0) 479if (trustPassword.Length == 0) 522if (targetForestName.Length == 0) 528if (newTrustPassword.Length == 0) 541if (targetForestName.Length == 0) 550if (newTrustPassword.Length == 0)
System\DirectoryServices\ActiveDirectory\ForestTrustRelationshipInformation.cs (4)
193record.DomainInfo.DNSNameLength = (short)(tmp.DnsName == null ? 0 : tmp.DnsName.Length * 2); // sizeof(WCHAR) 194record.DomainInfo.DNSNameMaximumLength = (short)(tmp.DnsName == null ? 0 : tmp.DnsName.Length * 2); 197record.DomainInfo.NetBIOSNameLength = (short)(tmp.NetBiosName == null ? 0 : tmp.NetBiosName.Length * 2); 198record.DomainInfo.NetBIOSNameMaximumLength = (short)(tmp.NetBiosName == null ? 0 : tmp.NetBiosName.Length * 2);
System\DirectoryServices\ActiveDirectory\GlobalCatalog.cs (3)
347if (siteName != null && siteName.Length == 0) 397Debug.Assert(domainControllerInfo.DomainControllerName.Length > 2); 410if (siteName != null && siteName.Length == 0)
System\DirectoryServices\ActiveDirectory\Locator.cs (2)
36if ((computerName != null) && (computerName.Length == 0)) 40if ((siteName != null) && (siteName.Length == 0))
System\DirectoryServices\ActiveDirectory\ReplicationConnection.cs (1)
920if (name.Length == 0)
System\DirectoryServices\ActiveDirectory\TrustHelper.cs (3)
473AuthData.AuthInfoLength = password.Length * 2; // sizeof(WCHAR) 626AuthData.AuthInfoLength = password.Length * 2; 752AuthData.AuthInfoLength = password.Length * 2;
System\DirectoryServices\ActiveDirectory\Utils.cs (58)
149if ((dsNameResultItem.name.Length - 1) == dsNameResultItem.name.IndexOf('/')) 151dnsName = dsNameResultItem.name.Substring(0, dsNameResultItem.name.Length - 1); 329if ((objectCategoryValue.Length >= ntdsdsa.Length) && (Utils.Compare(objectCategoryValue, 0, ntdsdsa.Length, ntdsdsa, 0, ntdsdsa.Length) == 0)) 388if ((objectCategoryValue.Length >= ntdsdsa.Length) && (Utils.Compare(objectCategoryValue, 0, ntdsdsa.Length, ntdsdsa, 0, ntdsdsa.Length) == 0)) 477if (dnComponents[i].Name!.Length == 0) 483if (dnComponents[i].Value!.Length == 0) 513if (dnComponents[i].Name!.Length == 0) 519if (dnComponents[i].Value!.Length == 0) 543for (int i = 0; i < distinguishedName.Length; i++) 554if (i < (distinguishedName.Length - 1)) 567if (i == (distinguishedName.Length - 1)) 598if ((context.UserName != null) && (context.UserName.Length > 0)) 1187if ((propertyNameWithRangeInfo.Length >= propertyToLoad.Length) && (Utils.Compare(propertyToLoad, 0, propertyToLoad.Length, propertyNameWithRangeInfo, 0, propertyToLoad.Length) != 0)) 1377if (ntdsaFilter.ToString().Length == 0) 1484if ((objectCategory.Length >= objectCategoryValue.Length) && (Utils.Compare(objectCategory, 0, objectCategoryValue.Length, objectCategoryValue, 0, objectCategoryValue.Length) == 0)) 1492if ((objectCategory.Length >= roObjectCategoryValue.Length) && (Utils.Compare(objectCategory, 0, roObjectCategoryValue.Length, roObjectCategoryValue, 0, roObjectCategoryValue.Length) == 0)) 1514if ((property.Length >= PropertyManager.MsDSHasInstantiatedNCs.Length) && (Utils.Compare(property, 0, PropertyManager.MsDSHasInstantiatedNCs.Length, PropertyManager.MsDSHasInstantiatedNCs, 0, PropertyManager.MsDSHasInstantiatedNCs.Length) == 0)) 1537Debug.Assert(dnString.Length > 10, "ConfigurationSet::GetReplicaList - dnWithBinary is not in the expected format."); 1539if (((dnString.Length - 13) >= partitionName!.Length) && (Utils.Compare(dnString, 13, partitionName.Length, partitionName, 0, partitionName.Length) == 0)) 1560if ((!foundPartitionEntry) && ((propertyName.Length >= propertyWithRangeInfo.Length) && (Utils.Compare(propertyName, 0, propertyWithRangeInfo.Length, propertyWithRangeInfo, 0, propertyWithRangeInfo.Length) != 0))) 1674Debug.Assert(dnString.Length > 10, "ConfigurationSet::GetReplicaList - dnWithBinary is not in the expected format."); 1676if (((dnString.Length - 13) >= partitionName!.Length) && (Utils.Compare(dnString, 13, partitionName.Length, partitionName, 0, partitionName.Length) == 0)) 1694if ((!foundPartitionEntry) && ((propertyName.Length >= propertyWithRangeInfo2.Length) && (Utils.Compare(propertyName, 0, propertyWithRangeInfo2.Length, propertyWithRangeInfo2, 0, propertyWithRangeInfo2.Length) != 0))) 1784StringBuilder str = new StringBuilder(2 * filterValue.Length); 1788for (int i = index; i < filterValue.Length; i++) 1859cchCount1 = s1.Length; 1860cchCount2 = s2.Length; 1914serverName = serverName.Substring(1, serverName.Length - 2); //2 for []
System\DirectoryServices\Design\DirectoryEntryConverter.cs (1)
31if (text.Length == 0)
System\DirectoryServices\DirectoryEntry.cs (8)
201if (guid.Length == 32) 759if (propertyName.Length > 0) 884if (System.DirectoryServices.ActiveDirectory.Utils.Compare(childPath, 0, parentPath.Length, parentPath, 0, parentPath.Length) == 0) 891if (System.DirectoryServices.ActiveDirectory.Utils.Compare(childPath, 0, parentPath.Length, parentPath, 0, parentPath.Length, compareFlags) != 0) 893childPath = parentPath + childPath.Substring(parentPath.Length); 997rangeName = rangeName.Remove(rangeName.Length - 1, 1);
System\DirectoryServices\DirectorySearcher.cs (3)
408if (value.Length != 0) 805if (Sort.PropertyName != null && Sort.PropertyName.Length > 0) 830if (_vlv.Target.Length != 0)
System.DirectoryServices.AccountManagement (47)
src\runtime\src\libraries\Common\src\Interop\Windows\Advapi32\Interop.LsaOpenPolicy.cs (2)
50systemNameUnicode.Length = checked((ushort)(SystemName.Length * sizeof(char))); 51systemNameUnicode.MaximumLength = checked((ushort)(SystemName.Length * sizeof(char)));
System\DirectoryServices\AccountManagement\AD\ADAMStoreCtx.cs (2)
119if ((partitionDN.Length > maxMatchLength) && ctxBaseDN.EndsWith(partitionDN, StringComparison.OrdinalIgnoreCase)) 121maxMatchLength = partitionDN.Length;
System\DirectoryServices\AccountManagement\AD\ADDNLinkedAttrSet.cs (1)
1351if (userSuppliedServername.Length > 0)
System\DirectoryServices\AccountManagement\AD\ADStoreCtx_LoadStore.cs (4)
114if ((name != null) && (name.Length > 0)) 128if (index != samAccountName.Length - 1) 134if ((samAccountName != null) && (samAccountName.Length > 0)) 1177if ((value == null) || (value.Length > 0))
System\DirectoryServices\AccountManagement\AD\ADStoreCtx_Query.cs (1)
439if (index == identity.Length - 1)
System\DirectoryServices\AccountManagement\AD\ADStoreCtx.cs (4)
2453if ((component.Length > 3) && 2456sb.Append(component, 3, component.Length - 3); 2464if (dnsDomainName.Length > 0) 2465dnsDomainName = dnsDomainName.Substring(0, dnsDomainName.Length - 1);
System\DirectoryServices\AccountManagement\AD\ADUtils.cs (7)
72StringBuilder sb = new StringBuilder(dnComponent.Length); 84for (int i = startingIndex; i < dnComponent.Length; i++) 150StringBuilder sb = new StringBuilder(s.Length); 214StringBuilder sb = new StringBuilder(papiString.Length); 330if (s.Length % 2 != 0) 332GlobalDebug.WriteLineIf(GlobalDebug.Warn, "ADUtils", "HexStringToLdapHexString: string has bad length " + s.Length); 338for (int i = 0; i < (s.Length) / 2; i++)
System\DirectoryServices\AccountManagement\AD\SDSUtils.cs (4)
400Debug.Assert(attribute != null && attribute.Length > 0); 442Debug.Assert(attribute != null && attribute.Length > 0); 790if ((component.Length > 3) && 793sb.Append(component, 3, component.Length - 3);
System\DirectoryServices\AccountManagement\AD\TokenGroupsSet.cs (1)
149if (userSuppliedServername.Length > 0)
System\DirectoryServices\AccountManagement\AuthZSet.cs (1)
310Debug.Assert(sidIssuerName.Length > 0);
System\DirectoryServices\AccountManagement\constants.cs (2)
104private static readonly int s_acctInfoPrefixLength = PropertyNames.AcctInfoPrefix.Length; 105private static readonly int s_pwdInfoPrefixLength = PropertyNames.PwdInfoPrefix.Length;
System\DirectoryServices\AccountManagement\Context.cs (3)
243if (userName != null && userName.Length == 0) 314if (userName != null && userName.Length == 0) 500Debug.Assert(_connectedServer == null || _connectedServer.Length != 0);
System\DirectoryServices\AccountManagement\Principal.cs (2)
125if (null == value || 0 == value.Length) 245if (null == value || 0 == value.Length)
System\DirectoryServices\AccountManagement\SAM\SAMQuerySet.cs (3)
416(((string)de.Properties[winNTPropertyName].Value).Length == 0)) 476if (index == samToMatch.Length - 1) 574(((string)de.Properties[winNTPropertyName].Value).Length == 0))
System\DirectoryServices\AccountManagement\SAM\SAMStoreCtx_LoadStore.cs (4)
171if (index == Name.Length - 1) 532if (index == urnValue.Length - 1) 774if ((values.Count > 0) && (((string)values[0]).Length == 0)) 915if (value != null && value.Length > 0)
System\DirectoryServices\AccountManagement\SAM\SAMStoreKey.cs (1)
17Debug.Assert(machineName != null && machineName.Length > 0);
System\DirectoryServices\AccountManagement\SAM\SAMUtils.cs (1)
139StringBuilder sb = new StringBuilder(papiString.Length);
System\DirectoryServices\AccountManagement\Utils.cs (4)
82if (s.Length % 2 != 0) 84GlobalDebug.WriteLineIf(GlobalDebug.Warn, "Utils", "StringToByteArray: string has bad length " + s.Length); 88byte[] bytes = new byte[s.Length / 2]; 90for (int i = 0; i < (s.Length) / 2; i++)
System.DirectoryServices.Protocols (10)
System\DirectoryServices\Protocols\common\BerConverter.cs (2)
35for (int formatCount = 0; formatCount < format.Length; formatCount++) 332for (int formatCount = 0; formatCount < format.Length; formatCount++)
System\DirectoryServices\Protocols\Interop\LdapPal.Linux.cs (1)
224interactChallenge.len = interactChallenge != null ? (uint)interactChallenge.defresult.Length : 0;
System\DirectoryServices\Protocols\ldap\LdapConnection.cs (7)
1023if (tempCredential != null && tempCredential.UserName.Length == 0 && tempCredential.Password.Length == 0 && tempCredential.Domain.Length == 0) 1065cred.packageListLength = cred.packageList.Length; 1071cred.userLength = (username == null ? 0 : username.Length); 1073cred.domainLength = (domainName == null ? 0 : domainName.Length); 1075cred.passwordLength = (password == null ? 0 : password.Length);
System.Drawing.Common (23)
System\Drawing\Drawing2D\GraphicsPath.cs (1)
792c, s.Length,
System\Drawing\Font.cs (1)
163private static bool IsVerticalName(string familyName) => familyName?.Length > 0 && familyName[0] == '@';
System\Drawing\FontConverter.cs (5)
160if (font.Length == 0) 186if (nameIndex < font.Length - 1) 265int length = text.Length; 459if (bestMatch is null || fontName.Length <= bestMatch.Length)
System\Drawing\Icon.cs (3)
168char[] buffer = ArrayPool<char>.Shared.Rent(Math.Max((int)PInvokeCore.MAX_PATH, filePath.Length)); 169filePath.CopyTo(0, buffer, 0, filePath.Length); 170buffer[filePath.Length] = '\0';
System\Drawing\ImageFormatConverter.cs (1)
40if ((strFormat[0] == '[') && (strFormat.Length >= 50) && Guid.TryParse(strFormat.AsSpan(14, 36), out Guid guid))
System\Drawing\Imaging\EncoderParameter.cs (1)
165_numberOfValues = value.Length;
System\Drawing\Imaging\Metafile.cs (1)
211if (fileName.Length > MaxPath)
System\Drawing\Printing\MarginsConverter.cs (1)
31if (text.Length == 0)
System\Drawing\Printing\PrinterSettings.cs (9)
731int namesChars = checked(4 + printerName.Length + driver.Length + outPort.Length); 743driver.AsSpan().CopyTo(names.Slice(offsetInChars, driver.Length)); 744offsetInChars += (ushort)(driver.Length + 1); 747printerName.AsSpan().CopyTo(names.Slice(offsetInChars, printerName.Length)); 748offsetInChars += (ushort)(printerName.Length + 1); 751outPort.AsSpan().CopyTo(names.Slice(offsetInChars, outPort.Length)); 752offsetInChars += (ushort)(outPort.Length + 1);
System.Drawing.Primitives (11)
src\runtime\src\libraries\Common\src\System\Drawing\ColorConverterCommon.cs (7)
18if (text.Length == 0) 41if (text.Length >= 2 && (text[0] == '\'' || text[0] == '"') && text[0] == text[text.Length - 1]) 44string colorName = text.Substring(1, text.Length - 2); 47else if ((text.Length == 7 && text[0] == '#') || 48(text.Length == 8 && (text.StartsWith("0x") || text.StartsWith("0X"))) || 49(text.Length == 8 && (text.StartsWith("&h") || text.StartsWith("&H"))))
System\Drawing\ColorTranslator.cs (4)
227if ((htmlColor == null) || (htmlColor.Length == 0)) 232((htmlColor.Length == 7) || (htmlColor.Length == 4))) 234if (htmlColor.Length == 7)
System.Formats.Nrbf (4)
System\Formats\Nrbf\Utils\TypeNameHelpers.cs (4)
207int length = typeName.Length + 1 + libraryName.Length; 212rented[typeName.Length] = ','; 213libraryName.AsSpan().CopyTo(rented.AsSpan(typeName.Length + 1));
System.Formats.Tar (26)
src\runtime\src\libraries\Common\src\System\IO\PathInternal.cs (6)
36if (commonChars == first.Length 37&& (commonChars == second.Length || IsDirectorySeparator(second[commonChars]))) 40if (commonChars == second.Length && IsDirectorySeparator(first[commonChars])) 63for (; (uint)commonLength < (uint)first.Length; commonLength++) 65if (commonLength >= second.Length || 217path.Substring(0, path.Length - 1) :
src\runtime\src\libraries\Common\src\System\IO\PathInternal.Unix.cs (5)
47for (int i = 0; i < path.Length; i++) 50&& (i + 1 < path.Length && IsDirectorySeparator(path[i + 1]))) 60StringBuilder builder = new StringBuilder(path.Length); 62for (int i = 0; i < path.Length; i++) 68&& (i + 1 < path.Length && IsDirectorySeparator(path[i + 1])))
src\runtime\src\libraries\Common\src\System\Text\ValueStringBuilder.cs (5)
125int count = s.Length; 167if (s.Length == 1 && (uint)pos < (uint)_chars.Length) // very common case, e.g. appending strings from NumberFormatInfo like separators, percent symbols, etc. 181if (pos > _chars.Length - s.Length) 183Grow(s.Length); 191_pos += s.Length;
System\Formats\Tar\TarEntry.cs (2)
454string relative = normalizedFile.Substring(logicalPrefix.Length) 505string[] components = fullPath.Substring(root.Length)
System\Formats\Tar\TarFile.cs (2)
542foreach ((string fullpath, string entryname) in GetFilesForCreation(sourceDirectoryName, basePath.Length)) 597foreach ((string fullpath, string entryname) in GetFilesForCreation(sourceDirectoryName, basePath.Length))
System\Formats\Tar\TarHeader.Write.cs (1)
1154return result.Length >= FieldLengths.Name ?
System\Formats\Tar\TarHelpers.cs (5)
422if (childFullPath.Length <= parentFullPath.Length) 431if ((childFullPath.Length < parentFullPath.Length + 2) || 432!IsDirectorySeparatorChar(childFullPath[parentFullPath.Length]))
System.IO.Compression.ZipFile (8)
src\runtime\src\libraries\Common\src\System\IO\Archiving.Utils.Windows.cs (3)
20if (preserveDriveRoot && entryPath.Length >= 3 && entryPath[1] == ':' && Path.IsPathFullyQualified(entryPath)) 35return string.Create(entryPath.Length, (i, entryPath), static (dest, state) => 45for (int i = state.i + 1; i < entryPath.Length; i++)
System\IO\Compression\ZipFile.Create.Async.cs (2)
537string entryName = ArchivingUtils.EntryFromPath(fullPath.AsSpan(basePath.Length)); 544string entryName = ArchivingUtils.EntryFromPath(fullPath.AsSpan(basePath.Length), appendPathSeparator: true);
System\IO\Compression\ZipFile.Create.cs (2)
485string entryName = ArchivingUtils.EntryFromPath(fullPath.AsSpan(basePath.Length)); 492string entryName = ArchivingUtils.EntryFromPath(fullPath.AsSpan(basePath.Length), appendPathSeparator: true);
System\IO\Compression\ZipFileExtensions.ZipArchiveEntry.Extract.cs (1)
210if (Path.GetFileName(fileDestinationPath).Length == 0)
System.IO.FileSystem.AccessControl (22)
src\runtime\src\libraries\Common\src\System\IO\FileSystem.DirectoryCreation.Windows.cs (1)
37int length = fullPath.Length;
src\runtime\src\libraries\Common\src\System\IO\PathInternal.cs (6)
36if (commonChars == first.Length 37&& (commonChars == second.Length || IsDirectorySeparator(second[commonChars]))) 40if (commonChars == second.Length && IsDirectorySeparator(first[commonChars])) 63for (; (uint)commonLength < (uint)first.Length; commonLength++) 65if (commonLength >= second.Length || 217path.Substring(0, path.Length - 1) :
src\runtime\src\libraries\Common\src\System\IO\PathInternal.Windows.cs (6)
82char c = path[path.Length - 1]; 96if (path != null && (path.Length >= MaxShortPath || EndsWithPeriodOrSpace(path))) 328for (int i = 0; i < path.Length; i++) 334|| (i > 0 && i + 1 < path.Length && IsDirectorySeparator(path[i + 1])))) 353for (int i = start; i < path.Length; i++) 361if (i + 1 < path.Length && IsDirectorySeparator(path[i + 1]))
src\runtime\src\libraries\Common\src\System\Text\ValueStringBuilder.cs (5)
125int count = s.Length; 167if (s.Length == 1 && (uint)pos < (uint)_chars.Length) // very common case, e.g. appending strings from NumberFormatInfo like separators, percent symbols, etc. 181if (pos > _chars.Length - s.Length) 183Grow(s.Length); 191_pos += s.Length;
System\IO\FileSystemAclExtensions.cs (2)
314if (errorCode == Interop.Errors.ERROR_PATH_NOT_FOUND && fullPath.Length == Path.GetPathRoot(fullPath)!.Length)
System\Security\AccessControl\FileSystemSecurity.cs (2)
48if ((name != null) && (name.Length != 0)) 55if ((name != null) && (name.Length != 0))
System.IO.FileSystem.DriveInfo (3)
src\runtime\src\libraries\Common\src\Interop\Linux\procfs\Interop.ProcMountInfo.cs (1)
42if (mount.MountPoint.Length == path.Length)
src\runtime\src\libraries\Common\src\Interop\Linux\procfs\Interop.ProcMountInfo.TryParseMountInfoLine.cs (1)
59line = line.Slice(endOfOptionalFields + Separator.Length);
System\IO\DriveInfo.UnixOrDefault.cs (1)
31if (driveName.Length == 0)
System.IO.FileSystem.Watcher (21)
src\runtime\src\libraries\Common\src\System\IO\PathInternal.cs (6)
36if (commonChars == first.Length 37&& (commonChars == second.Length || IsDirectorySeparator(second[commonChars]))) 40if (commonChars == second.Length && IsDirectorySeparator(first[commonChars])) 63for (; (uint)commonLength < (uint)first.Length; commonLength++) 65if (commonLength >= second.Length || 217path.Substring(0, path.Length - 1) :
src\runtime\src\libraries\Common\src\System\IO\PathInternal.Unix.cs (5)
47for (int i = 0; i < path.Length; i++) 50&& (i + 1 < path.Length && IsDirectorySeparator(path[i + 1]))) 60StringBuilder builder = new StringBuilder(path.Length); 62for (int i = 0; i < path.Length; i++) 68&& (i + 1 < path.Length && IsDirectorySeparator(path[i + 1])))
src\runtime\src\libraries\Common\src\System\Text\ValueStringBuilder.cs (5)
125int count = s.Length; 167if (s.Length == 1 && (uint)pos < (uint)_chars.Length) // very common case, e.g. appending strings from NumberFormatInfo like separators, percent symbols, etc. 181if (pos > _chars.Length - s.Length) 183Grow(s.Length); 191_pos += s.Length;
System\IO\FileSystemEventArgs.cs (1)
37bool hasSeparator = directory.Length != 0 && PathInternal.IsDirectorySeparator(directory[^1]);
System\IO\FileSystemWatcher.cs (3)
242if (value.Length == 0) 364if (path.Length == 0) 676if (_directory.Length != 0 && _enabled)
System\IO\FileSystemWatcher.Linux.cs (1)
676if (dir.IsRootDir && nextEvent.name.Length == 0)
System.IO.IsolatedStorage (5)
System\IO\IsolatedStorage\Helper.cs (2)
71if (Path.GetFileName(directory)?.Length == 12) 75if (Path.GetFileName(subdirectory)?.Length == 12)
System\IO\IsolatedStorage\IsolatedStorageFile.cs (2)
201return Directory.EnumerateDirectories(RootDirectory, searchPattern).Select(m => m.Substring(Path.GetDirectoryName(m)!.Length + 1)).ToArray(); 546for (i = 0; i < partialPath.Length; i++)
System\IO\IsolatedStorage\IsolatedStorageFileStream.cs (1)
88if ((path.Length == 0) || path.Equals(BackSlash))
System.IO.MemoryMappedFiles (4)
System\IO\MemoryMappedFiles\MemoryMappedFile.cs (2)
288if (mapName != null && mapName.Length == 0) 517if (mapName != null && mapName.Length == 0)
System\IO\MemoryMappedFiles\MemoryMappedFile.Unix.cs (2)
262guid.Slice(0, MaxNameLength - NamePrefix.Length).CopyTo(span.Slice(NamePrefix.Length));
System.IO.Packaging (52)
System\IO\Packaging\ContentType.cs (7)
77if (contentType.Length == 0) 83if (IsLinearWhiteSpaceChar(contentType[0]) || IsLinearWhiteSpaceChar(contentType[contentType.Length - 1])) 254Debug.Assert(!IsLinearWhiteSpaceChar(contentType[0]) && !IsLinearWhiteSpaceChar(contentType[contentType.Length - 1])); 415for (int i = 0; i < token.Length; i++) 438if (parameterValue.Length >= 2 && 440parameterValue[parameterValue.Length - 1] == '"') 442ValidateQuotedText(parameterValue.AsSpan(1, parameterValue.Length - 2));
System\IO\Packaging\Package.cs (9)
445&& normalizedPartName.Length > precedingPartName.Length 446&& normalizedPartName[precedingPartName.Length] == PackUriHelper.ForwardSlashChar) 999&& normalizedPartName.Length > precedingPartName.Length 1000&& normalizedPartName[precedingPartName.Length] == PackUriHelper.ForwardSlashChar) || 1003&& followingPartName.Length > normalizedPartName.Length 1004&& followingPartName[normalizedPartName.Length] == PackUriHelper.ForwardSlashChar))
System\IO\Packaging\PackUriHelper.cs (26)
52if (partName.Length == 0) 209Debug.Assert((partName.Length - file.Length) > 0, 213partName = partName.Substring(0, partName.Length - file.Length); 265Debug.Assert((path.Length - partNameWithoutExtension.Length - RelationshipPartExtensionName.Length - 1) > 0, 269path = path.Substring(0, path.Length - partNameWithoutExtension.Length - RelationshipPartExtensionName.Length - 1); 271Debug.Assert((path.Length - RelationshipPartSegmentName.Length) > 0, 274path = path.Substring(0, path.Length - RelationshipPartSegmentName.Length); // Removing rels segment 348Debug.Assert(partUriString != null && partUriString.Length == 0); 385if (partName.Length == 0) 475if (partName.Length > 0) 477if (partName[partName.Length - 1] == ForwardSlashChar) 498if (partName.Length > 1) 563return (partName.Length == 0 || ((partName.Length == 1) && (partName[0] == ForwardSlashChar))); 685if (partUriExtension.Length > 0) 784Debug.Assert(segments.Length > 0 && segments[0].Length == 0); 792(segments[segments.Length - 1].Length > RelationshipPartExtensionName.Length))
System\IO\Packaging\PackUriHelper.PackUriScheme.cs (2)
80if (fragment.Length == 0 || fragment[0] != '#') 324if (partName.Length == 0)
System\IO\Packaging\XmlCompatibilityReader.cs (1)
897int length = pair.Length;
System\IO\Packaging\ZipPackage.cs (5)
429Debug.Assert(opcName != null && opcName.Length > 0); 827if (extension.Length == 0 1057if (zipFileInfo.FullName.Length == ContentTypeFileName.Length) 1282if (attributeValue!.Length == 0)
System\IO\Packaging\ZipPackagePartPiece.cs (2)
52int searchPosition = path.Length; 83searchPosition -= PartPieceLastExtension.Length;
System.IO.Pipes (1)
System\IO\Pipes\NamedPipeClientStream.cs (1)
63if (serverName.Length == 0)
System.IO.Ports (9)
System\IO\Ports\SerialPort.cs (9)
351if (value.Length == 0) 398if (value.Length == 0) 1062if (value.Length == 0) 1069char lastValueChar = value[value.Length - 1]; 1108if (lastValueChar == (char)_singleCharBuffer[numCharsRead - 1] && (currentLine.Length >= value.Length)) 1113for (int i = 2; i <= value.Length; i++) 1115if (value[value.Length - i] != currentLine[currentLine.Length - i]) 1125string ret = currentLine.ToString(0, currentLine.Length - value.Length); 1180if (text.Length == 0) return;
System.Linq.Expressions (3)
System\Linq\Expressions\DebugViewWriter.cs (1)
194_column += s.Length;
System\Linq\Expressions\Interpreter\LightLambda.cs (2)
120_indent = new string(' ', _indent.Length + 2); 125_indent = new string(' ', _indent.Length - 2);
System.Management (119)
System\Management\ManagementClass.cs (6)
459if ((null == Path) || (null == Path.Path) || (0 == Path.Path.Length)) 582if ((null == Path) || (null == Path.Path) || (0 == Path.Path.Length)) 1019if ((null == Path) || (null == Path.Path) || (0 == Path.Path.Length)) 1116if ((null == Path) || (null == Path.Path) || (0 == Path.Path.Length)) 1222if ((null == Path) || (null == Path.Path) || (0 == Path.Path.Length)) 1307if ((null == Path) || (null == Path.Path) || (0 == Path.Path.Length))
System\Management\ManagementDateTime.cs (6)
127if (dmtf.Length == 0) 134if (dmtf.Length != SIZEOFDMTFDATETIME) 276if (strMicrosec.Length > 6) 324if (dmtfts.Length == 0) 328if (dmtfts.Length != SIZEOFDMTFDATETIME) 431if (strMicrosec.Length > 6)
System\Management\ManagementObject.cs (18)
396if ((null != scope) && (scope.Path.NamespacePath.Length > 0)) 421if (nsPath.Length > 0) 571if ((nsPath.Length > 0) && (scope != null) && (scope.IsDefaulted)) 772if ((null == path) || (path.Path.Length == 0)) 892if ((null == path) || (path.Path.Length == 0)) 1027if ((null == path) || (path.Path.Length == 0)) 1143if ((null == path) || (path.Path.Length == 0)) 1264if ((null == path) || (path.Path.Length == 0)) 1370if ((null == path) || (path.Path.Length == 0)) 1946if ((null == path) || (path.Path.Length == 0)) 2009if ((null == path) || (path.Path.Length == 0)) 2132if ((null == path) || (path.Path.Length == 0)) 2177if ((null == path) || (path.Path.Length == 0)) 2278if ((null == path) || (path.Path.Length == 0)) 2343if ((null == path) || (path.Path.Length == 0)) 2567if (0 < nsPath.Length) 2583if (0 < nsPath.Length) 2627if (curPath.Length > 0)
System\Management\ManagementOptions.cs (3)
1352for (int i = 0; i < value.Length; i++) 1360for (int i = 0; i < value.Length; i++) 1589for (int i = 0; i < password.Length; i++)
System\Management\ManagementPath.cs (5)
134if (nsPath.Length != 0) 191if ((null != path) && (0 < path.Length)) 392return (Path.Length == 0); 575if (nsPath.Length > 0) 739if (status >= 0 && nsPath.Length > 1 &&
System\Management\ManagementQuery.cs (65)
124q = q.Remove(0, token.Length).TrimStart(null); 133q = q.Remove(0, op.Length).TrimStart(null); 136if (0 == q.Length) 143i = q.Length; // No WS => consume entire string 146q = q.Remove(0, tokenValue.Length).TrimStart(null); 155q = q.Remove(0, token.Length).TrimStart(null); 675if (p.IsClass && (p.NamespacePath.Length == 0)) 920if ((className == null) || (className.Length == 0)) 948if ((Condition != null) && (Condition.Length != 0)) 995if (tempProp.Length > 0) 1029condition = q.Substring(keyword.Length).Trim(); 1041q = q.Remove(0, keyword.Length).TrimStart(null); 1055q = q.Remove(0, keyword.Length).TrimStart(null); 1063q = q.Remove(0, keyword.Length).TrimStart(null); 1066if (0 < q.Length) 1074q = q.Remove(0, keyword.Length); 1077if ((0 == q.Length) || !char.IsWhiteSpace(q[0])) 1270if ((p.IsClass || p.IsInstance) && (p.NamespacePath.Length == 0)) 1563if ((sourceObject == null) || (sourceObject.Length == 0)) 1570if (!(RelatedClass.Length == 0) || 1571!(RelationshipClass.Length == 0) || 1572!(RelatedQualifier.Length == 0) || 1573!(RelationshipQualifier.Length == 0) || 1574!(RelatedRole.Length == 0) || 1575!(ThisRole.Length == 0) || 1582if (!(RelatedClass.Length == 0)) 1586if (!(RelationshipClass.Length == 0)) 1590if (!(RelatedRole.Length == 0)) 1594if (!(ThisRole.Length == 0)) 1598if (!(RelatedQualifier.Length == 0)) 1602if (!(RelationshipQualifier.Length == 0)) 1649q = q.Remove(0, TokenAssociators.Length); 1652if ((0 == q.Length) || !char.IsWhiteSpace(q[0])) 1662q = q.Remove(0, TokenOf.Length).TrimStart(null); 1679if (0 < q.Length) 1685q = q.Remove(0, TokenWhere.Length); 1688if ((0 == q.Length) || !char.IsWhiteSpace(q[0])) 1728else if (0 == q.Length) 1897if ((p.IsClass || p.IsInstance) && (p.NamespacePath.Length == 0)) 2098if ((sourceObject == null) || (sourceObject.Length == 0)) 2105if (!(RelationshipClass.Length == 0) || 2106!(RelationshipQualifier.Length == 0) || 2107!(ThisRole.Length == 0) || 2114if (!(RelationshipClass.Length == 0)) 2118if (!(ThisRole.Length == 0)) 2122if (!(RelationshipQualifier.Length == 0)) 2166q = q.Remove(0, TokenReferences.Length); 2169if ((0 == q.Length) || !char.IsWhiteSpace(q[0])) 2179q = q.Remove(0, TokenOf.Length).TrimStart(null); 2196if (0 < q.Length) 2202q = q.Remove(0, TokenWhere.Length); 2205if ((0 == q.Length) || !char.IsWhiteSpace(q[0])) 2236else if (0 == q.Length) 2485if (p.IsClass && (p.NamespacePath.Length == 0)) 2962if ((eventClassName == null) || (eventClassName.Length == 0)) 2979if (!(Condition.Length == 0)) 2998if (!(HavingCondition.Length == 0)) 3035q = q.Remove(0, keyword.Length).TrimStart(null); 3058if ((q.Length >= keyword.Length) && ((i = q.ToLowerInvariant().IndexOf(keyword, StringComparison.Ordinal)) != -1)) //found 3072q = q.Remove(0, keyword.Length); 3086if (tempProp.Length > 0) 3111q = q.Remove(0, keyword.Length); 3113if (q.Length == 0) //bad query 3127condition = w.Substring(keyword.Length);
System\Management\ManagementScope.cs (1)
973if ((null == nsPath) || (0 == nsPath.Length))
System\Management\WMIGenerator.cs (15)
174if (filePath.Length == 0) 198if (OriginalNamespace == null || (OriginalNamespace != null && OriginalNamespace.Length == 0)) 203if (OriginalClassName == null || (OriginalClassName != null && OriginalClassName.Length == 0)) 525if (OriginalPath.Length != 0) 532if (OriginalServer.Length != 0) 560int Len = OriginalNamespace.Length; 825if (strTemp.Length > 0) 844if (NETNamespace.Length == 0) 859if (NETNamespace.Length == 0) 1259if (description.Length != 0) 1685if (strArray[i].Length == 0) 1747if (strArray[i].Length == 0) 4761if (str.Length == 0) 4774for (int i = 0; i < str.Length; i++) 5046int Len = bitMap.Length;
System.Net.Http (241)
src\runtime\src\libraries\Common\src\System\Net\Http\aspnetcore\Http2\Hpack\H2StaticTable.Http2.cs (1)
103value.Length != 0 ? Encoding.ASCII.GetBytes(value) : Array.Empty<byte>());
src\runtime\src\libraries\Common\src\System\Net\Http\aspnetcore\Http2\Hpack\HPackEncoder.cs (10)
374if (IntegerEncoder.Encode(value.Length, 7, destination, out int integerLength)) 379if (value.Length <= destination.Length) 383Debug.Assert(valueBytesWritten == value.Length); 385bytesWritten = integerLength + value.Length; 397Debug.Assert(destination.Length >= value.Length); 407Debug.Assert(bytesWritten == value.Length); 465? value.Length 537valueLength = checked(valueLength + part.Length); 559destination = destination.Slice(value.Length); 568destination = destination.Slice(value.Length);
src\runtime\src\libraries\Common\src\System\Net\Http\aspnetcore\Http3\QPack\QPackEncoder.cs (18)
104Span<byte> temp = value.Length < 256 ? stackalloc byte[256 + IntegerEncoder.MaxInt32EncodedLength * 2] : new byte[value.Length + IntegerEncoder.MaxInt32EncodedLength * 2]; 164Span<byte> temp = name.Length < 256 ? stackalloc byte[256 + IntegerEncoder.MaxInt32EncodedLength] : new byte[name.Length + IntegerEncoder.MaxInt32EncodedLength]; 174Span<byte> temp = (name.Length + value.Length) < 256 ? stackalloc byte[256 + IntegerEncoder.MaxInt32EncodedLength * 2] : new byte[name.Length + value.Length + IntegerEncoder.MaxInt32EncodedLength * 2]; 189? s.Length 243valueLength += part.Length; 264buffer = buffer.Slice(value.Length); 273buffer = buffer.Slice(value.Length); 303Debug.Assert(buffer.Length >= s.Length); 313Debug.Assert(bytesWritten == s.Length); 324if (IntegerEncoder.Encode(s.Length, 3, buffer, out int nameLength)) 328if (buffer.Length >= s.Length) 332Debug.Assert(valueBytesWritten == s.Length); 334length = nameLength + s.Length;
src\runtime\src\libraries\Common\src\System\Net\Http\UriRedactionHelper.cs (2)
41if (queryIndex >= 0 && queryIndex < (pathAndQuery.Length - 1)) 76queryIndex < pathAndQuery.Length - 1; // Query is not empty.
src\runtime\src\libraries\Common\src\System\Net\Logging\NetEventSource.Common.Associate.cs (4)
60Size = ((arg1.Length + 1) * 2) 65Size = ((arg2.Length + 1) * 2) 70Size = ((arg3.Length + 1) * 2) 75Size = ((arg4.Length + 1) * 2)
src\runtime\src\libraries\Common\src\System\Net\Logging\NetEventSource.Common.cs (2)
203Size = (arg1.Length + 1) * sizeof(char) 208Size = (arg2.Length + 1) * sizeof(char)
src\runtime\src\libraries\Common\src\System\Text\ValueStringBuilder.cs (5)
125int count = s.Length; 167if (s.Length == 1 && (uint)pos < (uint)_chars.Length) // very common case, e.g. appending strings from NumberFormatInfo like separators, percent symbols, etc. 181if (pos > _chars.Length - s.Length) 183Grow(s.Length); 191_pos += s.Length;
System\Net\Http\Headers\AltSvcHeaderParser.cs (10)
28Debug.Assert(startIndex < value.Length); 48if (idx != value.Length) 60if (idx + 1 >= value.Length || value[idx++] != '=') 77while (idx < value.Length) 80while (idx < value.Length && IsOptionalWhiteSpace(value[idx])) ++idx; 82if (idx == value.Length) 106while (idx < value.Length && IsOptionalWhiteSpace(value[idx])) ++idx; 116if ((idx + tokenLength) >= value.Length || value[idx + tokenLength] != '=') 389if (startIndex >= value.Length) 453if (startIndex >= value.Length)
System\Net\Http\Headers\AuthenticationHeaderValue.cs (8)
122if (string.IsNullOrEmpty(input) || (startIndex >= input.Length) || HttpRuleParser.ContainsNewLineOrNull(input, startIndex)) 153if ((current == input.Length) || (input[current] == ',')) 180if (current < input.Length) 198while ((current < input.Length) && (input[current] != ',')) 236Debug.Assert(parseEndIndex < input.Length, "Expected string to have at least 1 char"); 245if (current == input.Length) 265if ((current == input.Length) || (input[current] != '=')) 286} while ((current < input.Length) && (input[current] == ','));
System\Net\Http\Headers\BaseHeaderParser.cs (3)
39if (string.IsNullOrEmpty(value) || (index == value.Length)) 53if (current == value.Length) 74if ((separatorFound && !SupportsMultipleValues) || (!separatorFound && (current < value.Length)))
System\Net\Http\Headers\ByteArrayHeaderParser.cs (2)
32if (string.IsNullOrEmpty(value) || (index == value.Length)) 47index = value.Length;
System\Net\Http\Headers\CacheControlHeaderValue.cs (5)
355if (string.IsNullOrEmpty(input) || (startIndex >= input.Length)) 364while (current < input.Length) 397return input.Length - startIndex; 501if ((valueString.Length < 3) || !valueString.StartsWith('\"') || !valueString.EndsWith('\"')) 508int maxLength = valueString.Length - 1; // -1 because we don't want to parse the final '"'.
System\Net\Http\Headers\ContentDispositionHeaderValue.cs (10)
213if (string.IsNullOrEmpty(input) || (startIndex >= input.Length)) 233if ((current < input.Length) && (input[current] == ';')) 255Debug.Assert((input != null) && (input.Length > 0) && (startIndex < input.Length)); 351return IsQuoted(nameParameter.Value) ? nameParameter.Value!.Substring(1, nameParameter.Value.Length - 2) : nameParameter.Value; 400result = result.Substring(1, result.Length - 2); 414else if (!needsQuotes && HttpRuleParser.GetTokenLength(result, 0) != result.Length) 452if (!IsQuoted(processedInput) || processedInput.Length < 10) 516byte[] unescapedBytes = new byte[dataString.Length]; 518for (int index = 0; index < dataString.Length; index++)
System\Net\Http\Headers\ContentRangeHeaderValue.cs (6)
163if (string.IsNullOrEmpty(input) || (startIndex >= input.Length)) 187if (current == input.Length) 203if ((current == input.Length) || (input[current] != '/')) 211if (current == input.Length) 285if ((current == input.Length) || (input[current] != '-')) 294if (current == input.Length)
System\Net\Http\Headers\CookieHeaderParser.cs (1)
32index = value.Length;
System\Net\Http\Headers\DateHeaderParser.cs (2)
32if (string.IsNullOrEmpty(value) || (index == value.Length)) 49index = value.Length;
System\Net\Http\Headers\EntityTagHeaderValue.cs (4)
91if (string.IsNullOrEmpty(input) || (startIndex >= input.Length)) 114if ((current + 2 >= input.Length) || (input[current] != '/')) 123if (current == input.Length || HttpRuleParser.GetQuotedStringLength(input, current, out int tagLength) != HttpParseResult.Parsed) 129Debug.Assert(tagLength != input.Length || (startIndex == 0 && !isWeak));
System\Net\Http\Headers\GenericHeaderParser.cs (1)
131return result.Length;
System\Net\Http\Headers\HeaderDescriptor.cs (1)
304Debug.Assert(candidate is null || candidate.Length == contentTypeValue.Length);
System\Net\Http\Headers\HeaderUtilities.cs (9)
71byte[] utf8bytes = ArrayPool<byte>.Shared.Rent(Encoding.UTF8.GetMaxByteCount(input.Length)); 72int utf8length = Encoding.UTF8.GetBytes(input, 0, input.Length, utf8bytes, 0); 158(length != value.Length)) // no trailing spaces allowed 169(length != value.Length)) // no trailing spaces allowed 245Debug.Assert(startIndex <= input.Length); // it's OK if index == value.Length. 250if ((current == input.Length) || (input[current] != ',')) 263while ((current < input.Length) && (input[current] == ',')) 307if (offset < 0 || length < 0 || offset > value.Length - length) 318if (offset < 0 || length < 0 || offset > value.Length - length)
System\Net\Http\Headers\HttpHeaderParser.cs (1)
55Debug.Assert((value == null) || ((index >= 0) && (index <= value.Length)));
System\Net\Http\Headers\HttpHeaders.cs (6)
952if ((value == null) || (index == value.Length)) 964Debug.Assert(index < value.Length, "Parser must return an index value within the string length."); 974while (index < value.Length) 1119if ((value == null) || (index == value.Length)) 1129Debug.Assert(index < value.Length, "Parser must return an index value within the string length."); 1139while (index < value.Length)
System\Net\Http\Headers\HttpRequestHeaders.cs (1)
117if ((value != null) && (HttpRuleParser.GetHostLength(value, 0, false) != value.Length))
System\Net\Http\Headers\KnownHeader.cs (2)
27var asciiBytesWithColonSpace = new byte[name.Length + 2]; // + 2 for ':' and ' ' 29Debug.Assert(asciiBytes == name.Length);
System\Net\Http\Headers\MediaTypeHeaderValue.cs (7)
183if (string.IsNullOrEmpty(input) || (startIndex >= input.Length)) 201if ((current < input.Length) && (input[current] == ';')) 228Debug.Assert((input != null) && (input.Length > 0) && (startIndex < input.Length)); 245if ((current >= input.Length) || (input[current] != '/')) 282if ((mediaTypeLength == 0) || (tempMediaType!.Length != mediaType.Length))
System\Net\Http\Headers\NameValueHeaderValue.cs (7)
215if (string.IsNullOrEmpty(input) || (startIndex >= input.Length)) 234if ((current == input.Length) || (input[current] != '=')) 271if ((string.IsNullOrEmpty(input)) || (startIndex >= input.Length)) 292if ((current == input.Length) || (input[current] != delimiter)) 306Debug.Assert((name != null) && (name.Length > 0)); 327if (startIndex >= input.Length) 369if (parseResult != HttpParseResult.Parsed || valueLength != value.Length)
System\Net\Http\Headers\NameValueWithParametersHeaderValue.cs (2)
103if (string.IsNullOrEmpty(input) || (startIndex >= input.Length)) 124if ((current < input.Length) && (input[current] == ';'))
System\Net\Http\Headers\ProductHeaderValue.cs (2)
110if (string.IsNullOrEmpty(input) || (startIndex >= input.Length)) 127if ((current == input.Length) || (input[current] != '/'))
System\Net\Http\Headers\ProductInfoHeaderParser.cs (3)
28if (string.IsNullOrEmpty(value) || (index == value.Length)) 36if (current == value.Length) 53if (current < value.Length)
System\Net\Http\Headers\ProductInfoHeaderValue.cs (3)
87if (index < input.Length) 103if (index < input.Length) 121if (string.IsNullOrEmpty(input) || (startIndex >= input.Length))
System\Net\Http\Headers\RangeConditionHeaderValue.cs (3)
80if (string.IsNullOrEmpty(input) || (startIndex + 1 >= input.Length)) 110if (current != input.Length) 123current = input.Length;
System\Net\Http\Headers\RangeHeaderValue.cs (3)
137if (string.IsNullOrEmpty(input) || (startIndex >= input.Length)) 155if ((current == input.Length) || (input[current] != '=')) 171Debug.Assert(current == input.Length, "GetRangeItemListLength() should consume the whole string or fail.");
System\Net\Http\Headers\RangeItemHeaderValue.cs (7)
85if ((string.IsNullOrEmpty(input)) || (startIndex >= input.Length)) 94if (current == input.Length) 115if ((current < input.Length) && !separatorFound) 120if (current == input.Length) 135if (string.IsNullOrEmpty(input) || (startIndex >= input.Length)) 156if ((current == input.Length) || (input[current] != '-')) 169if (current < input.Length)
System\Net\Http\Headers\RetryConditionHeaderValue.cs (3)
83if (string.IsNullOrEmpty(input) || (startIndex >= input.Length)) 113if (current != input.Length) 131current = input.Length;
System\Net\Http\Headers\StringWithQualityHeaderValue.cs (5)
91if (string.IsNullOrEmpty(input) || (startIndex >= input.Length)) 108if ((current == input.Length) || (input[current] != ';')) 133if ((current == input.Length) || ((input[current] != 'q') && (input[current] != 'Q'))) 142if ((current == input.Length) || (input[current] != '=')) 150if (current == input.Length)
System\Net\Http\Headers\TransferCodingHeaderValue.cs (2)
68if (string.IsNullOrEmpty(input) || (startIndex >= input.Length)) 87if ((current < input.Length) && (input[current] == ';'))
System\Net\Http\Headers\UriHeaderParser.cs (6)
31if (string.IsNullOrEmpty(value) || (index == value.Length)) 53index = value.Length; 69Span<byte> rawBytes = input.Length <= 256 ? stackalloc byte[input.Length] : new byte[input.Length]; 70for (int i = 0; i < input.Length; i++)
System\Net\Http\Headers\ViaHeaderValue.cs (5)
143if (string.IsNullOrEmpty(input) || (startIndex >= input.Length)) 153if ((current == 0) || (current == input.Length)) 172if ((current < input.Length) && (input[current] == '(')) 212if (current == input.Length) 262if (HttpRuleParser.GetHostLength(receivedBy, 0, true) != receivedBy.Length)
System\Net\Http\Headers\WarningHeaderValue.cs (5)
141if (string.IsNullOrEmpty(input) || (startIndex >= input.Length)) 199if ((whitespaceLength == 0) || (current == input.Length)) 231if ((whitespaceLength == 0) || (current == input.Length)) 248if ((current < input.Length) && (input[current] == '"')) 297if (HttpRuleParser.GetHostLength(agent, 0, true) != agent.Length)
System\Net\Http\HttpContent.cs (2)
140if (charset.Length > 2 && 144encoding = Encoding.GetEncoding(charset.Substring(1, charset.Length - 2));
System\Net\Http\HttpMethod.SocketsHttpHandler.cs (1)
59bytes = new byte[method.Length + 1];
System\Net\Http\HttpRuleParser.cs (11)
64if (startIndex >= input.Length) 72while (current < input.Length) 86return input.Length - startIndex; 97Debug.Assert((startIndex >= 0) && (startIndex < input.Length)); 116while (current < input.Length) 143if (startIndex >= input.Length) 192Debug.Assert((startIndex >= 0) && (startIndex < input.Length)); 203if ((startIndex + 2 > input.Length) || (input[startIndex + 1] is > (char)127 or '\r' or '\n' or '\0')) 228Debug.Assert((startIndex >= 0) && (startIndex < input.Length)); 238while (current < input.Length) 243if ((current + 2 < input.Length) &&
System\Net\Http\HttpTelemetry.cs (6)
256Size = (arg1.Length + 1) * sizeof(char) 261Size = (arg2.Length + 1) * sizeof(char) 271Size = (arg4.Length + 1) * sizeof(char) 381Size = (arg4.Length + 1) * sizeof(char) 386Size = (arg5.Length + 1) * sizeof(char) 396Size = (arg7.Length + 1) * sizeof(char)
System\Net\Http\MultipartContent.cs (3)
76if (boundary.Length > 70) 364currentLength += headerPair.Key.Length + ColonSpaceLength; 636int maxLength = encoding.GetMaxByteCount(content.Length);
System\Net\Http\NetEventSource.Http.cs (2)
109Size = ((arg4.Length + 1) * 2) 114Size = ((arg5.Length + 1) * 2)
System\Net\Http\SocketsHttpHandler\AuthenticationHelper.Digest.cs (15)
128index2 = digestResponse.Parameters[Qop].IndexOf(Auth, index1 + AuthInt.Length, StringComparison.Ordinal); 262while (currentIndex < data.Length && CharIsSpaceOrTab(data[currentIndex])) 272while (currentIndex < data.Length && data[currentIndex] != '=' && !CharIsSpaceOrTab(data[currentIndex])) 277if (currentIndex == data.Length) 290while (currentIndex < data.Length && CharIsSpaceOrTab(data[currentIndex])) 295if (currentIndex == data.Length || data[currentIndex] != '=') 304while (currentIndex < data.Length && (CharIsSpaceOrTab(data[currentIndex]) || data[currentIndex] == '=')) 316Debug.Assert(currentIndex < data.Length && !CharIsSpaceOrTab(data[currentIndex])); 333while (currentIndex < data.Length && ((quotedValue && data[currentIndex] != '"') || (!quotedValue && data[currentIndex] != ','))) 338if (currentIndex == data.Length) 357while (currentIndex < data.Length && CharIsSpaceOrTab(data[currentIndex])) 361if (currentIndex == data.Length) 375while (currentIndex < data.Length && CharIsSpaceOrTab(data[currentIndex])) 388while (parsedIndex < challenge.Length) 393if (string.IsNullOrEmpty(key) || parsedIndex >= challenge.Length)
System\Net\Http\SocketsHttpHandler\ConnectionPool\HttpConnectionPool.cs (1)
201byte[] hostHeaderLine = new byte[6 + hostHeader.Length + 2]; // Host: foo\r\n
System\Net\Http\SocketsHttpHandler\Http2Connection.cs (3)
1511headerListSize += knownHeader.Name.Length; 1612headerListSize += HttpKnownHeaderNames.Cookie.Length + HeaderField.RfcOverhead; 1624headerListSize += HttpKnownHeaderNames.ContentLength.Length + HeaderField.RfcOverhead;
System\Net\Http\SocketsHttpHandler\Http2Stream.cs (1)
681AdjustHeaderBudget(descriptor.Name.Length + value.Length);
System\Net\Http\SocketsHttpHandler\Http3RequestStream.cs (5)
727headerListSize += HttpKnownHeaderNames.Cookie.Length + HeaderField.RfcOverhead; 736headerListSize += HttpKnownHeaderNames.ContentLength.Length + HeaderField.RfcOverhead; 796headerListSize += knownHeader.Name.Length; 1035_headerBudgetRemaining -= descriptor.Name.Length + (staticValue?.Length ?? literalValue.Length);
System\Net\Http\SocketsHttpHandler\HttpConnection.cs (7)
494_writeBuffer.EnsureAvailableSpace(s.Length); 498Debug.Assert(bytesWritten == s.Length); 507_writeBuffer.EnsureAvailableSpace(s.Length); 518Debug.Assert(bytesWritten == s.Length); 520_writeBuffer.Commit(s.Length); 524_writeBuffer.EnsureAvailableSpace(encoding.GetMaxByteCount(s.Length)); 1341if (NameValueHeaderValue.GetNameValueListLength(keepAlive, 0, ',', parsedValues) == keepAlive.Length)
System\Net\Http\SocketsHttpHandler\MultiProxy.cs (7)
172if (_currentIndex < _proxyConfig.Length) 177Debug.Assert(_currentIndex <= _proxyConfig.Length); 179isFinalProxy = _currentIndex == _proxyConfig.Length; 228proxyString = proxyString.Slice("http=".Length); 233proxyString = proxyString.Slice("https=".Length); 242proxyString = proxyString.Slice("http://".Length); 250proxyString = proxyString.Slice("https://".Length);
System.Net.Http.Json (3)
System\Net\Http\Json\JsonHelpers.cs (3)
39if (charset.Length > 2 && charset[0] == '\"' && charset[charset.Length - 1] == '\"') 41encoding = Encoding.GetEncoding(charset.Substring(1, charset.Length - 2));
System.Net.Http.WinHttpHandler (5)
src\runtime\src\libraries\Common\src\System\Net\Logging\NetEventSource.Common.cs (2)
203Size = (arg1.Length + 1) * sizeof(char) 208Size = (arg2.Length + 1) * sizeof(char)
System\Net\Http\WinHttpCookieContainerAdapter.cs (2)
62(uint)CookieHeaderNameWithColon.Length, 80(uint)cookieHeader.Length,
System\Net\Http\WinHttpRequestCallback.cs (1)
537(uint)AuthHeaderNameWithColon.Length,
System.Net.HttpListener (47)
src\runtime\src\libraries\Common\src\System\Net\CookieParser.cs (4)
59_length = tokenStream.Length; 386if ((Name = Extract()).Length != 0) 855return (value.Length >= 2 && value.StartsWith('\"') && value.EndsWith('\"')) 856? value.Substring(1, value.Length - 2)
src\runtime\src\libraries\Common\src\System\Net\Logging\NetEventSource.Common.Associate.cs (4)
60Size = ((arg1.Length + 1) * 2) 65Size = ((arg2.Length + 1) * 2) 70Size = ((arg3.Length + 1) * 2) 75Size = ((arg4.Length + 1) * 2)
src\runtime\src\libraries\Common\src\System\Net\Logging\NetEventSource.Common.cs (2)
203Size = (arg1.Length + 1) * sizeof(char) 208Size = (arg2.Length + 1) * sizeof(char)
src\runtime\src\libraries\Common\src\System\Net\Logging\NetEventSource.Common.DumpBuffer.cs (2)
61Size = (arg1.Length + 1) * sizeof(char) 66Size = (arg2.Length + 1) * sizeof(char)
src\runtime\src\libraries\Common\src\System\Net\WebSockets\WebSocketValidate.cs (1)
85Encoding.UTF8.GetMaxByteCount(statusDescription.Length) > MaxControlFramePayloadLength &&
System\Net\HttpListener.cs (4)
130while (j < uriPrefix.Length && uriPrefix[j] != '/' && (uriPrefix[j] != ':' || inSquareBrakets)) 172int length = uriPrefix.Length; 175length += i == 7 ? ":80".Length : ":443".Length;
System\Net\HttpListenerRequest.cs (7)
42if (cookie.Name.Length == 0) 77if (postDataCharset != null && postDataCharset.Length > 0) 290int l = headerValue.Length; 291int k = AttrName.Length; 364int l = s.Length; 412int count = s.Length; 536int l = s.Length;
System\Net\HttpListenerRequestUriBuilder.cs (8)
177while (index < _rawPath.Length) 182if (index + 2 >= _rawPath.Length) 192if (index + 4 >= _rawPath.Length) 366Debug.Assert(uriString.Length > 0, "uriString must not be empty"); 399pathStartIndex = uriString.Length; 408Debug.Assert((uriString.Length == 1) && (uriString[0] == '*'), "Unknown request Uri string format", 425queryIndex = uriString.Length; 438if ((path.Length == 1) && (path[0] == '*'))
System\Net\HttpListenerResponse.cs (1)
160for (int i = 0; i < value.Length; i++)
System\Net\Managed\HttpEndPointListener.cs (4)
195if (ppath.Length < bestLength) 203bestLength = ppath.Length; 245if (ppath.Length < bestLength) 250bestLength = ppath.Length;
System\Net\Managed\HttpEndPointManager.cs (1)
85int root = p.IndexOf('/', colon, p.Length - colon);
System\Net\Managed\HttpListenerContext.Managed.cs (1)
44_user = ParseBasicAuthentication(header.Substring(AuthenticationTypes.Basic.Length + 1));
System\Net\Managed\HttpListenerRequest.Managed.cs (1)
104_version = Version.Parse(version.Slice("HTTP/".Length));
System\Net\Managed\ListenerAsyncResult.Managed.cs (3)
145authHeader.Length < AuthenticationTypes.Basic.Length + 2 || 146!HttpListenerContext.TryParseBasicAuth(authHeader.Substring(AuthenticationTypes.Basic.Length + 1), out errorCode, out _, out _))
System\Net\Managed\ListenerPrefix.cs (3)
107int length = uri.Length; 128if (_path.Length != 1) 129_path = _path.Substring(0, _path.Length - 1);
System\Net\ServiceNameStore.cs (1)
231while (j < uriPrefix.Length && uriPrefix[j] != '/' && (uriPrefix[j] != ':' || inSquareBrackets))
System.Net.Mail (75)
src\runtime\src\libraries\Common\src\System\Net\Logging\NetEventSource.Common.Associate.cs (4)
60Size = ((arg1.Length + 1) * 2) 65Size = ((arg2.Length + 1) * 2) 70Size = ((arg3.Length + 1) * 2) 75Size = ((arg4.Length + 1) * 2)
src\runtime\src\libraries\Common\src\System\Net\Logging\NetEventSource.Common.cs (2)
203Size = (arg1.Length + 1) * sizeof(char) 208Size = (arg2.Length + 1) * sizeof(char)
src\runtime\src\libraries\Common\src\System\Text\ValueStringBuilder.cs (5)
125int count = s.Length; 167if (s.Length == 1 && (uint)pos < (uint)_chars.Length) // very common case, e.g. appending strings from NumberFormatInfo like separators, percent symbols, etc. 181if (pos > _chars.Length - s.Length) 183Grow(s.Length); 191_pos += s.Length;
System\Net\BufferBuilder.cs (1)
71Append(value, 0, value.Length, allowUnicode);
System\Net\Mail\Attachment.cs (5)
137if (value.Length == 0 || offset >= mediaType.Length || mediaType[offset++] != '/') 140if (value.Length == 0 || offset < mediaType.Length) 209return cid.Substring(1, cid.Length - 2);
System\Net\Mail\DomainLiteralReader.cs (1)
34Debug.Assert(0 <= index && index < data.Length, $"index was outside the bounds of the string: {index}");
System\Net\Mail\DotAtomReader.cs (1)
40Debug.Assert(0 <= index && index < data.Length, $"index was outside the bounds of the string: {index}");
System\Net\Mail\MailAddress.cs (2)
155if (displayName.Length >= 2 && displayName.StartsWith('\"') && displayName.EndsWith('\"')) 158displayName = displayName.Substring(1, displayName.Length - 2);
System\Net\Mail\MailAddressParser.cs (5)
28int index = data.Length - 1; 40int index = data.Length - 1; 70Debug.Assert(index >= 0 && index < data.Length, $"Index out of range: {index}, {data.Length}"); 75if (index == data.Length - 1 && MailBnfHelper.HasCROrLF(data))
System\Net\Mail\MailBnfHelper.cs (10)
125for (; offset < data.Length; offset++) 150if (data.Length == 0 || data.AsSpan().ContainsAnyExcept(s_charactersAllowedInHeaderNames)) 170for (; offset < data.Length; offset++) 184data.Length > offset + 3 && 225if (start >= data.Length) 296for (; offset < data.Length; offset++) 306for (; offset < data.Length; offset++) 331if (data.Length == 0) 364Debug.Assert(index < data.Length); 367&& index + 2 < data.Length
System\Net\Mail\MailPriority.cs (12)
278EnvelopeHeaders.InternalSet(xSenderHeader, sender.Encode(xSenderHeader.Length, allowUnicode)); 286EnvelopeHeaders.InternalAdd(headerName, address.Encode(headerName.Length, allowUnicode)); 290EnvelopeHeaders.InternalAdd(headerName, address.Encode(headerName.Length, allowUnicode)); 294EnvelopeHeaders.InternalAdd(headerName, address.Encode(headerName.Length, allowUnicode)); 312Headers.InternalAdd(headerName, Sender.Encode(headerName.Length, allowUnicode)); 320Headers.InternalAdd(headerName, From!.Encode(headerName.Length, allowUnicode)); 325Headers.InternalAdd(headerName, To.Encode(headerName.Length, allowUnicode)); 335Headers.InternalAdd(headerName, CC.Encode(headerName.Length, allowUnicode)); 345Headers.InternalAdd(headerName, ReplyTo.Encode(headerName.Length, allowUnicode)); 349Headers.InternalAdd(headerName, ReplyToList.Encode(headerName.Length, allowUnicode)); 393headerName.Length)); 439headerName.Length);
System\Net\Mail\QuotedPairReader.cs (2)
37Debug.Assert(0 <= index && index < data.Length, $"Index out of range: {index}, {data.Length}");
System\Net\Mail\QuotedStringFormatReader.cs (4)
38Debug.Assert(0 <= index && index < data.Length, $"Index out of range: {index}, {data.Length}"); 129Debug.Assert(0 <= index && index < data.Length, $"Index out of range: {index}, {data.Length}");
System\Net\Mail\SmtpClient.cs (1)
132for (int i = 0; i < clientDomainRaw.Length; i++)
System\Net\Mail\SmtpLoginAuthenticationModule.cs (1)
34if (domain != null && domain.Length > 0)
System\Net\Mail\WhitespaceReader.cs (2)
35Debug.Assert(index < data.Length, "index was outside the bounds of the string"); 118Debug.Assert(index < data.Length, "index was outside the bounds of the string");
System\Net\Mime\BaseWriter.cs (4)
55WriteAndFold(value, name.Length + 2, allowUnicode); 62for (int index = 0; index < value.Length; index++) 89if (value.Length - startOfLine > 0) 91_bufferBuilder.Append(value, startOfLine, value.Length - startOfLine, allowUnicode);
System\Net\Mime\ByteEncoder.cs (2)
74for (int i = 0; i < value.Length; ++i) 133return char.IsSurrogate(value[i]) && i + 1 < value.Length && char.IsSurrogatePair(value[i], value[i + 1]);
System\Net\Mime\ContentType.cs (6)
99if (_mediaType.Length == 0 || offset >= value.Length || value[offset++] != '/') 103if (_subType.Length == 0 || offset < value.Length) 227if (string.IsNullOrEmpty(_mediaType) || offset >= _type.Length || _type[offset++] != '/') 258if (offset >= _type.Length || _type[offset++] != '=')
System\Net\Mime\MediaTypeMap.cs (2)
742longestExtensionLength = Math.Max(longestExtensionLength, entry.Key.Length); 753longestExtensionLength = Math.Max(longestExtensionLength, entry.Value.Length);
System\Net\Mime\QEncoder.cs (1)
61if (value[i] == '\r' && i + 1 < value.Length && value[i + 1] == '\n')
System\Net\Mime\SmtpDateTime.cs (2)
179if (offset.Length != OffsetLength) 214for (int i = 0; i < value.Length; i++)
System.Net.NameResolution (9)
src\runtime\src\libraries\Common\src\System\Net\Logging\NetEventSource.Common.cs (2)
203Size = (arg1.Length + 1) * sizeof(char) 208Size = (arg2.Length + 1) * sizeof(char)
System\Net\Dns.cs (6)
450(hostSpan.Length == reservedName.Length || 451hostSpan[hostSpan.Length - reservedName.Length - 1] == '.'); 467int length = hostName.Length; 474return length > Localhost.Length && IsReservedName(hostName, Localhost); 899if (hostName.Length > MaxHostName || 900(hostName.Length == MaxHostName && hostName[MaxHostName - 1] != '.')) // If 255 chars, the last one must be a dot.
System\Net\ResolvConf.cs (1)
101ReadOnlySpan<char> rest = span[Directive.Length..];
System.Net.NetworkInformation (15)
src\runtime\src\libraries\Common\src\System\IO\RowConfigReader.cs (9)
67if (_currentIndex >= _buffer.Length) 85int afterKey = keyIndex + key.Length; 92endOfLine = _buffer.Length - 1; 135|| (keyIndex >= Environment.NewLine.Length && _buffer.AsSpan(keyIndex - Environment.NewLine.Length, Environment.NewLine.Length).SequenceEqual(Environment.NewLine))) 138if (HasFollowingWhitespace(keyIndex, key.Length)) 144startIndex += key.Length; 150return (keyIndex + length < _buffer.Length)
src\runtime\src\libraries\Common\src\System\IO\StringParser.cs (2)
56if (_endIndex >= _buffer.Length) 64_endIndex = nextSeparator >= 0 ? nextSeparator : _buffer.Length;
System\Net\NetworkInformation\StringParsingHelpers.Addresses.cs (2)
160ReadOnlySpan<char> addressSpan = fileContents.AsSpan(labelIndex + label.Length, endOfLine - (labelIndex + label.Length));
System\Net\NetworkInformation\StringParsingHelpers.Connections.cs (2)
283ReadOnlySpan<char> portSpan = localAddressAndPort.AsSpan(indexOfColon + 1, localAddressAndPort.Length - (indexOfColon + 1)); 303ReadOnlySpan<char> portSpan = colonSeparatedAddress.AsSpan(indexOfColon + 1, colonSeparatedAddress.Length - (indexOfColon + 1));
System.Net.Ping (1)
src\runtime\src\libraries\Common\src\System\Net\NetworkInformation\UnixCommandLinePing.cs (1)
212int afterTime = timeIndex + "time=".Length;
System.Net.Primitives (27)
src\runtime\src\libraries\Common\src\System\Net\CookieParser.cs (4)
59_length = tokenStream.Length; 386if ((Name = Extract()).Length != 0) 855return (value.Length >= 2 && value.StartsWith('\"') && value.EndsWith('\"')) 856? value.Substring(1, value.Length - 2)
src\runtime\src\libraries\Common\src\System\Net\Logging\NetEventSource.Common.cs (2)
203Size = (arg1.Length + 1) * sizeof(char) 208Size = (arg2.Length + 1) * sizeof(char)
src\runtime\src\libraries\Common\src\System\Net\SocketAddress.cs (2)
162familyString.Length + // AddressFamily 175int length = familyString.Length;
System\Net\Cookie.cs (11)
388(!(m_value.Length > 2 && m_value.StartsWith('\"') && m_value.EndsWith('\"')) && m_value.AsSpan().ContainsAny(';', ','))) 394if (Comment != null && !(Comment.Length > 2 && Comment.StartsWith('\"') && Comment.EndsWith('\"')) 401if (Path != null && !(Path.Length > 2 && Path.StartsWith('\"') && Path.EndsWith('\"')) 463if (!m_port_implicit && m_port.Length == 0) 670if (!m_path_implicit && m_path.Length > 0) 677if (!m_domain_implicit && m_domain.Length > 0) 690if (m_port.Length > 0) 709if (m_comment != null && m_comment.Length > 0) 721if (!m_domain_implicit && m_domain != null && m_domain.Length > 0) 736if (!m_path_implicit && m_path != null && m_path.Length > 0) 740if (!Plain && !m_port_implicit && m_port != null && m_port.Length > 0)
System\Net\CookieContainer.cs (7)
185if (cookie.Domain.Length == 0) 235if (cookie.Value.Length > m_maxCookieSize) 758return requestPath.Length == cookiePath.Length || 760requestPath[cookiePath.Length] == '/'; 954int ll = pathLeft.Length; 955int lr = pathRight.Length;
System\Net\NetworkCredential.cs (1)
187return new SecureString(ptr, str.Length);
System.Net.Quic (4)
src\runtime\src\libraries\Common\src\System\Net\Logging\NetEventSource.Common.cs (2)
203Size = (arg1.Length + 1) * sizeof(char) 208Size = (arg2.Length + 1) * sizeof(char)
src\runtime\src\libraries\Common\src\System\Net\Security\CertificateValidation.Unix.cs (2)
43hostNameMatch = Interop.Crypto.CheckX509IpAddress(certHandle, addressBytes, addressBytes.Length, hostName, hostName.Length); 51hostNameMatch = Interop.Crypto.CheckX509Hostname(certHandle, matchName, matchName.Length);
System.Net.Requests (40)
src\runtime\src\libraries\Common\src\System\Net\HttpValidationHelpers.cs (3)
29return (token.Length > 0) 53for (int i = 0; i < value.Length; ++i) 106for (int i = 0; i < stringValue.Length; i++)
src\runtime\src\libraries\Common\src\System\Net\Logging\NetEventSource.Common.Associate.cs (4)
60Size = ((arg1.Length + 1) * 2) 65Size = ((arg2.Length + 1) * 2) 70Size = ((arg3.Length + 1) * 2) 75Size = ((arg4.Length + 1) * 2)
src\runtime\src\libraries\Common\src\System\Net\Logging\NetEventSource.Common.cs (2)
203Size = (arg1.Length + 1) * sizeof(char) 208Size = (arg2.Length + 1) * sizeof(char)
System\Net\CommandStream.cs (5)
203string sendCommand = _commands[_index].Command.Substring(0, _commands[_index].Command.Length - 2); 510if (_buffer.Length > 0) 575if (_buffer.Length > 0) 604if ((szResponse.Length + state.Resp.StatusBuffer.Length) > MaxResponseLength) 621_buffer = szResponse.Substring(szResponse.Length - unusedChars, unusedChars);
System\Net\FtpControlStream.cs (12)
529if (domainUserName.Length == 0 && password.Length == 0) 569if (requestFilename.Length == 0 && request.MethodInfo.HasFlag(FtpMethodFlags.TakesParameter)) 584if (request.MethodInfo.HasFlag(FtpMethodFlags.MustChangeWorkingDirectoryToPath) && requestDirectory.Length > 0) 628string baseDir = (requestDirectory.Length == 0) 784index != -1 && index == path.Length - 1) 787path = path.Substring(0, path.Length - 1); 804if (directory.Length > 1 && directory.EndsWith('/')) 805directory = directory.Substring(0, directory.Length - 1); 976end = str.Length; 988if (originalPath.Length > 0 && !originalPath.EndsWith('/')) 1232if (responseString.Length > lineStart + 4)
System\Net\FtpWebRequest.cs (1)
502if (_uri.UserInfo is { Length: > 0 } userInfo)
System\Net\HttpWebRequest.cs (1)
1563if ((curRange == null) || (curRange.Length == 0))
System\Net\HttpWebResponse.cs (2)
297while (i < srchString.Length && srchString[i] == ' ') 302if (i < srchString.Length - 1 && srchString[i] == '=')
System\Net\NetRes.cs (2)
67if (statusMessage != null && statusMessage.Length > 0) 76if (statusDescription != null && statusDescription.Length > 0)
System\Net\WebRequest.cs (8)
92int LookupLength = LookupUri.Length; 112if (LookupLength >= Current.Prefix.Length) 119Current.Prefix.Length, 262cookedUri = cookedUri.Substring(0, cookedUri.Length - 1); 279if (prefix.Length > Current.Prefix.Length) 286if (prefix.Length == Current.Prefix.Length)
System.Net.Security (14)
src\runtime\src\libraries\Common\src\Interop\Unix\System.Security.Cryptography.Native\Interop.OpenSsl.cs (1)
640EnsureSize(ref buffer, index + alg.Length + 2);
src\runtime\src\libraries\Common\src\System\Net\Logging\NetEventSource.Common.cs (2)
203Size = (arg1.Length + 1) * sizeof(char) 208Size = (arg2.Length + 1) * sizeof(char)
src\runtime\src\libraries\Common\src\System\Net\Logging\NetEventSource.Common.DumpBuffer.cs (2)
61Size = (arg1.Length + 1) * sizeof(char) 66Size = (arg2.Length + 1) * sizeof(char)
src\runtime\src\libraries\Common\src\System\Net\Security\CertificateValidation.Unix.cs (2)
43hostNameMatch = Interop.Crypto.CheckX509IpAddress(certHandle, addressBytes, addressBytes.Length, hostName, hostName.Length); 51hostNameMatch = Interop.Crypto.CheckX509Hostname(certHandle, matchName, matchName.Length);
System\Net\Security\NegotiateAuthentication.cs (1)
282rentedBuffer = ArrayPool<byte>.Shared.Rent((incomingBlob.Length / 4) * 3);
System\Net\Security\NetEventSource.Security.cs (1)
301Size = (arg1.Length + 1) * sizeof(char)
System\Net\Security\NetSecurityTelemetry.cs (2)
276Size = (arg2.Length + 1) * sizeof(char) 308Size = (arg3.Length + 1) * sizeof(char)
System\Net\Security\SslStreamCertificateContext.Linux.cs (1)
389Debug.Assert(baseUri.Length > 0);
System\Security\Authentication\ExtendedProtection\ServiceNameCollection.cs (2)
179if (hostPortAndDistinguisher.Length == 0) 225host.Length == hostPortAndDistinguisher.Length ?
System.Net.Sockets (7)
src\runtime\src\libraries\Common\src\System\Net\Logging\NetEventSource.Common.cs (2)
203Size = (arg1.Length + 1) * sizeof(char) 208Size = (arg2.Length + 1) * sizeof(char)
src\runtime\src\libraries\Common\src\System\Net\Logging\NetEventSource.Common.DumpBuffer.cs (2)
61Size = (arg1.Length + 1) * sizeof(char) 66Size = (arg2.Length + 1) * sizeof(char)
System\Net\Sockets\UnixDomainSocketEndPoint.cs (3)
47if (path.Length == 0 || bufferLength > s_nativePathLength) 56int bytesEncoded = Encoding.UTF8.GetBytes(path, 0, path.Length, _encodedPath, 0); 166private static bool IsAbstract(string path) => path.Length > 0 && path[0] == '\0';
System.Net.WebClient (6)
System\Net\WebClient.cs (6)
512boundaryBytes = new byte["\r\n--".Length + boundary.Length + "--\r\n".Length]; 514"--\r\n"u8.CopyTo(boundaryBytes.AsSpan("\r\n--".Length + boundary.Length)); 515OperationStatus conversionStatus = Ascii.FromUtf16(boundary, boundaryBytes.AsSpan("\r\n--".Length), out _);
System.Net.WebHeaderCollection (5)
src\runtime\src\libraries\Common\src\System\Net\HttpValidationHelpers.cs (3)
29return (token.Length > 0) 53for (int i = 0; i < value.Length; ++i) 106for (int i = 0; i < stringValue.Length; i++)
System\Net\HeaderInfoTable.cs (2)
30for (int i = 0; i < value.Length; i++) 51if (startIndex < value.Length && length > 0)
System.Net.WebProxy (2)
System\Net\WebProxy.cs (2)
372int lengthRequired = checked(input.Scheme.Length + 3 + input.Host.Length +
System.Net.WebSockets (13)
src\runtime\src\libraries\Common\src\System\Net\Logging\NetEventSource.Common.Associate.cs (4)
60Size = ((arg1.Length + 1) * 2) 65Size = ((arg2.Length + 1) * 2) 70Size = ((arg3.Length + 1) * 2) 75Size = ((arg4.Length + 1) * 2)
src\runtime\src\libraries\Common\src\System\Net\Logging\NetEventSource.Common.cs (2)
203Size = (arg1.Length + 1) * sizeof(char) 208Size = (arg2.Length + 1) * sizeof(char)
src\runtime\src\libraries\Common\src\System\Net\WebSockets\WebSocketValidate.cs (1)
85Encoding.UTF8.GetMaxByteCount(statusDescription.Length) > MaxControlFramePayloadLength &&
System\Net\WebSockets\ManagedWebSocket.cs (1)
1560int encodedLength = s_textEncoding.GetBytes(closeStatusDescription, 0, closeStatusDescription.Length, buffer, 2);
System\Net\WebSockets\NetEventSource.WebSockets.cs (5)
219Size = (arg1.Length + 1) * sizeof(char) 224Size = (arg2.Length + 1) * sizeof(char) 251Size = (arg1.Length + 1) * sizeof(char) 256Size = (arg2.Length + 1) * sizeof(char) 261Size = (arg3.Length + 1) * sizeof(char)
System.Net.WebSockets.Client (1)
src\runtime\src\libraries\Common\src\System\Net\WebSockets\WebSocketValidate.cs (1)
85Encoding.UTF8.GetMaxByteCount(statusDescription.Length) > MaxControlFramePayloadLength &&
System.Private.CoreLib (974)
Internal\Runtime\CompilerHelpers\InteropHelpers.cs (2)
42int lenUnicode = str.Length; 230int stringLength = s.Length;
src\runtime\src\coreclr\tools\Common\Internal\NativeFormat\NativeFormatReader.String.cs (3)
110if (numBytes < value.Length) 113for (int i = 0; i < value.Length; i++) 124return numBytes == value.Length; // All char ANSI, all matching
src\runtime\src\coreclr\tools\Common\TypeSystem\Common\TypeHashingAlgorithms.cs (2)
34for (int i = 0; i < src.Length; i += 2) 37if ((i + 1) < src.Length)
src\runtime\src\libraries\Common\src\Interop\Linux\procfs\Interop.ProcMountInfo.cs (1)
42if (mount.MountPoint.Length == path.Length)
src\runtime\src\libraries\Common\src\Interop\Linux\procfs\Interop.ProcMountInfo.TryParseMountInfoLine.cs (1)
59line = line.Slice(endOfOptionalFields + Separator.Length);
src\runtime\src\libraries\Common\src\System\IO\PathInternal.cs (6)
36if (commonChars == first.Length 37&& (commonChars == second.Length || IsDirectorySeparator(second[commonChars]))) 40if (commonChars == second.Length && IsDirectorySeparator(first[commonChars])) 63for (; (uint)commonLength < (uint)first.Length; commonLength++) 65if (commonLength >= second.Length || 217path.Substring(0, path.Length - 1) :
src\runtime\src\libraries\Common\src\System\IO\PathInternal.Unix.cs (5)
47for (int i = 0; i < path.Length; i++) 50&& (i + 1 < path.Length && IsDirectorySeparator(path[i + 1]))) 60StringBuilder builder = new StringBuilder(path.Length); 62for (int i = 0; i < path.Length; i++) 68&& (i + 1 < path.Length && IsDirectorySeparator(path[i + 1])))
src\runtime\src\libraries\Common\src\System\IO\StringParser.cs (2)
56if (_endIndex >= _buffer.Length) 64_endIndex = nextSeparator >= 0 ? nextSeparator : _buffer.Length;
src\runtime\src\libraries\Common\src\System\Number.Formatting.Common.cs (1)
526if (info.NumberGroupSeparator.Length > 0)
src\runtime\src\libraries\Common\src\System\Reflection\AssemblyNameFormatter.cs (4)
23Debug.Assert(name.Length != 0); 60if (cultureName.Length == 0) 108if (s.Length != span.Trim().Length || span.IndexOfAny('\"', '\'') >= 0) 114for (int i = 0; i < s.Length; i++)
src\runtime\src\libraries\Common\src\System\Reflection\AssemblyNameParser.cs (3)
310if (attributeValue.Length % 2 != 0 || (isToken && attributeValue.Length != 8 * 2)) 316byte[] pkt = new byte[attributeValue.Length / 2];
src\runtime\src\libraries\Common\src\System\Text\ValueStringBuilder.cs (5)
125int count = s.Length; 167if (s.Length == 1 && (uint)pos < (uint)_chars.Length) // very common case, e.g. appending strings from NumberFormatInfo like separators, percent symbols, etc. 181if (pos > _chars.Length - s.Length) 183Grow(s.Length); 191_pos += s.Length;
src\runtime\src\libraries\System.Private.CoreLib\src\System\AppContextConfigHelper.cs (3)
64if (str.Length >= 2 && str[1] == 'x') 104if (str.Length >= 2 && str[1] == 'x') 214if (str.Length >= 2 && str[1] == 'x')
src\runtime\src\libraries\System.Private.CoreLib\src\System\BitConverter.cs (1)
870var dst = new Span<char>(ref result.GetRawStringData(), result.Length);
src\runtime\src\libraries\System.Private.CoreLib\src\System\Boolean.cs (2)
101charsWritten = TrueLiteral.Length; 109charsWritten = FalseLiteral.Length;
src\runtime\src\libraries\System.Private.CoreLib\src\System\Buffers\SharedArrayPool.cs (1)
535envVar.Length is > 0 and <= 32) // arbitrary limit that allows for some spaces around the maximum length of a non-negative Int32 (10 digits)
src\runtime\src\libraries\System.Private.CoreLib\src\System\Char.cs (20)
673if ((uint)index >= (uint)s.Length) 688if ((uint)index >= (uint)s.Length) 708if ((uint)index >= (uint)s.Length) 729if ((uint)index >= (uint)s.Length) 746if ((uint)index >= (uint)s.Length) 788if ((uint)index >= (uint)s.Length) 821if ((uint)index >= (uint)s.Length) 863if ((uint)index >= (uint)s.Length) 888if ((uint)index >= (uint)s.Length) 918if ((uint)index >= (uint)s.Length) 935if ((uint)index >= (uint)s.Length) 955if ((uint)index >= (uint)s.Length) 981if ((uint)index >= (uint)s.Length) 1005if ((uint)index >= (uint)s.Length) 1027if ((uint)index >= (uint)s.Length) 1049if ((uint)index >= (uint)s.Length) 1066if ((uint)index >= (uint)s.Length) 1071if ((uint)(index + 1) < (uint)s.Length) 1173if ((uint)index >= (uint)s.Length) 1187if ((uint)(index + 1) < (uint)s.Length)
src\runtime\src\libraries\System.Private.CoreLib\src\System\CharEnumerator.cs (2)
22int length = _str.Length; 44if ((uint)index >= (uint)s.Length)
src\runtime\src\libraries\System.Private.CoreLib\src\System\Collections\Generic\RandomizedStringEqualityComparer.cs (2)
84(uint)obj.Length * 2, 129obj.Length,
src\runtime\src\libraries\System.Private.CoreLib\src\System\Convert.cs (1)
494if (value.Length != 1)
src\runtime\src\libraries\System.Private.CoreLib\src\System\DateOnly.cs (2)
626if (format!.Length == 1) 810if (format.Length == 1)
src\runtime\src\libraries\System.Private.CoreLib\src\System\Diagnostics\DebugProvider.cs (2)
90if (s.Length > 0) 104if (_indentString?.Length == indentCount)
src\runtime\src\libraries\System.Private.CoreLib\src\System\Diagnostics\DebugProvider.Unix.cs (2)
75while (i < message.Length) 77for (bufCount = 0; bufCount < BufferLength && i < message.Length; i++)
src\runtime\src\libraries\System.Private.CoreLib\src\System\Diagnostics\Tracing\ActivityTracker.cs (2)
259return string.Concat(providerName, activityName.AsSpan()[..^EventSource.ActivityStartSuffix.Length]); 263return string.Concat(providerName, activityName.AsSpan()[..^EventSource.ActivityStopSuffix.Length]);
src\runtime\src\libraries\System.Private.CoreLib\src\System\Diagnostics\Tracing\EventPipeMetadataGenerator.cs (10)
85uint v1MetadataLength = 24 + ((uint)eventName.Length + 1) * 2; 153WriteToBuffer(pMetadata, totalMetadataLength, ref offset, (byte*)pEventName, ((uint)eventName.Length + 1) * 2); 304EventPipeMetadataGenerator.WriteToBuffer(pMetadataBlob, blobSize, ref offset, (byte*)pParameterName, ((uint)ParameterName.Length + 1) * 2); 349EventPipeMetadataGenerator.WriteToBuffer(pMetadataBlob, blobSize, ref offset, (byte*)pPropertyName, ((uint)property.name.Length + 1) * 2); 371EventPipeMetadataGenerator.WriteToBuffer(pMetadataBlob, blobSize, ref offset, (byte*)pPropertyName, ((uint)property.name.Length + 1) * 2); 398EventPipeMetadataGenerator.WriteToBuffer(pMetadataBlob, blobSize, ref offset, (byte*)pPropertyName, ((uint)name.Length + 1) * 2); 605size += (uint)(sizeof(uint) + ((ParameterName.Length + 1) * 2)); 639ret += (uint)((property.name.Length + 1) * 2); 643ret += (uint)(sizeof(uint) + ((property.name.Length + 1) * 2)); 753((name.Length + 1) * 2));
src\runtime\src\libraries\System.Private.CoreLib\src\System\Diagnostics\Tracing\EventProvider.cs (2)
257dataDescriptor->Size = ((uint)sRet.Length + 1) * 2; 421dataDescriptor->Size = ((uint)sRet.Length + 1) * 2;
src\runtime\src\libraries\System.Private.CoreLib\src\System\Diagnostics\Tracing\EventSource.cs (15)
939descrs[0].Size = ((arg1.Length + 1) * 2); 959descrs[0].Size = ((arg1.Length + 1) * 2); 962descrs[1].Size = ((arg2.Length + 1) * 2); 984descrs[0].Size = ((arg1.Length + 1) * 2); 987descrs[1].Size = ((arg2.Length + 1) * 2); 990descrs[2].Size = ((arg3.Length + 1) * 2); 1009descrs[0].Size = ((arg1.Length + 1) * 2); 1030descrs[0].Size = ((arg1.Length + 1) * 2); 1055descrs[0].Size = ((arg1.Length + 1) * 2); 1080descrs[1].Size = ((arg2.Length + 1) * 2); 1102descrs[1].Size = ((arg2.Length + 1) * 2); 2278data.Size = (uint)(2 * (msgString.Length + 1)); 3216string taskName = eventName[..^ActivityStartSuffix.Length]; // Remove the Start suffix to get the task name 3238startEventMetadata.Name.AsSpan()[..^ActivityStartSuffix.Length].SequenceEqual( 3239eventName.AsSpan()[..^ActivityStopSuffix.Length]))
src\runtime\src\libraries\System.Private.CoreLib\src\System\Diagnostics\Tracing\FrameworkEventSource.cs (2)
51descrs[2].Size = ((arg3.Length + 1) * 2); 86descrs[2].Size = ((arg3.Length + 1) * 2);
src\runtime\src\libraries\System.Private.CoreLib\src\System\Diagnostics\Tracing\ManifestBuilder.cs (7)
601string evtName = key.Substring("event_".Length); 732if (keyword.Length != 0) 818if (i >= eventMessage.Length) 835else if (i < eventMessage.Length - 1 && 849while (i < eventMessage.Length && char.IsDigit(eventMessage[i])) 854if (i < eventMessage.Length && eventMessage[i] == '}') 863if (i < eventMessage.Length && eventMessage[i] == '!')
src\runtime\src\libraries\System.Private.CoreLib\src\System\Diagnostics\Tracing\TraceLogging\DataCollector.cs (1)
154nullCharIndex = value.Length;
src\runtime\src\libraries\System.Private.CoreLib\src\System\Diagnostics\Tracing\TraceLogging\FieldMetadata.cs (1)
171Encoding.UTF8.GetBytes(this.name, 0, this.name.Length, metadata, pos);
src\runtime\src\libraries\System.Private.CoreLib\src\System\Diagnostics\Tracing\TraceLogging\Statics.cs (2)
93Encoding.UTF8.GetBytes(name, 0, name.Length, metadata, 2 + prefixSize); 174return fieldName.Length <= 2 && fieldName[0] == '_';
src\runtime\src\libraries\System.Private.CoreLib\src\System\Diagnostics\Tracing\TraceLogging\TraceLoggingDataCollector.cs (1)
89DataCollector.ThreadInstance.AddBinary(value, value == null ? 0 : value.Length * 2);
src\runtime\src\libraries\System.Private.CoreLib\src\System\Diagnostics\Tracing\TraceLogging\TraceLoggingEventSource.cs (3)
797if (value.Length == 0) 809for (int i = 1; i < value.Length; i++) 813if (!(i + 1 < value.Length))
src\runtime\src\libraries\System.Private.CoreLib\src\System\Enum.cs (8)
1402if (format.Length == 1) 1641if (format.Length == 1) 1653if (format.Length == 1) 1871charsWritten = enumName.Length; 1950WriteMultipleFoundFlagsNames(names, foundItems, new Span<char>(ref result.GetRawStringData(), result.Length)); 1975charsWritten = singleEnumFlagsFormat.Length; 2088resultLength = checked(resultLength + names[index].Length); 2116destination = destination.Slice(name.Length);
src\runtime\src\libraries\System.Private.CoreLib\src\System\Environment.cs (2)
141if (name.Length == 0) 205return (processPath.Length != 0) ? processPath : null;
src\runtime\src\libraries\System.Private.CoreLib\src\System\Environment.GetFolderPathCore.Unix.cs (7)
28if (path.Length == 0 || 201if (pos >= line.Length) continue; 205pos += key.Length; 209if (pos >= line.Length - 4 || line[pos] != '=') continue; // 4 for ="" and at least one char between quotes 214if (pos >= line.Length - 3 || line[pos] != '"') continue; // 3 for "" and at least one char between quotes 223pos += RelativeToHomePrefix.Length; 253while (pos < line.Length && char.IsWhiteSpace(line[pos])) pos++;
src\runtime\src\libraries\System.Private.CoreLib\src\System\Environment.OSVersion.Unix.cs (2)
34pos = numberPos >= 0 ? pos + numberPos : text.Length; 38for (; (uint)pos < (uint)text.Length; pos++)
src\runtime\src\libraries\System.Private.CoreLib\src\System\Environment.UnixOrBrowser.cs (1)
29while (lastPos < name.Length && (pos = name.IndexOf('%', lastPos + 1)) >= 0)
src\runtime\src\libraries\System.Private.CoreLib\src\System\Exception.cs (11)
133int length = className.Length; 138length += 2 + message.Length; 142length += Environment.NewLineConst.Length + InnerExceptionPrefix.Length + innerExceptionString.Length + Environment.NewLineConst.Length + 3 + endOfInnerExceptionResource.Length; 146length += Environment.NewLineConst.Length + stackTrace.Length; 152Span<char> resultSpan = new Span<char>(ref result.GetRawStringData(), result.Length); 183dest = dest.Slice(source.Length);
src\runtime\src\libraries\System.Private.CoreLib\src\System\Globalization\CalendarData.cs (1)
300if (this.saEraNames[0].Length == 4)
src\runtime\src\libraries\System.Private.CoreLib\src\System\Globalization\CalendarData.Icu.cs (13)
180if (s.Length > 100) 183Span<char> modifiedPattern = stackalloc char[s.Length + 2]; 186while (index < s.Length) 194} while (index < s.Length && s[index] != '\''); 196if (index >= s.Length) 209if (index >= s.Length - 1 || s[index + 1] != 'y') 215if (index + 2 < s.Length && s[index + 2] == 'y') 232while (index < s.Length) 264var destination = input.Length < 128 ? 266new ValueStringBuilder(input.Length); 269while (index < input.Length) 277while (index < input.Length) 360while (index < input.Length && input[index] == value)
src\runtime\src\libraries\System.Private.CoreLib\src\System\Globalization\CharUnicodeInfo.cs (8)
46if ((uint)index >= (uint)s.Length) 140if ((uint)index >= (uint)s.Length) 174if ((uint)index >= (uint)s.Length) 249if ((uint)index >= (uint)s.Length) 378if ((uint)index >= (uint)s.Length) 393Debug.Assert(index < value.Length); 405Debug.Assert(str.Length > 0); 406Debug.Assert(index >= 0 && index < str.Length);
src\runtime\src\libraries\System.Private.CoreLib\src\System\Globalization\CompareInfo.cs (14)
308return Compare(string1, offset1, string1 == null ? 0 : string1.Length - offset1, 309string2, offset2, string2 == null ? 0 : string2.Length - offset2, options); 391if (offset1 > (string1 == null ? 0 : string1.Length) - length1) 396Debug.Assert(offset2 > (string2 == null ? 0 : string2.Length) - length2); 842return IndexOf(source, value, startIndex, source.Length - startIndex, options); 853return IndexOf(source, value, startIndex, source.Length - startIndex, options); 878if ((uint)startIndex > (uint)source.Length) 912if ((uint)startIndex > (uint)source.Length) 1204if ((uint)startIndex >= (uint)source.Length) 1206if (startIndex == -1 && source.Length == 0) 1210else if (startIndex == source.Length) 1264if ((uint)startIndex >= (uint)source.Length) 1266if (startIndex == -1 && source.Length == 0) 1270else if (startIndex == source.Length)
src\runtime\src\libraries\System.Private.CoreLib\src\System\Globalization\CompareInfo.Icu.cs (5)
65return _sortName.Length == 0 || 66(_sortName.Length >= 2 && _sortName[0] == 'e' && _sortName[1] == 'n' && (_sortName.Length == 2 || _sortName[2] == '-')); 731sortKeyLength = Interop.Globalization.GetSortKey(_sortHandle, pSource, source.Length, null, 0, options); 748if (Interop.Globalization.GetSortKey(_sortHandle, pSource, source.Length, pSortKey, sortKeyLength, options) != sortKeyLength)
src\runtime\src\libraries\System.Private.CoreLib\src\System\Globalization\CompareInfo.Invariant.cs (2)
22if (source.Length == 0) 29keyData = new byte[source.Length * sizeof(char)];
src\runtime\src\libraries\System.Private.CoreLib\src\System\Globalization\CompareInfo.Nls.cs (1)
375int sourceLength = source.Length;
src\runtime\src\libraries\System.Private.CoreLib\src\System\Globalization\CultureData.cs (23)
720if (name.Length > LocaleNameMaxLength) 726Span<char> normalizedName = stackalloc char[name.Length]; 730while (i < name.Length && name[i] != '-' && name[i] != '_') 745if (i < name.Length) 751while (i < name.Length) 777if (cultureName.Length > LocaleNameMaxLength || !CultureInfo.VerifyCultureName(cultureName, false)) 791if (cultureName.Length == 1 && (cultureName[0] == 'C' || cultureName[0] == 'c')) 931if (!GlobalizationMode.Invariant && Name.Length > 0) 1006EnglishLanguageName.AsSpan(0, _sEnglishLanguage!.Length - 1), 1113if (!GlobalizationMode.Invariant && Name.Length > 0) 1418for (int j = 0; j < time.Length; j++) 1490for (; index < time.Length; index++) 2027for (int i = start; i < str.Length && i <= end; i++) 2032result ??= new StringBuilder(str, start, i - start, str.Length); 2035result ??= new StringBuilder(str, start, i - start, str.Length); 2037if (i < str.Length) 2088} while (index < format.Length && format[index] == cTimePart); 2093if (separatorStart < format.Length) 2112for (int i = startIndex; i < format.Length; ++i) 2122if (i + 1 < format.Length) 2159if (digits.Length < NumberFormatInfo.s_asciiDigits.Length) 2197while ((uint)ffffPos < (uint)digits.Length && digits[ffffPos] != '\uFFFF') 2202} while (ffffPos < digits.Length && index < 10);
src\runtime\src\libraries\System.Private.CoreLib\src\System\Globalization\CultureData.Icu.cs (14)
36Debug.Assert(name.Length <= ICU_ULOC_FULLNAME_CAPACITY); 44if (name.Length > 1 && (name[0] == '-' || name[0] == '_') && originalName.StartsWith("und", StringComparison.OrdinalIgnoreCase)) 53for (int i = 0; i < name.Length && bufferIndex < ICU_ULOC_FULLNAME_CAPACITY; i++) 56if (c == '-' && i < name.Length - 1 && name[i + 1] == '-') 78collationIndex += "collation=".Length; 84endOfCollation = name.Length; 162_bNeutral = TwoLetterISOCountryName.Length == 0; 622if (subject.Length == 0) return true; // Invariant Culture 623if (subject.Length == 1 || subject.Length > LocaleNameMaxLength) return false; 626for (int i = 0; i < subject.Length; ++i) 637if (i == 0 || i == subject.Length - 1) return false; 647if (indexOfExtensions < 0 && i < subject.Length - 2 && (subject[i + 1] is 'u' or 't') && subject[i + 2] == '-') // we have -u- or -t- which is an extension 649if (subject[i + 1] == 't' || i >= subject.Length - 6 || subject[i + 3] != 'c' || subject[i + 4] != 'o' || subject[i + 5] != '-') // not -u-co- collation extension
src\runtime\src\libraries\System.Private.CoreLib\src\System\Globalization\CultureData.Nls.cs (7)
214for (int i = 0; i < str.Length; i++) 223if (i + 1 < str.Length && str[i + 1] == '\'') 227result ??= new StringBuilder(str, 0, i, str.Length * 2); 249result ??= new StringBuilder(str, 0, i, str.Length * 2); 303values = new int[win32Str.Length / 2]; 308values = new int[(win32Str.Length / 2) + 2]; 314for (i = 0, j = 0; i < win32Str.Length && j < values.Length; i += 2, j++)
src\runtime\src\libraries\System.Private.CoreLib\src\System\Globalization\CultureInfo.cs (3)
314for (int i = 0; i < cultureName.Length; i++) 467if (_name.Length == 5 && _name[2] == '-') 488else if (_name.Length > 8 && _name.AsSpan(2, 4) is "-Han" && _name[7] == '-') // cultures like zh-Hant-* and zh-Hans-*
src\runtime\src\libraries\System.Private.CoreLib\src\System\Globalization\DateTimeFormat.cs (16)
533if (designator.Length >= 1) 933TryFormatS(dateTime, new Span<char>(ref str.GetRawStringData(), str.Length), out int charsWritten); 940TryFormatInvariantG(dateTime, offset, new Span<char>(ref str.GetRawStringData(), str.Length), out int charsWritten); 959TryFormatInvariantG(dateTime, offset, new Span<char>(ref str.GetRawStringData(), str.Length), out int charsWritten); 969else if (format.Length == 1) 985TryFormatR(dateTime, offset, new Span<char>(ref str.GetRawStringData(), str.Length), out charsWritten); 986Debug.Assert(charsWritten == str.Length); 992TryFormatS(dateTime, new Span<char>(ref str.GetRawStringData(), str.Length), out charsWritten); 993Debug.Assert(charsWritten == str.Length); 999TryFormatu(dateTime, offset, new Span<char>(ref str.GetRawStringData(), str.Length), out charsWritten); 1000Debug.Assert(charsWritten == str.Length); 1019TryFormatInvariantG(dateTime, offset, new Span<char>(ref str.GetRawStringData(), str.Length), out charsWritten); 1439Debug.Assert(dayAbbrev.Length == 3); 1442Debug.Assert(monthAbbrev.Length == 3); 1646Debug.Assert(dayAbbrev.Length == 3); 1649Debug.Assert(monthAbbrev.Length == 3);
src\runtime\src\libraries\System.Private.CoreLib\src\System\Globalization\DateTimeFormatInfo.cs (17)
476if (eraName.Length == 0) 490if (m_eraNames![i].Length > 0) 927for (int i = 0; !foundZ && i < longTimePattern.Length; i++) 2134if (twDtfi.GetEraName(i).Length > 0) 2193if (str.Length > 0) 2339if (((int)value.tokenType & (int)TokenMask) > 0 && value.tokenString.Length <= remaining) 2346int nextCharIndex = str.Index + value.tokenString.Length; 2360((value.tokenString.Length == 1 && str.Value[str.Index] == value.tokenString[0]) || 2361Culture.CompareInfo.Compare(str.Value.Slice(str.Index, value.tokenString.Length), value.tokenString, CompareOptions.IgnoreCase) == 0)) 2365str.Advance(value.tokenString.Length); 2437if (str.Length == 0) 2457if (str.Length >= value.tokenString.Length) 2461if (CompareStringIgnoreCaseOptimized(str, 0, value.tokenString.Length, value.tokenString, 0, value.tokenString.Length)) 2463if (str.Length > value.tokenString.Length)
src\runtime\src\libraries\System.Private.CoreLib\src\System\Globalization\DateTimeFormatInfoScanner.cs (15)
118while (currentIndex < pattern.Length) 125if (currentIndex < pattern.Length) 166if (str.Length == 0) 171if (str.Length == 1) 265while (index < pattern.Length) 284if (index < pattern.Length) 320while ((uint)++index < (uint)pattern.Length && pattern[index] == ch) 399while (i < pattern.Length) 414if ((uint)i < (uint)pattern.Length && pattern[i] == '\'') 591for (int j = 0; j < array[i].Length; j++) 614if (s.Length != 0 && char.IsAsciiDigit(s[0])) 617while ((uint)index < (uint)s.Length && char.IsAsciiDigit(s[index])) 622if (index == s.Length) 627if (index == s.Length - 1) 640if (index == s.Length - 4)
src\runtime\src\libraries\System.Private.CoreLib\src\System\Globalization\DateTimeParse.cs (45)
421if (target.Length > (str.Value.Length - str.Index)) 426if (str.CompareInfo.Compare(str.Value.Slice(str.Index, target.Length), target, CompareOptions.IgnoreCase) != 0) 431int nextCharIndex = str.Index + target.Length; 1274for (int i = 0; i < datePattern.Length && orderCount < 3; i++) 1297for (; i + 1 < datePattern.Length && datePattern[i + 1] == 'y'; i++) 1308for (; i + 1 < datePattern.Length && datePattern[i + 1] == 'M'; i++) 1319for (; i + 1 < datePattern.Length && datePattern[i + 1] == 'd'; i++) 1370for (int i = 0; i < pattern.Length && orderCount < 2; i++) 1393for (; i + 1 < pattern.Length && pattern[i + 1] == 'y'; i++) 1403for (; i + 1 < pattern.Length && pattern[i + 1] == 'M'; i++) 1436for (int i = 0; i < pattern.Length && orderCount < 2; i++) 1458for (; i + 1 < pattern.Length && pattern[i + 1] == 'd'; i++) 1477for (; i + 1 < pattern.Length && pattern[i + 1] == 'M'; i++) 1994if (dtfi.AMDesignator.Length == 0 && dtfi.PMDesignator.Length != 0) 1998if (dtfi.PMDesignator.Length == 0 && dtfi.AMDesignator.Length != 0) 3443int monthsInYear = (dtfi.GetAbbreviatedMonthName(13).Length == 0 ? 12 : 13); 3447int matchStrLen = searchStr.Length; 3542int monthsInYear = (dtfi.GetMonthName(13).Length == 0 ? 12 : 13); 3546int matchStrLen = searchStr.Length; 3639int matchStrLen = searchStr.Length; 3704int matchStrLen = searchStr.Length; 3736maxMatchStrLen = match.Length; 3761str.Index += (searchStr.Length - 1); 3768str.Index += (searchStr.Length - 1); 3790if (dtfi.AMDesignator.Length == 0) 3794if (dtfi.PMDesignator.Length == 0) 3804if (amDesignator.Length > 0) 3812str.Index += (pmDesignator.Length - 1); 3818str.Index += (amDesignator.Length - 1); 3825if (pmDesignator.Length > 0) 3830str.Index += (pmDesignator.Length - 1); 3861if (amDesignator.Length > 0 && str.GetChar() == amDesignator[0]) 3868if (pmDesignator.Length > 0 && str.GetChar() == pmDesignator[0]) 4429if (((dtfi.TimeSeparator.Length > 1 && dtfi.TimeSeparator[0] == ':') || !str.Match(':')) && 4440if (((dtfi.DateSeparator.Length > 1 && dtfi.DateSeparator[0] == '/') || !str.Match('/')) && 4548format.Index += (GMTName.Length - 1); 5685Index + target.Length <= Length && 5686m_info.Compare(Value.Slice(Index, target.Length), target, CompareOptions.IgnoreCase) == 0; 5691matchLength = target.Length; 5751if (targetPosition < target.Length) 5753int segmentLength = target.Length - targetPosition; 5792Index += (str.Length - 1); 5834int matchLength = word.Length;
src\runtime\src\libraries\System.Private.CoreLib\src\System\Globalization\IcuLocaleData.cs (3)
3807if (name.Length > LocaleLongestName) 3810Span<byte> lower_case = stackalloc byte[name.Length]; 3811for (int i = 0; i < name.Length; ++i)
src\runtime\src\libraries\System.Private.CoreLib\src\System\Globalization\IdnMapping.cs (23)
64return GetAscii(unicode, index, unicode.Length - index); 73if (index > unicode.Length) 75if (index > unicode.Length - count) 140return GetUnicode(ascii, index, ascii.Length - index); 149if (index > ascii.Length) 151if (index > ascii.Length - count) 217originalString.Length == input.Length && 252if (index == 0 && count == unicodeString.Length) 310if (result.Length <= destination.Length) 313charsWritten = result.Length; 512output.Remove(iOutputAfterLastDot, c_strAcePrefix.Length); 670if (index == 0 && count == ascii.Length && strUnicode.Equals(ascii, StringComparison.OrdinalIgnoreCase)) 692if (strUnicode.Length <= destination.Length) 695charsWritten = strUnicode.Length; 727if (ascii.Length == 0) 731if (ascii.Length > c_defaultNameLimit - (IsDot(ascii[^1]) ? 0 : 1)) 736StringBuilder output = new StringBuilder(ascii.Length); 743while (iNextDot < ascii.Length) 747if (iNextDot < 0 || iNextDot > ascii.Length) 748iNextDot = ascii.Length; 754if (iNextDot != ascii.Length) 774iAfterLastDot += c_strAcePrefix.Length; 939if (iNextDot != ascii.Length)
src\runtime\src\libraries\System.Private.CoreLib\src\System\Globalization\InvariantModeCasing.cs (12)
21if (s.Length == 0) 29while (i < s.Length) 31if (char.IsHighSurrogate(source[i]) && i < s.Length - 1 && char.IsLowSurrogate(source[i + 1])) 51if (i >= s.Length) 56string result = string.FastAllocateString(s.Length); 57var destination = new Span<char>(ref result.GetRawStringData(), result.Length); 67if (s.Length == 0) 75while (i < s.Length) 77if (char.IsHighSurrogate(source[i]) && i < s.Length - 1 && char.IsLowSurrogate(source[i + 1])) 97if (i >= s.Length) 102string result = string.FastAllocateString(s.Length); 103var destination = new Span<char>(ref result.GetRawStringData(), result.Length);
src\runtime\src\libraries\System.Private.CoreLib\src\System\Globalization\JapaneseCalendar.Icu.cs (1)
114if (abbrevEnglishEraNames[^1] is { Length: 0 } or [> '\u007F', ..])
src\runtime\src\libraries\System.Private.CoreLib\src\System\Globalization\JapaneseCalendar.Nls.cs (1)
171if (value.Length != 10) return null;
src\runtime\src\libraries\System.Private.CoreLib\src\System\Globalization\Normalization.Icu.cs (3)
60Span<char> buffer = strInput.Length <= StackallocThreshold 62: (toReturn = ArrayPool<char>.Shared.Rent(strInput.Length)); 78realLen = Interop.Globalization.NormalizeString(normalizationForm, pInput, strInput.Length, pDest, buffer.Length);
src\runtime\src\libraries\System.Private.CoreLib\src\System\Globalization\Normalization.Nls.cs (4)
42if (strInput.Length == 0) 52Span<char> buffer = strInput.Length <= StackallocThreshold 54: (toReturn = ArrayPool<char>.Shared.Rent(strInput.Length)); 65realLength = Interop.Normaliz.NormalizeString(normalizationForm, pInput, strInput.Length, pDest, buffer.Length);
src\runtime\src\libraries\System.Private.CoreLib\src\System\Globalization\NumberFormatInfo.cs (3)
137if (nativeDig[i].Length != 1) 139if (nativeDig[i].Length != 2) 186_allowHyphenDuringParsing = _negativeSign.Length == 1 &&
src\runtime\src\libraries\System.Private.CoreLib\src\System\Globalization\Ordinal.cs (3)
315if ((uint)startIndex > (uint)source.Length) 609if (value.Length == 0) 639if ((uint)startIndex > (uint)source.Length)
src\runtime\src\libraries\System.Private.CoreLib\src\System\Globalization\RegionInfo.cs (1)
31if (name.Length == 0)
src\runtime\src\libraries\System.Private.CoreLib\src\System\Globalization\StringInfo.cs (4)
46if (_indexes == null && String.Length > 0) 161if ((uint)index > (uint)str.Length) 188if ((uint)index > (uint)str.Length) 220builder.Append(str.Length - remaining.Length); // a new extended grapheme cluster begins at this offset
src\runtime\src\libraries\System.Private.CoreLib\src\System\Globalization\TextElementEnumerator.cs (6)
22Debug.Assert(startIndex >= 0 && startIndex <= str.Length, "TextElementEnumerator(): startIndex >= 0 && startIndex <= str.Length"); 38if (newOffset >= _str.Length) 57if (_currentTextElementOffset >= _str.Length) 73if (_currentTextElementOffset >= _str.Length) 87_currentTextElementOffset = _str.Length; 88_currentTextElementLength = _strStartIndex - _str.Length;
src\runtime\src\libraries\System.Private.CoreLib\src\System\Globalization\TextInfo.cs (20)
27private bool HasEmptyCultureName { get { return _cultureName.Length == 0; } } 307if (source.Length == 0) 325if (source.Length >= 2) 327nuint lastIndexWhereCanReadTwoChars = (uint)source.Length - 2; 347if ((source.Length & 1) != 0) 369string result = string.FastAllocateString(source.Length); // changing case uses simple folding: doesn't change UTF-16 code unit count 372Span<char> resultSpan = new Span<char>(ref result.GetRawStringData(), result.Length); 391string result = string.FastAllocateString(source.Length); // changing case uses simple folding: doesn't change UTF-16 code unit count 396Span<char> resultSpan = new Span<char>(ref result.GetRawStringData(), result.Length); 406instance.ChangeCaseCore(pSource + currIdx, source.Length - (int)currIdx, pResult + currIdx, result.Length - (int)currIdx, toUpper); 415if (s.Length == 0) 428string result = string.FastAllocateString(s.Length); 431s.AsSpan(0, i).CopyTo(new Span<char>(pResult, result.Length)); 436while (i < s.Length) 621if (str.Length == 0) 631for (int i = 0; i < str.Length; i++) 638if (isDutchCulture && i < str.Length - 1 && (str[i] == 'i' || str[i] == 'I') && (str[i + 1] == 'j' || str[i + 1] == 'J')) 658while (i < str.Length) 712if (i < str.Length)
src\runtime\src\libraries\System.Private.CoreLib\src\System\Globalization\TimeSpanFormat.cs (2)
26if (format.Length == 1) 94int maxLength = checked(25 + decimalSeparator.Length); // large enough for any "g"/"G" TimeSpan
src\runtime\src\libraries\System.Private.CoreLib\src\System\Guid.cs (3)
1218if (format.Length != 1) 1250bool result = TryFormatCore(new Span<char>(ref guidString.GetRawStringData(), guidString.Length), out int bytesWritten, format); 1251Debug.Assert(result && bytesWritten == guidString.Length, "Formatting guid should have succeeded.");
src\runtime\src\libraries\System.Private.CoreLib\src\System\IO\BinaryWriter.cs (3)
359if (GetType() == typeof(BinaryWriter) && value.Length <= 127 / 3) 368else if (value.Length <= MaxArrayPoolRentalSize / 3) 370byte[] rented = ArrayPool<byte>.Shared.Rent(value.Length * 3); // max expansion: each char -> 3 bytes
src\runtime\src\libraries\System.Private.CoreLib\src\System\IO\Directory.cs (1)
86if (path.Length == 0)
src\runtime\src\libraries\System.Private.CoreLib\src\System\IO\Enumeration\FileSystemName.cs (1)
23int length = expression.Length;
src\runtime\src\libraries\System.Private.CoreLib\src\System\IO\File.cs (2)
97if (path.Length == 0) 106if (path.Length > 0 && PathInternal.IsDirectorySeparator(path[^1]))
src\runtime\src\libraries\System.Private.CoreLib\src\System\IO\FileSystem.Unix.cs (5)
250if (directoryName.Length > 0 && !Directory.Exists(directoryName)) 285Debug.Assert(fullPath.Length > 0); 288if (fullPath.Length == 1) 322stackDir.Append(fullPath.Length); 324int i = fullPath.Length - 1;
src\runtime\src\libraries\System.Private.CoreLib\src\System\IO\FileSystemInfo.cs (1)
51int length = FullPath.Length;
src\runtime\src\libraries\System.Private.CoreLib\src\System\IO\Path.cs (22)
47int subLength = path.Length; 51for (int i = path.Length - 1; i >= 0; i--) 227if (path.Length == result.Length) 257if (path.Length == result.Length) 394if (paths[i].Length == 0) 402maxSize = paths[i].Length; 406maxSize += paths[i].Length; 419if (paths[i].Length == 0) 550maxSize += path?.Length ?? 0; 653if (first.Length == 0) 656if (second.Length == 0) 667if (first.Length == 0) 669if (second.Length == 0) 671if (third.Length == 0) 684if (first.Length == 0) 686if (second.Length == 0) 688if (third.Length == 0) 690if (fourth.Length == 0) 885int relativeToLength = relativeTo.Length; 890int pathLength = path.Length; 908sb.EnsureCapacity(Math.Max(relativeTo.Length, path.Length));
src\runtime\src\libraries\System.Private.CoreLib\src\System\IO\Path.Unix.cs (4)
68Debug.Assert(collapsedString.Length < path.Length || collapsedString.ToString() == path, 71string result = collapsedString.Length == 0 ? PathInternal.DirectorySeparatorCharAsString : collapsedString; 91PathInternal.IsDirectorySeparator(path[path.Length - 1]) ? path :
src\runtime\src\libraries\System.Private.CoreLib\src\System\IO\ReadLinesIterator.cs (1)
37Debug.Assert(path.Length > 0);
src\runtime\src\libraries\System.Private.CoreLib\src\System\IO\SharedMemoryManager.Unix.cs (2)
31name = name.Substring("Global\\".Length); 38name = name.Substring("Local\\".Length);
src\runtime\src\libraries\System.Private.CoreLib\src\System\IO\StreamWriter.cs (1)
532int estimatedLength = checked((format?.Length ?? 0) + args.Length * 8);
src\runtime\src\libraries\System.Private.CoreLib\src\System\IO\StringReader.cs (8)
52if ((uint)pos < (uint)s.Length) 72if ((uint)pos < (uint)s.Length) 101int n = _s.Length - _pos; 130int n = s.Length - _pos; 156_pos = s.Length; 181if ((uint)pos >= (uint)s.Length) 196if ((uint)pos < (uint)s.Length && s[pos] == '\n') 208_pos = s.Length;
src\runtime\src\libraries\System.Private.CoreLib\src\System\Memory.cs (1)
288lengthOfUnderlyingSpan = Unsafe.As<string>(tmpObject).Length;
src\runtime\src\libraries\System.Private.CoreLib\src\System\MemoryExtensions.cs (18)
102return new ReadOnlySpan<char>(ref text.GetRawStringData(), text.Length); 123if ((uint)start > (uint)text.Length) 126return new ReadOnlySpan<char>(ref Unsafe.Add(ref text.GetRawStringData(), (nint)(uint)start /* force zero-extension */), text.Length - start); 146int actualIndex = startIndex.GetOffset(text.Length); 147if ((uint)actualIndex > (uint)text.Length) 152return new ReadOnlySpan<char>(ref Unsafe.Add(ref text.GetRawStringData(), (nint)(uint)actualIndex /* force zero-extension */), text.Length - actualIndex); 177(int start, int length) = range.GetOffsetAndLength(text.Length); 203if ((ulong)(uint)start + (ulong)(uint)length > (ulong)(uint)text.Length) 221return new ReadOnlyMemory<char>(text, 0, text.Length); 240if ((uint)start > (uint)text.Length) 243return new ReadOnlyMemory<char>(text, start, text.Length - start); 259int actualIndex = startIndex.GetOffset(text.Length); 260if ((uint)actualIndex > (uint)text.Length) 263return new ReadOnlyMemory<char>(text, actualIndex, text.Length - actualIndex); 285if ((ulong)(uint)start + (ulong)(uint)length > (ulong)(uint)text.Length) 311(int start, int length) = range.GetOffsetAndLength(text.Length); 6119_pos += value.Length; 6367_pos += value.Length;
src\runtime\src\libraries\System.Private.CoreLib\src\System\Net\WebUtility.cs (3)
314for (int i = value.AsSpan().IndexOfAnyExcept(s_safeUrlChars); (uint)i < (uint)value.Length; i++) 346int byteIndex = (byteCount - (value.Length - unsafeCount)) * 2; 454int count = value.Length;
src\runtime\src\libraries\System.Private.CoreLib\src\System\Number.Formatting.cs (15)
599Debug.Assert(significand.Length < TDecimal.BufferLength); 601for (int i = 0; i < significand.Length; i++) 606number.Scale = significand.Length + unpackDecimal.UnbiasedExponent; 607number.DigitsCount = significand.Length; 608number.Digits[significand.Length] = (byte)'\0'; 1105charsWritten = source.Length; 1870int bufferLength = Math.Max(digits, FormattingHelpers.CountDigits((uint)(-value))) + sNegative.Length; 1875Debug.Assert(p == buffer + sNegative.Length); 1877for (int i = sNegative.Length - 1; i >= 0; i--) 2303int bufferLength = Math.Max(digits, FormattingHelpers.CountDigits((ulong)(-value))) + sNegative.Length; 2308Debug.Assert(p == buffer + sNegative.Length); 2310for (int i = sNegative.Length - 1; i >= 0; i--) 2731int bufferLength = Math.Max(digits, FormattingHelpers.CountDigits(absValue)) + sNegative.Length; 2736Debug.Assert(p == buffer + sNegative.Length); 2738for (int i = sNegative.Length - 1; i >= 0; i--)
src\runtime\src\libraries\System.Private.CoreLib\src\System\Numerics\INumberBase.cs (1)
438charsConsumed = s.Length;
src\runtime\src\libraries\System.Private.CoreLib\src\System\Numerics\Vector2.cs (1)
1140var handler = new DefaultInterpolatedStringHandler(literalLength: 3 + (separator.Length * 1), formattedCount: 2, formatProvider, stackalloc char[512]);
src\runtime\src\libraries\System.Private.CoreLib\src\System\Numerics\Vector3.cs (1)
1150var handler = new DefaultInterpolatedStringHandler(literalLength: 4 + (separator.Length * 2), formattedCount: 3, formatProvider, stackalloc char[512]);
src\runtime\src\libraries\System.Private.CoreLib\src\System\Numerics\Vector4.cs (1)
1220var handler = new DefaultInterpolatedStringHandler(literalLength: 5 + (separator.Length * 3), formattedCount: 4, formatProvider, stackalloc char[512]);
src\runtime\src\libraries\System.Private.CoreLib\src\System\PasteArguments.cs (5)
23if (argument.Length != 0 && ContainsNoWhitespaceOrQuotes(argument)) 32while (idx < argument.Length) 38while (idx < argument.Length && argument[idx] == Backslash) 44if (idx == argument.Length) 83for (int i = 0; i < s.Length; i++)
src\runtime\src\libraries\System.Private.CoreLib\src\System\Random.cs (1)
688GetItems(choices, new Span<char>(ref destination.GetRawStringData(), destination.Length));
src\runtime\src\libraries\System.Private.CoreLib\src\System\ReadOnlyMemory.cs (1)
210lengthOfUnderlyingSpan = Unsafe.As<string>(tmpObject).Length;
src\runtime\src\libraries\System.Private.CoreLib\src\System\Reflection\AssemblyName.cs (1)
315vsb.EnsureCapacity(codebase.Length);
src\runtime\src\libraries\System.Private.CoreLib\src\System\Reflection\Emit\SymbolType.cs (2)
60if (format == null || curIndex == format.Length) 74if (curIndex != format.Length)
src\runtime\src\libraries\System.Private.CoreLib\src\System\Reflection\Module.cs (1)
189ReadOnlySpan<char> slice = str.AsSpan(0, str.Length - 1);
src\runtime\src\libraries\System.Private.CoreLib\src\System\Resources\FastResourceComparer.cs (7)
39for (int i = 0; i < key.Length; i++) 82int numChars = a.Length; 86return (a.Length == 0) ? 0 : -1; 99return a.Length - bCharLength; 119if (numChars > b.Length) 120numChars = b.Length; 128return byteLen - b.Length * 2;
src\runtime\src\libraries\System.Private.CoreLib\src\System\Resources\ManifestBasedResourceGroveler.cs (1)
429if (missingCultureName.Length == 0)
src\runtime\src\libraries\System.Private.CoreLib\src\System\Resources\ResourceManager.cs (2)
560int typeNameLength = (firstComma != -1) ? firstComma : asmTypeName.Length; 572int simpleAsmNameLength = ((secondComma != -1) ? secondComma : asmTypeName.Length) - (firstComma + 1);
src\runtime\src\libraries\System.Private.CoreLib\src\System\Runtime\CompilerServices\DefaultInterpolatedStringHandler.cs (6)
150_pos += value.Length; 468_pos += value.Length; 491EnsureCapacityForAdditionalChars(value.Length); 493_pos += value.Length; 606Grow(value.Length); 608_pos += value.Length;
src\runtime\src\libraries\System.Private.CoreLib\src\System\Runtime\InteropServices\Marshal.cs (14)
1027long lnb = (s.Length + 1) * (long)SystemMaxDBCSCharSize; 1049int nb = (s.Length + 1) * 2; 1052if (nb < s.Length) 1059s.CopyTo(new Span<char>((char*)ptr, s.Length)); 1060((char*)ptr)[s.Length] = '\0'; 1072int nb = Encoding.UTF8.GetMaxByteCount(s.Length); 1090int nb = (s.Length + 1) * 2; 1093if (nb < s.Length) 1100s.CopyTo(new Span<char>((char*)ptr, s.Length)); 1101((char*)ptr)[s.Length] = '\0'; 1113int nb = Encoding.UTF8.GetMaxByteCount(s.Length); 1131long lnb = (s.Length + 1) * (long)SystemMaxDBCSCharSize; 1329IntPtr bstr = AllocBSTR(s.Length); 1331s.CopyTo(new Span<char>((char*)bstr, s.Length)); // AllocBSTR already included the null terminator
src\runtime\src\libraries\System.Private.CoreLib\src\System\Runtime\InteropServices\Marshal.Unix.cs (1)
38Debug.Assert(bufferLength >= (s.Length + 1) * SystemMaxDBCSCharSize, "Insufficient buffer length passed to StringToAnsiString");
src\runtime\src\libraries\System.Private.CoreLib\src\System\Runtime\InteropServices\Marshalling\AnsiStringMarshaller.cs (1)
80if ((long)Marshal.SystemMaxDBCSCharSize * managed.Length >= buffer.Length)
src\runtime\src\libraries\System.Private.CoreLib\src\System\Runtime\InteropServices\Marshalling\BStrStringMarshaller.cs (3)
76int lengthInBytes = checked(sizeof(char) * managed.Length); 100managed.CopyTo(new Span<char>(ptrToFirstChar, managed.Length)); 101ptrToFirstChar[managed.Length] = '\0'; // null-terminate
src\runtime\src\libraries\System.Private.CoreLib\src\System\Runtime\InteropServices\Marshalling\Utf8StringMarshaller.cs (1)
84if ((long)MaxUtf8BytesPerChar * managed.Length >= buffer.Length)
src\runtime\src\libraries\System.Private.CoreLib\src\System\Runtime\InteropServices\MemoryMarshal.cs (1)
435return (IEnumerable<T>)(object)(index == 0 && length == str.Length ?
src\runtime\src\libraries\System.Private.CoreLib\src\System\Runtime\Loader\AssemblyLoadContext.cs (3)
886Debug.Assert(assemblyName.CultureName?.Length > 0); 893string parentAssemblyName = assemblyName.Name.Substring(0, assemblyName.Name.Length - SatelliteSuffix.Length);
src\runtime\src\libraries\System.Private.CoreLib\src\System\Runtime\Loader\LibraryNameVariation.Unix.cs (2)
32indexOfSuffix += LibraryNameSuffix.Length; 33containsSuffix = indexOfSuffix == libName.Length || libName[indexOfSuffix] == '.';
src\runtime\src\libraries\System.Private.CoreLib\src\System\Runtime\Versioning\FrameworkName.cs (1)
129if (_identifier.Length == 0)
src\runtime\src\libraries\System.Private.CoreLib\src\System\SearchValues\Strings\Helpers\AhoCorasickBuilder.cs (5)
31Debug.Assert(values[i - 1].Length <= values[i].Length); 75for (int i = 0; i < value.Length; i++) 100if (i == value.Length - 1) 102node.MatchLength = value.Length;
src\runtime\src\libraries\System.Private.CoreLib\src\System\SearchValues\Strings\Helpers\CharacterFrequencyHelper.cs (4)
34Debug.Assert(value.Length > 1); 46ch2Offset = value.Length - 1; 49if (value.Length > 2) 64ch3Offset = value.Length - 1;
src\runtime\src\libraries\System.Private.CoreLib\src\System\SearchValues\Strings\Helpers\RabinKarp.cs (2)
47minimumLength = Math.Min(minimumLength, value.Length); 67if (value.Length > MaxInputLength)
src\runtime\src\libraries\System.Private.CoreLib\src\System\SearchValues\Strings\Helpers\StringSearchValuesHelper.cs (18)
61if (lengthRemaining < candidate.Length) 78(uint)candidate.Length * sizeof(char)); 84return Ascii.EqualsIgnoreCase(ref matchStart, ref candidate.GetRawStringData(), (uint)candidate.Length); 88return Ordinal.EqualsIgnoreCase(ref matchStart, ref candidate.GetRawStringData(), candidate.Length); 121Debug.Assert(value.Length >= 2); 144if (value.Length <= 16) 146if (value.Length > 8) 148SecondReadByteOffset = (value.Length - 8) * sizeof(char); 153else if (value.Length >= 4) 155SecondReadByteOffset = (value.Length - 4) * sizeof(char); 163Debug.Assert(value.Length is 2 or 3); 165SecondReadByteOffset = (value.Length - 2) * sizeof(char); 186Debug.Assert(Value.Length is >= 9 and <= 16); 208Debug.Assert(Value.Length is >= 9 and <= 16); 273Debug.Assert(state.Value.Length is 2 or 3); 341Debug.Assert(state.Value.Length is 2 or 3); 433Debug.Assert(state.Value.Length is 2 or 3); 462return Ordinal.EqualsIgnoreCase_Scalar(ref matchStart, ref state.Value.GetRawStringData(), state.Value.Length);
src\runtime\src\libraries\System.Private.CoreLib\src\System\SearchValues\Strings\SingleStringSearchValuesPackedThreeChars.cs (4)
55Debug.Assert(value.Length > 1); 60_minusValueTailLength = -(value.Length - 1); 339ValidateReadPosition(ref searchSpaceStart, searchSpaceLength, ref matchRef, _valueState.Value.Length); 366ValidateReadPosition(ref searchSpaceStart, searchSpaceLength, ref matchRef, _valueState.Value.Length);
src\runtime\src\libraries\System.Private.CoreLib\src\System\SearchValues\Strings\SingleStringSearchValuesThreeChars.cs (4)
49Debug.Assert(value.Length > 1); 53_minusValueTailLength = -(value.Length - 1); 337ValidateReadPosition(ref searchSpaceStart, searchSpaceLength, ref matchRef, _valueState.Value.Length); 365ValidateReadPosition(ref searchSpaceStart, searchSpaceLength, ref matchRef, _valueState.Value.Length);
src\runtime\src\libraries\System.Private.CoreLib\src\System\SearchValues\Strings\StringSearchValues.cs (6)
65normalizedValues.Sort(static (a, b) => a.Length.CompareTo(b.Length)); 376if (Vector128.IsHardwareAccelerated && value.Length > 1 && value.Length <= maxLength) 378SearchValues<string>? searchValues = value.Length switch 470minLength = Math.Min(minLength, value.Length);
src\runtime\src\libraries\System.Private.CoreLib\src\System\Security\SecurityElement.cs (2)
353newIndex = index + strEscValue.Length; 369int strLen = str.Length;
src\runtime\src\libraries\System.Private.CoreLib\src\System\SR.cs (1)
24if (key.Length == 0)
src\runtime\src\libraries\System.Private.CoreLib\src\System\String.Comparison.cs (69)
28Debug.Assert(strA.Length == strB.Length); 33((uint)strA.Length) * sizeof(char)); 43Debug.Assert(indexA + countA <= strA.Length && indexB + countB <= strB.Length); 52Debug.Assert(strA.Length == strB.Length); 54return Ordinal.EqualsIgnoreCase(ref strA.GetRawStringData(), ref strB.GetRawStringData(), strB.Length); 79if (Math.Min(strA.Length, strB.Length) <= 2) goto NotLongerThan2; 87ref Unsafe.Add(ref strA._firstChar, 2), strA.Length - 2, 88ref Unsafe.Add(ref strB._firstChar, 2), strB.Length - 2); 93return strA.Length - strB.Length; 158return Ordinal.CompareStringIgnoreCase(ref strA.GetRawStringData(), strA.Length, ref strB.GetRawStringData(), strB.Length); 223lengthA = Math.Min(lengthA, strA.Length - indexA); 228lengthB = Math.Min(lengthB, strB.Length - indexB); 258lengthA = Math.Min(lengthA, strA.Length - indexA); 263lengthB = Math.Min(lengthB, strB.Length - indexB); 292if (strA.Length - indexA < 0 || strB.Length - indexB < 0) 294string paramName = strA.Length - indexA < 0 ? nameof(indexA) : nameof(indexB); 303int lengthA = Math.Min(length, strA.Length - indexA); 304int lengthB = Math.Min(length, strB.Length - indexB); 377int lengthA = Math.Min(length, strA.Length - indexA); 378int lengthB = Math.Min(length, strB.Length - indexB); 441if (value.Length == 0) 458int offset = this.Length - value.Length; 459return (uint)offset <= (uint)this.Length && this.AsSpan(offset).SequenceEqual(value); 462return Length >= value.Length && 463Ordinal.EqualsIgnoreCase(ref Unsafe.Add(ref GetRawStringData(), Length - value.Length), 465value.Length); 497nuint localLength = (uint)Length; 501int lastPos = Length - 1; 502return ((uint)lastPos < (uint)Length) && this[lastPos] == value; 533return Length > 1 && this[^2] == highSurrogate && this[^1] == lowSurrogate; 559if (this.Length != str.Length) 579if (this.Length != value.Length) 611if (this.Length != value.Length) 616if (this.Length != value.Length) 635if (a is null || b is null || a.Length != b.Length) 669if (a.Length != b.Length) 674if (a.Length != b.Length) 772Debug.Assert(src[Length] == '\0', "src[Length] == '\\0'"); 779int length = Length; 866int length = Length; 869Debug.Assert(src[Length] == '\0', "src[this.Length] == '\\0'"); 904return GetNonRandomizedHashCodeOrdinalIgnoreCaseSlow(hash1, hash2, this.AsSpan(Length - length)); 1055if (value.Length == 0) 1072if (this.Length < value.Length || _firstChar != value._firstChar) 1076return (value.Length == 1) ? 1081((nuint)value.Length) * 2); 1084if (this.Length < value.Length) 1088return Ordinal.EqualsIgnoreCase(ref this.GetRawStringData(), ref value.GetRawStringData(), value.Length); 1120return Length != 0 && _firstChar == value; 1151return Length > 1 && _firstChar == highSurrogate && this[1] == lowSurrogate;
src\runtime\src\libraries\System.Private.CoreLib\src\System\String.cs (20)
85elementCount: (uint)result.Length, // derefing Length now allows JIT to prove 'result' not null below 112elementCount: (uint)result.Length, // derefing Length now allows JIT to prove 'result' not null below 138elementCount: (uint)result.Length, // derefing Length now allows JIT to prove 'result' not null below 172elementCount: (uint)result.Length, // derefing Length now allows JIT to prove 'result' not null below 370value != null ? new ReadOnlySpan<char>(ref value.GetRawStringData(), value.Length) : default; 377if ((ulong)(uint)startIndex + (ulong)(uint)count > (ulong)(uint)Length) 405string result = FastAllocateString(str.Length); 408elementCount: (uint)result.Length, // derefing Length now allows JIT to prove 'result' not null below 426ArgumentOutOfRangeException.ThrowIfGreaterThan(count, Length - sourceIndex, nameof(sourceIndex)); 442if ((uint)Length <= (uint)destination.Length) 444Buffer.Memmove(ref destination._reference, ref _firstChar, (uint)Length); 459if ((uint)Length <= (uint)destination.Length) 461Buffer.Memmove(ref destination._reference, ref _firstChar, (uint)Length); 470if (Length == 0) 473char[] chars = new char[Length]; 478elementCount: (uint)Length); 488ArgumentOutOfRangeException.ThrowIfGreaterThan((uint)startIndex, (uint)Length, nameof(startIndex)); 489ArgumentOutOfRangeException.ThrowIfGreaterThan(startIndex, Length - length); 509return value == null || value.Length == 0; 516for (int i = 0; i < value.Length; i++)
src\runtime\src\libraries\System.Private.CoreLib\src\System\String.Manipulation.cs (97)
71Debug.Assert(src.Length <= dest.Length - destPos); 76elementCount: (uint)src.Length); 128totalLength += toString.Length; 150Debug.Assert(position <= totalLength - s.Length, "We didn't allocate enough space for the result string!"); 153position += s.Length; 218int str0Length = str0.Length; 220int totalLength = str0Length + str1.Length; 254long totalLength = (long)str0.Length + (long)str1.Length + (long)str2.Length; 263CopyStringContent(result, str0.Length, str1); 264CopyStringContent(result, str0.Length + str1.Length, str2); 292long totalLength = (long)str0.Length + (long)str1.Length + (long)str2.Length + (long)str3.Length; 301CopyStringContent(result, str0.Length, str1); 302CopyStringContent(result, str0.Length + str1.Length, str2); 303CopyStringContent(result, str0.Length + str1.Length + str2.Length, str3); 317Span<char> resultSpan = new Span<char>(ref result._firstChar, result.Length); 334Span<char> resultSpan = new Span<char>(ref result._firstChar, result.Length); 356Span<char> resultSpan = new Span<char>(ref result._firstChar, result.Length); 381Span<char> resultSpan = new Span<char>(ref result._firstChar, result.Length); 434totalLengthLong += value.Length; 457int valueLen = value.Length; 559sb.EnsureCapacity(format.Length + args.Length * 8); 6580 => format._literalLength == format.Format.Length ? format.Format : Format(provider, format, (object?)null, 0, 0, args), 670if (format._formattedCount == 0 && format._literalLength == format.Format.Length) 717ArgumentOutOfRangeException.ThrowIfGreaterThan((uint)startIndex, (uint)Length, nameof(startIndex)); 719int oldLength = Length; 720int insertLength = value.Length; 1075totalLength += value.Length; 1102int valueLen = value.Length; 1149int oldLength = Length; 1167int oldLength = Length; 1184int oldLength = this.Length; 1204if ((uint)startIndex > Length) 1300nuint remainingLength = (uint)(Length - firstIndex); 1301string result = FastAllocateString(Length); 1318nuint length = (uint)Length; 1356if (oldValue.Length == 1) 1362if (newValue.Length == 1) 1376int pos = PackedSpanHelpers.IndexOf(ref Unsafe.Add(ref _firstChar, i), c, Length - i); 1389int pos = SpanHelpers.NonPackedIndexOfChar(ref Unsafe.Add(ref _firstChar, i), c, Length - i); 1405int pos = SpanHelpers.IndexOf(ref Unsafe.Add(ref _firstChar, i), Length - i, ref oldValue._firstChar, oldValue.Length); 1411i += pos + oldValue.Length; 1423string dst = ReplaceHelper(oldValue.Length, newValue, replacementIndices.AsSpan()); 1434long dstLength = this.Length + ((long)(newValue.Length - oldValueLength)) * indices.Length; 1439Span<char> dstSpan = new Span<char>(ref dst._firstChar, dst.Length); 1459dstIdx += newValue.Length; 1463Debug.Assert(this.Length - thisIdx == dstSpan.Length - dstIdx); 1635else if (replacementText.Length != 1 || replacementText[0] != text[idx]) 1650if ((uint)idxOfFirstNewlineChar >= (uint)Length) 1656(uint)(idxOfFirstNewlineChar + 1) < (uint)Length && 1718if (count <= 1 || Length == 0) 1784if (count <= 1 || Length == 0) 1791if (separators.IsEmpty && count > Length) 1854if (count <= 1 || Length == 0) 1863if (separator!.Length == 0) 1910if ((options & StringSplitOptions.RemoveEmptyEntries) == 0 || candidate.Length != 0) 1958for (int i = 0; i < numActualReplaces && currIndex < Length; i++) 1965if (currIndex < Length && numActualReplaces >= 0) 2463int currentSepLength = separator.Length; 2498int length = Length - startIndex; 2504if ((uint)startIndex > (uint)Length) 2506ThrowSubstringArgumentOutOfRange(startIndex, length, Length); 2516if ((ulong)(uint)startIndex + (ulong)(uint)length > (ulong)(uint)Length) 2521ThrowSubstringArgumentOutOfRange(startIndex, length, Length); 2529if (length == Length) 2555Debug.Assert(startIndex >= 0 && startIndex <= this.Length, "StartIndex is out of range!"); 2556Debug.Assert(length >= 0 && startIndex <= this.Length - length, "length is out of range!"); 2611if (Length == 0) 2628if (Length == 0) 2638Debug.Assert(Length > 0); 2655string result = FastAllocateString(Length); 2656Span<char> resultSpan = new Span<char>(ref result.GetRawStringData(), Length); 2679if (Length == 0 || (!char.IsWhiteSpace(_firstChar) && !char.IsWhiteSpace(this[^1]))) 2689if (Length == 0 || (_firstChar != trimChar && this[^1] != trimChar)) 2715while ((uint)(index + 1) < (uint)Length && this[index] == highSurrogate && this[index + 1] == lowSurrogate) 2721int endIndex = Length - 2; 2789while ((uint)(index + 1) < (uint)Length && this[index] == highSurrogate && this[index + 1] == lowSurrogate) 2855int endIndex = Length - 2; 2856while ((uint)endIndex < (uint)Length && this[endIndex] == highSurrogate && this[endIndex + 1] == lowSurrogate) 2903int end = Length - 1; 2909for (start = 0; start < Length; start++) 2920for (end = Length - 1; end >= start; end--) 2939int end = Length - 1; 2945for (start = 0; start < Length; start++) 2966for (end = Length - 1; end >= start; end--) 2992len == Length ? this :
src\runtime\src\libraries\System.Private.CoreLib\src\System\String.Searching.cs (36)
18if (RuntimeHelpers.IsKnownConstant(value) && value.Length == 1) 26Length, 28value.Length) >= 0; 39=> SpanHelpers.ContainsValueType(ref Unsafe.As<char, short>(ref _firstChar), (short)value, Length); 76public int IndexOf(char value) => SpanHelpers.IndexOfChar(ref _firstChar, value, Length); 80return IndexOf(value, startIndex, Length - startIndex); 102return IndexOf(value, startIndex, Length - startIndex, comparisonType); 133ArgumentOutOfRangeException.ThrowIfGreaterThan(startIndex, Length); 135ArgumentOutOfRangeException.ThrowIfGreaterThan(count, Length - startIndex); 166if ((uint)startIndex > (uint)Length) 171if ((uint)count > (uint)(Length - startIndex)) 191return new ReadOnlySpan<char>(ref _firstChar, Length).IndexOfAny(anyOf); 196return IndexOfAny(anyOf, startIndex, Length - startIndex); 206if ((uint)startIndex > (uint)Length) 211if ((uint)count > (uint)(Length - startIndex)) 323return IndexOf(value, 0, Length, comparisonType); 328return IndexOf(value, startIndex, Length - startIndex, comparisonType); 417return IndexOf(value, startIndex, Length - startIndex, comparisonType); 436ArgumentOutOfRangeException.ThrowIfGreaterThan(startIndex, Length); 438ArgumentOutOfRangeException.ThrowIfGreaterThan(count, Length - startIndex); 452=> SpanHelpers.LastIndexOfValueType(ref Unsafe.As<char, short>(ref _firstChar), (short)value, Length); 461if (Length == 0) 466if ((uint)startIndex >= (uint)Length) 494return LastIndexOf(value, Length - 1, comparisonType); 529if (Length == 0) 549ArgumentOutOfRangeException.ThrowIfGreaterThanOrEqual(startIndex, Length); 595return new ReadOnlySpan<char>(ref _firstChar, Length).LastIndexOfAny(anyOf); 610if (Length == 0) 615if ((uint)startIndex >= (uint)Length) 638return LastIndexOf(value, Length - 1, Length, StringComparison.CurrentCulture); 653return LastIndexOf(value, Length - 1, Length, comparisonType); 730return LastIndexOf(value, Length - 1, comparisonType); 765if (Length == 0) 773ArgumentOutOfRangeException.ThrowIfGreaterThanOrEqual(startIndex, Length);
src\runtime\src\libraries\System.Private.CoreLib\src\System\StringComparer.cs (10)
341return Globalization.Ordinal.CompareStringIgnoreCase(ref x.GetRawStringData(), x.Length, ref y.GetRawStringData(), y.Length); 356if (x.Length != y.Length) 360return Globalization.Ordinal.EqualsIgnoreCase(ref x.GetRawStringData(), ref y.GetRawStringData(), x.Length); 504return Globalization.Ordinal.CompareStringIgnoreCase(ref x.GetRawStringData(), x.Length, ref y.GetRawStringData(), y.Length); 519if (x.Length != y.Length) 524return Globalization.Ordinal.EqualsIgnoreCase(ref x.GetRawStringData(), ref y.GetRawStringData(), x.Length);
src\runtime\src\libraries\System.Private.CoreLib\src\System\Text\ASCIIEncoding.cs (2)
117return GetByteCountCommon(pChars, chars.Length); 226if (chars.Length - charIndex < charCount)
src\runtime\src\libraries\System.Private.CoreLib\src\System\Text\CompositeFormat.cs (1)
50literalLength += literal.Length; // no concern about overflow as these were parsed out of a single string
src\runtime\src\libraries\System.Private.CoreLib\src\System\Text\DecoderReplacementFallback.cs (5)
70public override int MaxCharCount => _strDefault.Length; 103if (_strDefault.Length == 0) 106_fallbackCount = _strDefault.Length; 132Debug.Assert(_fallbackIndex < _strDefault.Length && _fallbackIndex >= 0, 170_strDefault.Length;
src\runtime\src\libraries\System.Private.CoreLib\src\System\Text\EncoderReplacementFallback.cs (4)
70public override int MaxCharCount => _strDefault.Length; 111_fallbackCount = _strDefault.Length / 2; 134_fallbackCount = _strDefault.Length; 160Debug.Assert(_fallbackIndex < _strDefault.Length && _fallbackIndex >= 0,
src\runtime\src\libraries\System.Private.CoreLib\src\System\Text\Encoding.cs (3)
555ArgumentOutOfRangeException.ThrowIfGreaterThan(index, s.Length - count); 630int bytesReceived = GetBytes(s, 0, s.Length, bytes, 0); 643ArgumentOutOfRangeException.ThrowIfGreaterThan(index, s.Length - count);
src\runtime\src\libraries\System.Private.CoreLib\src\System\Text\EncodingTable.cs (1)
52Debug.Assert(EncodingNameIndices[^1] == EncodingNames.Length);
src\runtime\src\libraries\System.Private.CoreLib\src\System\Text\Latin1Encoding.cs (3)
99return GetByteCountCommon(pChars, s.Length); 272if (s.Length - charIndex < charCount) 561GetCharsCommon(pBytes, bytes.Length, pChars, result.Length);
src\runtime\src\libraries\System.Private.CoreLib\src\System\Text\Rune.cs (4)
897if ((uint)index >= (uint)input.Length) 920if ((uint)index >= (uint)input.Length) 1006if (DecodeFromUtf16(s, out Rune result, out int charsConsumed) != OperationStatus.Done || charsConsumed != s.Length) 1017if (DecodeFromUtf16(s, out result, out int charsConsumed) != OperationStatus.Done || charsConsumed != s!.Length)
src\runtime\src\libraries\System.Private.CoreLib\src\System\Text\StringBuilder.cs (23)
108: this(value, 0, value?.Length ?? 0, capacity) 127if (startIndex > value.Length - length) 201if (persistedMaxCapacity < 1 || persistedString.Length > persistedMaxCapacity) 209persistedCapacity = Math.Min(Math.Max(DefaultCapacity, persistedString.Length), persistedMaxCapacity); 212if (persistedCapacity < 0 || persistedCapacity < persistedString.Length || persistedCapacity > persistedMaxCapacity) 220persistedString.CopyTo(0, m_ChunkChars, 0, persistedString.Length); 221m_ChunkLength = persistedString.Length; 336if ((uint)(chunkLength + chunkOffset) > (uint)result.Length || (uint)chunkLength > (uint)sourceArray.Length) 374CopyTo(startIndex, new Span<char>(ref result.GetRawStringData(), result.Length), result.Length); 779Append(ref value.GetRawStringData(), value.Length); 807if (startIndex > value.Length - count) 1173return AppendJoinCore(ref separator.GetRawStringData(), separator.Length, values); 1186return AppendJoinCore(ref separator.GetRawStringData(), separator.Length, values); 1197return AppendJoinCore(ref separator.GetRawStringData(), separator.Length, values); 1208return AppendJoinCore(ref separator.GetRawStringData(), separator.Length, values); 1221return AppendJoinCore(ref separator.GetRawStringData(), separator.Length, values); 1340Insert(index, ref value.GetRawStringData(), value.Length); 1591if ((uint)pos >= (uint)format.Length) 1811if (width <= s.Length) 1818Append(' ', width - s.Length); 1822Append(' ', width - s.Length); 1833if ((uint)pos >= (uint)format.Length)
src\runtime\src\libraries\System.Private.CoreLib\src\System\Text\StringRuneEnumerator.cs (1)
29if ((uint)_nextIndex >= _string.Length)
src\runtime\src\libraries\System.Private.CoreLib\src\System\Text\Unicode\Utf8.cs (1)
407ref value.GetRawStringData(), value.Length,
src\runtime\src\libraries\System.Private.CoreLib\src\System\Text\UnicodeEncoding.cs (2)
117return GetByteCount(pChars, s.Length, null); 149if (s.Length - charIndex < charCount)
src\runtime\src\libraries\System.Private.CoreLib\src\System\Text\UTF32Encoding.cs (2)
125return GetByteCount(pChars, s.Length, null); 157if (s.Length - charIndex < charCount)
src\runtime\src\libraries\System.Private.CoreLib\src\System\Text\UTF7Encoding.cs (2)
161return GetByteCount(pChars, s.Length, null); 193if (s.Length - charIndex < charCount)
src\runtime\src\libraries\System.Private.CoreLib\src\System\Text\UTF8Encoding.cs (2)
166return GetByteCountCommon(pChars, chars.Length); 272if (s.Length - charIndex < charCount)
src\runtime\src\libraries\System.Private.CoreLib\src\System\Text\UTF8Encoding.Sealed.cs (4)
45if (s?.Length <= MaxSmallInputElementCount) 58Debug.Assert(s.Length <= MaxSmallInputElementCount); 62int sourceLength = s.Length; // hoist this to avoid having the JIT auto-insert null checks 68Debug.Assert(0 <= bytesWritten && bytesWritten <= s.Length * MaxUtf8BytesPerChar);
src\runtime\src\libraries\System.Private.CoreLib\src\System\Text\ValueStringBuilder.AppendFormat.cs (5)
36if ((uint)pos >= (uint)format.Length) 248if (width <= s.Length) 255Append(' ', width - s.Length); 259Append(' ', width - s.Length); 270if ((uint)pos >= (uint)format.Length)
src\runtime\src\libraries\System.Private.CoreLib\src\System\Threading\Mutex.Unix.cs (3)
60name.Length > NamedWaitHandleOptionsInternal.CurrentSessionPrefix.Length) 62name = name.Substring(NamedWaitHandleOptionsInternal.CurrentSessionPrefix.Length);
src\runtime\src\libraries\System.Private.CoreLib\src\System\Threading\Tasks\TplEventSource.cs (1)
449eventPayload[1].Size = ((OperationName.Length + 1) * 2);
src\runtime\src\libraries\System.Private.CoreLib\src\System\TimeOnly.cs (2)
795if (format!.Length == 1) 981if (format.Length == 1)
src\runtime\src\libraries\System.Private.CoreLib\src\System\TimeZoneInfo.cs (3)
552if (id.Length == 0 || id.Length > MaxKeyLength || id.Contains('\0')) 749if (source.Length == 0)
src\runtime\src\libraries\System.Private.CoreLib\src\System\TimeZoneInfo.FullGlobalizationData.cs (5)
72if (region is not null && region.Length < MaxRegionNameLength) 74byte* regionInAscii = stackalloc byte[region.Length + 1]; 76for (; i < region.Length && region[i] <= '\u007F'; i++) 81if (i >= region.Length) 83regionInAscii[region.Length] = 0;
src\runtime\src\libraries\System.Private.CoreLib\src\System\TimeZoneInfo.FullGlobalizationData.Unix.cs (2)
42if (GlobalizationMode.Invariant || uiCulture.Name.Length == 0 || uiCulture.TwoLetterISOLanguageName == "en") 80if (uiCulture.Name.Length == 0)
src\runtime\src\libraries\System.Private.CoreLib\src\System\TimeZoneInfo.StringSerializer.cs (19)
399if (_currentTokenStartIndex < 0 || _currentTokenStartIndex >= _serializedText.Length) 406for (int i = _currentTokenStartIndex; i < _serializedText.Length; i++) 429if (_currentTokenStartIndex >= _serializedText.Length) 467if (_currentTokenStartIndex < 0 || _currentTokenStartIndex >= _serializedText.Length) 475for (int i = _currentTokenStartIndex; i < _serializedText.Length; i++) 501if (_currentTokenStartIndex >= _serializedText.Length) 598_currentTokenStartIndex >= _serializedText.Length || 605if (_currentTokenStartIndex >= _serializedText.Length || 629if (count <= 0 || count > (_serializedText.Length - _currentTokenStartIndex) / MinSeparatorsPerFullFidelityRule) 741if (_currentTokenStartIndex < 0 || _currentTokenStartIndex >= _serializedText.Length) 760if (_currentTokenStartIndex < 0 || _currentTokenStartIndex >= _serializedText.Length) 788if (_state == State.EndOfLine || _currentTokenStartIndex >= _serializedText.Length) 805if (_state == State.EndOfLine || _currentTokenStartIndex >= _serializedText.Length) 837if (_currentTokenStartIndex >= _serializedText.Length) 856(_currentTokenStartIndex < _serializedText.Length && _serializedText[_currentTokenStartIndex] == Rhs)) 864if (_currentTokenStartIndex < 0 || _currentTokenStartIndex >= _serializedText.Length) 920if (_state == State.EndOfLine || _currentTokenStartIndex >= _serializedText.Length) 941if (_currentTokenStartIndex < _serializedText.Length && 956if (_currentTokenStartIndex >= _serializedText.Length)
src\runtime\src\libraries\System.Private.CoreLib\src\System\TimeZoneInfo.Unix.NonAndroid.cs (3)
57for (int i = 0; i < zoneId.Length; i++) 256id = symlinkPath.Substring(timeZoneDirectory.Length); 334id = id.Substring(timeZoneDirectory.Length);
src\runtime\src\libraries\System.Reflection.Metadata\src\System\Reflection\Metadata\TypeName.cs (2)
183else if (_nestedNameLength > 0 && _fullName.Length > _nestedNameLength) // Declaring types 234else if (_nestedNameLength > 0 && _fullName.Length > _nestedNameLength) // Declaring types
src\runtime\src\libraries\System.Reflection.Metadata\src\System\Reflection\Metadata\TypeNameParserHelpers.cs (3)
105sb.EnsureCapacity(name.Length); 108for (int i = indexOfEscapeCharacter; i < name.Length;) 112if (c != EscapeCharacter || i == name.Length)
System\CrashInfo.cs (1)
279int length = value.Length;
System\Diagnostics\Debugger.cs (1)
62if (string.Empty.Length != 0)
System\Diagnostics\StackTrace.NativeAot.cs (2)
91if (traceFormat == TraceFormat.Normal && builder.Length >= Environment.NewLine.Length) 92builder.Length -= Environment.NewLine.Length;
System\Reflection\Assembly.NativeAot.cs (1)
89if ((partialName.Length == 0) || (partialName[0] == '\0'))
System\Reflection\Runtime\Assemblies\NativeFormat\NativeFormatRuntimeAssembly.GetTypeCore.CaseInsensitive.cs (1)
82if (ns.Length != 0)
System\Reflection\Runtime\Assemblies\RuntimeAssemblyInfo.cs (1)
100string fullTypeName = typeForwardInfo.NamespaceName.Length == 0 ? typeForwardInfo.TypeName : typeForwardInfo.NamespaceName + "." + typeForwardInfo.TypeName;
System\Reflection\Runtime\CustomAttributes\RuntimeCustomAttributeData.cs (1)
61i == 0 && ctorArgs.Length == 0 ? "{0} = {1}" : ", {0} = {1}",
System\Reflection\Runtime\General\Helpers.cs (1)
96StringBuilder sbEscapedName = new StringBuilder(identifier.Length);
System\Reflection\Runtime\General\MetadataReaderExtensions.NativeFormat.cs (2)
545if (ns.Length != 0) 638ReverseStringInStringBuilder(fullName, index, namespacePart.Length);
System\Reflection\Runtime\General\ThunkedApis.cs (2)
214int nameLength = fullname.Length - ns.Length - 1;
System\Reflection\Runtime\MethodInfos\RuntimeMethodHelpers.cs (1)
83sb.Append(parameterTypeString, 0, parameterTypeString.Length - 1);
System\Reflection\Runtime\TypeInfos\RuntimeTypeInfo.GetMember.cs (1)
38string prefix = optionalNameOrPrefix.Substring(0, optionalNameOrPrefix.Length - 1);
System\Reflection\Runtime\TypeInfos\RuntimeTypeInfo.InvokeMember.cs (1)
99if (name.Length == 0 || name.Equals(@"[DISPID=0]"))
System\Reflection\TypeNameResolver.NativeAot.cs (1)
48if (typeName.Length == 0)
System\Runtime\InteropServices\PInvokeMarshal.cs (2)
342StringToAnsiString(pManaged, str.Length, pNative, /*terminateWithNull=*/true, bestFit, throwOnUnmappableChar); 417int lenUnicode = str.Length;
System.Private.DataContractSerialization (147)
src\runtime\src\libraries\Common\src\System\CodeDom\CodeTypeReference.cs (3)
135int end = typeName.Length - 1; 363int end = typeName.Length - 1; 367while (start < typeName.Length && char.IsWhiteSpace(typeName[start])) start++;
System\Runtime\Serialization\Attributes.cs (2)
136if (xsiTypeString != null && xsiTypeString.Length > 0) 143if (factoryTypeString != null && factoryTypeString.Length > 0)
System\Runtime\Serialization\ClassDataContract.cs (1)
282if (ns.Length > 0 && ns != dataContract.Namespace.Value)
System\Runtime\Serialization\DataContract.cs (12)
1206if (localName.Length == 0) 1210for (int i = 1; i < localName.Length; i++) 1495int nsLen = (type.Namespace == null) ? 0 : type.Namespace.Length; 1671if (dataContractNs.Length > 0) 1675if (trimmedNs.Length == 0 || trimmedNs.Contains("##", StringComparison.Ordinal)) 1684Span<char> formatted = stackalloc char[Globals.SerializationNamespace.Length]; 1686charsWritten == Globals.SerializationNamespace.Length && 1723return uriString.StartsWith(Globals.DataContractXsdBaseNamespace, StringComparison.Ordinal) ? uriString.Substring(Globals.DataContractXsdBaseNamespace.Length) : uriString; 1909for (int i = 0; i < format.Length; i++) 1916for (; i < format.Length; i++) 1919if (i == format.Length) 2006if (methodName.Length == 0)
System\Runtime\Serialization\EnumDataContract.cs (6)
338for (; i < stringValue.Length; i++) 345for (; i < stringValue.Length; i++) 352for (++i; i < stringValue.Length; i++) 356if (i == stringValue.Length) 366if (stringValue.Length == 0) 368longValue = ReadEnumValue(stringValue, 0, stringValue.Length);
System\Runtime\Serialization\ExtensionDataReader.cs (1)
802prefix = (ns.Length == 0) ? string.Empty : "p" + s_nsToPrefixTable.Count;
System\Runtime\Serialization\Json\DataContractJsonSerializer.cs (1)
361for (int i = 0; i < jsonName.Length; i++)
System\Runtime\Serialization\Json\JsonGlobals.cs (1)
19public static readonly int DataContractXsdBaseNamespaceLength = Globals.DataContractXsdBaseNamespace.Length;
System\Runtime\Serialization\Json\JsonReaderDelegator.cs (1)
156ReadOnlySpan<char> ticksvalue = dateTimeValue.AsSpan(6, dateTimeValue.Length - 8);
System\Runtime\Serialization\Json\JsonWriterDelegator.cs (1)
238if (localName != null && localName.Length == 0)
System\Runtime\Serialization\Json\XmlJsonReader.cs (5)
755actual = Math.Min(count, value.Length); 1563for (int i = 0; i < val.Length; i++) 1570Debug.Assert(i < val.Length, "Found that an '\' was the last character in a string. ReadServerTypeAttriute validates that the escape sequence is valid when it calls ReadQuotedText and ReadEscapedCharacter"); 1571if (i >= val.Length) 1599if ((i + 3) >= val.Length)
System\Runtime\Serialization\Json\XmlJsonWriter.cs (5)
229if (ns.Length == 0) 674if (localName.Length == 0) 746if (localName.Length == 0) 831if (localName.Length == 0) 1296for (j = 0; j < str.Length; j++)
System\Runtime\Serialization\Json\XmlObjectSerializerReadContextComplexJson.cs (2)
169if (serverTypeNamespace.Length >= 2) 202if (serverTypeNamespace.Length >= 2)
System\Runtime\Serialization\PrimitiveDataContract.cs (1)
1174else if (ns != null && ns.Value != null && ns.Value.Length > 0)
System\Runtime\Serialization\ReflectionReader.cs (1)
285if (objectId.Length == 0)
System\Runtime\Serialization\ReflectionXmlFormatWriter.cs (1)
227return type == Globals.TypeOfXmlQualifiedName && (ns != null && ns.Value != null && ns.Value.Length > 0);
System\Runtime\Serialization\SchemaExporter.cs (1)
275int nsLen = (clrType.Namespace == null) ? 0 : clrType.Namespace.Length;
System\Runtime\Serialization\SchemaHelper.cs (3)
122if ((schema.TargetNamespace == null && ns.Length == 0) || ns.Equals(schema.TargetNamespace)) 135if (ns.Length > 0) 169if (ns != null && ns.Length > 0)
System\Runtime\Serialization\SchemaImporter.cs (1)
107if (typeName != null && typeName.Name.Length > 0)
System\Runtime\Serialization\XmlFormatWriterGenerator.cs (1)
762return type == Globals.TypeOfXmlQualifiedName && (ns != null && ns.Value != null && ns.Value.Length > 0);
System\Runtime\Serialization\XmlObjectSerializerReadContext.cs (3)
554if (xmlReader.NamespaceURI.Length != 0) 879if (xmlReader.NamespaceURI.Length != 0) 970couldBeISerializableData = (ns.Length == 0);
System\Runtime\Serialization\XmlObjectSerializerWriteContext.cs (1)
355if (ns != null && ns.Value != null && ns.Value.Length > 0)
System\Runtime\Serialization\XmlObjectSerializerWriteContextComplex.cs (1)
135if (ns != null && ns.Value != null && ns.Value.Length > 0)
System\Runtime\Serialization\XmlReaderDelegator.cs (1)
479if (str.Length == 0)
System\Runtime\Serialization\XmlWriterDelegator.cs (1)
78if (ns.Length == 0)
System\Xml\UniqueId.cs (3)
85if (value.Length == 0) 89UnsafeParse(pch, value.Length); 122return _s.Length;
System\Xml\ValueHandle.cs (2)
148return s_constStrings[_offset].Length == 0; 536if (_length != str.Length)
System\Xml\XmlBaseReader.cs (4)
1148actual = Math.Min(count, value.Length); 1536if (value.Length > _quotas.MaxStringContentLength) 2958int length = s.Length; 3157Add(value.Length);
System\Xml\XmlBaseWriter.cs (38)
203if (localName == null || (localName.Length == 0 && prefix != "xmlns")) 220if (prefix.Length == 0 && localName == "xmlns") 248if (prefix.Length != 0) 256else if (ns.Length == 0) 259if (prefix.Length != 0) 262else if (prefix.Length == 0) 271if (ns.Length == xmlnsNamespace.Length && ns == xmlnsNamespace) 273if (ns.Length == xmlNamespace.Length && ns == xmlNamespace) 476if (text.Length > 0) 498if (localName.Length == 0) 833if (prefix.Length != 0) 846if (localName.Value.Length == 0) 980if (value.Length > 0 || _inList) 1003if (value.Value.Length > 0) 1055if (value.Length > 0) 1855if (_attributeValue!.Length == 0) 2100if (uri.Length == 0) 2141if (prefix.Length >= 3) 2166if (prefix.Length != 0 && uri.Length == 0) 2168if (uri.Length == xmlnsNamespace.Length && uri == xmlnsNamespace) 2171if (uri.Length == xmlNamespace.Length && uri[18] == 'X' && uri == xmlNamespace) 2246if (ns.Length == 0) 2252if (_namespaces![i].Prefix!.Length == 0) 2271if (_lastNameSpace != null && _lastNameSpace.Uri == ns && _lastNameSpace.Prefix!.Length != 0) 2282if (prefix.Length != 0) 2308if (prefix.Length != 0) 2328if (ns.Length == 0) 2336if (prefix.Length == 0) 2341if (nameSpace.Prefix!.Length == 0) 2346if (prefix.Length == 1) 2373Debug.Assert(nsCount >= 1 && _namespaces![0].Prefix!.Length == 0 && _namespaces[0].Uri!.Length == 0); 2493if (value.Length == 1)
System\Xml\XmlBinaryReader.cs (1)
112if (value.Length > Quotas.MaxStringContentLength)
System\Xml\XmlBinaryWriter.cs (11)
157if (prefix.Length == 1 && char.IsAsciiLetterLower(ch)) 194if (prefix.Length == 1 && char.IsAsciiLetterLower(ch)) 240if (prefix.Length == 0) 248if (prefix.Length == 1 && char.IsAsciiLetterLower(ch)) 273if (prefix.Length == 0) 281if (prefix.Length == 1 && char.IsAsciiLetterLower(ch)) 381int length = s.Length; 585if (value.Length > 0) 589UnsafeWriteText(pch, value.Length); 1013if (prefix.Length == 0) 1021if (prefix.Length == 1 && char.IsAsciiLetterLower(ch) && TryGetKey(localName, out key))
System\Xml\XmlBufferReader.cs (1)
861int charLength = s2.Length;
System\Xml\XmlCanonicalWriter.cs (8)
252if (_inclusivePrefixes[i].Length == xmlnsAttribute.prefixLength) 363if (prefix.Length > int.MaxValue - ns.Length) 365int totalLength = prefix.Length + ns.Length; 371xmlnsAttribute.prefixLength = Encoding.UTF8.GetBytes(prefix, 0, prefix.Length, _xmlnsBuffer, _xmlnsOffset); 374xmlnsAttribute.nsLength = Encoding.UTF8.GetBytes(ns, 0, ns.Length, _xmlnsBuffer, _xmlnsOffset); 581if (value.Length > 0)
System\Xml\XmlConverter.cs (4)
458if (index == qname.Length - 1) 786for (int i = 0; i < s.Length; i++) 791return s.Length; 1121int count = s.Length - 1;
System\Xml\XmlDictionaryReader.cs (6)
404if (result.Length == 0) 411if (sb.Length > maxStringContentLength - value.Length) 443if (result.Length > maxStringContentLength) 473if (result.Length == 0) 480if (sb.Length > maxStringContentLength - value.Length) 489if (result.Length > maxStringContentLength)
System\Xml\XmlDictionaryString.cs (1)
107if (value.Length == 0)
System\Xml\XmlDictionaryWriter.cs (3)
116prefix = namespaceUri.Length == 0 ? string.Empty : $"d{namespaceUri.Length}"; 846if (namespaceUri.Length == 0)
System\Xml\XmlExceptionHelper.cs (2)
55if (prefix.Length == 0) 237if (localName.Length == 0)
System\Xml\XmlSigningNodeWriter.cs (1)
385if (prefix.Length != 0)
System\Xml\XmlStreamNodeWriter.cs (1)
267int count = value.Length;
System\Xml\XmlUTF8TextWriter.cs (4)
304if (prefix.Length != 0) 346if (prefix.Length == 1) 385int count = s.Length; 713if (prefix.Length != 0)
System.Private.Reflection.Execution (4)
src\runtime\src\coreclr\tools\Common\Internal\NativeFormat\NativeFormatReader.String.cs (3)
110if (numBytes < value.Length) 113for (int i = 0; i < value.Length; i++) 124return numBytes == value.Length; // All char ANSI, all matching
src\runtime\src\libraries\System.Private.CoreLib\src\System\SR.cs (1)
24if (key.Length == 0)
System.Private.TypeLoader (8)
src\runtime\src\coreclr\tools\Common\Internal\NativeFormat\NativeFormatReader.String.cs (3)
110if (numBytes < value.Length) 113for (int i = 0; i < value.Length; i++) 124return numBytes == value.Length; // All char ANSI, all matching
src\runtime\src\coreclr\tools\Common\Internal\Text\Utf8Span.cs (3)
33if (_value.Length < value.Length) 36for (int i = 0; i < value.Length; i++) 47return _value.Length == value.Length; // All char ANSI, all matching
src\runtime\src\coreclr\tools\Common\TypeSystem\Common\Utilities\ExceptionTypeNameFormatter.cs (1)
101if (ns.Length > 0)
src\runtime\src\libraries\System.Private.CoreLib\src\System\SR.cs (1)
24if (key.Length == 0)
System.Private.Uri (107)
src\runtime\src\libraries\Common\src\System\Text\ValueStringBuilder.cs (5)
125int count = s.Length; 167if (s.Length == 1 && (uint)pos < (uint)_chars.Length) // very common case, e.g. appending strings from NumberFormatInfo like separators, percent symbols, etc. 181if (pos > _chars.Length - s.Length) 183Grow(s.Length); 191_pos += s.Length;
System\DomainNameHelper.cs (1)
232for (int i = 0; i < hostname.Length; i++)
System\Uri.cs (72)
177Debug.Assert(offset.End >= offset.Fragment && offset.End <= _string.Length); 511if (uriString!.Length != 0) 648if ((uint)i < (uint)relativeStr.Length && relativeStr[i] == ':' && i > 1) 658if (i + 1 < relativeStr.Length) 677if (relativeStr.Length == 0) 927if (path.Length == 0) 936while (current < path.Length) 941next = path.Length - 1; 1218string.Concat(host.AsSpan(1, host.Length - 2), scopeId) : 1219host.Substring(1, host.Length - 2); 1297if (IPv6AddressHelper.IsValid(name, out end) && end == name.Length) 1303if (IPv4AddressHelper.IsValid(name.AsSpan(), out end, false, false, false) && end == name.Length) 1308if (DomainNameHelper.IsValid(name, iri: false, notImplicitFile: false, out end) && end == name.Length) 1313if (DomainNameHelper.IsValid(name, iri: true, notImplicitFile: false, out end) && end == name.Length) 1320if (IPv6AddressHelper.IsValid($"[{name}]", out end) && end - 2 == name.Length) 1431ArgumentOutOfRangeException.ThrowIfGreaterThanOrEqual(index, pattern.Length); 1434&& (pattern.Length - index >= 3)) 1471(pattern.Length - index) >= 3 && 1904return (uint)index < (uint)uriString.Length && uriString[index] == ':'; 1919int length = uriString.Length; 2214info.Offset.End = str.Length; 2250idx += _syntax.SchemeName.Length + 1; 2310Debug.Assert((uint)idx <= (uint)OriginalString.Length); 2322(uint)idx < (uint)str.Length && str[idx] == ':') 2334if ((uint)idx < (uint)str.Length) 2345for (idx++; (uint)idx < (uint)str.Length; idx++) 2419if (host.Length != 0) 2466for (int i = 0; i < host.Length; ++i) 2522if (host.Length == 0) 2562if (CheckAuthorityHelper(host, 0, out ParsingError err, ref flags, _syntax.Flags, ref newHost) != host.Length || 2570host = CreateHostStringHelper(host, 0, host.Length, ref flags, _info); 2572for (int i = 0; i < host.Length; ++i) 2597for (int idx = 0; idx < portStr.Length; ++idx) 2706var dest = str.Length <= StackallocThreshold 2708: new ValueStringBuilder(str.Length); 2723var dest = str.Length <= StackallocThreshold 2725: new ValueStringBuilder(str.Length); 2809if (host.Length != 0) 2988if (_info.Offset.Scheme == 0 && _info.Offset.End == _string.Length) 3001if (_info.Offset.Scheme == 0 && _info.Offset.Fragment == _string.Length) 3012if (_info.Offset.Scheme == 0 && _info.Offset.Fragment == _string.Length) 3097if (_info.Offset.Scheme == 0 && _info.Offset.End == _string.Length) 3156int length = inputStr.Length; 3158while ((uint)(length - 1) < (uint)inputStr.Length && UriHelper.IsLWS(inputStr[length - 1])) 3172Debug.Assert(str[_syntax.SchemeName.Length] == ':'); 3174int schemeLength = _syntax.SchemeName.Length; 3234queryStart = inputStr.Length; 3241queryStart = inputStr.Length; 3246_info.Offset.Fragment = inputStr.Length; // There is no fragment in DisablePathAndQueryCanonicalization mode 3247_info.Offset.End = inputStr.Length; 3355if ((uint)idx < (uint)inputStr.Length && inputStr[idx] == '?') 3382if ((uint)idx < (uint)inputStr.Length && inputStr[idx] == '#') 3524while ((uint)i < (uint)uriString.Length && UriHelper.IsLWS(uriString[i])) 3532(uint)i < (uint)uriString.Length && uriString[i] == '/' && 3533((uint)(i + 1) >= (uint)uriString.Length || uriString[i + 1] is not ('/' or '\\'))) 3545if ((uint)(i + 2) >= (uint)uriString.Length || colonOffset == 0) 3582while ((uint)i < (uint)uriString.Length && uriString[i] is '/' or '\\') 4428(relativePart.Length == 1 || (relativePart[1] != '/' && relativePart[1] != '\\'))) 4447if (relativePart.Length >= 2 && (relativePart[1] == '\\' || relativePart[1] == '/')) 4488if (relativePart.Length >= 2 && relativePart[1] == '/') 4515int length = left.Length; 4516char[] path = new char[length + relativePart.Length]; 4532relativePart.CopyTo(0, path, length, relativePart.Length); 4546for (; i < relativePart.Length; ++i) 4557else if (i < relativePart.Length) 4565length += relativePart.Length; 4638for (i = 0; (i < path1.Length) && (i < path2.Length); ++i) 4657if ((i == path1.Length) && (i == path2.Length)) 4664for (; i < path1.Length; ++i) 4672if (relPath.Length == 0 && path2.Length - 1 == si)
System\UriBuilder.cs (15)
95if (_query.Length == 1) 100if (_fragment.Length == 1) 115if (value.Length != 0) 183if (value.AsSpan(1, value.Length - 2).ContainsAny(s_hostReservedCharsExceptColon)) 314if (userInfo.Length > 0) 332if (UserName.Length == 0 && Password.Length != 0) 342if (scheme.Length != 0) 348schemeDelimiter = host.Length == 0 ? ":" : Uri.SchemeDelimiter; 353|| (host.Length != 0 && syntax.NotAny(UriSyntaxFlags.MailToLikeUri) && syntax.InFact(UriSyntaxFlags.OptionalAuthority)) 363if (username.Length != 0) 368if (password.Length != 0) 377if (host.Length != 0) 393if (path.Length != 0) 395if (!path.StartsWith('/') && host.Length != 0)
System\UriExt.cs (10)
88((_string.Length >= 2 && (_string[0] != '\\' || _string[1] != '\\')) 190for ( ; i < data.Length; i++) 195if ((uint)(i + 2) < (uint)data.Length) 443int idx = _info.Offset.Scheme + _syntax.SchemeName.Length + 3; 507Debug.Assert(backingString is null || backingString.Length == charsToUnescape.Length); 684if (relativeStr.Length > 0 && (UriHelper.IsLWS(relativeStr[0]) || UriHelper.IsLWS(relativeStr[relativeStr.Length - 1]))) 687if (relativeStr.Length == 0) 711if (relativeStr.Length >= 3 757if (_string.Length == 0)
System\UriHelper.cs (2)
207Debug.Assert(backingString is null || backingString.Length == charsToEscape.Length); 568Debug.Assert(backingString is null || strToClean.Length == backingString.Length);
System\UriScheme.cs (1)
171ArgumentOutOfRangeException.ThrowIfEqual(schemeName.Length, 1);
System\UriSyntax.cs (1)
157if (syntax.SchemeName.Length != 0)
System.Private.Windows.Core (14)
System\Private\Windows\Ole\Composition.ManagedToNativeAdapter.cs (7)
337sizeInBytes += (uint)(file.Length + 1) * sizeof(char); 367fileBuffer[file.Length] = '\0'; 368fileBuffer = fileBuffer[(file.Length + 1)..]; 378int byteCount = PInvokeCore.WideCharToMultiByte(PInvokeCore.CP_ACP, 0, value, value.Length, null, 0, null); 386PInvokeCore.WideCharToMultiByte(PInvokeCore.CP_ACP, 0, value, value.Length, (PSTR)buffer.Pointer, byteCount, null); 396uint byteCount = (uint)value.Length * sizeof(char) + sizeof(char); 408span[value.Length] = '\0';
System\Private\Windows\Ole\DragDropHelper.cs (2)
346if (message.Length >= (int)PInvokeCore.MAX_PATH) 351if (messageReplacementToken.Length >= (int)PInvokeCore.MAX_PATH)
System\Text\ValueStringBuilder.cs (5)
173int count = s.Length; 216if (s.Length == 1 && (uint)pos < (uint)_chars.Length) 231if (pos > _chars.Length - s.Length) 233Grow(s.Length); 237_pos += s.Length;
System.Private.Xml (1051)
src\runtime\src\libraries\Common\src\System\CSharpHelpers.cs (2)
131if (value.Length < 3) 152for (int i = 0; i < value.Length; i++)
src\runtime\src\libraries\Common\src\System\Text\ValueStringBuilder.cs (5)
125int count = s.Length; 167if (s.Length == 1 && (uint)pos < (uint)_chars.Length) // very common case, e.g. appending strings from NumberFormatInfo like separators, percent symbols, etc. 181if (pos > _chars.Length - s.Length) 183Grow(s.Length); 191_pos += s.Length;
System\Xml\Base64Decoder.cs (1)
65ArgumentOutOfRangeException.ThrowIfGreaterThan(len, str.Length - startPos);
System\Xml\BinaryXml\XmlBinaryReader.cs (15)
115prefix.Length == 0 ? localname : $"{this.prefix}:{this.localname}"; 1837if (nsdecl.prefix.Length > 0 || nsdecl.uri.Length > 0) 1934if (5 < prefixStr.Length) 1936if (6 == prefixStr.Length || ':' != prefixStr[5]) 2455if (prefix.Length != 0) 2459if (_attributes[i].name.prefix.Length != 0) 2499if (decl.prefix.Length == 0) 2627else if (n.prefix.Length != 0) 2629if (n.namespaceUri.Length == 0) 2633else if (n.namespaceUri.Length != 0) 2763sb ??= new StringBuilder(value.Length + value.Length / 2).Append(value); 2824if (_qnameOther.localname.Length != 0) 4016if (qname.prefix.Length == 0)
System\Xml\BinHexDecoder.cs (1)
67ArgumentOutOfRangeException.ThrowIfGreaterThan(len, str.Length - startPos);
System\Xml\Cache\XPathDocumentBuilder.cs (1)
153Debug.Assert(prefix != null && localName != null && ns != null && localName.Length != 0 && baseUri != null);
System\Xml\Cache\XPathDocumentNavigator.cs (3)
124if (s.Length == 0) 747if (name.Length == 0) 769if (name.Length == 0)
System\Xml\Cache\XPathNode.cs (2)
94if (Prefix.Length == 0) 238return NodeType == XPathNodeType.Namespace && localName.Length == 3 && localName == "xml";
System\Xml\Cache\XPathNodeInfoAtom.cs (3)
141for (int i = 0; i < _localName.Length; i++) 330if (_localName.Length != 0) 337if (_prefix.Length != 0)
System\Xml\Core\CharEntityEncoderFallback.cs (4)
61public override int Remaining => _charEntityIndex == -1 ? 0 : _charEntity.Length - _charEntityIndex; 118if (_charEntityIndex == _charEntity.Length) 128Debug.Assert(_charEntityIndex < _charEntity.Length); 141Debug.Assert(_charEntityIndex <= _charEntity.Length);
System\Xml\Core\HtmlEncodedRawTextWriter.cs (13)
50Debug.Assert(name != null && name.Length > 0); 101if (ns.Length == 0) 103Debug.Assert(prefix.Length == 0); 141if (ns.Length == 0) 143Debug.Assert(prefix.Length == 0); 166if (ns.Length == 0) 168Debug.Assert(prefix.Length == 0); 290if (ns.Length == 0) 292Debug.Assert(prefix.Length == 0); 384char* pSrcEnd = pSrc + text.Length; 822if (ns.Length == 0) 824Debug.Assert(prefix.Length == 0); 847if (prefix.Length != 0)
System\Xml\Core\HtmlUtf8RawTextWriter.cs (13)
45Debug.Assert(name != null && name.Length > 0); 94if (ns.Length == 0) 96Debug.Assert(prefix.Length == 0); 132if (ns.Length == 0) 134Debug.Assert(prefix.Length == 0); 155if (ns.Length == 0) 157Debug.Assert(prefix.Length == 0); 277if (ns.Length == 0) 279Debug.Assert(prefix.Length == 0); 363char* pSrcEnd = pSrc + text.Length; 792if (ns.Length == 0) 794Debug.Assert(prefix.Length == 0); 817if (prefix.Length != 0)
System\Xml\Core\IncrementalReadDecoders.cs (1)
89Debug.Assert(str.Length - startPos >= len);
System\Xml\Core\ReadContentAsBinaryHelper.cs (1)
367int decodedCharsCount = _decoder.Decode(value, _valueOffset, value.Length - _valueOffset);
System\Xml\Core\ReadContentAsBinaryHelperAsync.cs (1)
289int decodedCharsCount = _decoder.Decode(value, _valueOffset, value.Length - _valueOffset);
System\Xml\Core\ValidatingReaderNodeData.cs (1)
81if (_prefix.Length == 0)
System\Xml\Core\XmlAutoDetectWriter.cs (1)
89if (ns!.Length == 0 && IsHtmlTag(localName))
System\Xml\Core\XmlCharCheckingReader.cs (1)
608if (prefix.Length > 0)
System\Xml\Core\XmlCharCheckingWriter.cs (13)
116if (prefix != null && prefix.Length > 0) 133if (prefix != null && prefix.Length > 0) 337if (ncname.Length == 0) 342if (len != ncname.Length) 350if (name.Length == 0) 357if (len != name.Length) 375for (i = 0; i < str.Length; i++) 388sb ??= new StringBuilder(str.Length + 5); 393if (i + 1 < str.Length && str[i + 1] == '\n') 401sb ??= new StringBuilder(str.Length + 5); 412sb ??= new StringBuilder(str.Length + 5); 521for (i = 0; i < text.Length; i++) 529sb ??= new StringBuilder(text.Length + 5);
System\Xml\Core\XmlCharCheckingWriterAsync.cs (2)
66if (prefix != null && prefix.Length > 0) 82if (prefix != null && prefix.Length > 0)
System\Xml\Core\XmlEncodedRawTextWriter.cs (20)
253Debug.Assert(name != null && name.Length > 0); 294Debug.Assert(localName != null && localName.Length > 0); 326Debug.Assert(localName != null && localName.Length > 0); 358Debug.Assert(localName != null && localName.Length > 0); 378Debug.Assert(localName != null && localName.Length > 0); 388if (prefix != null && prefix.Length > 0) 438if (prefix.Length == 0) 524Debug.Assert(name != null && name.Length > 0); 533if (text.Length > 0) 546Debug.Assert(name != null && name.Length > 0); 599char* pSrcEnd = pSrc + ws.Length; 621char* pSrcEnd = pSrc + text.Length; 700WriteRawWithCharChecking(pSrcBegin, pSrcBegin + data.Length); 1137RawText(pSrcBegin, pSrcBegin + s.Length); 1313if (text.Length == 0) 1328char* pSrcEnd = pSrcBegin + text.Length; 1462if (text.Length == 0) 1479char* pSrcEnd = pSrcBegin + text.Length; 1855for (int i = 0; i < chars.Length; i++) 1873if (i + 1 < chars.Length)
System\Xml\Core\XmlEncodedRawTextWriterAsync.cs (27)
135Debug.Assert(name != null && name.Length > 0); 177Debug.Assert(localName != null && localName.Length > 0); 205Debug.Assert(localName != null && localName.Length > 0); 240Debug.Assert(localName != null && localName.Length > 0); 262Debug.Assert(localName != null && localName.Length > 0); 272if (prefix != null && prefix.Length > 0) 326if (prefix.Length == 0) 420Debug.Assert(name != null && name.Length > 0); 429if (text.Length > 0) 443Debug.Assert(name != null && name.Length > 0); 893int leftCount = text.Length; 1112int leftCount = text.Length; 1248int writeLen = RawTextNoFlush(text, 0, text.Length); 1250_RawTextAsync(text, writeLen, text.Length - writeLen) : 1263writeLen = RawTextNoFlush(text1, 0, text1.Length); 1268return _RawTextAsync(text1, writeLen, text1.Length - writeLen, text2, text3, text4); 1274writeLen = RawTextNoFlush(text2, 0, text2.Length); 1279return _RawTextAsync(text2, writeLen, text2.Length - writeLen, text3, text4); 1287writeLen = RawTextNoFlush(text3, 0, text3.Length); 1292return _RawTextAsync(text3, writeLen, text3.Length - writeLen, text4); 1299writeLen = RawTextNoFlush(text4, 0, text4.Length); 1302return _RawTextAsync(text4, writeLen, text4.Length - writeLen); 1510int leftCount = text.Length; 1686if (text.Length == 0) 1697int leftCount = text.Length; 1870if (text.Length == 0) 1881int leftCount = text.Length;
System\Xml\Core\XmlRawWriter.cs (1)
267if (prefix.Length != 0)
System\Xml\Core\XmlRawWriterAsync.cs (1)
193if (prefix.Length != 0)
System\Xml\Core\XmlReader.cs (2)
96public virtual string Name => Prefix.Length == 0 ? LocalName : NameTable.Add($"{Prefix}:{LocalName}"); 1480if (value.Length == 0)
System\Xml\Core\XmlReaderAsync.cs (1)
337if (value.Length == 0)
System\Xml\Core\XmlSubtreeReader.cs (8)
863if (_nsIncReadOffset == _curNode.value.Length) 870_nsIncReadOffset += _binDecoder.Decode(_curNode.value, _nsIncReadOffset, _curNode.value.Length - _nsIncReadOffset); 1001if (_nsIncReadOffset == _curNode.value.Length) 1008_nsIncReadOffset += _binDecoder.Decode(_curNode.value, _nsIncReadOffset, _curNode.value.Length - _nsIncReadOffset); 1124int copyCount = _curNode.value.Length - _nsIncReadOffset; 1267if (prefix.Length == 0) 1279else if (prefix.Length != 0 && _nsManager.LookupNamespace(prefix) != ns) 1316if (prefix.Length == 0)
System\Xml\Core\XmlSubtreeReaderAsync.cs (5)
269if (_nsIncReadOffset == _curNode.value.Length) 276_nsIncReadOffset += _binDecoder.Decode(_curNode.value, _nsIncReadOffset, _curNode.value.Length - _nsIncReadOffset); 407if (_nsIncReadOffset == _curNode.value.Length) 414_nsIncReadOffset += _binDecoder.Decode(_curNode.value, _nsIncReadOffset, _curNode.value.Length - _nsIncReadOffset); 522int copyCount = _curNode.value.Length - _nsIncReadOffset;
System\Xml\Core\XmlTextEncoder.cs (1)
391int len = text.Length;
System\Xml\Core\XmlTextReader.cs (1)
269if (ns != null && ns.Length == 0)
System\Xml\Core\XmlTextReaderImpl.cs (37)
594if (context.BaseURI != null && context.BaseURI.Length > 0 && 597if (baseUriStr.Length > 0) 691if (context.BaseURI != null && context.BaseURI.Length > 0 && 694if (baseUriStr!.Length > 0) 2363if (_ps.baseUriStr.Length > 0 && _ps.baseUri == null && _xmlResolver != null) 2579Debug.Assert((systemId != null && systemId.Length > 0) || (publicId != null && publicId.Length > 0)); 2619RegisterConsumedCharacters(internalDtd.Length, false); 2954int len = str.Length; 2956str.CopyTo(0, _ps.chars, 0, str.Length); 3056Debug.Assert(_url != null && _url.Length > 0); 4390if (prefixLen == _lastPrefix.Length && chars.AsSpan(startPos).StartsWith(_lastPrefix)) 4530string qname = (prefix.Length == 0) ? defaultAttributeInfo.LocalName : (prefix + ':' + defaultAttributeInfo.LocalName); 4550int prefLen = startTagNode.prefix.Length; 4551int locLen = startTagNode.localName.Length; 4564if (startTagNode.prefix.Length == 0) 4919if (attr.prefix.Length == 0) 4980if (_curNode.prefix.Length == 0) 4995if (at.type == XmlNodeType.Attribute && at.prefix.Length > 0) 5060if (ns.Length == 0) 6195_curNode.lineInfo.linePos += _curNode.localName.Length; 7684if (prefixLen == _lastPrefix.Length && _ps.chars.AsSpan(_ps.charPos).StartsWith(_lastPrefix)) 7805if (uri.Length == 0 && prefix.Length > 0) 7821if (prefix.Length == 0) 8058RegisterConsumedCharacters(entity.Text!.Length, true); 8389if ((endPos - _ps.charPos - 2) == checkName.Length && chars.AsSpan(_ps.charPos + 2).StartsWith(checkName) && 8428if (endPos - _ps.charPos - 1 == _curNode.localName.Length && _ps.chars.AsSpan(_ps.charPos + 1).StartsWith(_curNode.localName) && 8835if (Ref.Equal(_nodes[i].localName, atomizedName) && _nodes[i].prefix.Length == 0) 9202if (defAttrInfo.Prefix.Length > 0) 9253if (prefix.Length == 0 && ns.Length > 0) 9287NodeData attr = AddAttribute(localName, prefix, prefix.Length > 0 ? null : localName); 9299if (attr.prefix.Length == 0) 9309if (_nodes[_index].prefix.Length == 0) 9582Debug.Assert(endPos < str.Length); 9624int len = value.Length;
System\Xml\Core\XmlTextReaderImplAsync.cs (11)
829Debug.Assert((systemId != null && systemId.Length > 0) || (publicId != null && publicId.Length > 0)); 1966if (prefixLen == _lastPrefix.Length && chars.AsSpan(startPos).StartsWith(_lastPrefix)) 2064int prefLen = startTagNode.prefix.Length; 2065int locLen = startTagNode.localName.Length; 2086int prefLen = startTagNode.prefix.Length; 2087int locLen = startTagNode.localName.Length; 2101int prefLen = startTagNode.prefix.Length; 2102int locLen = startTagNode.localName.Length; 2106if (startTagNode.prefix.Length == 0) 2545if (attr.prefix.Length == 0)
System\Xml\Core\XmlTextReaderImplHelpers.cs (5)
539Debug.Assert(localName.Length > 0); 591sb.Append(_value, valueOffset, _value.Length - valueOffset); 612int copyCount = _value.Length - valueOffset; 632return decoder.Decode(_value, valueOffset, _value.Length - valueOffset); 670if (prefix.Length == 0)
System\Xml\Core\XmlTextWriter.cs (9)
517else if (prefix.Length == 0) 523if (ns.Length == 0) 579if (prefix != null && prefix.Length == 0) 647else if (ns.Length == 0) 866if (null != text && text.Length != 0) 1075if (prefix.Length != 0) 1489if (prefix.Length != 0 && ns.Length == 0) 1691int nameLength = name.Length;
System\Xml\Core\XmlUtf8RawTextWriter.cs (20)
199Debug.Assert(name != null && name.Length > 0); 238Debug.Assert(localName != null && localName.Length > 0); 268Debug.Assert(localName != null && localName.Length > 0); 298Debug.Assert(localName != null && localName.Length > 0); 316Debug.Assert(localName != null && localName.Length > 0); 324if (prefix != null && prefix.Length > 0) 371if (prefix.Length == 0) 450Debug.Assert(name != null && name.Length > 0); 457if (text.Length > 0) 470Debug.Assert(name != null && name.Length > 0); 517char* pSrcEnd = pSrc + ws.Length; 537char* pSrcEnd = pSrc + text.Length; 609WriteRawWithCharChecking(pSrcBegin, pSrcBegin + data.Length); 957RawText(pSrcBegin, pSrcBegin + s.Length); 1131if (text.Length == 0) 1146char* pSrcEnd = pSrcBegin + text.Length; 1279if (text.Length == 0) 1296char* pSrcEnd = pSrcBegin + text.Length; 1720for (int i = 0; i < chars.Length; i++) 1738if (i + 1 < chars.Length)
System\Xml\Core\XmlUtf8RawTextWriterAsync.cs (27)
113Debug.Assert(name != null && name.Length > 0); 153Debug.Assert(localName != null && localName.Length > 0); 179Debug.Assert(localName != null && localName.Length > 0); 212Debug.Assert(localName != null && localName.Length > 0); 232Debug.Assert(localName != null && localName.Length > 0); 240if (prefix != null && prefix.Length > 0) 290if (prefix.Length == 0) 376Debug.Assert(name != null && name.Length > 0); 383if (text.Length > 0) 397Debug.Assert(name != null && name.Length > 0); 766int leftCount = text.Length; 984int leftCount = text.Length; 1119int writeLen = RawTextNoFlush(text, 0, text.Length); 1121_RawTextAsync(text, writeLen, text.Length - writeLen) : 1134writeLen = RawTextNoFlush(text1, 0, text1.Length); 1139return _RawTextAsync(text1, writeLen, text1.Length - writeLen, text2, text3, text4); 1145writeLen = RawTextNoFlush(text2, 0, text2.Length); 1150return _RawTextAsync(text2, writeLen, text2.Length - writeLen, text3, text4); 1158writeLen = RawTextNoFlush(text3, 0, text3.Length); 1163return _RawTextAsync(text3, writeLen, text3.Length - writeLen, text4); 1170writeLen = RawTextNoFlush(text4, 0, text4.Length); 1173return _RawTextAsync(text4, writeLen, text4.Length - writeLen); 1380int leftCount = text.Length; 1555if (text.Length == 0) 1566int leftCount = text.Length; 1738if (text.Length == 0) 1749int leftCount = text.Length;
System\Xml\Core\XmlValidatingReader.cs (1)
202if (ns != null && ns.Length == 0)
System\Xml\Core\XmlValidatingReaderImpl.cs (3)
167if (_coreReader.BaseURI!.Length > 0) 185if (_coreReader.BaseURI!.Length > 0) 1067if (_outerReader.BaseURI!.Length > 0)
System\Xml\Core\XmlWellFormedWriter.cs (19)
439else if (prefix.Length > 0) 443if (ns == null || (ns != null && ns.Length == 0)) 453Debug.Assert(prefix.Length == 0); 632if (prefix.Length > 0) 639if (prefix.Length == 0) 643if (namespaceName.Length > 0 && namespaceName != XmlReservedNs.NsXmlNs) 651else if (namespaceName.Length > 0) 666if (namespaceName.Length > 0 && namespaceName != XmlReservedNs.NsXmlNs) 676if (namespaceName.Length > 0 && namespaceName != XmlReservedNs.NsXml) 694if (namespaceName.Length == 0) 709if (prefix.Length != 0) 773if (value.Length == 0) 893if (name.Length == 3 && string.Equals(name, "xml", StringComparison.OrdinalIgnoreCase)) 1302if (prefix.Length != 0) 1684throw DupAttrException((prefix.Length == 0) ? string.Empty : "xmlns", (prefix.Length == 0) ? "xmlns" : prefix); 1833string attr = prefix.Length > 0 ? $"{prefix}:{localName}" : localName; 2028Debug.Assert(ncname != null && ncname.Length > 0); 2031int endPos = ncname.Length;
System\Xml\Core\XmlWellFormedWriterAsync.cs (14)
215else if (prefix.Length > 0) 219if (ns == null || (ns != null && ns.Length == 0)) 229Debug.Assert(prefix.Length == 0); 493if (prefix.Length > 0) 500if (prefix.Length == 0) 504if (namespaceName.Length > 0 && namespaceName != XmlReservedNs.NsXmlNs) 512else if (namespaceName.Length > 0) 527if (namespaceName.Length > 0 && namespaceName != XmlReservedNs.NsXmlNs) 537if (namespaceName.Length > 0 && namespaceName != XmlReservedNs.NsXml) 555if (namespaceName.Length == 0) 570if (prefix.Length != 0) 681if (value.Length == 0) 797if (name.Length == 3 && string.Equals(name, "xml", StringComparison.OrdinalIgnoreCase)) 1155if (prefix.Length != 0)
System\Xml\Core\XmlWellFormedWriterHelpers.cs (3)
103if (prefix.Length == 0) 427if (((string)item.data).Length == 0) 468if (((string)item.data).Length == 0)
System\Xml\Core\XmlWellFormedWriterHelpersAsync.cs (1)
38if (prefix.Length == 0)
System\Xml\Core\XmlWriter.cs (1)
599if (prefix.Length == 0)
System\Xml\Core\XmlWriterAsync.cs (1)
567if (prefix.Length == 0)
System\Xml\Core\XsdCachingReader.cs (1)
722if (Ref.Equal(attribute.LocalName, atomizedName) && attribute.Prefix.Length == 0)
System\Xml\Core\XsdValidatingReader.cs (3)
2112_nsManager.AddNamespace(_coreReader.Prefix.Length == 0 ? string.Empty : _coreReader.LocalName, _coreReader.Value); 2221if (attrPrefix.Length == 0) 2267if (attrPrefix.Length == 0)
System\Xml\Core\XsdValidatingReaderAsync.cs (1)
610_nsManager.AddNamespace(_coreReader.Prefix.Length == 0 ? string.Empty : _coreReader.LocalName, _coreReader.Value);
System\Xml\Dom\DocumentSchemaValidator.cs (4)
189if (attr.Prefix.Length == 0) 354_nsManager.AddNamespace(attr.Prefix.Length == 0 ? string.Empty : attr.LocalName, attr.Value); 466if (defaultPrefix.Length != 0) 703_nsManager.AddNamespace(attr.Prefix.Length == 0 ? string.Empty : attr.LocalName, attr.Value);
System\Xml\Dom\DocumentXmlWriter.cs (2)
249if (prefix.Length == 0) 443throw new XmlException(SR.Xml_DupAttributeName, attr.Prefix.Length == 0 ? attr.LocalName : $"{attr.Prefix}:{attr.LocalName}");
System\Xml\Dom\DocumentXPathNavigator.cs (6)
384&& name.Length != 0) 428&& name.Length != 0) 1462if (localNameAtom.Length == 0) 1822string prefix = attribute.Prefix.Length == 0 ? string.Empty : attribute.LocalName; 2372Debug.Assert(localNameAtom.Length > 0); // Use DocumentXPathNodeIterator_ElemChildren_NoLocalName class for special magic value of localNameAtom 2402Debug.Assert(localNameAtom.Length > 0); // Use DocumentXPathNodeIterator_ElemChildren_AndSelf_NoLocalName if localName == String.Empty
System\Xml\Dom\XmlAttribute.cs (2)
29if (name.LocalName.Length == 0) 412if (_name.Prefix.Length == 0 && _name.LocalName == "xmlns") return string.Empty;
System\Xml\Dom\XmlCharacterData.cs (8)
75return _data.Length; 84int len = _data != null ? _data.Length : 0; 102int capacity = _data != null ? _data.Length : 0; 103if (strData != null) capacity += strData.Length; 120int capacity = _data != null ? _data.Length : 0; 121if (strData != null) capacity += strData.Length; 138int len = _data != null ? _data.Length : 0; 164int len = _data != null ? _data.Length : 0;
System\Xml\Dom\XmlDeclaration.cs (6)
25if ((standalone != null) && (standalone.Length > 0)) 62else if (value.Length == 0 || value == YES || value == NO) 86if (Encoding.Length > 0) 92if (Standalone.Length > 0) 179return ver.Length >= 3 && ver[0] == '1' && ver[1] == '.' && XmlCharType.IsOnlyDigits(ver, 2, ver.Length - 2);
System\Xml\Dom\XmlDocument.cs (11)
207if (endPos < name.Length) 216Debug.Assert((prefix == null) ? (n.Prefix.Length == 0) : (prefix == n.Prefix)); 218Debug.Assert((namespaceURI == null) ? (n.NamespaceURI.Length == 0) : (n.NamespaceURI == namespaceURI)); 225Debug.Assert(n == null || ((prefix == null) ? (n.Prefix.Length == 0) : (prefix == n.Prefix))); 227Debug.Assert(n == null || ((namespaceURI == null) ? (n.NamespaceURI.Length == 0) : (n.NamespaceURI == namespaceURI))); 234Debug.Assert((prefix == null) ? (xmlName.Prefix.Length == 0) : (prefix == xmlName.Prefix)); 236Debug.Assert((namespaceURI == null) ? (xmlName.NamespaceURI.Length == 0) : (xmlName.NamespaceURI == namespaceURI)); 244if ((oPrefix == (object)strXmlns || (xmlName.Prefix.Length == 0 && oLocalName == (object)strXmlns)) ^ (oNamespaceURI == (object)strReservedXmlns)) 611if (prefix == strXmlns || (prefix.Length == 0 && localName == strXmlns)) 1353if (value.Length > 0) 1438if (Standalone!.Length == 0)
System\Xml\Dom\XmlElement.cs (1)
30if (name.LocalName.Length == 0)
System\Xml\Dom\XmlEntityReference.cs (4)
189if (nCount > 0 && nCount < baseURI.Length) 194return string.Create(buf.Length + systemId.Length, (buf, systemId), (dest, state) => 197state.systemId.AsSpan().Replace(dest.Slice(state.buf.Length), '\\', '/');
System\Xml\Dom\XmlLoader.cs (2)
705else if (!bHasDefXmlnsAttr && attr.Prefix.Length == 0 && attr.LocalName == _doc.strXmlns) 828else if (attr.Prefix.Length == 0 && attr.LocalName == _doc.strXmlns)
System\Xml\Dom\XmlName.cs (2)
90if (_prefix.Length > 0) 92if (_localName.Length > 0)
System\Xml\Dom\XmlNode.cs (4)
1097if (pref.Length == 0) 1102if (attr.Prefix.Length == 0) 1185if (attr.Prefix.Length == 0) 1288if (-1 == colonPos || 0 == colonPos || name.Length - 1 == colonPos)
System\Xml\Dom\XmlNodeReader.cs (11)
518XmlNodeType.XmlDeclaration => (ns.Length == 0) ? GetDeclarationAttr((XmlDeclaration)_curNode, name) : null, 519XmlNodeType.DocumentType => (ns.Length == 0) ? GetDocumentTypeAttr((XmlDocumentType)_curNode, name) : null, 640if (ns.Length == 0) 667else if (nt == XmlNodeType.XmlDeclaration && namespaceURI.Length == 0) 675else if (nt == XmlNodeType.DocumentType && namespaceURI.Length == 0) 867string attrName = prefix.Length == 0 ? 894if (prefix.Length == 0) 935if (namespaceName.Length == 0) 954if (a.Prefix.Length == 0 && a.LocalName == "xmlns") 1004if (a.LocalName == "xmlns" && a.Prefix.Length == 0) 1764if (ns != null && ns.Length == 0)
System\Xml\NameTable.cs (2)
58int len = key.Length; 119if (value.Length == 0)
System\Xml\Schema\Asttree.cs (6)
192if (!((URN == null) || (URN.Length == 0))) 198else if ((thisURN.Length != 0) && (thisURN != URN)) 203if ((thisname.Length != 0) && (thisname != name)) 547if ((xPath == null) || (xPath.Length == 0)) 692if (axis.Prefix.Length != 0) 701else if (axis.Name.Length != 0)
System\Xml\Schema\BaseProcessor.cs (1)
57if (qname.Name.Length == 0)
System\Xml\Schema\BaseValidator.cs (1)
233if (textString.Length == 0)
System\Xml\Schema\Chameleonkey.cs (3)
34if (chameleonLocation.OriginalString.Length == 0) 66Debug.Assert((chameleonLocation.OriginalString.Length == 0 && originalSchema != null) 67|| (chameleonLocation.OriginalString.Length != 0 && originalSchema == null));
System\Xml\Schema\ContentValidator.cs (3)
1633if (s.Length != 0) 1782if (s.Length != 0) 2059if (s.Length != 0)
System\Xml\Schema\DtdParser.cs (22)
289if (systemId != null && systemId.Length > 0) 299if (publicId != null && publicId.Length > 0) 309if (internalSubset != null && internalSubset.Length > 0) 469if (_systemId != null && _systemId.Length > 0) 484if (_systemId != null && _systemId.Length > 0) 682if (attrDef != null && attrDef.Prefix.Length > 0 && attrDef.Prefix.Equals("xml") && attrDef.Name.Name == "space") 706if (attrDef.Prefix.Length > 0 && attrDef.Prefix.Equals("xml")) 944SendValidationEvent(_curPos - name.Name.Length, XmlSeverityType.Error, SR.Sch_DupElementDecl, GetNameString()); 1228entity.DeclaredURI = (_externalDtdBaseUri.Length == 0) ? _documentBaseUri : _externalDtdBaseUri; 1323SendValidationEvent(_curPos - notationName.Name.Length, XmlSeverityType.Error, SR.Sch_DupNotation, notationName.Name); 1353UndeclaredNotation un = new UndeclaredNotation(notationName, LineNo, LinePos - notationName.Length); 1483Throw(_curPos - systemId.Length - 1, SR.Xml_FragmentId, new string[] { systemId.Substring(systemId.IndexOf('#')), systemId }); 1501ThrowInvalidChar(_curPos - 1 - publicId.Length + i, publicId, i); 3257Throw(_curPos - entityName.Name.Length - 1, SR.Xml_InvalidParEntityRef); 3267Throw(_curPos - entityName.Name.Length - 1, paramEntity ? SR.Xml_RecursiveParEntity : SR.Xml_RecursiveGenEntity, entityName.Name); 3281if (entity.Text!.Length == 0) 3360SendValidationEvent(_curPos - entityName.Name.Length - 1, XmlSeverityType.Error, SR.Xml_UndeclaredParEntity, entityName.Name); 3369SendValidationEvent(_curPos - entityName.Name.Length - 1, XmlSeverityType.Error, SR.Xml_UndeclaredEntity, entityName.Name); 3374Throw(_curPos - entityName.Name.Length - 1, SR.Xml_UndeclaredEntity, entityName.Name); 3382Throw(_curPos - entityName.Name.Length - 1, SR.Xml_UnparsedEntityRef, entityName.Name); 3387Throw(_curPos - entityName.Name.Length - 1, SR.Xml_ExternalEntityInAttValue, entityName.Name); 3539int len = value.Length;
System\Xml\Schema\DtdParserAsync.cs (12)
113if (_systemId != null && _systemId.Length > 0) 128if (_systemId != null && _systemId.Length > 0) 326if (attrDef != null && attrDef.Prefix.Length > 0 && attrDef.Prefix.Equals("xml") && attrDef.Name.Name == "space") 350if (attrDef.Prefix.Length > 0 && attrDef.Prefix.Equals("xml")) 588SendValidationEvent(_curPos - name.Name.Length, XmlSeverityType.Error, SR.Sch_DupElementDecl, GetNameString()); 859entity.DeclaredURI = (_externalDtdBaseUri.Length == 0) ? _documentBaseUri : _externalDtdBaseUri; 957SendValidationEvent(_curPos - notationName.Name.Length, XmlSeverityType.Error, SR.Sch_DupNotation, notationName.Name); 1108Throw(_curPos - systemId.Length - 1, SR.Xml_FragmentId, new string[] { systemId.Substring(systemId.IndexOf('#')), systemId }); 1126ThrowInvalidChar(_curPos - 1 - publicId.Length + i, publicId, i); 2587Throw(_curPos - entityName.Name.Length - 1, SR.Xml_InvalidParEntityRef); 2597Throw(_curPos - entityName.Name.Length - 1, paramEntity ? SR.Xml_RecursiveParEntity : SR.Xml_RecursiveGenEntity, entityName.Name); 2614if (entity.Text!.Length == 0)
System\Xml\Schema\FacetChecker.cs (3)
703int length = pattern.Length; 1361int length = value.Length; 1504int length = strValue.Length;
System\Xml\Schema\Inference\Infer.cs (62)
247if (ns.Length != 0) 324if (childURI.Length == 0) 340if (childURI.Length != 0) 344if (prefix.Length != 0 && !string.Equals(prefix, "xml", StringComparison.OrdinalIgnoreCase)) 356if (childURI!.Length != 0) //BUGBUG It need not be an attribute reference if there is a namespace, it can be attribute with attributeFormDefault = qualified 468if (childURI.Length != 0) 483Debug.Assert(targetNS == null || targetNS.Length > 0, "targetns for schema is empty"); 539if (prefix.Length != 0) 1041if (childURI.Length == 0) 1423if (attr.RefName.Name.Length == 0) 1751if (s.Length == 0) return TF_string; 1778if (i == s.Length) 1797i++; if (i == s.Length) return TF_decimal | TF_float | TF_double | TF_string; //"9999.9" was matched 1810i++; if (i == s.Length) return TF_string; 1823i++; if (i == s.Length) return TF_string; //".9999e+" was matched 1829i++; if (i == s.Length) return TF_float | TF_double | TF_string; //".9999e+99" was matched 1836i++; if (i == s.Length) return TF_string; 1852i++; if (i == s.Length) return TF_string; 1866i++; if (i == s.Length) return TF_string; 1877i++; if (i == s.Length) return TF_string; //"P999" was matched 1894if (i == s.Length) 1910i++; if (i == s.Length) return TF_string; //"P999Y9" was matched 1925if (i == s.Length) 1941i++; if (i == s.Length) return TF_string; //"P999Y999M9" was matched 1954if (i == s.Length) 1967i++; if (i == s.Length) return TF_string; //"P999Y999M9999DT" was matched 1973i++; if (i == s.Length) return TF_string; //"___T9" was matched 1992if (i == s.Length) 2002i++; if (i == s.Length) return TF_string; //"___T999H9" was matched 2019if (i == s.Length) 2029i++; if (i == s.Length) return TF_string; //"___T999H999M9" was matched 2044if (i == s.Length) 2054i++; if (i == s.Length) return TF_string; //"___T999H999M999.9" was matched 2067if (i == s.Length) 2085if (i == s.Length) 2116if (i == s.Length) 2145if (i == s.Length) 2170if (i == s.Length) 2198i++; if (i == s.Length) return TF_string; //"9999-" 2201i++; if (i == s.Length) return TF_string; //"9999-9" 2205if (i == s.Length) 2225i++; if (i == s.Length) return TF_string; //"9999-99-" 2228i++; if (i == s.Length) return TF_string; //"9999-99-9" 2231i++; if (i == s.Length) return DateTime(s, bDate, bTime); //"9999-99-99" 2251if (i == s.Length) 2266i++; if (i == s.Length) return TF_string; 2269i++; if (i == s.Length) return TF_string; 2272i++; if (i == s.Length) return TF_string; 2276i++; if (i == s.Length) return TF_string; 2279i++; if (i == s.Length) return TF_string; 2283if (i == s.Length) 2297i++; if (i == s.Length) return TF_string; 2300i++; if (i == s.Length) return TF_string; 2303i++; if (i == s.Length) return TF_string; 2307i++; if (i == s.Length) return TF_string; 2310i++; if (i == s.Length) return TF_string; 2313i++; if (i == s.Length) return TF_string; 2316i++; if (i == s.Length) return TF_string; 2319i++; if (i == s.Length) return TF_string; 2322i++; if (i == s.Length) return DateTime(s, bDate, bTime); 2337i++; if (i == s.Length) return TF_string; 2341i++; if (i == s.Length) return DateTime(s, bDate, bTime);
System\Xml\Schema\NamespaceList.cs (3)
32if (namespaces == "##any" || namespaces.Length == 0) 108return ns != _targetNamespace && ns.Length != 0; 146else if (s!.Length == 0)
System\Xml\Schema\Parser.cs (5)
188_namespaceManager.AddNamespace(_reader.Prefix.Length == 0 ? string.Empty : _reader.LocalName, _reader.Value); 354_annotationNSManager!.AddNamespace(r.Prefix.Length == 0 ? string.Empty : _reader.LocalName, _reader.Value); 367else if (ns.Length == 0) 379if (r.Prefix.Length != 0) 403if (prefix.Length == 0)
System\Xml\Schema\Preprocessor.cs (5)
530if (tns.Length == 0) 598if (importNS.Length == 0) 2084if (len != name.Length) 2103if (_currentSchema!.IsChameleon && value.Namespace.Length == 0) 2124if (location.Length == 0)
System\Xml\Schema\SchemaCollectionpreProcessor.cs (4)
295if (tns.Length == 0) 330else if (schema.TargetNamespace == null && targetNamespace != null && targetNamespace.Length == 0) 406if (ns.Length == 0) 1741if (len != name.Length)
System\Xml\Schema\SchemaInfo.cs (1)
161if (!ed.ContentValidator!.IsOpen || qname.Namespace.Length == 0)
System\Xml\Schema\SchemaNamespacemanager.cs (1)
31return prefix.Length == 0 ? string.Empty : null;
System\Xml\Schema\XdrBuilder.cs (7)
460if (prefixValue.Length != 0) 523Uri ruri = _xmlResolver.ResolveUri(_baseUri, uri.Substring(x_schema.Length)); 675if (gname.Namespace.Length == 0) 763if (s.Length == 0) 1286if (prefix.Length == 0) 1294else if (prefix.Length != 0) 1521ns.Length != 0 &&
System\Xml\Schema\XdrValidator.cs (6)
213_nsManager.AddNamespace(reader.Prefix.Length == 0 ? string.Empty : reader.LocalName, reader.Value); 339string url = uri.Substring(x_schema.Length); 475if (value.Length == 0) 505if (value.Length > decl.MaxLength) 512if (value.Length < decl.MinLength) 578if (value.Length == 0)
System\Xml\Schema\XmlAtomicValue.cs (1)
409if (len == 0 || len != value.Length)
System\Xml\Schema\XmlSchemaDataType.cs (2)
246if (uri.Length > 5 && uri.StartsWith("uuid:", StringComparison.Ordinal)) 250else if (uri.Length > 9 && uri.StartsWith("urn:uuid:", StringComparison.Ordinal))
System\Xml\Schema\XmlSchemaElement.cs (1)
229get { return _defaultValue != null && _defaultValue.Length > 0; }
System\Xml\Schema\XmlSchemaParticle.cs (1)
157return new XmlQualifiedName("*", ns.Length == 0 ? "##any" : ns);
System\Xml\Schema\XmlSchemaSet.cs (9)
833if (schemaUri == null || schemaUri.OriginalString.Length == 0) 863else if (tns.Length == 0) 1103if (_schemas.ContainsKey(currentSchema.SchemaId) || (baseUri != null && baseUri.OriginalString.Length != 0 && _schemaLocations[baseUri] != null)) 1109if (baseUri != null && baseUri.OriginalString.Length != 0) 1231if (_schemas.ContainsKey(schema.SchemaId) && (targetNamespace.Length == 0 || targetNamespace == schema.TargetNamespace)) 1247else if (targetNamespace.Length != 0 && targetNamespace != schema.TargetNamespace) 1268if (schemaUri == null || schemaUri.OriginalString.Length == 0) 1303if (reprocessList[i].BaseUri != null && reprocessList[i].BaseUri!.OriginalString.Length != 0) 1371if (qname.Name.Length == 0)
System\Xml\Schema\XmlSchemaValidator.cs (12)
538&& attQName.Namespace.Length != 0 1035if (attributeNS.Length > 0) 1422if (stringValue.Length == 0 && currentElementDecl.DefaultValueTyped != null) 1504if (typeName.Length == 0) 1515return value.Length > MaxLength 1828if (elementValue.Length == 0) 2148if (defaultPrefix.Length != 0) 2364if (typedValue != null && stringValue.Length != 0) 2685if (name.Namespace.Length != 0) 2725if (name.Namespace.Length != 0) 2760return (ns.Length != 0) ? $"{ns}:{localName}" : localName; 2770if (ns.Length != 0)
System\Xml\Schema\XmlValueConverter.cs (2)
490if (name.Namespace.Length == 0) 772return (prefix.Length != 0) ? $"{prefix}:{qname.Name}" : qname.Name;
System\Xml\Schema\XsdBuilder.cs (2)
749if ((ns != _schemaNames.NsXs) && (ns.Length != 0)) 2545if (r == (int)XmlSchemaDerivationMethod.All && value.Length > HashAllLength)
System\Xml\Schema\XsdDateTime.cs (23)
88private static readonly int s_lzyyyy = "yyyy".Length; 89private static readonly int s_lzyyyy_ = "yyyy-".Length; 90private static readonly int s_lzyyyy_MM = "yyyy-MM".Length; 91private static readonly int s_lzyyyy_MM_ = "yyyy-MM-".Length; 92private static readonly int s_lzyyyy_MM_dd = "yyyy-MM-dd".Length; 93private static readonly int s_lzyyyy_MM_ddT = "yyyy-MM-ddT".Length; 94private static readonly int s_lzHH = "HH".Length; 95private static readonly int s_lzHH_ = "HH:".Length; 96private static readonly int s_lzHH_mm = "HH:mm".Length; 97private static readonly int s_lzHH_mm_ = "HH:mm:".Length; 98private static readonly int s_lzHH_mm_ss = "HH:mm:ss".Length; 99private static readonly int s_Lz_ = "-".Length; 100private static readonly int s_lz_zz = "-zz".Length; 101private static readonly int s_lz_zz_ = "-zz:".Length; 102private static readonly int s_lz_zz_zz = "-zz:zz".Length; 103private static readonly int s_Lz__ = "--".Length; 104private static readonly int s_lz__mm = "--MM".Length; 105private static readonly int s_lz__mm_ = "--MM-".Length; 106private static readonly int s_lz__mm__ = "--MM--".Length; 107private static readonly int s_lz__mm_dd = "--MM-dd".Length; 108private static readonly int s_Lz___ = "---".Length; 109private static readonly int s_lz___dd = "---dd".Length; 758_length = text.Length;
System\Xml\Schema\XsdDuration.cs (2)
462length = s.Length; 643int offsetEnd = s.Length;
System\Xml\Schema\XsdValidator.cs (4)
285_nsManager.AddNamespace(reader.Prefix.Length == 0 ? string.Empty : reader.LocalName, reader.Value); 344if (!(stringValue.Length == 0 && context.ElementDecl.DefaultValueTyped != null)) 511&& attQName.Namespace.Length != 0 1054if (reader.TypedValueObject != null && stringValue.Length != 0)
System\Xml\Serialization\CodeIdentifier.cs (11)
31if (identifier.Length <= 2) 37return string.Create(identifier.Length, identifier, static (buffer, identifier) => 56if (identifier.Length <= 2) 62return string.Create(identifier.Length, identifier, static (buffer, identifier) => 81for (int i = 0; i < identifier.Length && builder.Length < MaxIdentifierLength; i++) 99if (identifier.Length > 30) 230if (ns != null && ns.Length > 0) 263identifier = identifier.Substring(0, identifier.Length - 2); 265if (identifier.Length > 0) 294separator += names[i].Length; 298if (sb.Length != originalIdentifier.Length)
System\Xml\Serialization\CodeIdentifiers.cs (1)
109if (identifier.Length > CodeIdentifier.MaxIdentifierLength)
System\Xml\Serialization\Compilation.cs (2)
200else if (assemblyAttribute.CodeBase != null && assemblyAttribute.CodeBase.Length > 0) 612if (encodingStyle != null && encodingStyle.Length > 0)
System\Xml\Serialization\Mappings.cs (3)
119if (colon == 0 || colon == name.Length - 1) 259Name = Name.Substring("xml:".Length); 1154if (s.TargetNamespace != null && s.TargetNamespace.Length > 0)
System\Xml\Serialization\ReflectionXmlSerializationReader.cs (3)
210if (mapping.Elements[j].Any && mapping.Elements[j].Name.Length == 0) 885if (element.Any && element.Name.Length == 0) 2069xmlnsMember.XmlnsSource(Reader.Name.Length == 5 ? string.Empty : Reader.LocalName, Reader.Value);
System\Xml\Serialization\ReflectionXmlSerializationWriter.cs (6)
290string? ns = element.Any && element.Name.Length == 0 ? null : (element.Form == XmlSchemaForm.Qualified ? element.Namespace : string.Empty); 370if (element.Name != null && element.Name.Length > 0) 466if (element.Any && element.Name.Length == 0) 497if (element.Any && element.Name.Length == 0) 552string? ns = element.Any && element.Name.Length == 0 ? null : (element.Form == XmlSchemaForm.Qualified ? (writeAccessor ? element.Namespace : element.Mapping!.Namespace) : string.Empty); 1288if (value is string && ((string)value).Length == 0)
System\Xml\Serialization\SchemaObjectWriter.cs (1)
258if (s.Length == 0)
System\Xml\Serialization\SoapReflectionImporter.cs (7)
165if (dataType.Length > 0) 532if (dataType.Length > 0) 599constant.XmlName = a.SoapEnum.Name.Length == 0 ? model.Name : a.SoapEnum.Name; 703attribute.Name = Accessor.EscapeQName(a.SoapAttribute == null || a.SoapAttribute.AttributeName.Length == 0 ? accessorName : a.SoapAttribute.AttributeName); 718element.Name = XmlConvert.EncodeLocalName(a.SoapElement == null || a.SoapElement.ElementName.Length == 0 ? accessorName : a.SoapElement.ElementName); 766if (typeDesc.IsPrimitive && typeDesc.DataType != null && typeDesc.DataType.Name != null && typeDesc.DataType.Name.Length > 0) 775if (a.SoapType != null && a.SoapType.TypeName.Length > 0)
System\Xml\Serialization\Xmlcustomformatter.cs (2)
491if (value.Length == 0) 512else if (validate && parts[i].Length > 0)
System\Xml\Serialization\XmlReflectionImporter.cs (26)
282if (root.ElementName.Length > 0) 314if (accessor.Any && accessor.Name.Length == 0) 402if (dataType.Length > 0) 966if (typeDesc.IsPrimitive && typeDesc.DataType != null && typeDesc.DataType.Name != null && typeDesc.DataType.Name.Length > 0) 975if (a.XmlType != null && a.XmlType.TypeName.Length > 0) 1168if (dataType.Length > 0) 1358if (structAttrs.XmlRoot.ElementName.Length > 0) 1373if (xmlElement.ElementName.Length == 0) 1523arrayItemElement.Name = xmlArrayItem.ElementName.Length == 0 ? arrayItemElement.Mapping.DefaultElementName : XmlConvert.EncodeLocalName(xmlArrayItem.ElementName); 1606attribute.Name = Accessor.EscapeQName(a.XmlAttribute.AttributeName.Length == 0 ? accessorName : a.XmlAttribute.AttributeName); 1671element.Name = XmlConvert.EncodeLocalName(xmlElement.ElementName.Length == 0 ? accessorName : xmlElement.ElementName); 1676element.Name = xmlElement.ElementName.Length == 0 ? element.Mapping.DefaultElementName : XmlConvert.EncodeLocalName(xmlElement.ElementName); 1707string anyName = xmlAnyElement.Name.Length == 0 ? xmlAnyElement.Name : XmlConvert.EncodeLocalName(xmlAnyElement.Name); 1726if (element.Name.Length > 0) 1762arrayElement.Name = XmlConvert.EncodeLocalName(a.XmlArray.ElementName.Length == 0 ? accessorName : a.XmlArray.ElementName); 1799attribute.Name = Accessor.EscapeQName(a.XmlAttribute.AttributeName.Length == 0 ? accessorName : a.XmlAttribute.AttributeName); 1843element.Name = XmlConvert.EncodeLocalName(xmlElement.ElementName.Length == 0 ? accessorName : xmlElement.ElementName); 1913element.Name = XmlConvert.EncodeLocalName(xmlElement.ElementName.Length == 0 ? accessorName : xmlElement.ElementName); 1917element.Name = xmlElement.ElementName.Length == 0 ? element.Mapping.DefaultElementName : XmlConvert.EncodeLocalName(xmlElement.ElementName); 1949string anyName = xmlAnyElement.Name.Length == 0 ? xmlAnyElement.Name : XmlConvert.EncodeLocalName(xmlAnyElement.Name); 1969if (element.Name.Length > 0) 2017if (element.Any && element.Name.Length == 0) 2020if (xmlName.Substring(0, xmlName.Length - 1) == anyNs) 2044if (element.Any && element.Name.Length == 0) 2051string id = element.Namespace != null && element.Namespace.Length > 0 ? $"{element.Namespace}:{element.Name}" : element.Name; 2326if (typeName.Length == 0)
System\Xml\Serialization\XmlSchemaExporter.cs (7)
49if (type != null && type.Name != null && type.Name.Length > 0) 168if (members.Count == 1 && members[0].Any && members[0].ElementName.Length == 0) 235if (accessor.Any && accessor.Name.Length == 0) 308if (ns != null && ns.Length > 0) 448if (serializableMapping.NamespaceList.Length > 0) 799if (accessor.Any && accessor.Name.Length == 0) 804if (accessor.Namespace != null && accessor.Namespace.Length > 0 && accessor.Namespace != ns)
System\Xml\Serialization\XmlSchemaImporter.cs (6)
282if (element.Name!.Length == 0) 288if (identifier.Length == 0) 1103if (identifier.Length == 0) 1614if (attribute.Name!.Length == 0) throw new InvalidOperationException(SR.XmlAttributeHasNoName); 1615if (identifier.Length == 0) 1745if (dataType.Name != null && dataType.Name.Length > 0)
System\Xml\Serialization\XmlSerializationReader.cs (16)
799if (name.Length == 5) return true; 990if (value.Length == 0) 995int charsLength = value.Length; 1060if (itemType != null && itemType.Length > 0) 1066if (arraySize != null && arraySize.Length > 0) 1075if (dimensions[i].Length > 0) 1624if (arrayInfo.qname.Length > 0) 1726if (_r.NamespaceURI.Length != 0) 2609if (mapping.Elements[j].Any && mapping.Elements[j].Name.Length == 0) 3604if (member.Mapping.CheckSpecified == SpecifiedAccessor.ReadWrite && member.CheckSpecifiedSource != null && member.CheckSpecifiedSource.Length > 0) 3710if (name != null && name.Length > 0) 3921if (member.Mapping.CheckSpecified == SpecifiedAccessor.ReadWrite && member.CheckSpecifiedSource != null && member.CheckSpecifiedSource.Length > 0) 4079bool checkType = (checkTypeHrefsSource != null && checkTypeHrefsSource.Length > 0); 4254if (element.Any && element.Name.Length == 0) 4278bool checkType = checkTypeSource != null && checkTypeSource.Length > 0; 4739if (checkSpecified != null && checkSpecified.Length > 0)
System\Xml\Serialization\XmlSerializationReaderILGen.cs (4)
548if (mapping.Elements[j].Any && mapping.Elements[j].Name.Length == 0) 2188if (member.Mapping.CheckSpecified == SpecifiedAccessor.ReadWrite && member.CheckSpecifiedSource != null && member.CheckSpecifiedSource.Length > 0) 2543if (element.Any && element.Name.Length == 0) 3171if (checkSpecified != null && checkSpecified.Length > 0)
System\Xml\Serialization\XmlSerializationWriter.cs (20)
499else if (prefix.Length == 0) 567if (writePrefixed && prefix == null && ns != null && ns.Length > 0) 588if (alias.Length == 0 && string.IsNullOrEmpty(aliasNs)) 592if (alias.Length > 0) 601if (prefix == null && alias.Length == 0) 614int prefixLength = prefix.Length; 618if (qname.Name.Length > prefixLength) 621if (name.Length > prefixLength && name.Length <= prefixLength + MaxInt32.Length && name.StartsWith(prefix, StringComparison.Ordinal)) 624for (int j = prefixLength; j < name.Length; j++) 842if (node is XmlElement && name != null && name.Length > 0) 1302if (_soap12 && name != null && name.Length > 0) 1443WriteStartElement(name.Length == 0 ? entry.typeName! : name!, ns ?? entry.typeNs, null, true); 2055if (cast != null && cast.Length > 0) 3740if (element.Name != null && element.Name.Length > 0) 3978string? ns = element.Any && element.Name.Length == 0 ? null : (element.Form == XmlSchemaForm.Qualified ? (writeAccessor ? element.Namespace : element.Mapping!.Namespace) : ""); 4264if (value is string && ((string)value).Length == 0) 4538if (element.Any && element.Name.Length == 0) 4568if (element.Any && element.Name.Length == 0)
System\Xml\Serialization\XmlSerializationWriterILGen.cs (8)
1640if (element.Name != null && element.Name.Length > 0) 1942string? ns = element.Any && element.Name.Length == 0 ? null : (element.Form == XmlSchemaForm.Qualified ? (writeAccessor ? element.Namespace : element.Mapping!.Namespace) : ""); 2125if (value is string && ((string)value).Length == 0) 2291if (element.Any && element.Name.Length == 0) 2317if (element.Any && element.Name.Length == 0) 2631for (i = 0; i < value.Length; i++) 2640if (i == value.Length) 2651for (; i < value.Length; i++)
System\Xml\Serialization\XmlSerializer.cs (2)
391if (encodingStyle != null && encodingStyle.Length > 0) 493if (encodingStyle != null && encodingStyle.Length > 0)
System\Xml\Serialization\XmlSerializerNamespaces.cs (2)
67if (prefix != null && prefix.Length > 0) 70if (ns != null && ns.Length > 0)
System\Xml\ValidateNames.cs (38)
38Debug.Assert(s != null && offset <= s.Length); 42while (i < s.Length) 69Debug.Assert(s != null && offset <= s.Length); 73while (i < s.Length) 92return endPos > 0 && endPos == s.Length; 107Debug.Assert(s != null && offset <= s.Length); 111if (i < s.Length) 123while (i < s.Length) 143return endPos > 0 && endPos == s.Length; 157Debug.Assert(s != null && offset <= s.Length); 161if (i < s.Length) 173while (i < s.Length) 213if (len == 0 || len != s.Length) 246if ((uint)offset < (uint)s.Length && s[offset] == ':') 271if (len == 0 || len != s.Length) 323if ((uint)len < (uint)s.Length && s[len] == ':') 328if ((uint)offset < (uint)s.Length && s[offset] == '*') 357if (len == 0 || len != s.Length) 373if (offsetStartChar >= s.Length) 376Debug.Assert(offsetBadChar < s.Length); 393if (offsetStartChar >= s.Length) 396Debug.Assert(offsetBadChar < s.Length); 458if (prefix.Length != 0) 464if (localName.Length != 0) 478if (localName.Length == 0) 487if (ns.Length == 0 && localName.Equals("xmlns")) 496if (localName.Length == 0 || (localName.Length == 3 && StartsWithXml(localName))) 505if (localName.Length != 0) 522if (ns.Length == 0) 525if (prefix.Length != 0) 534if (prefix.Length == 0 && nodeKind == XPathNodeType.Attribute) 566if (prefix.Length != 0 || ns.Length != 0) 575if (prefix.Length != 0 || ns.Length != 0) 592return (prefix.Length != 0) ? $"{prefix}:{localName}" : localName; 607else if (0 == colonPos || (name.Length - 1) == colonPos)
System\Xml\XmlCharType.cs (2)
169Debug.Assert(startPos <= str.Length); 170Debug.Assert(startPos + len <= str.Length);
System\Xml\XmlComplianceUtil.cs (3)
17int len = value.Length; 98int len = value.Length; 152int len = value.Length;
System\Xml\XmlConvert.cs (18)
97int length = name.Length; 179int length = name.Length; 319if (endPos != name.Length) 337if (endPos != name.Length) 353if (endPos != name.Length) 376if (end != name.Length) 389if (len == 0 || len != name.Length) 450if (name.Length == 0) 457if (endPos != name.Length) 473if (endPos != name.Length) 782if (s.Length != 1) 1312if (s.Length == 0 || s.Contains("##")) 1331if (s != null && s.Length > 0) 1334if (s.Length == 0 || s.Contains("##")) 1402int len = data.Length; 1483while (i < value.Length) 1488sb ??= new StringBuilder(value.Length + 4); 1643charsWritten = valueAsString.Length;
System\Xml\XmlException.cs (1)
222return BuildCharExceptionArgs(data[invCharIndex], invCharIndex + 1 < data.Length ? data[invCharIndex + 1] : '\0');
System\Xml\XmlNamespacemanager.cs (4)
257if (uri.Length > 0 || prefix.Length > 0 || scope == XmlNamespaceScope.Local) 348if (prefix.Length > 0 || _nsdecls[thisDecl].uri!.Length > 0)
System\Xml\XmlQualifiedName.cs (5)
62public bool IsEmpty => Name.Length == 0 && Namespace.Length == 0; 68return Namespace.Length == 0 ? Name : $"{Namespace}:{Name}"; 136if (Namespace.Length != 0) 155if (prefix.Length != 0)
System\Xml\XmlResolver.cs (2)
43if (baseUri == null || (!baseUri.IsAbsoluteUri && baseUri.OriginalString.Length == 0)) 46if (!uri.IsAbsoluteUri && uri.OriginalString.Length > 0)
System\Xml\XPath\Internal\BaseAxisQuery.cs (5)
39_nameTest = prefix.Length != 0 || name.Length != 0; 87if (_name.Equals(e.LocalName) || _name.Length == 0) 121if (_name.Length != 0) 125if (_prefix.Length != 0)
System\Xml\XPath\Internal\BooleanFunctions.cs (4)
51return str.Length > 0; 83(lang.Length == str.Length || lang[str.Length] == '-')
System\Xml\XPath\Internal\CompiledXPathExpr.cs (1)
125if (prefix.Length == 0)
System\Xml\XPath\Internal\ExtensionQuery.cs (1)
122protected string QName { get { return prefix.Length != 0 ? $"{prefix}:{name}" : name; } }
System\Xml\XPath\Internal\FilterQuery.cs (2)
68if (value is string) return ((string)value).Length != 0; 148return (((string)_cond.Evaluate(new XPathSingletonIterator(current, /*moved:*/true))).Length != 0) ? context : null;
System\Xml\XPath\Internal\FunctionQuery.cs (1)
98if (name != "key" && prefix.Length != 0)
System\Xml\XPath\Internal\NamespaceQuery.cs (2)
59if (e.Value.Length == 0) 61Debug.Assert(e.LocalName.Length == 0, "Only xmlns='' can have empty string as a value");
System\Xml\XPath\Internal\QueryBuilder.cs (4)
59if (root.Prefix.Length > 0) 191if ((root.NodeType == XPathNodeType.All || root.NodeType == XPathNodeType.Element || root.NodeType == XPathNodeType.Attribute) && root.Prefix.Length == 0) 424if (!_allowCurrent && root.Name == "current" && root.Prefix.Length == 0) 428if (!_allowKey && root.Name == "key" && root.Prefix.Length == 0)
System\Xml\XPath\Internal\StringFunctions.cs (8)
150if (s2.Length == 0) { return s2; } 160if (s2.Length == 0) { return s1; } 162return (idx < 0) ? string.Empty : s1.Substring(idx + s2.Length); 171if (double.IsNaN(num) || str1.Length <= num) 192double maxlength = str1.Length - num; 210return _argList[0].Evaluate(nodeIterator).ToString()!.Length; 213return nodeIterator.Current.Value.Length; 269if (index < mapTo.Length)
System\Xml\XPath\Internal\XPathAxisIterator.cs (1)
82(name.Length == 0 || name == nav.LocalName) &&
System\Xml\XPath\Internal\XPathParser.cs (4)
227_scanner.Prefix.Length == 0 && 522if (prefix.Length == 0) 657if (_scanner.Prefix.Length == 0) 766_scanner.Prefix.Length == 0 &&
System\Xml\XPath\Internal\XPathScanner.cs (2)
43Debug.Assert(0 <= _xpathExprIndex && _xpathExprIndex <= _xpathExpr.Length); 47if ((uint)index < (uint)expr.Length)
System\Xml\XPath\XPathDocument.cs (1)
207if (reader.Prefix.Length == 0)
System\Xml\XPath\XPathNavigator.cs (7)
421if (prefix.Length == 0) 496if (prefix.Length != 0 || ns.Length != 0 || scope == XmlNamespaceScope.Local) 1338if (LocalName.Length == 0) 1431if (value.Length != 0) 2052if (reader.Prefix.Length == 0) 2113if (reader.Prefix.Length == 0)
System\Xml\XPath\XPathNavigatorReader.cs (5)
217if (_nav.NodeType == XPathNodeType.Namespace && _nav.LocalName.Length == 0) 231if (_nav.NodeType == XPathNodeType.Namespace && _nav.LocalName.Length != 0) 432if (0 == prefix.Length) 716if ((IsXmlnsNoPrefix = (0 == prefix.Length && localname == "xmlns")) 730else if (0 == prefix.Length)
System\Xml\Xsl\IlGen\OptimizerPatterns.cs (1)
279if (s.Length != 0)
System\Xml\Xsl\IlGen\XmlILConstructAnalyzer.cs (1)
1066if (nd.NodeType == QilNodeType.AttributeCtor && ns.Length == 0 ||
System\Xml\Xsl\IlGen\XmlILOptimizerVisitor.cs (2)
186if (((QilInvokeEarlyBound)node).Name.NamespaceUri.Length != 0) 1584return Replace(XmlILOptimization.EliminateStrLength, local0, VisitLiteralInt32(f.LiteralInt32(local2.Length)));
System\Xml\Xsl\IlGen\XmlIlVisitor.cs (5)
1513if (delimiter.NodeType == QilNodeType.LiteralString && ((string)(QilLiteral)delimiter).Length == 0) 3630if (ndName.NamespaceUri.Length == 0) 3656if (ndName.NamespaceUri.Length == 0) 3722else if (ndName.NamespaceUri.Length != 0 && !clrTypeRetSrc.IsValueType) 4127if (ndLiteralName.NamespaceUri.Length == 0)
System\Xml\Xsl\QIL\QilName.cs (3)
71if (_prefix.Length == 0) 137if (_prefix.Length == 0) 139if (_uri.Length == 0)
System\Xml\Xsl\QIL\QilReference.cs (1)
48if (value.Length > MaxDebugNameLength)
System\Xml\Xsl\QIL\QilXmlWriter.cs (1)
365_len = _zero = prefix.Length;
System\Xml\Xsl\Runtime\ContentIterators.cs (2)
210if (context.LocalName.Length != 0 || context.Value.Length != 0)
System\Xml\Xsl\Runtime\DecimalFormatter.cs (6)
44if (formatPicture.Length == 0) 66for (int i = 0; i < formatPicture.Length; i++) 167pos = formatPicture.Length - 1; 253StringBuilder builder = new StringBuilder(result.Length); 255for (int i = 0; i < result.Length; i++) 266Debug.Assert(i + 1 < result.Length);
System\Xml\Xsl\Runtime\XmlCollation.cs (2)
184if (lang.Length == 0) 219if (query.Length != 0)
System\Xml\Xsl\Runtime\XmlExtensionFunction.cs (1)
258if (_namespaceUri!.Length == 0)
System\Xml\Xsl\Runtime\XmlQueryOutput.cs (16)
222if (prefix.Length == 5 && prefix == "xmlns") 236if (ns.Length != 0 && _depth != 0) 541Debug.Assert(prefix.Length == 0 || ns.Length != 0); 553if (ns.Length == 0 && prefix.Length == 0) 725throw new XslTransformException(SR.XmlIl_NmspConflict, new string[] { prefix.Length == 0 ? "" : ":", prefix, ns, nsExisting }); 1221if (navigator.NamespaceURI.Length == 0) 1223Debug.Assert(navigator.LocalName.Length != 0, "xmlns:foo='' isn't allowed"); 1350Debug.Assert(prefix.Length != 0 && ns.Length != 0); 1413if (isElemPrefix || genPrefix.Length != 0) 1422if (isElemPrefix || genPrefix.Length != 0) 1504Debug.Assert(ValidateNames.ParseNCName(name.Name, 0) == name.Name.Length); 1507prefix = (name.Namespace.Length != 0) ? RemapPrefix(string.Empty, name.Namespace, nodeType == XPathNodeType.Element) : string.Empty; 1526prefix = (ns.Length != 0) ? RemapPrefix(string.Empty, ns, nodeType == XPathNodeType.Element) : string.Empty;
System\Xml\Xsl\Runtime\XmlQueryRuntime.cs (1)
415if (prefix.Length == 0)
System\Xml\Xsl\Runtime\XmlRawWriterWrapper.cs (1)
226if (prefix.Length == 0)
System\Xml\Xsl\Runtime\XslNumber.cs (9)
128Debug.Assert(groupingSeparator.Length <= 1); 133_groupingSize = groupingSeparator.Length > 0 ? groupingSize : 0; 135if (formatString == "1" || formatString.Length == 0) 151for (int idx = 0; idx <= formatString.Length; idx++) 154if (idx == formatString.Length || isAlphaNumeric != CharUtil.IsAlphaNumeric(formatString[idx])) 313int oldLen = str.Length; 319Debug.Assert(groupSeparator.Length == 1); 336char separator = groupSeparator.Length > 0 ? groupSeparator[0] : ' '; 341int oldPos = str.Length - 1;
System\Xml\Xsl\Runtime\XsltConvert.cs (1)
39return item.Value.Length != 0;
System\Xml\Xsl\Runtime\XsltFunctions.cs (24)
42if (s2.Length == 0) { return s2; } 50if (s2.Length == 0) { return s1; } 53return (idx < 0) ? string.Empty : s1.Substring(idx + s2.Length); 63else if (startIndex <= value.Length) 69Debug.Assert(value.Length < startIndex || double.IsNaN(startIndex)); 77if (startIndex >= value.Length) 87if (endIndex > value.Length) 89endIndex = value.Length; 91Debug.Assert(0 <= startIndex && startIndex <= endIndex && endIndex <= value.Length); 106for (idx = 0; idx < value.Length; idx++) 120sb = new StringBuilder(value.Length); 148sb = new StringBuilder(value.Length); 166if (mapString.Length == 0) 171StringBuilder sb = new StringBuilder(arg.Length); 173for (int i = 0; i < arg.Length; i++) 181else if (index < transString.Length) 202return (lang.Length == value.Length || lang[value.Length] == '-'); 379if (format.Length == 0) 397for (int idx = 0; idx < options.Length; idx++) 489if (len != name.Length) 508if (len != name.Length) 537if (lang.Length == 0)
System\Xml\Xsl\Runtime\XsltLibrary.cs (3)
148if (name.Namespace.Length == 0 || name.Namespace == XmlReservedNs.NsXslt) 235if (lang.Length == 0) 284if (lang.Length == 0)
System\Xml\Xsl\SourceLineInfo.cs (1)
87if (uriString.Length != 0 &&
System\Xml\Xsl\XmlQualifiedNameTest.cs (1)
125if (this.Namespace.Length == 0)
System\Xml\Xsl\XmlQueryType.cs (1)
646else if (name.Namespace.Length == 0)
System\Xml\Xsl\XPath\XPathBuilder.cs (2)
562if (prefix.Length == 0) 823if (nsUri.Length != 0)
System\Xml\Xsl\XPath\XPathCompileException.cs (3)
104AppendTrimmed(sb, queryString, endChar, queryString.Length - endChar, TrimType.Right); 114if (error != null && error.Length > 0) 116if (message.Length > 0)
System\Xml\Xsl\XPath\XPathParser.cs (1)
230return scanner.Prefix.Length == 0 && (
System\Xml\Xsl\XPath\XPathQilFactory.cs (1)
231? Boolean(((string)(QilLiteral)n).Length != 0)
System\Xml\Xsl\XPath\XPathScanner.cs (7)
93Debug.Assert(0 <= index && index <= _xpathExpr.Length); 100Debug.Assert(-1 <= _curIndex && _curIndex < _xpathExpr.Length); 102if (_curIndex < _xpathExpr.Length) 108Debug.Assert(_curIndex == _xpathExpr.Length); 426if (_prefix.Length != 0 || _name.Length > 3) 520SetSourceIndex(_xpathExpr.Length);
System\Xml\Xsl\XslException.cs (4)
85if (info != null && info.Length > 0) 206if (lineInfoMessage != null && lineInfoMessage.Length > 0) 208if (message.Length > 0 && !XmlCharType.IsWhiteSpace(message[message.Length - 1]))
System\Xml\Xsl\Xslt\Compiler.cs (4)
189if (prefix.Length == 0) 260return namespaceName.Length > 0 && namespaceName[0] == '\0'; 266return nsUri.Length > 0 && nsUri[0] == '\0'; 452Debug.Assert(characters.Length == 8);
System\Xml\Xsl\Xslt\OutputScopeManager.cs (1)
128_records[_lastRecord].prefix!.Length == 0 &&
System\Xml\Xsl\Xslt\QilGenerator.cs (16)
923if (prefix.Length != 0) 957if (name == "xmlns" || local == "xmlns" && nsUri.Length == 0) 987Debug.Assert(pos < source.Length); 991for (i = pos; i < source.Length; i++) 997if (i + 1 < source.Length && source[i + 1] == ch) 1012pos = source.Length; 1023Debug.Assert(i == source.Length || source[i] == '{'); 1040while (pos < source.Length) 1047if (pos < source.Length) 2046if (value.Length != 1) 2338XPathCompileException e = new XPathCompileException(expr, 0, expr.Length, SR.XPath_NodeSetExpected, null); 2368pos = expr.Length; 2503if (ignoreDefaultNs && recPrefix.Length == 0) 2687string attMode = (mode.LocalName.Length == 0) ? string.Empty : $" mode=\"{mode.QualifiedName}\""; 2766if (ignoreDefaultNs && prefix.Length == 0) 2775if (prefix.Length == 0)
System\Xml\Xsl\Xslt\QilGeneratorEnv.cs (5)
104if (prefix.Length == 0) 262if (ignoreDefaultNs && prefix.Length == 0) 271if (prefix.Length != 0) 324if (nsUri.Length == 0) 710if (qname.Namespace.Length == 0 || qname.Namespace == XmlReservedNs.NsXslt)
System\Xml\Xsl\Xslt\XPathPatternBuilder.cs (1)
291Debug.Assert(prefix.Length == 0);
System\Xml\Xsl\Xslt\XPathPatternParser.cs (2)
92if (_scanner.CanBeFunction && _scanner.Prefix.Length == 0 && (_scanner.Name == "id" || _scanner.Name == "key")) 125Debug.Assert(_scanner.Prefix.Length == 0);
System\Xml\Xsl\Xslt\XslAst.cs (1)
210if (Mode.LocalName.Length != 0)
System\Xml\Xsl\Xslt\XslAstAnalyzer.cs (6)
914while (pos < source.Length) 922if (pos < source.Length && source[pos] == '{') 927if (pos < source.Length) 961if (prefix.Length == 0) 1071if (prefix.Length == 0) 1281for (int t = 2; t < xpath.Length; t += 2)
System\Xml\Xsl\Xslt\XsltInput.cs (14)
285else if (rec.prefix.Length == 0 && Ref.Equal(rec.localName, _atoms.Xmlns)) 307int nameLength = ((rec.prefix.Length != 0) ? rec.prefix.Length + 1 : 0) + rec.localName.Length; 333int correction = ((_reader.NodeType == XmlNodeType.EndEntity) ? 1 : lastText.Length) + 1; 403if (local.Length > 0 && ( 581return qn._prefix.Length == 0 ? qn._localName : (qn._prefix + ':' + qn._localName); 950if (value.Length != 0) 965if (list[idx].Length == 0 && _compiler.Version != 1 && !BackwardCompatibility) 1002if (Value.Length != 0) 1077return new SourceLineInfo(Uri, new Location(line, pos), new Location(line, pos + QualifiedName.Length)); 1102if (prefix.Length == 0) 1155_elemNameLength = input.QualifiedName.Length; 1215public string QualifiedName { get { return prefix.Length == 0 ? localName : $"{prefix}:{localName}"; } }
System\Xml\Xsl\Xslt\XsltLoader.cs (7)
191Uri? resolvedBaseUri = (baseUri.Length != 0) ? _xmlResolver.ResolveUri(null, baseUri) : null; 1019if (_input.Value.Length == 0) 1031if (_input.Value.Length == 0) 1294if (_input.Value.Length == 0) 2756if (ignoreDefaultNs && prefix.Length == 0) 2867else if (prefix.Length == 0) 2938if (_input.Value.Length == 1)
System\Xml\Xsl\XsltOld\AttributeAction.cs (1)
41if (qname.Prefix.Length == 3)
System\Xml\Xsl\XsltOld\BeginEvent.cs (1)
49if (_nodeType == XPathNodeType.Attribute && _namespaceUri.Length == 0)
System\Xml\Xsl\XsltOld\BuilderInfo.cs (3)
98if (prefix != null && 0 < prefix.Length) 100if (localName.Length > 0) 151size += ti.Length;
System\Xml\Xsl\XsltOld\CompiledAction.cs (1)
29if (input.NamespaceURI.Length != 0) continue;
System\Xml\Xsl\XsltOld\Compiler.cs (10)
280if (value.Length != 0) 490if (nspace.Length != 0) continue; 570Uri uri = _xmlResolver.ResolveUri((baseUri.Length != 0) ? _xmlResolver.ResolveUri(null, baseUri) : null, relativeUri); 772if (nsUri.Length == 0 || nsUri == XmlReservedNs.NsXslt) 805Debug.Assert(avt.Length != start, "Empty string not supposed here"); 807int avtLength = avt.Length; 845Debug.Assert(avt.Length != start, "Empty string not supposed here"); 848int avtLength = avt.Length; 898Debug.Assert(start <= avt.Length); 903if (start == avt.Length)
System\Xml\Xsl\XsltOld\ContainerAction.cs (9)
61if (nspace.Length != 0) continue; 282if (nspace.Length != 0) continue; 330if (nspace.Length != 0) continue; 375if (input.Prefix.Length != 0) continue; 414if (CheckAttribute(value.Length == 1, compiler)) 421if (CheckAttribute(value.Length == 1, compiler)) 428if (CheckAttribute(value.Length == 1, compiler)) 474int idx = name.Length - 2; 602if (nspace.Length == 0)
System\Xml\Xsl\XsltOld\DocumentScope.cs (2)
28Debug.Assert(prefix != null && prefix.Length > 0); 44Debug.Assert(prefix != null && prefix.Length > 0);
System\Xml\Xsl\XsltOld\InputScopeManager.cs (2)
120if (prefix.Length == 0) 130if (prefix.Length == 0)
System\Xml\Xsl\XsltOld\NameSpaceEvent.cs (1)
26if (_namespaceUri.Length != 0)
System\Xml\Xsl\XsltOld\NavigatorOutput.cs (1)
44if (attrInfo.Prefix.Length == 0)
System\Xml\Xsl\XsltOld\NumberAction.cs (3)
224if (_groupingSep != null && _groupingSep.Length > 1) 699while (length <= formatString.Length) 702bool currentchar = length < formatString.Length ? CharUtil.IsAlphaNumeric(formatString[length]) : !lastAlphaNumeric;
System\Xml\Xsl\XsltOld\OutputScope.cs (1)
91scope.Prefix.Length > 0)
System\Xml\Xsl\XsltOld\PrefixQName.cs (4)
49if (position < qname.Length) 65if (position < qname.Length) 74if (prefix.Length == 0) 79return endPos == prefix.Length;
System\Xml\Xsl\XsltOld\ProcessingInstructionAction.cs (1)
122int nameLength = name.Length;
System\Xml\Xsl\XsltOld\ReaderOutput.cs (4)
70if (prefix != null && prefix.Length > 0) 72if (localName.Length > 0) 344Debug.Assert(Value.Length != 0, "It whould be Whitespace in this case"); 347if (Value.Length == 0)
System\Xml\Xsl\XsltOld\RecordBuilder.cs (9)
622for (; index < comment.Length; index++) 631newComment = new StringBuilder(comment, begin, index, 2 * comment.Length); 651if (begin < comment.Length) 652newComment.Append(comment, begin, comment.Length - begin); 675for (; index < pi.Length; index++) 687newPI = new StringBuilder(pi, begin, index, 2 * pi.Length); 706if (begin < pi.Length) 708newPI.Append(pi, begin, pi.Length - begin); 781Debug.Assert(prefix != null && prefix.Length > 0);
System\Xml\Xsl\XsltOld\SequentialOutput.cs (8)
114if (mainNode.Prefix.Length == 0) 367if (node.NamespaceURI.Length == 0 && string.Equals("html", node.LocalName, StringComparison.OrdinalIgnoreCase)) 519if (prefix != null && prefix.Length > 0) 522if (name != null && name.Length > 0) 544int length = value.Length; 577int length = value.Length; 633int length = value.Length; 695if (htmlElementsProps != null && attribute.Prefix.Length == 0)
System\Xml\Xsl\XsltOld\SortAction.cs (2)
39&& (value.Length == 0 || cultInfo == null) 68if (prefix.Length == 0 && !_forwardCompatibility)
System\Xml\Xsl\XsltOld\UseAttributeSetsAction.cs (1)
31if (_useString.Length == 0)
System\Xml\Xsl\XsltOld\XsltCompileContext.cs (3)
218if (prefix.Length == 0) 258if (baseUri.Length != 0) 449else if (ns.Length == 0)
System\Xml\Xsl\XsltOld\XsltOutput.cs (1)
225if (method.Namespace.Length != 0)
System.Private.Xml.Linq (54)
System\Xml\Linq\XAttribute.cs (4)
89if (namespaceName.Length == 0) 693if (namespaceName.Length == 0) return string.Empty; 706if (value.Length == 0) 740else if (namespaceName.Length == 0 && name.LocalName == "xmlns")
System\Xml\Linq\XContainer.cs (10)
74if (s.Length == 0) return null; 379if (s.Length > 0) 548if (s.Length > 0) 569else if (s.Length > 0) 591else if (s.Length > 0) 721if (text.Length > 0) 984e.AppendAttributeSkipNotify(new XAttribute(_aCache.Get(r.Prefix.Length == 0 ? string.Empty : r.NamespaceURI).GetName(r.LocalName), r.Value)); 1044_aCache.Get(r.Prefix.Length == 0 ? string.Empty : r.NamespaceURI).GetName(r.LocalName), 1120XAttribute a = new XAttribute(_aCache.Get(r.Prefix.Length == 0 ? string.Empty : r.NamespaceURI).GetName(r.LocalName), r.Value); 1243_aCache.Get(r.Prefix.Length == 0 ? string.Empty : r.NamespaceURI).GetName(r.LocalName),
System\Xml\Linq\XElement.cs (2)
515if (a.Name.NamespaceName.Length != 0 && 2071XAttribute a = new XAttribute(XNamespace.Get(r.Prefix.Length == 0 ? string.Empty : r.NamespaceURI).GetName(r.LocalName), r.Value);
System\Xml\Linq\XHashtable.cs (2)
280hashCode = ComputeHashCode(key, 0, key.Length); 299while (!FindEntry(hashCode, key, 0, key.Length, ref entryIndex))
System\Xml\Linq\XLinq.cs (13)
39if (_text.Length > 0) 61else if (_text.Length > 0) 130if (_text.Length > 0) 298if (namespaceName.Length == 0) return string.Empty; 320_resolver.AddFirst(a.Name.NamespaceName.Length == 0 ? string.Empty : a.Name.LocalName, XNamespace.Get(a.Value)); 338_resolver.Add(a.Name.NamespaceName.Length == 0 ? string.Empty : a.Name.LocalName, XNamespace.Get(a.Value)); 384_writer.WriteAttributeString(GetPrefixOfNamespace(ns, false), localName, namespaceName.Length == 0 && localName == "xmlns" ? XNamespace.xmlnsPrefixNamespace : namespaceName, a.Value); 404await _writer.WriteAttributeStringAsync(GetPrefixOfNamespace(ns, false), localName, namespaceName.Length == 0 && localName == "xmlns" ? XNamespace.xmlnsPrefixNamespace : namespaceName, a.Value).ConfigureAwait(false); 493if (_rover != null && _rover.ns == ns && (allowDefaultNamespace || _rover.prefix.Length > 0)) return _rover.prefix; 514else if (d.prefix.Length > 0) 553_writer.WriteAttributeString(GetPrefixOfNamespace(ns, false), localName, namespaceName.Length == 0 && localName == "xmlns" ? XNamespace.xmlnsPrefixNamespace : namespaceName, a.Value); 563if (namespaceName.Length == 0) return string.Empty; 578_resolver.Add(a.Name.NamespaceName.Length == 0 ? string.Empty : a.Name.LocalName, XNamespace.Get(a.Value));
System\Xml\Linq\XName.cs (3)
59if (_ns.NamespaceName.Length == 0) return _localName; 78if (i <= 1 || i == expandedName.Length - 1) throw new ArgumentException(SR.Format(SR.Argument_InvalidExpandedName, expandedName)); 79return XNamespace.Get(expandedName, 1, i - 1).GetName(expandedName, i + 1, expandedName.Length - i - 1);
System\Xml\Linq\XNamespace.cs (6)
60return GetName(localName, 0, localName.Length); 120return Get(namespaceName, 0, namespaceName.Length); 217Debug.Assert(index >= 0 && index <= localName.Length, "Caller should have checked that index was in bounds"); 218Debug.Assert(count >= 0 && index + count <= localName.Length, "Caller should have checked that count was in bounds"); 235Debug.Assert(index >= 0 && index <= namespaceName.Length, "Caller should have checked that index was in bounds"); 236Debug.Assert(count >= 0 && index + count <= namespaceName.Length, "Caller should have checked that count was in bounds");
System\Xml\Linq\XNodeBuilder.cs (1)
169_attrName = XNamespace.Get(prefix.Length == 0 ? string.Empty : namespaceName!).GetName(localName);
System\Xml\Linq\XNodeReader.cs (8)
232if (prefix.Length == 0) 260if (namespaceName.Length == 0 && a.Name.LocalName == "xmlns") 521if (namespaceName != null && namespaceName.Length == 0) 597XNamespace? ns = prefix.Length == 0 ? e.GetDefaultNamespace() : e.GetNamespaceOfPrefix(prefix); 655if (namespaceName != null && namespaceName.Length == 0) 1139if (i != 0 && i != qualifiedName.Length - 1) 1195if (s.Length > 0) 1216if (s.Length > 0)
System\Xml\Schema\XNodeValidator.cs (2)
342if (s.Length > 0) 355if (s != null && s.Length > 0)
System\Xml\XPath\XNodeNavigator.cs (3)
142if (_parent != null && a.Name.NamespaceName.Length == 0) 161if (prefix.Length == 0) 464if (localName != null && localName.Length == 0)
System.Reflection.Context (2)
System\Reflection\Context\Custom\CustomType.cs (1)
202if (name.Length > 4)
System\Reflection\Context\Virtual\VirtualPropertyBase.cs (1)
22if (name.Length == 0)
System.Reflection.Emit (2)
src\runtime\src\libraries\System.Private.CoreLib\src\System\Reflection\Emit\SymbolType.cs (2)
60if (format == null || curIndex == format.Length) 74if (curIndex != format.Length)
System.Reflection.Metadata (56)
src\runtime\src\libraries\Common\src\System\Reflection\AssemblyNameFormatter.cs (4)
23Debug.Assert(name.Length != 0); 60if (cultureName.Length == 0) 108if (s.Length != span.Trim().Length || span.IndexOfAny('\"', '\'') >= 0) 114for (int i = 0; i < s.Length; i++)
src\runtime\src\libraries\Common\src\System\Reflection\AssemblyNameParser.cs (3)
310if (attributeValue.Length % 2 != 0 || (isToken && attributeValue.Length != 8 * 2)) 316byte[] pkt = new byte[attributeValue.Length / 2];
src\runtime\src\libraries\Common\src\System\Text\ValueStringBuilder.cs (5)
125int count = s.Length; 167if (s.Length == 1 && (uint)pos < (uint)_chars.Length) // very common case, e.g. appending strings from NumberFormatInfo like separators, percent symbols, etc. 181if (pos > _chars.Length - s.Length) 183Grow(s.Length); 191_pos += s.Length;
System\Reflection\Internal\Utilities\MemoryBlock.cs (5)
405while (currentIndex < text.Length && currentPointer != endPointer) 432bool textTerminated = currentIndex == text.Length; 451if (asciiPrefix.Length > Length - offset) 458for (int i = 0; i < asciiPrefix.Length; i++) 482for (int i = 0; i < asciiString.Length; i++)
System\Reflection\Internal\Utilities\PathUtilities.cs (3)
33for (int i = path.Length - 1; i >= 0; i--) 57if (root.Length == 0) 62char c = root[root.Length - 1];
System\Reflection\Metadata\BlobBuilder.cs (4)
1036WriteUTF8(value, 0, value.Length, allowUnpairedSurrogates: true, prependSize: true); 1057WriteCompressedInteger(BlobUtilities.GetUserStringByteLength(value.Length)); 1078WriteUTF8(value, 0, value.Length, allowUnpairedSurrogates, prependSize: false); 1085Debug.Assert(start + length <= str.Length);
System\Reflection\Metadata\BlobWriter.cs (3)
428WriteUTF8(str, 0, str.Length, allowUnpairedSurrogates: true, prependSize: true); 449WriteCompressedInteger(BlobUtilities.GetUserStringByteLength(value.Length)); 465WriteUTF8(value, 0, value.Length, allowUnpairedSurrogates, prependSize: false);
System\Reflection\Metadata\Ecma335\Encoding\BlobEncoders.cs (3)
621if (serializedTypeName != null && serializedTypeName.Length == 0) 687if (name.Length == 0) Throw.ArgumentEmptyString(nameof(name)); 885if (enumTypeName.Length == 0) Throw.ArgumentEmptyString(nameof(enumTypeName));
System\Reflection\Metadata\Ecma335\MetadataBuilder.Heaps.cs (7)
336partBuilder.WriteUTF8(value, i, (next >= 0 ? next : value.Length) - i, allowUnpairedSurrogates: true, prependSize: false); 344if (next == value.Length - 1) 448if (value.Length == 0) 588for (int i = x.Length - 1, j = y.Length - 1; i >= 0 & j >= 0; i--, j--) 601return y.Length.CompareTo(x.Length);
System\Reflection\Metadata\Ecma335\MetadataRootBuilder.cs (2)
62Debug.Assert(Encoding.UTF8.GetByteCount(DefaultMetadataVersionString) == DefaultMetadataVersionString.Length); 63int metadataVersionByteCount = metadataVersion != null ? Encoding.UTF8.GetByteCount(metadataVersion) : DefaultMetadataVersionString.Length;
System\Reflection\Metadata\Ecma335\PortablePdbBuilder.cs (2)
64Debug.Assert(Encoding.UTF8.GetByteCount(MetadataVersion) == MetadataVersion.Length); 65_serializedMetadata = tablesAndHeaps.GetSerializedMetadata(typeSystemRowCounts, MetadataVersion.Length, isStandaloneDebugMetadata: true);
System\Reflection\Metadata\Internal\BlobHeap.cs (2)
232if (otherIndex == other.Length || !StringUtils.IsEqualAscii(other[otherIndex], separator, ignoreCaseMask)) 259return otherIndex == other.Length;
System\Reflection\Metadata\Internal\NamespaceCache.cs (1)
250if (childName.Length == 0)
System\Reflection\Metadata\Internal\StringHeap.cs (2)
259return value.Length == 0; 278return value.Length == 0;
System\Reflection\Metadata\TypeName.cs (2)
183else if (_nestedNameLength > 0 && _fullName.Length > _nestedNameLength) // Declaring types 234else if (_nestedNameLength > 0 && _fullName.Length > _nestedNameLength) // Declaring types
System\Reflection\Metadata\TypeNameParserHelpers.cs (3)
105sb.EnsureCapacity(name.Length); 108for (int i = indexOfEscapeCharacter; i < name.Length;) 112if (c != EscapeCharacter || i == name.Length)
System\Reflection\Metadata\TypeSystem\TypeDefinition.cs (1)
267TypeDefTreatment.UnmangleWinRTName => name.SuffixRaw(MetadataReader.ClrPrefix.Length),
System\Reflection\PortableExecutable\DebugDirectory\DebugDirectoryBuilder.cs (2)
117if (pdbPath.Length == 0 || pdbPath[0] == '\0') 178if (algorithmName.Length == 0)
System\Reflection\PortableExecutable\PEBuilder.cs (1)
353for (int j = 0, m = serializedSection.Name.Length; j < 8; j++)
System\Reflection\PortableExecutable\PEReader.cs (1)
664if (algorithmName.Length == 0 || checksum.Length == 0)
System.Reflection.MetadataLoadContext (9)
System\Reflection\PathAssemblyResolver.cs (1)
42if (file.Length == 0)
System\Reflection\TypeLoading\Assemblies\Ecma\EcmaAssembly.ManifestResources.cs (2)
18if (resourceName.Length == 0) 66if (name.Length == 0)
System\Reflection\TypeLoading\General\Helpers.cs (4)
104StringBuilder sbEscapedName = new StringBuilder(identifier.Length); 131StringBuilder sbUnescapedName = new StringBuilder(identifier.Length); 132for (int i = 0; i < identifier.Length; i++) 223return ns.Length == 0 ? name : ns + "." + name;
System\Reflection\TypeLoading\RuntimeTypeInfo.GetMember.cs (1)
36string prefix = optionalNameOrPrefix!.Substring(0, optionalNameOrPrefix.Length - 1);
System\Reflection\TypeLoading\Types\RoType.GetInterface.cs (1)
30if (ns.Length != 0 && !ns.Equals(ifc.Namespace))
System.Resources.Extensions (8)
src\runtime\src\libraries\System.Private.CoreLib\src\System\Resources\FastResourceComparer.cs (7)
39for (int i = 0; i < key.Length; i++) 82int numChars = a.Length; 86return (a.Length == 0) ? 0 : -1; 99return a.Length - bCharLength; 119if (numChars > b.Length) 120numChars = b.Length; 128return byteLen - b.Length * 2;
System\Resources\Extensions\DeserializingResourceReader.cs (1)
90for (int i = firstBracket + 1; i < typeName.Length; i++)
System.Resources.Writer (1)
System\Resources\__FastResourceComparer.cs (1)
31for (int i = 0; i < key.Length; i++)
System.Runtime.Caching (4)
System\Runtime\Caching\HostFileChangeMonitor.cs (1)
49capacity += path.Length + (2 * MAX_CHAR_COUNT_OF_LONG_CONVERTED_TO_HEXADECIMAL_STRING);
System\Runtime\Caching\MemoryCache.cs (2)
326if (name.Length == 0) 344if (name.Length == 0)
System\Runtime\Caching\MemoryCacheEntryChangeMonitor.cs (1)
50capacity += key.Length + MAX_CHAR_COUNT_OF_LONG_CONVERTED_TO_HEXADECIMAL_STRING;
System.Runtime.InteropServices.JavaScript (11)
System\Runtime\InteropServices\JavaScript\JSException.cs (1)
71jsStackTrace = jsStackTrace.Substring(Message.Length + 1);
System\Runtime\InteropServices\JavaScript\JSHostImplementation.cs (9)
119functionNameBytes = checked(functionName.Length * 2); 127moduleNameBytes = checked(moduleName.Length * 2); 298if (s.Length < 1) 300int start_index = (direction > 0) ? 0 : s.Length - 1, 301end_index = (direction > 0) ? s.Length - 1 : 0; 312if (s.Length < 1) 314int head = 0, tail = s.Length - 1; 315while (head < s.Length) 329if ((head > 0) || (tail < s.Length - 1))
System\Runtime\InteropServices\JavaScript\Marshaling\JSMarshalerArgument.String.cs (1)
55slot.Length = value.Length;
System.Runtime.Numerics (3)
src\runtime\src\libraries\Common\src\System\Number.Formatting.Common.cs (1)
526if (info.NumberGroupSeparator.Length > 0)
System\Number.BigInteger.cs (1)
824Debug.Assert(formatString == null || formatString.Length == formatSpan.Length);
System\Number.Polyfill.cs (1)
72return negativeSign.Length == 1 &&
System.Runtime.Serialization.Formatters (2)
System\Runtime\Serialization\FormatterServices.cs (2)
147if (t2Name.Length == t1Name.Length && t2Name[0] == t1Name[0] && t1Name == t2Name)
System.Runtime.Serialization.Schema (13)
System\Runtime\Serialization\Schema\CodeExporter.cs (10)
108if (ns.Length == 0) 458contractCodeDomInfo.TypeReference = new CodeTypeReference((clrNamespace == null || clrNamespace.Length == 0) ? typeName : clrNamespace + "." + typeName); 1135string expectedName = (nestedTypeIndex <= 0 || nestedTypeIndex == dataContractName.Length - 1) ? dataContractName : dataContractName.Substring(nestedTypeIndex + 1); 1432if (identifier.Length <= MaxIdentifierLength && CodeGenerator.IsValidLanguageIndependentIdentifier(identifier)) 1437for (int i = 0; i < identifier.Length && builder.Length < MaxIdentifierLength; i++) 1463int availableLength = MaxIdentifierLength - identifier.Length; 1464int requiredLength = appendString.Length; 1491uniqueNamespace = ((clrNamespace.Length == 0) ? ImportGlobals.DefaultClrNamespace : clrNamespace) + i.ToString(NumberFormatInfo.InvariantInfo); 1548AddToNamespace(builder, uriString.Substring(ImportGlobals.DataContractXsdBaseNamespace.Length), fragments); 1580for (int i = 0; i < fragment.Length && builder.Length < MaxIdentifierLength; i++)
System\Runtime\Serialization\Schema\SchemaImportHelper.cs (3)
105return uriString.StartsWith(ImportGlobals.DataContractXsdBaseNamespace, StringComparison.Ordinal) ? uriString.Substring(ImportGlobals.DataContractXsdBaseNamespace.Length) : uriString; 132if (localName.Length == 0) 136for (int i = 1; i < localName.Length; i++)
System.Security.Cryptography (44)
Microsoft\Win32\SafeHandles\SafePasswordHandle.cs (1)
30Length = password.Length;
src\runtime\src\libraries\Common\src\Internal\Cryptography\PkcsHelpers.cs (2)
143byte[] octets = new byte[2 * (s.Length + 1)]; 144Encoding.Unicode.GetBytes(s, 0, s.Length, octets, 0);
src\runtime\src\libraries\Common\src\Interop\Windows\BCrypt\Cng.cs (1)
102NTSTATUS ntStatus = Interop.BCryptSetProperty(hAlg, BCryptPropertyStrings.BCRYPT_CHAINING_MODE, cipherMode, (cipherMode.Length + 1) * 2, 0);
src\runtime\src\libraries\Common\src\Interop\Windows\BCrypt\Interop.BCryptSetProperty.cs (1)
32checked(((uint)pszValue.Length + 1) * 2),
src\runtime\src\libraries\Common\src\Interop\Windows\NCrypt\Interop.NCryptDeriveKeyMaterial.cs (1)
64hashAlgorithmBuffer.cbBuffer = (hashAlgorithm.Length + 1) * sizeof(char);
src\runtime\src\libraries\Common\src\System\Security\Cryptography\ECCng.ImportExport.NamedCurve.cs (1)
161buff.cbBuffer = (curveName.Length + 1) * 2; // Add 1 for null terminator
src\runtime\src\libraries\Common\src\System\Security\Cryptography\Pkcs\Pkcs9AttributeObject.cs (1)
44if (szOid.Length == 0)
src\runtime\src\libraries\Common\src\System\Security\Cryptography\PqcBlobHelpers.cs (1)
314int parameterSetMarshalLength = (parameterSet.Length + 1) * 2;
src\runtime\src\libraries\Common\src\System\Security\Cryptography\SP800108HmacCounterKdfImplementationCng.cs (1)
60buffers[2].cbBuffer = (_hashAlgorithm.Name.Length + 1) * 2; // +1 for the null terminator.
src\runtime\src\libraries\Common\src\System\Security\Cryptography\X25519DiffieHellmanImplementation.Windows.cs (1)
259((uint)X25519WindowsHelpers.BCRYPT_ECC_CURVE_25519.Length + 1) * 2,
src\runtime\src\libraries\Common\src\System\Text\ValueStringBuilder.cs (5)
125int count = s.Length; 167if (s.Length == 1 && (uint)pos < (uint)_chars.Length) // very common case, e.g. appending strings from NumberFormatInfo like separators, percent symbols, etc. 181if (pos > _chars.Length - s.Length) 183Grow(s.Length); 191_pos += s.Length;
System\Security\Cryptography\CngKey.Create.cs (1)
157int useContextByteLength = checked((useContext.Length + 1) * sizeof(char));
System\Security\Cryptography\CngKey.EC.cs (2)
73byte[] curveNameBytes = new byte[(curveName.Length + 1) * sizeof(char)]; // +1 to add trailing null 74System.Text.Encoding.Unicode.GetBytes(curveName, 0, curveName.Length, curveNameBytes, 0);
System\Security\Cryptography\OidLookup.cs (1)
63if (friendlyName.Length == 0)
System\Security\Cryptography\Pbkdf2Implementation.Windows.cs (1)
169buffers[2].cbBuffer = checked((hashAlgorithmName.Length + 1) * sizeof(char)); // Add null terminator.
System\Security\Cryptography\X509Certificates\CertificatePal.Windows.cs (1)
320Interop.Crypt32.DATA_BLOB blob = new Interop.Crypt32.DATA_BLOB(pFriendlyName, checked(2 * ((uint)friendlyName.Length + 1)));
System\Security\Cryptography\X509Certificates\FindPal.cs (2)
176if (maybeOid.Length == 0) 220int len = keyValue.Length;
System\Security\Cryptography\X509Certificates\WindowsHelpers.cs (5)
46allocationSize += oidString.Length + 1; // Encoding.ASCII doesn't have a fallback, so it's fine to use String.Length 60int bytesWritten = Encoding.ASCII.GetBytes(oidString, new Span<byte>(pOidContents, oidString.Length)); 61Debug.Assert(bytesWritten == oidString.Length); 63pOidContents[oidString.Length] = 0; 64pOidContents += oidString.Length + 1;
System\Security\Cryptography\X509Certificates\X500DistinguishedNameBuilder.cs (2)
135if (emailAddress.Length > 255) 224if (twoLetterCode.Length != 2 || !char.IsAsciiLetter(twoLetterCode[0]) || !char.IsAsciiLetter(twoLetterCode[1]))
System\Security\Cryptography\X509Certificates\X509Certificate2.cs (9)
456if (simpleName.Length > 0) 464if (emailName.Length > 0) 472if (upnName.Length > 0) 480if (dnsName.Length > 0) 495if (simpleName.Length > 0) 503if (emailName.Length > 0) 511if (upnName.Length > 0) 519if (dnsName.Length > 0) 1791if (embedded.Length == 0)
System\Security\Cryptography\X509Certificates\X509Certificate2Collection.cs (2)
610int certSize = PemEncoding.GetEncodedSize(PemLabels.X509Certificate.Length, certData.Length); 808size += PemEncoding.GetEncodedSize(PemLabels.X509Certificate.Length, this[i].RawDataMemory.Length);
System\Security\Cryptography\XmlKeyHelper.cs (2)
43if (value.Length == 0) 124Debug.Assert(name.Length > 0);
System.Security.Cryptography.Pkcs (7)
Internal\Cryptography\Pal\Windows\HelpersWindows.cs (2)
413int maxClear = provName.Length; 415maxClear = Math.Max(maxClear, keyName.Length);
Internal\Cryptography\PkcsHelpers.cs (2)
286Debug.Assert((normalizedString.Length & 0x1) == 0); 288byte[] ba = new byte[normalizedString.Length / 2];
src\runtime\src\libraries\Common\src\Internal\Cryptography\PkcsHelpers.cs (2)
143byte[] octets = new byte[2 * (s.Length + 1)]; 144Encoding.Unicode.GetBytes(s, 0, s.Length, octets, 0);
src\runtime\src\libraries\Common\src\System\Security\Cryptography\Pkcs\Pkcs9AttributeObject.cs (1)
44if (szOid.Length == 0)
System.Security.Cryptography.Xml (26)
System\Security\Cryptography\Xml\CanonicalXmlElement.cs (2)
58string name = ((Prefix.Length > 0) ? "xmlns" + ":" + Prefix : "xmlns"); 130string name = ((Prefix.Length > 0) ? "xmlns" + ":" + Prefix : "xmlns");
System\Security\Cryptography\Xml\CanonicalXmlProcessingInstruction.cs (2)
35if ((Value != null) && (Value.Length > 0)) 60if ((Value != null) && (Value.Length > 0))
System\Security\Cryptography\Xml\EncryptedXml.cs (1)
218if (cipherData.CipherReference.Uri.Length == 0)
System\Security\Cryptography\Xml\ExcAncestralNamespaceContextManager.cs (1)
64if (prefix.Length > 0)
System\Security\Cryptography\Xml\Reference.cs (2)
275if (_uri == null || _uri.Length == 0) 392else if (_uri.Length == 0)
System\Security\Cryptography\Xml\SignedXml.cs (2)
816if (string.IsNullOrEmpty(reference.Uri) || (reference.Uri.Length > 0 && reference.Uri[0] != '#')) 821if (reference.Uri.Length > 0 && reference.Uri[0] == '#')
System\Security\Cryptography\Xml\Transform.cs (1)
218string key = ((attrib.Prefix.Length > 0) ? attrib.Prefix + ":" + attrib.LocalName : attrib.LocalName);
System\Security\Cryptography\Xml\Utils.cs (14)
38string name = ((prefix.Length > 0) ? "xmlns:" + prefix : "xmlns"); 97return n.NodeType == XmlNodeType.Attribute && (n.Prefix.Equals("xmlns") || (n.Prefix.Length == 0 && n.LocalName.Equals("xmlns"))); 108bool b1 = n.NodeType == XmlNodeType.Attribute && n.Prefix.Length == 0 && n.LocalName.Equals("xmlns"); 115return IsDefaultNamespaceNode(n) && n.Value!.Length == 0; 121return a.Prefix.Length == 0 ? string.Empty : a.LocalName; 139return DiscardWhiteSpaces(inputBuffer, 0, inputBuffer.Length); 161int newStringLength = newString.Length; 405else if (prefix.Length > 0) 467string name = ((attrib.Prefix.Length > 0) ? attrib.Prefix + ":" + attrib.LocalName : attrib.LocalName); 469if (elem.HasAttribute(name) || (name.Equals("xmlns") && elem.Prefix.Length == 0)) continue; 514string name = ((ancestorElement.Prefix.Length > 0) ? "xmlns:" + ancestorElement.Prefix : "xmlns"); 540if (attrib.NamespaceURI.Length > 0) 547string name = ((attrib.Prefix.Length > 0) ? "xmlns:" + attrib.Prefix : "xmlns"); 729uint cbHex = (uint)hexString.Length / 2;
System\Security\Cryptography\Xml\XmlDsigXPathTransform.cs (1)
106if (prefix != null && prefix.Length > 0)
System.Security.Permissions (2)
System\Security\Permissions\PrincipalPermission.cs (2)
53if (idRole.ID == null || idRole.ID.Length != 0 || idRole.Role == null || idRole.Role.Length != 0 || idRole.Authenticated)
System.Security.Principal.Windows (7)
src\runtime\src\libraries\Common\src\Interop\Windows\Advapi32\Interop.LsaOpenPolicy.cs (2)
50systemNameUnicode.Length = checked((ushort)(SystemName.Length * sizeof(char))); 51systemNameUnicode.MaximumLength = checked((ushort)(SystemName.Length * sizeof(char)));
System\Security\Principal\NTAccount.cs (5)
38if (accountName.Length > MaximumAccountNameLength) 43if (domainName != null && domainName.Length > MaximumDomainNameLength) 62if (name.Length > (MaximumDomainNameLength + 1 /* '\' */ + MaximumAccountNameLength)) 234if (Names[currentName].Buffer.Length * 2 + 2 > ushort.MaxValue) 242Names[currentName].Length = (ushort)(Names[currentName].Buffer.Length * 2);
System.ServiceModel.Federation (1)
System\ServiceModel\Security\SecurityUtils.cs (1)
45return addressingVersionString.Substring(pos + 1, addressingVersionString.Length - pos - 2);
System.ServiceModel.Http (1)
System\ServiceModel\Channels\HttpChannelHelpers.cs (1)
201if (statusDescription != null && statusDescription.Length > 0)
System.ServiceModel.NetFramingBase (1)
System\ServiceModel\Channels\WindowsStreamSecurityUpgradeProvider.cs (1)
150if ((principalName != null) && (principalName.Length > 0))
System.ServiceModel.NetNamedPipe (5)
System\ServiceModel\Channels\PipeConnectionInitiator.cs (5)
86while (path.Length > 0) 105if (path.Length > matchPath.Length) 417path = path.Substring(0, path.Length - 1); 418if (path.Length == 0)
System.ServiceModel.NetNamedPipe.Tests (2)
NetNamedPipeBindingTest.cs (2)
26Assert.Equal(45, result.Length); 32Assert.Equal(61, result.Length);
System.ServiceModel.Primitives (158)
Internals\System\Runtime\Diagnostics\DiagnosticTraceBase.cs (1)
101int len = text.Length;
Internals\System\Runtime\Diagnostics\EtwDiagnosticTrace.cs (6)
94if (exceptionData.Length < remainingLength) 97remainingLength -= exceptionData.Length; 104if (!string.IsNullOrEmpty(innerException) && innerException.Length < remainingLength) 118int minXmlLength = (localName.Length * 2) + XmlBracketsLength; 130int xmlElementLength = (localName.Length * 2) + XmlBracketsLength + (value != null ? value.Length : 0);
Internals\System\Runtime\Remoting\SoapHexBinary.cs (2)
31if (s.Length == 1) 82for (int i = 0; i < value.Length; i++)
Internals\System\Runtime\UrlUtility.cs (4)
47if (query.Length > 0 && query[0] == '?') 106int l = s.Length; 294int count = s.Length; 503int l = (s != null) ? s.Length : 0;
Internals\System\Xml\XmlConverter.cs (1)
16for (int i = 0; i < s.Length; i++)
Internals\System\Xml\XmlMtomReader.cs (25)
120if (contentType != null && contentType.Length == 0) 231|| charset == null || charset.Length == 0) 285|| rootType == null || rootType.Length == 0) 405if (uri == null || uri.Length == 0) 410contentID = string.Format(CultureInfo.InvariantCulture, "<{0}>", Uri.UnescapeDataString(uri.Substring(MimeGlobals.ContentIDScheme.Length))); 1376count = Math.Min(_stringValue.Length - _stringOffset, count); 1449if (val.Length > stringContentQuota) 1451stringContentQuota -= val.Length; 2303remaining += value.Length * sizeof(char); 2306remaining += name.Length * sizeof(char); 2325remaining += header.Value.Length * sizeof(char); 2419if (offset >= Value.Length || Value[offset++] != '/') 2425if (offset >= Value.Length || Value[offset++] != ';') 2432if (paramAttribute == null || offset >= Value.Length || Value[offset++] != '=') 2462if (paramAttribute == null || startInfoOffset >= startInfo.Length || startInfo[startInfoOffset++] != '=') 2531contentTransferEncodingValue = (Value.Length == 0) ? Value : ((Value[0] == '"') ? MailBnfHelper.ReadQuotedString(Value, ref offset, null) : MailBnfHelper.ReadToken(Value, ref offset, null)); 2597if ((!MailBnfHelper.SkipCFWS(Value, ref offset) || offset >= Value.Length || Value[offset++] != '.') || !MailBnfHelper.SkipCFWS(Value, ref offset)) 2815XmlMtomReader.DecrementBufferQuota(maxBuffer, ref remaining, value.Length * sizeof(char)); 2824XmlMtomReader.DecrementBufferQuota(maxBuffer, ref remaining, value.Length * sizeof(char)); 3089for (; offset < data.Length; offset++) 3110for (; offset < data.Length; offset++) 3145if (offset < data.Length && data[offset] == '"') 3154for (; offset < data.Length; offset++) 3172for (; offset < data.Length && data[offset] < s_digits.Length && s_digits[data[offset]]; offset++) 3180int length = (data == null) ? 0 : data.Length;
Internals\System\Xml\XmlMtomWriter.cs (7)
172if (startUri != null && startUri.Length > 0) 175if (startInfo != null && startInfo.Length > 0) 1176size += XmlMtomWriter.ValidateSizeOfMessage(maxSizeInBytes, size, name.Length); 1177size += XmlMtomWriter.ValidateSizeOfMessage(maxSizeInBytes, size, value.Length); 1183byte[] boundaryBytes = new byte[boundary.Length + MimeGlobals.BoundaryPrefix.Length]; 1186Encoding.ASCII.GetBytes(boundary, 0, boundary.Length, boundaryBytes, MimeGlobals.BoundaryPrefix.Length); 1456Write(value, 0, value.Length);
System\IdentityModel\CanonicalFormWriter.cs (3)
19if (s.Length > workBuffer.Length) 25for (int i = 0; i < s.Length; i++) 39stream.Write(workBuffer, 0, s.Length);
System\IdentityModel\Claims\Claim.cs (2)
58if (claimType.Length <= 0) 68if (right.Length <= 0)
System\IdentityModel\Claims\X509CertificateClaimSet.cs (2)
486int separatorFirstChar = delimiterIndex + subjectName1.Length + 1; 488for (int i = separatorFirstChar + 1; i < x509ExtensionFormattedString.Length; i++)
System\IdentityModel\Tokens\WSSecurityJan2004.cs (1)
405if (uri != null && uri.Length > 0 && uri[0] == '#')
System\ServiceModel\Channels\AddressHeader.cs (3)
89if (hdr1.Length != hdr2.Length) 282if ((null == name) || (name.Length == 0))
System\ServiceModel\Channels\Addressing.cs (9)
98if (act.Length > 0 && (act[0] <= 32 || act[act.Length - 1] <= 32)) 111if (actor.Length == 0 && mustUnderstand == mustUnderstandValue && !relay) 215if (actor.Length == 0 && mustUnderstand == mustUnderstandValue && !relay) 309if (actor.Length == 0 && mustUnderstand == mustUnderstandValue && !relay) 488if (actor.Length == 0 && mustUnderstand == mustUnderstandValue && !relay) 638if (actor.Length == 0 && mustUnderstand == mustUnderstandValue && !relay) 750if (actor.Length == 0 && mustUnderstand == mustUnderstandValue && !relay) 894if (actor.Length == 0 && mustUnderstand == mustUnderstandValue && !relay && (object)relationship == (object)ReplyRelationshipType)
System\ServiceModel\Channels\BinaryMessageEncoder.cs (1)
414offset += Encoding.UTF8.GetBytes(newString, 0, newString.Length, buffer, offset);
System\ServiceModel\Channels\Binding.cs (2)
38if (ns.Length > 0) 97if (value.Length > 0)
System\ServiceModel\Channels\ContentOnlyMessage.cs (1)
89if (_data != null && _data.Length > 0)
System\ServiceModel\Channels\Message.cs (5)
850if (!((prefixString.Length == 1))) 1979if (value.Length == 0) 2001int byteCount = s.Length * sizeof(char); 2233if (key.Length > MaxKeyLength) 2251if (key.Length > MaxKeyLength)
System\ServiceModel\Channels\MessageEncoder.cs (14)
155if (contentType.Length > supportedContentType.Length && 157contentType[supportedContentType.Length] == ';') 165if (contentType.Length == supportedContentType.Length) 169else if (contentType.Length > supportedContentType.Length) 171char ch = contentType[supportedContentType.Length]; 181int i = supportedContentType.Length; 182if (ch == '\r' && contentType.Length > supportedContentType.Length + 1 && contentType[i + 1] == '\n') 192while (i < contentType.Length) 203if (ch == ';' || i == contentType.Length) 216if (supportedMediaType.Length > 0 && !supportedMediaType.Equals(parsedContentType.MediaType, StringComparison.OrdinalIgnoreCase))
System\ServiceModel\Channels\MessageFault.cs (4)
344if (Node.Length > 0) 349if (Actor.Length > 0) 455if (translation.XmlLang.Length > 0) 462if (Actor.Length > 0)
System\ServiceModel\Channels\MessageHeader.cs (4)
161if (actor.Length > 0) 291if (value.Length == 1) 398if (name.Length == 0) 407if (ns.Length > 0)
System\ServiceModel\Channels\MessageHeaders.cs (1)
1029if (name.Length > 0)
System\ServiceModel\Channels\MtomMessageEncoder.cs (1)
350if (charSet == null || charSet.Length == 0)
System\ServiceModel\Channels\TextMessageEncoder.cs (8)
143if ((contentType.Length > semiColonIndex + 11) // need room for parameter + charset + '=' 202if (charSet.Length > 2 && charSet[0] == '"' && charSet[charSet.Length - 1] == '"') 204charSet = charSet.Substring(1, charSet.Length - 2); 235if (charSet == null || charSet.Length == 0) 349if (charSet.Length > 2 && charSet[0] == '"' && charSet[charSet.Length - 1] == '"') 351charSet = charSet.Substring(1, charSet.Length - 2);
System\ServiceModel\Channels\UriGenerator.cs (1)
33if (scheme.Length == 0)
System\ServiceModel\Description\ContractDescription.cs (1)
63if (value.Length == 0)
System\ServiceModel\Description\OperationDescription.cs (1)
29if (name.Length == 0)
System\ServiceModel\Description\ServiceReflector.cs (4)
217for (int i = 1; i < localName.Length; i++) 967return method.Name.Substring(BeginMethodNamePrefix.Length); 971return method.Name.Substring(0, method.Name.Length - AsyncMethodNameSuffix.Length);
System\ServiceModel\Dispatcher\DataContractSerializerOperationFormatter.cs (1)
586string prefix = (Namespace == null || Namespace.Length == 0) ? string.Empty : "h";
System\ServiceModel\Dispatcher\EndpointAddressProcessor.cs (3)
64val = local + "^" + local.Length.ToString(CultureInfo.InvariantCulture) + ":" + ns + "^" + ns.Length.ToString(CultureInfo.InvariantCulture); 142builder.Append(s.Length.ToString(CultureInfo.InvariantCulture));
System\ServiceModel\Dispatcher\OperationFormatter.cs (1)
917writer.WriteStartElement((Namespace == null || Namespace.Length == 0) ? string.Empty : "h", Name, Namespace);
System\ServiceModel\EndpointAddress.cs (10)
351int u1Len = (u1Path.Length > 0 && u1Path[u1Path.Length - 1] == '/') ? u1Path.Length - 1 : u1Path.Length; 352int u2Len = (u2Path.Length > 0 && u2Path[u2Path.Length - 1] == '/') ? u2Path.Length - 1 : u2Path.Length; 381if (uriString.Length > 0 && uriString[uriString.Length - 1] != '/')
System\ServiceModel\EnvelopeVersion.cs (2)
46if (ultimateReceiverActor.Length == 0) 119return actor.Length == 0 || actor == UltimateDestinationActor || actor == NextDestinationActorValue;
System\ServiceModel\FaultCode.cs (2)
37if (name.Length == 0) 73return _ns.Length == 0 || _version != null;
System\ServiceModel\MessageContractMemberAttribute.cs (1)
29if (value.Length > 0)
System\ServiceModel\Security\SecurityTimestamp.cs (1)
99char[] buffer = new char[DefaultFormat.Length];
System\ServiceModel\Security\SecurityVerifiedMessage.cs (1)
478if (prefix.Length == 0 && localName == "xmlns")
System\ServiceModel\Security\Tokens\ClaimTypeRequirement.cs (1)
24if (claimType.Length <= 0)
System\ServiceModel\Security\WSKeyInfoSerializer.cs (1)
127if (uri.Length > 0 && uri[0] != '#')
System\ServiceModel\Security\WSSecureConversation.cs (2)
194if (label != null && label.Length > _maxKeyDerivationLabelLength) 196throw DiagnosticUtility.ExceptionUtility.ThrowHelperWarning(new MessageSecurityException(SRP.Format(SRP.DerivedKeyTokenLabelTooLong, label.Length, _maxKeyDerivationLabelLength)));
System\ServiceModel\Security\WSSecurityJan2004.cs (1)
319if (type != null && type.Length > 0 && type != SecurityJan2004Strings.UPTokenPasswordTextValue)
System\ServiceModel\Security\WSTrust.cs (5)
117if (secretType != null && secretType.Length > 0) 542if (valueTypeUri.Length == 0) 676if (valueTypeUri.Length == 0) 769if (attr.LocalName == SecurityJan2004Strings.EncodingType && attr.NamespaceURI.Length == 0) 777else if (attr.LocalName == SecurityJan2004Strings.ValueType && attr.NamespaceURI.Length == 0)
System\ServiceModel\Security\XmlHelper.cs (4)
118if (ns == null && prefix.Length > 0) 243if (value == null || value.Length == 0) 307if (idPrefix.Length == 0) 317for (int i = 1; i < idPrefix.Length; i++)
System\ServiceModel\XmlUtil.cs (8)
60for (i = s.Length; i > 0 && IsWhitespace(s[i - 1]); i--) 65if (i != s.Length) 76for (i = 0; i < s.Length && IsWhitespace(s[i]); i++) 92for (i = 0; i < s.Length && IsWhitespace(s[i]); i++) 97if (i >= s.Length) 103for (j = s.Length; j > 0 && IsWhitespace(s[j - 1]); j--) 110if (i != 0 || j != s.Length) 128if (index == qname.Length - 1)
System.ServiceModel.Syndication (3)
System\ServiceModel\Syndication\DateTimeHelper.cs (2)
47if (dateTimeString.Length < 20) 56while (dateTimeString.Length > i && char.IsDigit(dateTimeString[i]))
System\ServiceModel\Syndication\SyndicationFeedFormatter.cs (1)
490if (prefix.Length == 0)
System.ServiceProcess.ServiceController (8)
src\runtime\src\libraries\Common\src\System\Text\ValueStringBuilder.cs (5)
125int count = s.Length; 167if (s.Length == 1 && (uint)pos < (uint)_chars.Length) // very common case, e.g. appending strings from NumberFormatInfo like separators, percent symbols, etc. 181if (pos > _chars.Length - s.Length) 183Grow(s.Length); 191_pos += s.Length;
System\ServiceProcess\ServiceBase.cs (1)
293serviceName.Length <= ServiceBase.MaxNameLength && // not too long
System\ServiceProcess\ServiceController.cs (2)
69if (name.Length == 0) 632Marshal.InitHandle(databaseHandle, machineName.Equals(DefaultMachineName) || machineName.Length == 0 ?
System.Speech (76)
Internal\AlphabetConverter.cs (2)
157while (i < source.Length) 318for (j = 0; j + 1 < from.Length; j++)
Internal\ObjectToken\SAPICategories.cs (3)
42if (pos > 0 && pos < deviceName.Length) 271for (int i = 0; i < 4 && iPosPrev < s.Length; i++) 289if (fIsValid && iPosPrev != s.Length)
Internal\PhonemeConverter.cs (1)
73int cLen = sPhone.Length;
Internal\SapiInterop\SapiGrammar.cs (1)
40_sapiProxy.Invoke2(delegate { _sapiGrammar.SetWordSequenceData(text, (uint)text.Length, ref selectionInfo); });
Internal\SrgsCompiler\BackEnd.cs (3)
69int cBasePath = _basePath != null ? _basePath.Length + 1 : 0; 119streamBuffer.WriteArrayChar(_basePath.ToCharArray(), _basePath.Length); 122System.Diagnostics.Debug.Assert(_basePath.Length + 1 == cBasePath);
Internal\SrgsCompiler\SRGSCompiler.cs (1)
44if (xmlReaders[iReader].BaseURI != null && xmlReaders[iReader].BaseURI.Length > 0)
Internal\SrgsCompiler\SrgsElementCompilerFactory.cs (2)
253for (int iCurPron = 0, iDeliminator = 0; iCurPron < pronunciation.Length; iCurPron = iDeliminator + 1) 259iDeliminator = pronunciation.Length;
Internal\SrgsParser\SrgsDocumentParser.cs (1)
121if (srgsRule.Script.Length > 0)
Internal\SrgsParser\XmlParser.cs (13)
30if (_xmlTextReader != null && _xmlTextReader.BaseURI.Length > 0) 127int cChars = sChars.Length; 435if (reader.Value.Length == 0) 865bool isInvalidAttribute = reader.NamespaceURI.Length == 0; 912if (text.Length == 0) 1692int cLenProperty = sTag.Length; 1781if (sep < (repeat.Length - 1)) 1817if (reader.NamespaceURI.Length > 0) 1845if (uri.StartsWith(_shortFilename!, StringComparison.Ordinal) && (uri.Length > _shortFilename!.Length && uri[_shortFilename.Length] == '#' || uri.Length == _shortFilename.Length))
Internal\StringBlob.cs (4)
36_totalStringSizes += sWord.Length + 1; 68_totalStringSizes += psz.Length + 1; 124iPos += s.Length + 1; 155for (int i = 0; i < s.Length; i++)
Internal\Synthesis\EngineSite.cs (1)
477i += ttsEvent.Phoneme!.Length;
Internal\Synthesis\SSmlParser.cs (20)
99if (reader.NamespaceURI.Length == 0) 310bool isInvalidAttribute = reader.NamespaceURI.Length != 0; 373bool isInvalidAttribute = reader.NamespaceURI.Length != 0; 504bool isInvalidAttribute = reader.NamespaceURI.Length != 0; 561bool isInvalidAttribute = reader.NamespaceURI.Length != 0; 729bool isInvalidAttribute = reader.NamespaceURI.Length != 0; 854bool isInvalidAttribute = reader.NamespaceURI.Length != 0; 934bool isInvalidAttribute = reader.NamespaceURI.Length != 0; 1001bool isInvalidAttribute = reader.NamespaceURI.Length != 0; 1012textPosition = engine.Ssml.IndexOf(reader.Value, textReader.LinePosition + reader.LocalName.Length, StringComparison.Ordinal); 1075if (reader.NamespaceURI.Length == 0) 1232bool isInvalidAttribute = reader.NamespaceURI.Length != 0; 1478if (reader.NamespaceURI.Length > 0) 1494if (pos > 0 && time.Length == pos + 2) 1506if ((pos = time.IndexOf('s')) > 0 && time.Length == pos + 1) 1690if (sNumber[sNumber.Length - 1] == '%') 1692if (decimal.TryParse(sNumber.Substring(0, sNumber.Length - 1), out value)) 1743if (sNumber.IndexOf("Hz", StringComparison.Ordinal) == sNumber.Length - 2) 1747else if (sNumber.IndexOf("st", StringComparison.Ordinal) == sNumber.Length - 2) 1755fResult = TryParseNumber(sNumber.Substring(0, sNumber.Length - 2), ref number) && (acceptHzRelative || number.SsmlAttributeId == ProsodyNumber.AbsoluteNumber);
Internal\Synthesis\TextFragmentEngine.cs (3)
57_speakInfo.AddText((TTSVoice)voice, new TextFragment(fragmentState, text, _ssmlText, position, text.Length)); 70if (baseUri[baseUri.Length - 1] != '/' && baseUri[baseUri.Length - 1] != '\\')
Internal\Synthesis\VoiceSynthesis.cs (6)
227pos = text.Length; 232newLength += _xmlEscapeStrings[iEscapeString].Length - 1; 237pos += _xmlEscapeStrings[iEscapeString].Length; 247int lenEscape = _xmlEscapeStrings[iEscapeString].Length; 1163int lastCharacter = firstCharacter + sysVoice.VoiceInfo.Name.Length; 1164if ((firstCharacter == 0 || name[firstCharacter - 1] == ' ') && (lastCharacter == name.Length || name[lastCharacter] == ' '))
Recognition\Grammar.cs (1)
417if (!hasUri || (posDll > 0 && posDll == grammarName.Length - 4))
Recognition\RecognizerBase.cs (1)
303SPTEXTSELECTIONINFO selectionInfo = new(0, 0, (uint)precedingText.Length, 0);
Recognition\SrgsGrammar\SrgsElementFactory.cs (2)
49for (int iCurPron = 0, iDeliminator = 0; iCurPron < sPron.Length; iCurPron = iDeliminator + 1) 55iDeliminator = sPron.Length;
Recognition\SrgsGrammar\SrgsGrammar.cs (2)
155_fContainsCode |= _language != null || _script.Length > 0 || _usings.Count > 0 || _assemblyReferences.Count > 0 || _codebehind.Count > 0 || _namespace != null || _fDebug; 631if (_script.Length > 0)
Recognition\SrgsGrammar\SrgsRule.cs (2)
363return _script.Length > 0; 388if (s != null && (s.Length == 0 || s.AsSpan().ContainsAny(s_invalidChars)))
Recognition\SrgsGrammar\SrgsSubset.cs (1)
107if (_text != null && _text.Length > 0)
Recognition\SrgsGrammar\SrgsText.cs (1)
53if (_text != null && _text.Length > 0)
Recognition\SrgsGrammar\SrgsToken.cs (3)
98if (_text != null && _text.Length > 0) 115for (int iCurPron = 0, iDeliminator = 0; iCurPron < _pronunciation.Length; iCurPron = iDeliminator + 1) 121iDeliminator = _pronunciation.Length;
Result\RecognizedWordUnit.cs (1)
31_pronunciation = pronunciation == null || pronunciation.Length == 0 ? null : pronunciation;
Synthesis\TTSEngine\TTSEngineTypes.cs (1)
187: this(fragState, textToSpeak, textToSpeak, 0, textToSpeak.Length)
System.Text.Encoding.CodePages (6)
System\Text\EncodingNLS.cs (2)
76return GetByteCount(pChars, s.Length, null); 106if (s.Length - charIndex < charCount)
System\Text\EncodingTable.cs (4)
66Debug.Assert(encodingNameIndices[encodingNameIndices.Length - 1] == EncodingNames.Length); 111int count = s1.Length; 122return s1.Length - length; 138Debug.Assert(indices[indices.Length - 1] == names.Length);
System.Text.Encodings.Web (11)
src\runtime\src\libraries\Common\src\System\Text\ValueStringBuilder.cs (5)
125int count = s.Length; 167if (s.Length == 1 && (uint)pos < (uint)_chars.Length) // very common case, e.g. appending strings from NumberFormatInfo like separators, percent symbols, etc. 181if (pos > _chars.Length - s.Length) 183Grow(s.Length); 191_pos += s.Length;
System\IO\TextWriterExtensions.cs (1)
22if (offset == 0 && count == value.Length)
System\Text\Encodings\Web\TextEncoder.cs (5)
194Encode(output, value, 0, value.Length); 215ValidateRanges(startIndex, characterCount, actualInputLength: value.Length); 580if (destination.Length < source.Length) 586for (int i = 0; i < source.Length; i++) 591numberOfCharactersWritten = source.Length;
System.Text.Json (15)
src\runtime\src\libraries\Common\src\System\Text\ValueStringBuilder.cs (5)
125int count = s.Length; 167if (s.Length == 1 && (uint)pos < (uint)_chars.Length) // very common case, e.g. appending strings from NumberFormatInfo like separators, percent symbols, etc. 181if (pos > _chars.Length - s.Length) 183Grow(s.Length); 191_pos += s.Length;
src\runtime\src\libraries\System.Text.Json\Common\JsonCamelCaseNamingPolicy.cs (1)
16return string.Create(name.Length, name, (chars, name) =>
System\Text\Json\Nodes\JsonValueOfElement.cs (1)
175if (result.Length == 1)
System\Text\Json\Nodes\JsonValueOfJsonPrimitive.cs (1)
112if (result.Length == 1)
System\Text\Json\Serialization\Converters\Value\EnumConverter.cs (3)
593(name.Length > 0 && (char.IsWhiteSpace(name[0]) || char.IsWhiteSpace(name[name.Length - 1]))) || 594(s_isFlagsEnum && (name.Length == 0 || name.Contains(','))))
System\Text\Json\ThrowHelper.Serialization.cs (2)
643if (message.Length > 0) 671if (message.Length > 0)
System\Text\Json\Writer\JsonWriterOptions.cs (1)
16private static readonly string s_alternateNewLine = Environment.NewLine.Length == 2 ? JsonConstants.NewLineLineFeed : JsonConstants.NewLineCarriageReturnLineFeed;
System\Text\Json\Writer\Utf8JsonWriter.cs (1)
255_newLineLength = options.NewLine.Length;
System.Text.Json.SourceGeneration (4)
JsonSourceGenerator.Parser.cs (1)
3196capacity: EncodedPropName.Length + utf8Json.Length * 2);
src\runtime\src\libraries\Common\src\Roslyn\GetBestTypeByMetadataName.cs (2)
157return name.Length > AttributeSuffix.Length && name.EndsWith(AttributeSuffix, comparison);
src\runtime\src\libraries\System.Text.Json\Common\JsonCamelCaseNamingPolicy.cs (1)
16return string.Create(name.Length, name, (chars, name) =>
System.Text.RegularExpressions (176)
src\runtime\src\libraries\Common\src\System\Text\ValueStringBuilder.cs (5)
125int count = s.Length; 167if (s.Length == 1 && (uint)pos < (uint)_chars.Length) // very common case, e.g. appending strings from NumberFormatInfo like separators, percent symbols, etc. 181if (pos > _chars.Length - s.Length) 183Grow(s.Length); 191_pos += s.Length;
System\Text\RegularExpressions\Capture.cs (1)
75internal ReadOnlyMemory<char> GetRightSubstring() => Text is string text ? text.AsMemory(Index + Length, Text.Length - Index - Length) : ReadOnlyMemory<char>.Empty;
System\Text\RegularExpressions\MatchCollection.cs (2)
68if ((uint)startat > (uint)input.Length) 205match = _regex.RunSingleMatch(RegexRunnerMode.FullMatchRequired, _prevlen, _input, 0, _input.Length, _startat)!;
System\Text\RegularExpressions\Regex.Count.cs (1)
23RunAllMatchesWithCallback(input, RightToLeft ? input.Length : 0, ref count, static (ref int count, Match match) =>
System\Text\RegularExpressions\Regex.cs (3)
333string fullname = regexinfos[i].Namespace.Length == 0 ? 565if ((uint)startat > (uint)input.Length) 569if ((uint)length > (uint)input.Length)
System\Text\RegularExpressions\Regex.Match.cs (7)
214return RunSingleMatch(RegexRunnerMode.ExistenceRequired, -1, input, 0, input.Length, RightToLeft ? input.Length : 0) is null; 250return RunSingleMatch(RegexRunnerMode.ExistenceRequired, -1, input, 0, input.Length, startat) is null; 430return RunSingleMatch(RegexRunnerMode.FullMatchRequired, -1, input, 0, input.Length, RightToLeft ? input.Length : 0)!; 513return RunSingleMatch(RegexRunnerMode.FullMatchRequired, -1, input, 0, input.Length, startat)!; 742return new MatchCollection(this, input, RightToLeft ? input.Length : 0);
System\Text\RegularExpressions\Regex.Replace.cs (7)
222return Replace(input, replacement, -1, RightToLeft ? input.Length : 0); 263return Replace(input, replacement, count, RightToLeft ? input.Length : 0); 509return Replace(evaluator, this, input, -1, RightToLeft ? input.Length : 0); 557return Replace(evaluator, this, input, count, RightToLeft ? input.Length : 0); 620if ((uint)startat > (uint)input.Length) 647state.segments.Add(input.AsMemory(state.prevat, input.Length - state.prevat)); 651state.prevat = input.Length;
System\Text\RegularExpressions\Regex.Split.cs (4)
188return Split(this, input, 0, RightToLeft ? input.Length : 0); 227return Split(this, input, count, RightToLeft ? input.Length : 0); 284if ((uint)startat > (uint)input.Length) 325state.prevat = input.Length;
System\Text\RegularExpressions\RegexCaseEquivalences.cs (4)
72culture.Name.Length == 0 ? RegexCaseBehavior.Invariant : 78if (cultureName.Length >= 2) 86return cultureName[1] == 'r' && (cultureName.Length == 2 || cultureName[2] == '-'); 88return cultureName[1] == 'z' && (cultureName.Length == 2 || cultureName[2] == '-');
System\Text\RegularExpressions\RegexCharClass.cs (20)
325for (int i = 0; i < category.Length; i++) 431bool startsWithNulls = set.Length >= 2 && set[0] == '\0' && set[1] == '\0'; 432int strLength = SetStartIndex + set.Length + category.Length; 451span[SetLengthIndex] = (char)(state.set.Length - 2); 452span[CategoryLengthIndex] = (char)state.category.Length; 454index = SetStartIndex + state.set.Length - 2; 459span[SetLengthIndex] = (char)state.set.Length; 460span[CategoryLengthIndex] = (char)state.category.Length; 462index = SetStartIndex + state.set.Length; 637set.Length == SetStartIndex + set[SetLengthIndex]) // and no subtraction 668set.Length == SetStartIndex + set[SetLengthIndex]) // and no subtraction 1053set.Length > SetStartIndex && 1143charClass.Length > SetStartIndex + 1311if (set.Length <= endPosition) 1487if (charClass.Length <= endPosition) 1869temp.RemoveAll(kvp => kvp.Value.Length != 1); 1891endPosition >= set.Length && // no subtraction 1939endPosition >= set.Length && // no subtraction 2013if (set.Length > endPosition)
System\Text\RegularExpressions\RegexCompiler.cs (11)
858Ldc(prefix.Length); 1473int length = node.Kind == RegexNodeKind.Multi ? node.Str!.Length : 1; 2096return multi.Str!.Length == 2 ? 3176sliceStaticPos += caseInsensitiveString.Length; 3490Debug.Assert(str.Length >= 2); 3499Ldc(str.Length); 3505for (int i = str.Length - 1; i >= 0; i--) 3530sliceStaticPos += str.Length; 3949switch ((overlap, literal.SetChars.Length)) 5454literalLength = node.Str!.Length; 5696Ldc((root.Kind == RegexNodeKind.Multi ? root.Str!.Length : 1) * (!rtl ? 1 : -1));
System\Text\RegularExpressions\RegexFindOptimizations.cs (4)
100if (prefix.Length > 1) 164if (prefix is { Length: > 1 }) 366if (start != -1 && i - start >= (best is null ? 2 : best.Value.String.Length)) 465pos = i + LeadingPrefix.Length;
System\Text\RegularExpressions\RegexInterpreter.cs (2)
212int c = str.Length; 244pos += str.Length;
System\Text\RegularExpressions\RegexLWCGCompiler.cs (1)
54description = string.Concat("_", pattern.Length > DescriptionLimit ? pattern.AsSpan(0, DescriptionLimit) : pattern);
System\Text\RegularExpressions\RegexNode.cs (13)
333Debug.Assert(node.Str.Length >= 2, $"Expected {node.Str} to be at least two characters"); 1449Debug.Assert(startingNode.Str!.Length > 0); 1451int minLength = Math.Min(startingSpan.Length, startingNode.Str.Length); 1504if (node.Str!.Length == startingSpan.Length) 1509else if (node.Str.Length - 1 == startingSpan.Length) 1512node.Ch = node.Str[node.Str.Length - 1]; 1955while (matchingCharsInMulti < nextNode.Str.Length && currentNode.Ch == nextNode.Str[matchingCharsInMulti]) 1970if (nextNode.Str.Length == matchingCharsInMulti) 1978Debug.Assert(matchingCharsInMulti < nextNode.Str.Length); 1979if (nextNode.Str.Length - matchingCharsInMulti == 1) 1982nextNode.Ch = nextNode.Str[nextNode.Str.Length - 1]; 2851return Str!.Length; 2964return Str!.Length;
System\Text\RegularExpressions\RegexParser.cs (78)
227ValueStringBuilder vsb = input.Length <= EscapeMaxBufferSize ? 229new ValueStringBuilder(input.Length); 236if (i < input.Length) 243while (i < input.Length && input[i] != '\\') 249} while (i < input.Length); 279while (_pos < _pattern.Length) 292while (_pos < _pattern.Length && (!IsSpecialOrSpace(ch = _pattern[_pos]) || (ch == '{' && !IsTrueQuantifier()))) 297while (_pos < _pattern.Length && (!IsSpecial(ch = _pattern[_pos]) || (ch == '{' && !IsTrueQuantifier()))) 305if (_pos == _pattern.Length) 385if (_pos == _pattern.Length) 450if (_pos == _pattern.Length || !(isQuantifier = IsTrueQuantifier())) 484if (_pos < _pattern.Length && _pattern[_pos] == ',') 487max = _pos == _pattern.Length || _pattern[_pos] == '}' ? int.MaxValue : ScanDecimal(); 491if (startpos == _pos || _pos == _pattern.Length || _pattern[_pos++] != '}') 509if (_pos < _pattern.Length && _pattern[_pos] == '?') 546while (_pos < _pattern.Length) 553_pos = _pattern.Length; 558if (_pos < _pattern.Length) 587if (_pos < _pattern.Length && _pattern[_pos] == '^') 600for (; _pos < _pattern.Length; firstChar = false) 607if (_pos < _pattern.Length && _pattern[_pos] == '^') 614if ((_options & RegexOptions.ECMAScript) != 0 && _pos < _pattern.Length && _pattern[_pos] == ']') 619if (_pos >= _pattern.Length) 647if (_pos < _pattern.Length && _pattern[_pos] != ']') 660else if (ch == '\\' && _pos < _pattern.Length) 775else if (_pos + 1 < _pattern.Length && _pattern[_pos] == '-' && _pattern[_pos + 1] != ']') 782else if (_pos < _pattern.Length && ch == '-' && !translatedChar && _pattern[_pos] == '[' && !firstChar) 824if (_pos == _pattern.Length || _pattern[_pos] != '?' || (_pos + 1 < _pattern.Length && _pattern[_pos + 1] == ')')) 841if (_pos == _pattern.Length) 878if (_pos == _pattern.Length) 925if (_pos < _pattern.Length && !(_pattern[_pos] == close || _pattern[_pos] == '-')) 945if (_pos < _pattern.Length && !(_pattern[_pos] == close || _pattern[_pos] == '-')) 962if ((capnum != -1 || proceed) && _pos + 1 < _pattern.Length && _pattern[_pos] == '-') 977if (_pos < _pattern.Length && _pattern[_pos] != close) 991if (_pos < _pattern.Length && _pattern[_pos] != close) 1005if ((capnum != -1 || uncapnum != -1) && _pos < _pattern.Length && _pattern[_pos++] == close) 1017if (_pos < _pattern.Length) 1025if (_pos < _pattern.Length && _pattern[_pos++] == ')') 1041if (_capnames?[capname] is int tmpCapnum && _pos < _pattern.Length && _pattern[_pos++] == ')') 1052if (_pos + 2 < _pattern.Length && _pattern[_pos + 1] == '?') 1061if (_pattern[_pos + 2] == '\'' || (_pos + 3 < _pattern.Length && _pattern[_pos + 2] == '<' && _pattern[_pos + 3] != '!' && _pattern[_pos + 3] != '=')) 1080if (_pos == _pattern.Length) 1114while (_pos < _pattern.Length && IsSpace(_pattern[_pos])) 1120if ((_options & RegexOptions.IgnorePatternWhitespace) != 0 && _pos < _pattern.Length && _pattern[_pos] == '#') 1125_pos = _pattern.Length; 1128else if (_pos + 2 < _pattern.Length && _pattern[_pos + 2] == '#' && _pattern[_pos + 1] == '?' && _pattern[_pos] == '(') 1133_pos = _pattern.Length; 1149Debug.Assert(_pos < _pattern.Length, "The current reading position must not be at the end of the pattern"); 1228Debug.Assert(_pos < _pattern.Length, "The current reading position must not be at the end of the pattern"); 1239if (_pos + 1 < _pattern.Length) 1250if (!angled || _pos == _pattern.Length) 1260else if ((ch == '<' || ch == '\'') && _pos + 1 < _pattern.Length) 1274if (_pos < _pattern.Length && _pattern[_pos++] == close) 1300if (_pos == _pattern.Length || (ch = _pattern[_pos]) < '0' || ch > '9') 1340if (_pos < _pattern.Length && _pattern[_pos++] == close) 1362if (_pos == _pattern.Length) 1374if (ch == '{' && _pos + 1 < _pattern.Length) 1400while (_pos < _pattern.Length && (ch = _pattern[_pos]) >= '0' && ch <= '9') 1426if (!angled || _pos < _pattern.Length && _pattern[_pos++] == '}') 1438if (_pos < _pattern.Length && _pattern[_pos++] == '}') 1495while (_pos < _pattern.Length) 1511int c = Math.Min(3, _pattern.Length - _pos); 1537while (_pos < _pattern.Length && (uint)(d = (char)(_pattern[_pos] - '0')) <= 9) 1557if (_pos + c <= _pattern.Length) 1583if (_pos == _pattern.Length) 1608for (bool off = false; _pos < _pattern.Length; _pos++) 1695if (_pos + 2 >= _pattern.Length) 1707while (_pos < _pattern.Length) 1719if (_pos == _pattern.Length || _pattern[_pos++] != '}') 1868while (_pos < _pattern.Length) 1875if (_pos < _pattern.Length) 1901if (_pos + 1 < _pattern.Length && _pattern[_pos + 1] == '#' && _pattern[_pos] == '?') 1910if (_pos < _pattern.Length && _pattern[_pos] == '?') 1915if (_pos + 1 < _pattern.Length && (_pattern[_pos] == '<' || _pattern[_pos] == '\'')) 1942if (_pos < _pattern.Length) 2152Debug.Assert(_pos < _pattern.Length, "The current reading position must not be at the end of the pattern"); 2162int nChars = _pattern.Length - _pos;
System\Text\RegularExpressions\RegexPrefixAnalyzer.cs (6)
625for (; i < s.Length && results.Count < MaxFixedResults; i++) 630return i == s.Length; 1005cc.AddChar(node.Str![firstChar ? 0 : node.Str.Length - 1]); 1178if (FindPrefix(nextChild) is { Length: >= 1 } prefix) 1185prefix.Length == 1 ? (firstChild, (prefix[0], null, StringComparison.Ordinal, null)) : 1192if (FindPrefixOrdinalCaseInsensitive(nextChild) is { Length: >= 2 } ordinalCaseInsensitivePrefix)
System\Text\RegularExpressions\RegexReplacement.cs (5)
200if ((uint)startat > (uint)input.Length) 254state.offsetAndCounts.Add(input.Length - state.prevat); 265int length = ((span.Length / 2) - 1) * replacement.Length; 280dest = dest.Slice(state.replacement.Length); 320state.prevat = input.Length;
System\Text\RegularExpressions\Symbolic\RegexNodeConverter.cs (1)
446if (set.Length > i)
System\Text\RegularExpressions\Symbolic\SymbolicRegexMatcher.Dgml.cs (1)
61if (label.Length > maxLabelLength)
System.Text.RegularExpressions.Generator (147)
RegexGenerator.Emitter.cs (12)
35StringBuilder sb = new(text.Length); 784writer.WriteLine($"int end = base.runtextpos = start {(!rtl ? "+" : "-")} {(root.Kind == RegexNodeKind.Multi ? root.Str!.Length : 1)};"); 1269writer.WriteLine($"base.runtextpos = pos + {prefix.Length};"); 1979return multi.Str!.Length == 2 ? 3117sliceStaticPos += caseInsensitiveString.Length; 3359Debug.Assert(str.Length >= 2); 3365using (EmitBlock(writer, $"if ((uint)(pos - {str.Length}) >= inputSpan.Length)")) 3371using (EmitBlock(writer, $"for (int i = 0; i < {str.Length}; i++)")) 3373using (EmitBlock(writer, $"if (inputSpan[--pos] != {Literal(str)}[{str.Length - 1} - i])")) 3396sliceStaticPos += str.Length; 3706writer.WriteLine((overlap, literal.SetChars.Length) switch 5068literalLength = node.Str!.Length;
src\runtime\src\libraries\Common\src\Roslyn\GetBestTypeByMetadataName.cs (2)
157return name.Length > AttributeSuffix.Length && name.EndsWith(AttributeSuffix, comparison);
src\runtime\src\libraries\Common\src\System\Buffers\SearchValuesPolyfills.cs (1)
65Debug.Assert(_nonAscii.Length < 10, "Expected few non-ASCII characters at most.");
src\runtime\src\libraries\Common\src\System\StringPolyfills.cs (3)
12s.Length > 0 && s[0] == value; 15s.Length > 0 && s[s.Length - 1] == value;
src\runtime\src\libraries\Common\src\System\Text\ValueStringBuilder.cs (5)
125int count = s.Length; 167if (s.Length == 1 && (uint)pos < (uint)_chars.Length) // very common case, e.g. appending strings from NumberFormatInfo like separators, percent symbols, etc. 181if (pos > _chars.Length - s.Length) 183Grow(s.Length); 191_pos += s.Length;
src\runtime\src\libraries\System.Text.RegularExpressions\src\System\Text\RegularExpressions\RegexCaseEquivalences.cs (4)
72culture.Name.Length == 0 ? RegexCaseBehavior.Invariant : 78if (cultureName.Length >= 2) 86return cultureName[1] == 'r' && (cultureName.Length == 2 || cultureName[2] == '-'); 88return cultureName[1] == 'z' && (cultureName.Length == 2 || cultureName[2] == '-');
src\runtime\src\libraries\System.Text.RegularExpressions\src\System\Text\RegularExpressions\RegexCharClass.cs (20)
325for (int i = 0; i < category.Length; i++) 431bool startsWithNulls = set.Length >= 2 && set[0] == '\0' && set[1] == '\0'; 432int strLength = SetStartIndex + set.Length + category.Length; 451span[SetLengthIndex] = (char)(state.set.Length - 2); 452span[CategoryLengthIndex] = (char)state.category.Length; 454index = SetStartIndex + state.set.Length - 2; 459span[SetLengthIndex] = (char)state.set.Length; 460span[CategoryLengthIndex] = (char)state.category.Length; 462index = SetStartIndex + state.set.Length; 637set.Length == SetStartIndex + set[SetLengthIndex]) // and no subtraction 668set.Length == SetStartIndex + set[SetLengthIndex]) // and no subtraction 1053set.Length > SetStartIndex && 1143charClass.Length > SetStartIndex + 1311if (set.Length <= endPosition) 1487if (charClass.Length <= endPosition) 1869temp.RemoveAll(kvp => kvp.Value.Length != 1); 1891endPosition >= set.Length && // no subtraction 1939endPosition >= set.Length && // no subtraction 2013if (set.Length > endPosition)
src\runtime\src\libraries\System.Text.RegularExpressions\src\System\Text\RegularExpressions\RegexFindOptimizations.cs (3)
100if (prefix.Length > 1) 164if (prefix is { Length: > 1 }) 366if (start != -1 && i - start >= (best is null ? 2 : best.Value.String.Length))
src\runtime\src\libraries\System.Text.RegularExpressions\src\System\Text\RegularExpressions\RegexNode.cs (13)
333Debug.Assert(node.Str.Length >= 2, $"Expected {node.Str} to be at least two characters"); 1449Debug.Assert(startingNode.Str!.Length > 0); 1451int minLength = Math.Min(startingSpan.Length, startingNode.Str.Length); 1504if (node.Str!.Length == startingSpan.Length) 1509else if (node.Str.Length - 1 == startingSpan.Length) 1512node.Ch = node.Str[node.Str.Length - 1]; 1955while (matchingCharsInMulti < nextNode.Str.Length && currentNode.Ch == nextNode.Str[matchingCharsInMulti]) 1970if (nextNode.Str.Length == matchingCharsInMulti) 1978Debug.Assert(matchingCharsInMulti < nextNode.Str.Length); 1979if (nextNode.Str.Length - matchingCharsInMulti == 1) 1982nextNode.Ch = nextNode.Str[nextNode.Str.Length - 1]; 2851return Str!.Length; 2964return Str!.Length;
src\runtime\src\libraries\System.Text.RegularExpressions\src\System\Text\RegularExpressions\RegexParser.cs (78)
227ValueStringBuilder vsb = input.Length <= EscapeMaxBufferSize ? 229new ValueStringBuilder(input.Length); 236if (i < input.Length) 243while (i < input.Length && input[i] != '\\') 249} while (i < input.Length); 279while (_pos < _pattern.Length) 292while (_pos < _pattern.Length && (!IsSpecialOrSpace(ch = _pattern[_pos]) || (ch == '{' && !IsTrueQuantifier()))) 297while (_pos < _pattern.Length && (!IsSpecial(ch = _pattern[_pos]) || (ch == '{' && !IsTrueQuantifier()))) 305if (_pos == _pattern.Length) 385if (_pos == _pattern.Length) 450if (_pos == _pattern.Length || !(isQuantifier = IsTrueQuantifier())) 484if (_pos < _pattern.Length && _pattern[_pos] == ',') 487max = _pos == _pattern.Length || _pattern[_pos] == '}' ? int.MaxValue : ScanDecimal(); 491if (startpos == _pos || _pos == _pattern.Length || _pattern[_pos++] != '}') 509if (_pos < _pattern.Length && _pattern[_pos] == '?') 546while (_pos < _pattern.Length) 553_pos = _pattern.Length; 558if (_pos < _pattern.Length) 587if (_pos < _pattern.Length && _pattern[_pos] == '^') 600for (; _pos < _pattern.Length; firstChar = false) 607if (_pos < _pattern.Length && _pattern[_pos] == '^') 614if ((_options & RegexOptions.ECMAScript) != 0 && _pos < _pattern.Length && _pattern[_pos] == ']') 619if (_pos >= _pattern.Length) 647if (_pos < _pattern.Length && _pattern[_pos] != ']') 660else if (ch == '\\' && _pos < _pattern.Length) 775else if (_pos + 1 < _pattern.Length && _pattern[_pos] == '-' && _pattern[_pos + 1] != ']') 782else if (_pos < _pattern.Length && ch == '-' && !translatedChar && _pattern[_pos] == '[' && !firstChar) 824if (_pos == _pattern.Length || _pattern[_pos] != '?' || (_pos + 1 < _pattern.Length && _pattern[_pos + 1] == ')')) 841if (_pos == _pattern.Length) 878if (_pos == _pattern.Length) 925if (_pos < _pattern.Length && !(_pattern[_pos] == close || _pattern[_pos] == '-')) 945if (_pos < _pattern.Length && !(_pattern[_pos] == close || _pattern[_pos] == '-')) 962if ((capnum != -1 || proceed) && _pos + 1 < _pattern.Length && _pattern[_pos] == '-') 977if (_pos < _pattern.Length && _pattern[_pos] != close) 991if (_pos < _pattern.Length && _pattern[_pos] != close) 1005if ((capnum != -1 || uncapnum != -1) && _pos < _pattern.Length && _pattern[_pos++] == close) 1017if (_pos < _pattern.Length) 1025if (_pos < _pattern.Length && _pattern[_pos++] == ')') 1041if (_capnames?[capname] is int tmpCapnum && _pos < _pattern.Length && _pattern[_pos++] == ')') 1052if (_pos + 2 < _pattern.Length && _pattern[_pos + 1] == '?') 1061if (_pattern[_pos + 2] == '\'' || (_pos + 3 < _pattern.Length && _pattern[_pos + 2] == '<' && _pattern[_pos + 3] != '!' && _pattern[_pos + 3] != '=')) 1080if (_pos == _pattern.Length) 1114while (_pos < _pattern.Length && IsSpace(_pattern[_pos])) 1120if ((_options & RegexOptions.IgnorePatternWhitespace) != 0 && _pos < _pattern.Length && _pattern[_pos] == '#') 1125_pos = _pattern.Length; 1128else if (_pos + 2 < _pattern.Length && _pattern[_pos + 2] == '#' && _pattern[_pos + 1] == '?' && _pattern[_pos] == '(') 1133_pos = _pattern.Length; 1149Debug.Assert(_pos < _pattern.Length, "The current reading position must not be at the end of the pattern"); 1228Debug.Assert(_pos < _pattern.Length, "The current reading position must not be at the end of the pattern"); 1239if (_pos + 1 < _pattern.Length) 1250if (!angled || _pos == _pattern.Length) 1260else if ((ch == '<' || ch == '\'') && _pos + 1 < _pattern.Length) 1274if (_pos < _pattern.Length && _pattern[_pos++] == close) 1300if (_pos == _pattern.Length || (ch = _pattern[_pos]) < '0' || ch > '9') 1340if (_pos < _pattern.Length && _pattern[_pos++] == close) 1362if (_pos == _pattern.Length) 1374if (ch == '{' && _pos + 1 < _pattern.Length) 1400while (_pos < _pattern.Length && (ch = _pattern[_pos]) >= '0' && ch <= '9') 1426if (!angled || _pos < _pattern.Length && _pattern[_pos++] == '}') 1438if (_pos < _pattern.Length && _pattern[_pos++] == '}') 1495while (_pos < _pattern.Length) 1511int c = Math.Min(3, _pattern.Length - _pos); 1537while (_pos < _pattern.Length && (uint)(d = (char)(_pattern[_pos] - '0')) <= 9) 1557if (_pos + c <= _pattern.Length) 1583if (_pos == _pattern.Length) 1608for (bool off = false; _pos < _pattern.Length; _pos++) 1695if (_pos + 2 >= _pattern.Length) 1707while (_pos < _pattern.Length) 1719if (_pos == _pattern.Length || _pattern[_pos++] != '}') 1868while (_pos < _pattern.Length) 1875if (_pos < _pattern.Length) 1901if (_pos + 1 < _pattern.Length && _pattern[_pos + 1] == '#' && _pattern[_pos] == '?') 1910if (_pos < _pattern.Length && _pattern[_pos] == '?') 1915if (_pos + 1 < _pattern.Length && (_pattern[_pos] == '<' || _pattern[_pos] == '\'')) 1942if (_pos < _pattern.Length) 2152Debug.Assert(_pos < _pattern.Length, "The current reading position must not be at the end of the pattern"); 2162int nChars = _pattern.Length - _pos;
src\runtime\src\libraries\System.Text.RegularExpressions\src\System\Text\RegularExpressions\RegexPrefixAnalyzer.cs (6)
625for (; i < s.Length && results.Count < MaxFixedResults; i++) 630return i == s.Length; 1005cc.AddChar(node.Str![firstChar ? 0 : node.Str.Length - 1]); 1178if (FindPrefix(nextChild) is { Length: >= 1 } prefix) 1185prefix.Length == 1 ? (firstChild, (prefix[0], null, StringComparison.Ordinal, null)) : 1192if (FindPrefixOrdinalCaseInsensitive(nextChild) is { Length: >= 2 } ordinalCaseInsensitivePrefix)
System.Threading.AccessControl (6)
System\Security\AccessControl\EventWaitHandleSecurity.cs (1)
138if ((name != null) && (name.Length != 0))
System\Security\AccessControl\MutexSecurity.cs (1)
132if ((name != null) && (name.Length != 0))
System\Security\AccessControl\SemaphoreSecurity.cs (1)
126if ((name != null) && (name.Length != 0))
System\Threading\EventWaitHandleAcl.cs (1)
127if (name.Length == 0)
System\Threading\MutexAcl.cs (1)
118if (name.Length == 0)
System\Threading\SemaphoreAcl.cs (1)
133if (name.Length == 0)
System.Transactions.Local (3)
System\Transactions\Oletx\OletxTransactionManager.cs (1)
387if (_nodeNameField is { Length: 0 })
System\Transactions\TransactionsEtwProvider.cs (2)
1410if (str.Length >= 36) 1417if (str.Length >= 32)
System.Web.HttpUtility (11)
src\runtime\src\libraries\Common\src\System\Text\ValueStringBuilder.cs (5)
125int count = s.Length; 167if (s.Length == 1 && (uint)pos < (uint)_chars.Length) // very common case, e.g. appending strings from NumberFormatInfo like separators, percent symbols, etc. 181if (pos > _chars.Length - s.Length) 183Grow(s.Length); 191_pos += s.Length;
System\Web\HttpUtility.cs (3)
89int queryLength = query.Length; 125valueEnd = query.Length; 204if (e.GetMaxByteCount(str.Length) <= StackallocThreshold)
System\Web\Util\HttpEncoder.cs (2)
462if (e.GetMaxByteCount(str.Length) <= StackallocThreshold) 485int l = value.Length;
System\Web\Util\UriUtil.cs (1)
45int schemeAndAuthorityLength = authorityIndex + authority.Length;
System.Windows.Controls.Ribbon (17)
Microsoft\Windows\Controls\KeyTipService.cs (3)
488int length = keyTip.Length; 508if (keyTipEnd != null && keyTipEnd.Length == 1) 548if (alphaIndex < QatKeyTipCharacters.Length)
Microsoft\Windows\Controls\Ribbon\RibbonComboBox.cs (4)
682if (selectionStart == newText.Length && 830EditableTextBoxSite.SelectionStart = newText.Length; 831EditableTextBoxSite.SelectionLength = matchedText.Length - newText.Length;
Microsoft\Windows\Controls\Ribbon\RibbonControlLengthConverter.cs (4)
178int strLen = goodString.Length; 188strLenUnit = _unitStrings[i].Length; 199strLenUnit = _unitStrings[i].Length; 216strLenUnit = _pixelUnitStrings[i].Length;
Microsoft\Windows\Controls\Ribbon\RibbonHelper.cs (1)
402int length = text.Length;
Microsoft\Windows\Controls\Ribbon\RibbonKeyTipAndContentSyncHelper.cs (2)
104if (accessIndex >= 0 && accessIndex < stringContent.Length - 1) 149keyTip.Length > 0)
Microsoft\Windows\Controls\Ribbon\StringCollectionConverter.cs (1)
60if (str.Length == 0)
Microsoft\Windows\Controls\TextSearchInternal.cs (2)
329Prefix = prefix.Substring(0, prefix.Length - lastChar.Length);
System.Windows.Forms (245)
System\Resources\AssemblyNamesTypeResolutionService.cs (1)
98if (pos > 0 && pos < name.Length - 1)
System\Resources\ResXDataNode.cs (6)
195if (raw.Length > lineWrap) 198StringBuilder output = new(raw.Length + (raw.Length / lineWrap) * 3); 200for (; current < raw.Length - lineWrap; current += lineWrap) 209output.Append(raw, current, raw.Length - current); 643StringBuilder builder = new(text.Length);
System\Resources\ResxFileRef.Converter.cs (2)
61if (lastIndexOfQuote + 2 > stringValue.Length) 77if (nextSemiColumn + 1 > stringValue.Length)
System\Resources\ResXFileRef.cs (5)
59for (i = 0; (i < path1.Length) && (i < path2.Length); ++i) 78if ((i == path1.Length) && (i == path2.Length)) 85for (; i < path1.Length; ++i)
System\Resources\ResXResourceWriter.cs (5)
554if (raw.Length > lineWrap) 557StringBuilder output = new(raw.Length + (raw.Length / lineWrap) * 3); 560for (; current < raw.Length - lineWrap; current += lineWrap) 569output.Append(raw, current, raw.Length - current);
System\Windows\Forms\Accessibility\LabelEditUiaTextProvider.cs (4)
108if (startCharIndex < 0 || startCharIndex >= text.Length) 342if (index >= t.Length) 344index = Math.Max(t.Length - 1, 0); 362if (index < 0 || index >= Text.Length)
System\Windows\Forms\ActiveX\AxHost.cs (1)
1970return Text.Length != 0;
System\Windows\Forms\ActiveX\AxHost.State.cs (1)
316binaryWriter.Write(licenseKey.Length);
System\Windows\Forms\ActiveX\Control.ActiveXImpl.cs (3)
521StringBuilder sb = new(text.Length); 522for (int i = 0; i < text.Length; i++) 736int len = streamName.Length;
System\Windows\Forms\Application.cs (6)
185if (s_companyName is null || s_companyName.Length == 0) 196if (s_companyName is null || s_companyName.Length == 0) 598s_productName = lastDot != -1 && lastDot < ns.Length - 1 ? ns[(lastDot + 1)..] : ns; 635if (s_productVersion is null || s_productVersion.Length == 0) 645if (s_productVersion is null || s_productVersion.Length == 0) 1285s_appFileVersion = type is not null && type.Assembly.Location.Length > 0
System\Windows\Forms\ComponentModel\COM2Interop\COM2ICategorizePropertiesHandler.cs (1)
70if (GetCategoryFromObject(sender.TargetObject, sender.DISPID) is string category && category.Length > 0)
System\Windows\Forms\ComponentModel\COM2Interop\COM2IManagedPerPropertyBrowsingHandler.cs (1)
77if (typeName.Length > 0)
System\Windows\Forms\Components\ErrorProvider\ErrorProvider.ControlItem.cs (3)
121bool adding = _error.Length == 0; 123if (value.Length == 0) 272_error.Length > 0)
System\Windows\Forms\Components\ImageList\ImageList.ImageCollection.cs (1)
42if ((_imageInfoCollection[i] is ImageInfo image) && (image.Name is not null) && (image.Name.Length != 0))
System\Windows\Forms\Control.ControlVersionInfo.cs (7)
39if ((_companyName is null || _companyName.Length == 0) && !OwnerIsInMemoryAssembly) 48if (_companyName is null || _companyName.Length == 0) 86if ((_productName is null || _productName.Length == 0) && !OwnerIsInMemoryAssembly) 95if (_productName is null || _productName.Length == 0) 135if ((_productVersion is null || _productVersion.Length == 0) && !OwnerIsInMemoryAssembly) 145if (_productVersion is null || _productVersion.Length == 0) 172private bool OwnerIsInMemoryAssembly => _owner.GetType().Assembly.Location.Length == 0;
System\Windows\Forms\Control.cs (8)
3865_text = value.Length == 0 ? null : value; 6618if (pos + 1 >= text.Length) 6624if (pos <= 0 || pos >= text.Length) 6800m.ResultInternal = (LRESULT)((value.Length + 1) * sizeof(char)); 6804if ((int)m.WParamInternal < value.Length + 1) 7987if (_text is not null && _text.Length != 0) 8164if (_text is not null && _text.Length == 0) 11501return Text.Length != 0;
System\Windows\Forms\Controls\Buttons\ButtonInternal\ButtonBaseAdapter.LayoutOptions.cs (1)
505if (ImageSize == Size.Empty || Text is null || Text.Length == 0 || textImageRelation == TextImageRelation.Overlay)
System\Windows\Forms\Controls\ComboBox\ComboBox.AutoCompleteDropDownFinder.cs (2)
39Span<char> buffer = stackalloc char[AutoCompleteClassName.Length + 2]; 45if (length == AutoCompleteClassName.Length && buffer.StartsWith(AutoCompleteClassName))
System\Windows\Forms\Controls\ComboBox\ComboBox.ComboBoxUiaTextProvider.cs (4)
163if (!_owningComboBox.IsHandleCreated || startCharIndex < 0 || startCharIndex >= text.Length) 417if (index >= t.Length) 419index = Math.Max(t.Length - 1, 0); 437if (index < 0 || index >= Text.Length)
System\Windows\Forms\Controls\ComboBox\ComboBox.cs (4)
1272SelectionLength = text.Length; 2125MatchingText.Length <= 1) 3042Select(0, Text.Length); 3045SelectionLength = Text.Length;
System\Windows\Forms\Controls\DataGridView\DataGridView.DataConnection.cs (1)
1530if (DataMember.Length != 0 && props[DataMember] is not null)
System\Windows\Forms\Controls\DataGridView\DataGridView.Methods.cs (8)
2884if (cellStyle is not null && cellStyle.Format.Length != 0) 2888else if (columnHeadersStyle.Format.Length != 0) 10448Debug.Assert(dataGridViewColumn.DataPropertyName.Length != 0, "this method should be called only for columns which have DataPropertyName set"); 13255if (dataGridViewColumn.DataPropertyName.Length != 0) 13264if (Columns[i].DataPropertyName.Length != 0) 13324if (DataSource is not null && e.Column.DataPropertyName.Length != 0 && !_dataGridViewOper[OperationInRefreshColumns]) 13328else if (DataSource is not null && e.Column.DataPropertyName.Length == 0) 25442if (DataSource is not null && dataGridViewCols[j].DataPropertyName.Length != 0)
System\Windows\Forms\Controls\DataGridView\DataGridViewButtonCell.cs (3)
320if (cellStyle.WrapMode == DataGridViewTriState.True && formattedString.Length > 1 && 344if (cellStyle.WrapMode == DataGridViewTriState.True && formattedString.Length > 1 && 372if (cellStyle.WrapMode == DataGridViewTriState.True && formattedString.Length > 1)
System\Windows\Forms\Controls\DataGridView\DataGridViewCell.cs (9)
1159int cb = s.Length; 1217int cb = s.Length; 2104if (cellStyle is not null && cellStyle.Format.Length != 0) 2108else if (rowStyle is not null && rowStyle.Format.Length != 0) 2112else if (DataGridView.RowsDefaultCellStyle.Format.Length != 0 && 2113(rowIndex % 2 == 0 || DataGridView.AlternatingRowsDefaultCellStyle.Format.Length == 0)) 2117else if (rowIndex % 2 == 1 && DataGridView.AlternatingRowsDefaultCellStyle.Format.Length != 0) 2121else if (columnStyle is not null && columnStyle.Format.Length != 0) 3963if (toolTipText.Length > MaxToolTipLength)
System\Windows\Forms\Controls\DataGridView\DataGridViewCellStyle.cs (2)
234return nullValue is string nullValueString && nullValueString.Length == 0; 413if (dataGridViewCellStyle.Format.Length != 0)
System\Windows\Forms\Controls\DataGridView\DataGridViewColumn.cs (1)
510if (columnStyle is not null && columnStyle.Format.Length != 0)
System\Windows\Forms\Controls\DataGridView\DataGridViewColumnHeaderCell.cs (2)
393if (cellStyle is not null && cellStyle.Format.Length != 0) 397else if (columnHeadersStyle.Format.Length != 0)
System\Windows\Forms\Controls\DataGridView\DataGridViewComboBoxCell.cs (2)
163Debug.Assert(DisplayMember is not null && DisplayMember.Length > 0); 173Debug.Assert(ValueMember is not null && ValueMember.Length > 0);
System\Windows\Forms\Controls\DataGridView\DataGridViewLinkCell.cs (1)
559if (cellStyle.WrapMode == DataGridViewTriState.True && formattedString.Length > 1)
System\Windows\Forms\Controls\DataGridView\DataGridViewRow.cs (6)
706if (cellStyle is not null && cellStyle.Format.Length != 0) 710else if (rowHeadersStyle.Format.Length != 0) 935if (rowStyle is not null && rowStyle.Format.Length != 0) 939else if (rowsDefaultCellStyle.Format.Length != 0 && (rowIndex % 2 == 0 || alternatingRowsDefaultCellStyle.Format.Length == 0)) 943else if (rowIndex % 2 == 1 && alternatingRowsDefaultCellStyle.Format.Length != 0)
System\Windows\Forms\Controls\DataGridView\DataGridViewRowHeaderCell.cs (2)
418if (cellStyle is not null && cellStyle.Format.Length != 0) 422else if (rowHeadersStyle.Format.Length != 0)
System\Windows\Forms\Controls\DataGridView\DataGridViewTextBoxCell.cs (1)
411if (cellStyle.WrapMode == DataGridViewTriState.True && formattedString.Length > 1)
System\Windows\Forms\Controls\DataGridView\DataGridViewTextBoxEditingControl.cs (5)
129if ((RightToLeft == RightToLeft.No && !(SelectionLength == 0 && SelectionStart == Text.Length)) || 142(RightToLeft == RightToLeft.Yes && !(SelectionLength == 0 && SelectionStart == Text.Length))) 173if (SelectionLength != Text.Length) 191SelectionStart < Text.Length) 225SelectionStart = Text.Length;
System\Windows\Forms\Controls\DateTimePicker\DateTimePicker.cs (1)
827if (value is null || value.Length == 0)
System\Windows\Forms\Controls\GroupBox\GroupBox.Modern.cs (2)
537if (semiBoldFamilyName.Length == 0) 563? sourceFamilyName[..^" Regular".Length]
System\Windows\Forms\Controls\Labels\LinkLabel.cs (6)
510return index - numTextElements + text.Length; 515return sub.Length; 535if (text.Length == 0) 657ranges.Add(new CharacterRange(0, text.Length)); 743private bool LinkInText(int start, int length) => start >= 0 && start < Text.Length && length > 0; 988Debug.Assert(Text.Length == 0);
System\Windows\Forms\Controls\ListBoxes\ListBox.cs (1)
2219ReadOnlySpan<char> txt = (z.Length > 40) ? z.AsSpan(0, 40) : z;
System\Windows\Forms\Controls\ListControl\ListControl.cs (3)
310if (DisplayMember.Length == 0) 470private protected bool BindingFieldEmpty => _displayMember.BindingField.Length == 0; 503found = string.Compare(str, 0, GetItemText(items[index]), 0, str.Length, ignoreCase, CultureInfo.CurrentCulture) == 0;
System\Windows\Forms\Controls\ListView\ListView.cs (14)
402lvbkImage.cchImageMax = (uint)(_backgroundImageFileName.Length + 1); 5191backgroundImage.cchImageMax = (uint)(_backgroundImageFileName.Length + 1); 5629ReadOnlySpan<char> txt = (z.Length > 40) ? z.AsSpan(0, 40) : z; 5639ReadOnlySpan<char> txt = (z.Length > 40) ? z.AsSpan(0, 40) : z; 5777cchHeader = header.Length, 5782if (subtitle.Length != 0) 5787if (task.Length != 0) 5792if (footer.Length != 0) 5829if (footer.Length != 0) 5831lvgroup.cchFooter = footer.Length; 5847if (subtitle.Length != 0) 5849lvgroup.cchSubtitle = (uint)subtitle.Length; 5853if (task.Length != 0) 5855lvgroup.cchTask = (uint)task.Length;
System\Windows\Forms\Controls\PictureBox\PictureBox.cs (1)
1208if (ImageLocation is not null && ImageLocation.Length != 0 && WaitOnLoad)
System\Windows\Forms\Controls\PropertyGrid\PropertyGridInternal\CommandsPane.cs (2)
224links[i] = new Point(index, name.Length); 226index += name.Length;
System\Windows\Forms\Controls\PropertyGrid\PropertyGridInternal\GridEntry.cs (2)
1865if (text.Length > MaximumLengthOfPropertyString) 1925text = new string(s_passwordReplaceChar, text.Length);
System\Windows\Forms\Controls\PropertyGrid\PropertyGridInternal\GridToolTip.cs (1)
41if (value is not null && value.Length > MaximumToolTipLength)
System\Windows\Forms\Controls\PropertyGrid\PropertyGridInternal\PropertyDescriptorGridEntry.cs (1)
152if (category is null || category.Length == 0)
System\Windows\Forms\Controls\PropertyGrid\PropertyGridInternal\PropertyDescriptorGridEntry.ExceptionEditor.cs (1)
28if (message is null || message.Length == 0)
System\Windows\Forms\Controls\PropertyGrid\PropertyGridInternal\PropertyGridView.cs (4)
1546if (text is not null && text.Length > 0 && string.Equals(text[..1], letter, StringComparison.InvariantCultureIgnoreCase)) 3745PInvoke.GetTextExtentPoint32W(hdc.HDC, value, value.Length, textSize); 4956while (exMessage is null || exMessage.Length == 0) 5029while (message is null || message.Length == 0)
System\Windows\Forms\Controls\PropertyGrid\PropertyGridInternal\PropertyGridView.DropDownHolder.cs (1)
608CreateNewLink.Links.Add(0, editor.Text.Length, editor);
System\Windows\Forms\Controls\RichTextBox\RichTextBox.cs (13)
1098return SelectedText.Length; 1842int startIndex = FindInternal(kashidaString, position, position + str.Length, options); 1846chrg.cpMax = position + str.Length; 1853for (searchingCursor = startIndex, foundCursor = position + startIndex; searchingCursor < str.Length; 2252if (index >= t.Length) 2254index = Math.Max(t.Length - 1, 0); 2321textDocument.Value->Range(WindowText.Length - 1, WindowText.Length - 1, windowTextRange).ThrowOnFailure(); 2357if (index < 0 || index > Text.Length) 2616if (_textRtf!.Length == 0) 2888if (str.Length == 0) 2950byte[] bytes = new byte[SZ_RTF_TAG.Length]; 2956_editStream.ReadExactly(bytes, (int)streamStart, SZ_RTF_TAG.Length);
System\Windows\Forms\Controls\TabControl\TabControl.cs (3)
2155tcitem.cchTextMax = text.Length; 2190for (int i = firstAmpersand; i < value.Length; ++i) 2194if (i < value.Length - 1 && value[i + 1] == '&')
System\Windows\Forms\Controls\TextBox\MaskedTextBox.cs (2)
1211return GetFormattedDisplayString().Length; 2726if (text.Length == 0)
System\Windows\Forms\Controls\TextBox\TextBoxBase.cs (17)
604while (lineStart < text.Length) 608for (; lineEnd < text.Length; lineEnd++) 622if (lineEnd < text.Length && text[lineEnd] == '\r') 627if (lineEnd < text.Length && text[lineEnd] == '\n') 636if (text.Length > 0 && (text[^1] == '\r' || text[^1] == '\n')) 1170: t.Length; 1364=> IsHandleCreated ? PInvokeCore.GetWindowTextLength(this) : Text.Length; 1418Text = value.Length == 0 ? null : value; 1991return (index < 0 || index >= t.Length) ? (char)0 : t[index]; 2012if (index >= t.Length) 2014index = Math.Max(t.Length - 1, 0); 2037if (index < 0 || index >= Text.Length) 2345if (start > str.Length) 2347start = str.Length; 2355if (end > str.Length) 2357end = str.Length; 2383if (txt.Length > 40)
System\Windows\Forms\Controls\TextBox\TextBoxBase.TextBoxBaseUiaTextProvider.cs (4)
279: ((MaskedTextBox)Owner).PasswordChar, Owner.Text.Length) 282public override int TextLength => Text.Length; 312if (Owner is null || !Owner.IsHandleCreated || startCharIndex < 0 || startCharIndex >= text.Length) 383visibleEnd = Text.Length;
System\Windows\Forms\Controls\ToolStrips\ToolStripItemCollection.cs (2)
60if ((key is null) || (key.Length == 0)) 345if ((key is null) || (key.Length == 0))
System\Windows\Forms\Controls\TreeView\TreeViewImageKeyConverter.cs (1)
32if (value is string strValue && (strValue.Length == 0))
System\Windows\Forms\Controls\UpDown\DomainUpDown.cs (1)
265if (text.Length < 1)
System\Windows\Forms\Controls\UpDown\NumericUpDown.cs (2)
539!(Text.Length == 1 && Text == "-")) 740!(Text.Length == 1 && Text == "-")))
System\Windows\Forms\Controls\WebBrowser\WebBrowser.cs (2)
324MemoryStream ms = new(value.Length); 588if (value is not null && value.ToString().Length == 0)
System\Windows\Forms\DataBinding\Binding.BindToObject.cs (2)
147if (_owner.BindingMemberInfo.BindingField.Length == 0) 221if (_bindingManager.DataSource is not null && FieldInfo is null && dataField.Length > 0)
System\Windows\Forms\DataBinding\BindingContext.cs (1)
243if (dataMember.Length == 0)
System\Windows\Forms\DataBinding\BindingMemberInfo.cs (1)
33=> BindingPath.Length > 0
System\Windows\Forms\DataBinding\BindingSource.cs (1)
982int length = current.Length;
System\Windows\Forms\DataBinding\RelatedCurrencyManager.cs (1)
110if (name.Length > 0)
System\Windows\Forms\DataBinding\RelatedPropertyManager.cs (1)
36if (name.Length > 0)
System\Windows\Forms\Design\ComponentEditorForm.PageSelector.cs (2)
123PInvoke.GetTextExtentPoint32W(dc, pItemText, itemText.Length, (SIZE*)(void*)&size); 138itemText.Length,
System\Windows\Forms\Dialogs\CommonDialogs\FileDialog.cs (2)
130else if (defaultExt.Length == 0) 593return string.Create(s.Length + 2, s, static (span, s) =>
System\Windows\Forms\Dialogs\CommonDialogs\FolderBrowserDialog.cs (2)
495if (instance._initialDirectory.Length != 0) 501if (instance.SelectedPath.Length != 0)
System\Windows\Forms\Dialogs\TaskDialog\TaskDialog.cs (1)
1577return str is null ? 0 : ((long)str.Length + 1) * sizeof(char);
System\Windows\Forms\Dialogs\ThreadExceptionDialog.cs (3)
148if (messageText.Length == 0) 237if (activeForm is null || activeForm.Text.Length == 0) 397int i = s.Length;
System\Windows\Forms\Form.cs (1)
4687int newTextEmpty = Text.Length == 0 ? 1 : 0;
System\Windows\Forms\Help\Help.cs (1)
40if (keyword is not null && keyword.Length != 0)
System\Windows\Forms\ImageKeyConverter.cs (1)
87if (destinationType == typeof(string) && value is not null && value is string stringValue && stringValue.Length == 0)
System\Windows\Forms\Input\InputLanguage.cs (1)
158Debug.Assert(subKeyName.Length == 8, $"unexpected key length in registry: {subKey.Name}");
System\Windows\Forms\Internal\Formatter.cs (2)
402if (formattedNullValueStr.Length != valueStr.Length)
System\Windows\Forms\Internal\WinFormsUtils.cs (9)
42int textLength = text.Length; 166StringBuilder str = new(text.Length); 168for (; index < text.Length; ++index) 235int len = text.Length; 288StringBuilder str = new(text.Length); 290for (; index < text.Length; ++index) 298if (index < text.Length) 341if (string1.Length != string2.Length)
System\Windows\Forms\Layout\Containers\ContainerControl.cs (2)
732PInvoke.GetTextExtentPoint32W(dc, ps, FontMeasureString.Length, (SIZE*)(void*)&size); 736retval.Width = (int)Math.Round(size.Width / ((float)FontMeasureString.Length));
System\Windows\Forms\NativeWindow.cs (1)
434if (cp.Caption is not null && cp.Caption.Length > short.MaxValue)
System\Windows\Forms\NotifyIcon.cs (1)
242if (value.Length > MaxTextSize)
System\Windows\Forms\Panels\TableLayoutPanel\TableLayoutSettingsTypeConverter.cs (3)
188while (currentIndex < styleString.Length) 208while ((nextIndex < styleString.Length) && (char.IsDigit(styleString[nextIndex]))) 217while ((nextIndex < styleString.Length) && (!char.IsLetter(styleString[nextIndex])))
System\Windows\Forms\Rendering\FontCache.Data.cs (1)
71if (familyName is not null && familyName.Length > 1 && familyName[0] == '@')
System\Windows\Forms\Rendering\TextExtensions.cs (1)
294PInvoke.GetTextExtentPoint32W(hdc, pText, text.Length, (SIZE*)(void*)&size);
System\Windows\Forms\SendKeys\SendKeys.cs (2)
394int keysLen = keys.Length; 510else if (keyName.Length == 1)
System\Windows\Forms\ToolTip\ToolTipBuffer.cs (3)
25if (_buffer is null || _buffer.Length < text.Length + 1) 27_buffer = GC.AllocateUninitializedArray<char>(text.Length + 1, pinned: true); 32_buffer[text.Length] = '\0';
System\Windows\Forms\VisualStyles\VisualStyleRenderer.cs (3)
395textToDraw.Length, 670textToDraw.Length, 693textToDraw.Length,
System.Windows.Forms.Analyzers.CSharp (5)
System\Windows\Forms\CSharp\Generators\ApplicationConfiguration\ApplicationConfigurationInitializeBuilder.cs (2)
41code.Remove(code.Length - "\r\n".Length, "\r\n".Length);
System\Windows\Forms\CSharp\Generators\ApplicationConfiguration\ProjectFileReader.FontConverter.cs (3)
25if (font.Length == 0) 49if (nameIndex < font.Length - 1) 141int length = text.Length;
System.Windows.Forms.Design (64)
System\ComponentModel\Design\BinaryEditor.cs (1)
60int size = stringValue.Length * 2;
System\ComponentModel\Design\DesignerActionPanel.cs (3)
753StringBuilder result = new(s.Length); 754for (int i = 0; i < s.Length; i++) 760if (i == s.Length)
System\ComponentModel\Design\DesignerActionPanel.EditorPropertyLine.cs (1)
94PInvoke.GetTextExtentPoint32W(hdc, ps, s.Length, (SIZE*)(void*)&textSize);
System\ComponentModel\Design\DesignerActionPanel.PanelHeaderLine.cs (1)
118_subtitleLabel.Visible = (_subtitleLabel.Text.Length != 0);
System\ComponentModel\Design\DesignerHost.cs (6)
560&& className.Length > oldName.Length && className[className.Length - oldName.Length - 1] == '.') 563_rootComponentClassName = string.Concat(className.AsSpan(0, className.Length - oldName.Length), newName);
System\ComponentModel\Design\DesignerHost.Site.cs (1)
233if (value.Length > 0)
System\ComponentModel\Design\EventBindingService.EventPropertyDescriptor.cs (2)
152if (name is not null && name.Length == 0) 328null or string { Length: 0 } => null,
System\ComponentModel\Design\MultilineStringEditor.MultilineStringEditorUI.cs (7)
187PInvoke.DrawText(hdc, t, Text.Length, ref rect, DRAW_TEXT_FORMAT.DT_CALCRECT); 221ProcessSurrogateFonts(0, Text.Length); 224Select(Text.Length, 0); 268if (surrogates.Length == value.Length) 283if (currentSurrogate + 1 < value.Length) 315? value.Length - currentSurrogate 378if (Text.Length != 0)
System\ComponentModel\Design\Serialization\CodeDomComponentSerializationService.CodeDomSerializationStore.cs (3)
305Span<char> chars = stackalloc char[prefix.Length + 36]; 307guid.TryFormat(chars[prefix.Length..], out _); 308chars[prefix.Length..].Replace('-', '_');
System\ComponentModel\Design\Serialization\CodeDomDesignerLoader.cs (5)
1011string baseName = string.Create(dataType.Name.Length, dataType.Name, static (span, baseName) => 1013for (int i = 0; i < baseName.Length; i++) 1015if (char.IsUpper(baseName[i]) && (i == 0 || i == baseName.Length - 1 || char.IsUpper(baseName[i + 1]))) 1102if (name.Length == 0) 1174if (name.Length == 0)
System\ComponentModel\Design\Serialization\DesignerSerializationManager.cs (3)
457&& designerAttribute.SerializerTypeName.Length > 0) 870if (dotIndex == -1 || dotIndex == typeName.Length - 1) 875typeName = string.Concat(typeName.AsSpan(0, dotIndex), "+", typeName.AsSpan(dotIndex + 1, typeName.Length - dotIndex - 1));
System\ComponentModel\Design\Serialization\PrimitiveCodeDomSerializer.cs (1)
25string { Length: > 200 } stringValue => SerializeToResourceExpression(manager, stringValue)!,
System\Drawing\Design\ToolboxItem.cs (1)
853return key is string { Length: > 0 } propertyName
System\Resources\Tools\StronglyTypedResourceBuilder.cs (4)
471resourceManagerConstructorParameter = resourcesNamespace.Length > 0 652if (commentString.Length > DocCommentLengthThreshold) 884if ((key.Length > 0 && key[0] == '$') || 885(key.Length > 1 && key[0] == '>' && key[1] == '>'))
System\Windows\Forms\Design\Behavior\BehaviorService.cs (2)
761m.ResultInternal = (LRESULT)((text.Length + 1) * sizeof(char)); 765if ((int)m.WParamInternal < text.Length + 1)
System\Windows\Forms\Design\Behavior\DropSourceBehavior.cs (1)
366if (name is null || name.Length == 0)
System\Windows\Forms\Design\Behavior\ResizeBehavior.cs (1)
240if (name is null || name.Length == 0)
System\Windows\Forms\Design\ComponentTray.cs (1)
835if (message is null || message.Length == 0)
System\Windows\Forms\Design\ControlDesigner.cs (1)
2251stringFormat.SetMeasurableCharacterRanges([new(0, exceptionText.Length)]);
System\Windows\Forms\Design\DesignBindingValueUIHandler.LocalUIItem.cs (1)
31if (name.Length == 0)
System\Windows\Forms\Design\DocumentDesigner.AxToolboxItem.cs (1)
277minorVer = short.Parse(ver.AsSpan(dot + 1, ver.Length - dot - 1), CultureInfo.InvariantCulture);
System\Windows\Forms\Design\FormatControl.cs (1)
301secondRowLabel.Visible = secondRowLabel.Text.Length > 0;
System\Windows\Forms\Design\ImageCollectionCodeDomSerializer.cs (1)
59if (imageKeys[i] is { Length: not 0 } imageKey)
System\Windows\Forms\Design\ListViewDesigner.cs (1)
195if (message is null || message.Length == 0)
System\Windows\Forms\Design\MaskDescriptor.cs (1)
105return validationErrorDescription.Length == 0;
System\Windows\Forms\Design\StandardMenuStripVerb.cs (3)
448Text.StringBuilder name = new(text.Length + nameSuffix.Length); 450for (int i = 0; i < text.Length; i++)
System\Windows\Forms\Design\StringCollectionEditor.StringCollectionForm.cs (1)
172if (newLines[^1].Length == 0)
System\Windows\Forms\Design\ToolStripDesigner.cs (6)
1697Debug.Assert(defaultName is not null && defaultName.Length > 0, "Couldn't create default name for item"); 1699if (text is null || text.Length == 0 || text == "-") 1706Text.StringBuilder name = new(text.Length + nameSuffix.Length); 1708for (int i = 0; i < text.Length; i++) 1862if (name is null || name.Length == 0)
System\Windows\Forms\Design\ToolStripItemBehavior.cs (1)
661if (name is null || name.Length == 0)
System\Windows\Forms\Design\ToolStripItemDesigner.cs (1)
668if (current is null || current.Length == 0)
System\Windows\Forms\Design\ToolStripMenuItemDesigner.cs (1)
2649if (name is null || name.Length == 0)
System.Windows.Forms.Primitives (11)
System\Windows\Forms\Automation\UiaTextRange.cs (10)
195End = Math.Min(Math.Max(End, Start + 1), text.Length); 247End = Math.Min(Math.Max(End, Start + 1), text.Length); 351if (text.Length == 0) 440*pRetVal = text.Length < maxLength - Start 645=> string.IsNullOrWhiteSpace(text) || index <= 0 || index >= text.Length || ((text[index - 1] == '\n') && (text[index] != '\n')); 654if (string.IsNullOrWhiteSpace(text) || index <= 0 || index >= text.Length || AtParagraphBoundary(text, index)) 950while (moved < count && index < text.Length) 1000while (moved < count && index < text.Length) 1108bool firstLineEmpty = (lineMax == 0 || (lineMax > 1 && _provider.GetLineIndex(1) == LineSeparator.Length)); 1121index = _provider.GetLineIndex(line + actualCount) - LineSeparator.Length;
System\Windows\Forms\Internals\UnicodeCharBuffer.cs (1)
51int count = Math.Min(s.Length, _buffer.Length - _offset);
System.Windows.Input.Manipulations (1)
System\Windows\Input\Manipulations\Exceptions.cs (1)
219Debug.Assert(paramName.Length > 0);
System.Xaml (61)
src\wpf\src\Microsoft.DotNet.Wpf\src\Shared\MS\Internal\ReflectionUtils.cs (4)
110assemblyVersion = assemblyName.Slice(versionIndex + Version.Length, tokenLength - Version.Length); 122assemblyToken = assemblyName.Slice(tokenIndex + PublicKeyToken.Length, tokenLength - PublicKeyToken.Length);
src\wpf\src\Microsoft.DotNet.Wpf\src\Shared\System\Windows\Markup\XmlCompatibilityReader.cs (1)
961int length = pair.Length;
System\Windows\Markup\DateTimeValueSerializer.cs (1)
44if (value.Length == 0)
System\Windows\Markup\StaticExtension.cs (1)
91fieldString = _member.Substring(dotIndex + 1, _member.Length - dotIndex - 1);
System\Xaml\MS\Impl\XmlNsInfo.cs (8)
137if (prefix1.Length < prefix2.Length) 141else if (prefix2.Length < prefix1.Length) 558else if (prefix1.Length < prefix2.Length) 562else if (prefix2.Length < prefix1.Length)
System\Xaml\NameScope.cs (2)
31if (name.Length == 0) 69if (name.Length == 0)
System\Xaml\NameScopeDictionary.cs (3)
42if (name.Length == 0) 82if (name.Length == 0) 107if (name.Length == 0)
System\Xaml\NameValidationHelper.cs (1)
32for (int i = 0; i < name.Length; i++)
System\Xaml\Parser\GenericTypeNameScanner.cs (3)
325if (_multiCharTokenStartIdx == 0 && _multiCharTokenLength == _inputText.Length) 355get { return (_idx >= _inputText.Length); } 363_idx = _inputText.Length;
System\Xaml\Parser\MeScanner.cs (7)
119get { return (_idx >= _inputText.Length); } 254StringBuilder builder = new StringBuilder(value.Length); 262builder.Append(value, start, value.Length - start); 273if (idx + 1 < value.Length) 282while (start < value.Length); 540if (_idx + 1 < _inputText.Length) 554_idx = _inputText.Length;
System\Xaml\Parser\XamlName.cs (2)
46if (name.Length == 0) 56for (int i = 1; i < name.Length; i++)
System\Xaml\Parser\XamlQualifiedName.cs (4)
27if (name.Length == 0) 37for (int i = 1; i < name.Length; i++) 50if (name.Length == 0) 60for (int i = 1; i < name.Length; i++)
System\Xaml\Parser\XamlText.cs (9)
58return text.Remove(0, ME_ESCAPE.Length); 117bool textHadTrailingWhitespace = IsWhitespaceChar(text[text.Length - 1]); 184for (int i=0; i<text.Length; i++) 203StringBuilder sb = new StringBuilder(text.Length); 205while (firstIdx < text.Length) 218while (++advancingIdx < text.Length) 225if (firstIdx != 0 && advancingIdx != text.Length) 271Debug.Assert(end < text.Length); 286if (end + 1 >= text.Length)
System\Xaml\Schema\TypeReflector.cs (6)
922name = mi.Name.Substring(KnownStrings.Get.Length); 946name = mi.Name.Substring(KnownStrings.Set.Length); 970name = mi.Name.Substring(KnownStrings.Add.Length, 971mi.Name.Length - KnownStrings.Add.Length - KnownStrings.Handler.Length);
System\Xaml\XamlMarkupExtensionWriter.cs (2)
258for (int i = 0; i < s.Length; i++) 286if (ContainCharacterToEscape(value) || value.Length == 0)
System\Xaml\XamlObjectReader.cs (1)
2626if (prefix.Length == 0)
System\Xaml\XamlTypeName.cs (1)
228if (prefix.Length != 0)
System\Xaml\XamlXmlWriter.cs (5)
309return s[s.Length - 1] == KnownStrings.SpaceChar; 314for (int i = 1; i < s.Length - 1; i++) 327for (int i = 0; i < s.Length; i++) 670typeName = type.Name.Substring(0, type.Name.Length - "Extension".Length);
Terminals.Repl (3)
Program.cs (3)
29if (trimmed.Length == 0) 57PrintRainbow(rest.Length > 0 ? rest : "Hello from Aspire!"); 105for (var i = 0; i < text.Length; i++)
TestingAppHost1.AppHost (2)
TestingAppHostEntryPointProbe.cs (2)
35var id = argument[ArgumentPrefix.Length..]; 68var id = argument[BreakpointArgumentPrefix.Length..];
TypeScriptApiCompat (11)
ApiCompatSuppression.cs (2)
62if (line.Length == 0 || line.StartsWith("#", StringComparison.Ordinal)) 83if (reason.Length == 0)
AtsSurface.cs (1)
75return fileName[..^suffix.Length];
AtsSurfaceParser.cs (7)
259? symbolId["enum:".Length..] 282if (symbolId.Length <= knownPackageName.Length || 283symbolId[knownPackageName.Length] != '.' || 289if (knownPackageName.Length > packageName.Length) 295return packageName.Length > 0;
ExcludedPackageLoader.cs (1)
24if (line.Length == 0 || line.StartsWith("#", StringComparison.Ordinal))
UIAutomationClient (6)
MS\Internal\Automation\CacheHelper.cs (1)
97if (index != response.TreeStructure.Length)
MS\Internal\Automation\ProxyManager.cs (1)
721if( pi.ClassName != null && pi.ClassName.Length > 0 && pi.ClassName[ 0 ] == '#' )
MS\Internal\Automation\WindowShowOrOpenTracker.cs (1)
74if (string.Compare(str, 0, _wcpClassName, 0, _wcpClassName.Length, StringComparison.OrdinalIgnoreCase) == 0)
System\Windows\Automation\Automation.cs (2)
93return full.Substring(0, full.Length - 8); // Slice away "Property" suffix 106return full.Substring(0, full.Length - 26); // Slice away "InvokePatternIdentifiers.Pattern" to get just "Invoke"
System\Windows\Automation\Text\TextRange.cs (1)
217Misc.ValidateArgument(text.Length != 0, nameof(SR.TextMustNotBeNullOrEmpty));
UIAutomationClientSideProviders (27)
MS\Internal\AutomationProxies\Misc.cs (1)
41if (iPosShortCut < 0 || iPosShortCut + 1 >= s.Length)
MS\Internal\AutomationProxies\ProxySimple.cs (1)
246return _sAutomationId.Length > 0 ? _sAutomationId : null;
MS\Internal\AutomationProxies\WindowsEditBox.cs (2)
291if (result != -1 && result < str.Length) 863return Misc.GetTextExtentPoint32(hdc, text, text.Length, out size);
MS\Internal\AutomationProxies\WindowsEditBoxRange.cs (9)
127End = Math.Min(Math.Max(End, Start + 1), text.Length); 161End = Math.Min(Math.Max(End, Start + 1), text.Length); 213return i >= 0 ? new WindowsEditBoxRange(_provider, Start + i, Start + i + text.Length) : null; 545return index <= 0 || index >= text.Length || (text[index - 1]=='\n') && (text[index]!='\n'); 559if (index <= 0 || index >= text.Length) 850for (moved = 0; moved < count && index < text.Length; moved++) 891for (moved = 0; moved < count && index < text.Length; moved++) 1004((lineMax > 1 && _provider.LineIndex(1) == _lineSeparator.Length) 1019index = _provider.LineIndex(line + actualCount) - _lineSeparator.Length;
MS\Internal\AutomationProxies\WindowsListViewItemCheckBox.cs (1)
110return name.Length < Misc.MaxLengthNameProperty ? name : name.Substring(0, Misc.MaxLengthNameProperty);
MS\Internal\AutomationProxies\WindowsListViewSubItem.cs (1)
199return name.Length < Misc.MaxLengthNameProperty ? name : name.Substring(0, Misc.MaxLengthNameProperty);
MS\Internal\AutomationProxies\WindowsMenu.cs (10)
1361if (pos > 0 && pos + keywordsAccelerators[i].Length == menuText.Length && (menuText[pos - 1] == '\a' || menuText[pos - 1] == '\t')) 1549if (iPosShortCut < 0 || iPosShortCut + 1 >= s.Length) 2434int cMenuChars = menuText.Length; 2439int cKeyChars = sKeyword.Length; 2466int cChars = menuText.Length; 2695System.Diagnostics.Debug.Assert (name.Length > hotKeyStart + 1, "Unexpected end of string"); 2775if (pos > 0 && pos + keywordsAccelerators[i].Length == menuText.Length && (menuText[pos - 1] == '\a' || menuText[pos - 1] == '\t')) 2921return _sAutomationId.Length > 0 ? _sAutomationId : null;
MS\Internal\AutomationProxies\WindowsRichEdit.cs (1)
189if (result < str.Length)
MS\Internal\AutomationProxies\WindowsRichEditRange.cs (1)
240Debug.Assert(text == null || text.Length == maxLength);
UIAutomationTypes (1)
src\wpf\src\Microsoft.DotNet.Wpf\src\Shared\MS\Win32\NativeMethodsCLR.cs (1)
2423int count = Math.Min(s.Length, buffer.Length - offset);
vbc (3)
src\roslyn\src\Compilers\Shared\BuildProtocol.cs (1)
648writer.Write(value.Length);
src\roslyn\src\Compilers\Shared\RuntimeHostInfo.cs (2)
82if (Environment.GetEnvironmentVariable(DotNetHostPathEnvironmentName) is { Length: > 0 } pathToDotNet) 87if (Environment.GetEnvironmentVariable(DotNetExperimentalHostPathEnvironmentName) is { Length: > 0 } pathToDotNetExperimental)
VBCSCompiler (12)
src\roslyn\src\Compilers\Server\VBCSCompiler\BuildServerController.cs (8)
245options.PipeName = argSpan[pipeArgPrefix.Length..].ToString(); 249var timeoutValue = argSpan[timeoutArgPrefix.Length..]; 260var parsedLogFilePath = argSpan[logArgPrefix.Length..]; 295var value = argSpan[purgeCacheArgPrefix.Length..].ToString(); 321var value = argSpan[cacheStatsArgPrefix.Length..].ToString(); 332var value = argSpan[cacheStatsVerbosityArgPrefix.Length..].ToString(); 343var value = argSpan[cachePathArgPrefix.Length..].ToString(); 344if (value.Length == 0)
src\roslyn\src\Compilers\Server\VBCSCompiler\CompilationCache.cs (1)
103if (featureValue.Length != 0 && !string.Equals(featureValue, bool.TrueString, StringComparison.OrdinalIgnoreCase))
src\roslyn\src\Compilers\Shared\BuildProtocol.cs (1)
648writer.Write(value.Length);
src\roslyn\src\Compilers\Shared\RuntimeHostInfo.cs (2)
82if (Environment.GetEnvironmentVariable(DotNetHostPathEnvironmentName) is { Length: > 0 } pathToDotNet) 87if (Environment.GetEnvironmentVariable(DotNetExperimentalHostPathEnvironmentName) is { Length: > 0 } pathToDotNetExperimental)
vstest.console (10)
Internal\ConsoleLogger.cs (4)
93CommandLineResources.FailedTestIndicator.Length + 1, 94CommandLineResources.PassedTestIndicator.Length + 1, 95CommandLineResources.SkippedTestIndicator.Length + 1, 96CommandLineResources.None.Length
Internal\MSBuildLogger.cs (3)
283var sb = new StringBuilder(input.Length); 284for (int i = 0; i < input.Length; i++) 286if (input[i] == '%' && i + 1 < input.Length)
Internal\ProgressIndicator.cs (1)
55ConsoleOutput.Write(_testRunProgressString.Substring(0, _testRunProgressString.Length + _dotCounter - 2), OutputLevel.Information);
Processors\CLIRunSettingsArgumentProcessor.cs (1)
193if (indexOfSeparator <= 0 || indexOfSeparator >= arg.Length - 1)
Processors\EnableCodeCoverageArgumentProcessor.cs (1)
271var nonExistingPath = fullpath.Substring(existingPath.Length);
vstest.console.arm64 (10)
src\vstest\src\vstest.console\Internal\ConsoleLogger.cs (4)
93CommandLineResources.FailedTestIndicator.Length + 1, 94CommandLineResources.PassedTestIndicator.Length + 1, 95CommandLineResources.SkippedTestIndicator.Length + 1, 96CommandLineResources.None.Length
src\vstest\src\vstest.console\Internal\MSBuildLogger.cs (3)
283var sb = new StringBuilder(input.Length); 284for (int i = 0; i < input.Length; i++) 286if (input[i] == '%' && i + 1 < input.Length)
src\vstest\src\vstest.console\Internal\ProgressIndicator.cs (1)
55ConsoleOutput.Write(_testRunProgressString.Substring(0, _testRunProgressString.Length + _dotCounter - 2), OutputLevel.Information);
src\vstest\src\vstest.console\Processors\CLIRunSettingsArgumentProcessor.cs (1)
193if (indexOfSeparator <= 0 || indexOfSeparator >= arg.Length - 1)
src\vstest\src\vstest.console\Processors\EnableCodeCoverageArgumentProcessor.cs (1)
271var nonExistingPath = fullpath.Substring(existingPath.Length);