15939 references to Length
AnalyzerRunner (5)
DiagnosticAnalyzerRunner.cs (2)
436var longestAnalyzerName = telemetryInfoDictionary.Select(x => x.Key.GetType().Name.Length).Max(); 475var padding = new string(' ', longestAnalyzerName - analyzerName.Length);
Options.cs (3)
162var expression = new Regex(arg.Substring("/editperf:".Length), RegexOptions.Compiled | RegexOptions.IgnoreCase); 166testDocumentIterations = int.Parse(arg.Substring("/edititer:".Length)); 169iterations = int.Parse(arg.Substring("/iter:".Length));
aspire (1)
Commands\RunCommand.cs (1)
177.Max(s => s.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)
136private static string AddBase64Padding(string base64) => (base64.Length % 4) switch
Aspire.Azure.Npgsql.EntityFrameworkCore.PostgreSQL (1)
src\Components\Common\ManagedIdentityTokenCredentialHelpers.cs (1)
136private static string AddBase64Padding(string base64) => (base64.Length % 4) switch
Aspire.Dashboard (274)
artifacts\obj\Aspire.Dashboard\Debug\net8.0\DashboardService.cs (144)
490if (ApplicationName.Length != 0) hash ^= ApplicationName.GetHashCode(); 523if (ApplicationName.Length != 0) { 537if (ApplicationName.Length != 0) { 552if (other.ApplicationName.Length != 0) { 899if (Name.Length != 0) hash ^= Name.GetHashCode(); 900if (DisplayName.Length != 0) hash ^= DisplayName.GetHashCode(); 972if (Name.Length != 0) { 976if (DisplayName.Length != 0) { 1018if (Name.Length != 0) { 1021if (DisplayName.Length != 0) { 1057if (other.Name.Length != 0) { 1060if (other.DisplayName.Length != 0) { 1353if (CommandName.Length != 0) hash ^= CommandName.GetHashCode(); 1354if (ResourceName.Length != 0) hash ^= ResourceName.GetHashCode(); 1355if (ResourceType.Length != 0) hash ^= ResourceType.GetHashCode(); 1401if (CommandName.Length != 0) { 1405if (ResourceName.Length != 0) { 1409if (ResourceType.Length != 0) { 1427if (CommandName.Length != 0) { 1430if (ResourceName.Length != 0) { 1433if (ResourceType.Length != 0) { 1451if (other.CommandName.Length != 0) { 1454if (other.ResourceName.Length != 0) { 1457if (other.ResourceType.Length != 0) { 1936if (UniqueName.Length != 0) hash ^= UniqueName.GetHashCode(); 1976if (UniqueName.Length != 0) { 1995if (UniqueName.Length != 0) { 2014if (other.UniqueName.Length != 0) { 2212if (Name.Length != 0) hash ^= Name.GetHashCode(); 2255if (Name.Length != 0) { 2277if (Name.Length != 0) { 2298if (other.Name.Length != 0) { 2544if (FullUrl.Length != 0) hash ^= FullUrl.GetHashCode(); 2600if (FullUrl.Length != 0) { 2629if (FullUrl.Length != 0) { 2656if (other.FullUrl.Length != 0) { 2863if (DisplayName.Length != 0) hash ^= DisplayName.GetHashCode(); 2904if (DisplayName.Length != 0) { 2921if (DisplayName.Length != 0) { 2939if (other.DisplayName.Length != 0) { 3140if (Source.Length != 0) hash ^= Source.GetHashCode(); 3141if (Target.Length != 0) hash ^= Target.GetHashCode(); 3142if (MountType.Length != 0) hash ^= MountType.GetHashCode(); 3188if (Source.Length != 0) { 3192if (Target.Length != 0) { 3196if (MountType.Length != 0) { 3214if (Source.Length != 0) { 3217if (Target.Length != 0) { 3220if (MountType.Length != 0) { 3238if (other.Source.Length != 0) { 3241if (other.Target.Length != 0) { 3244if (other.MountType.Length != 0) { 3479if (Key.Length != 0) hash ^= Key.GetHashCode(); 3480if (Description.Length != 0) hash ^= Description.GetHashCode(); 3481if (Exception.Length != 0) hash ^= Exception.GetHashCode(); 3530if (Key.Length != 0) { 3534if (Description.Length != 0) { 3538if (Exception.Length != 0) { 3555if (Key.Length != 0) { 3558if (Description.Length != 0) { 3561if (Exception.Length != 0) { 3579if (other.Key.Length != 0) { 3582if (other.Description.Length != 0) { 3585if (other.Exception.Length != 0) { 3765if (ResourceName.Length != 0) hash ^= ResourceName.GetHashCode(); 3766if (Type.Length != 0) hash ^= Type.GetHashCode(); 3803if (ResourceName.Length != 0) { 3807if (Type.Length != 0) { 3821if (ResourceName.Length != 0) { 3824if (Type.Length != 0) { 3839if (other.ResourceName.Length != 0) { 3842if (other.Type.Length != 0) { 4074if (Name.Length != 0) hash ^= Name.GetHashCode(); 4122if (Name.Length != 0) { 4148if (Name.Length != 0) { 4172if (other.Name.Length != 0) { 4649if (Name.Length != 0) hash ^= Name.GetHashCode(); 4650if (ResourceType.Length != 0) hash ^= ResourceType.GetHashCode(); 4651if (DisplayName.Length != 0) hash ^= DisplayName.GetHashCode(); 4652if (Uid.Length != 0) hash ^= Uid.GetHashCode(); 4746if (Name.Length != 0) { 4750if (ResourceType.Length != 0) { 4754if (DisplayName.Length != 0) { 4758if (Uid.Length != 0) { 4807if (Name.Length != 0) { 4810if (ResourceType.Length != 0) { 4813if (DisplayName.Length != 0) { 4816if (Uid.Length != 0) { 4859if (other.Name.Length != 0) { 4862if (other.ResourceType.Length != 0) { 4865if (other.DisplayName.Length != 0) { 4868if (other.Uid.Length != 0) { 5425if (ResourceName.Length != 0) hash ^= ResourceName.GetHashCode(); 5426if (ResourceType.Length != 0) hash ^= ResourceType.GetHashCode(); 5463if (ResourceName.Length != 0) { 5467if (ResourceType.Length != 0) { 5481if (ResourceName.Length != 0) { 5484if (ResourceType.Length != 0) { 5499if (other.ResourceName.Length != 0) { 5502if (other.ResourceType.Length != 0) { 6700if (Text.Length != 0) hash ^= Text.GetHashCode(); 6743if (Text.Length != 0) { 6765if (Text.Length != 0) { 6786if (other.Text.Length != 0) { 6968if (ResourceName.Length != 0) hash ^= ResourceName.GetHashCode(); 7006if (ResourceName.Length != 0) { 7024if (ResourceName.Length != 0) { 7042if (other.ResourceName.Length != 0) { 8019if (Title.Length != 0) hash ^= Title.GetHashCode(); 8020if (Message.Length != 0) hash ^= Message.GetHashCode(); 8021if (PrimaryButtonText.Length != 0) hash ^= PrimaryButtonText.GetHashCode(); 8022if (SecondaryButtonText.Length != 0) hash ^= SecondaryButtonText.GetHashCode(); 8111if (Title.Length != 0) { 8115if (Message.Length != 0) { 8119if (PrimaryButtonText.Length != 0) { 8123if (SecondaryButtonText.Length != 0) { 8168if (Title.Length != 0) { 8171if (Message.Length != 0) { 8174if (PrimaryButtonText.Length != 0) { 8177if (SecondaryButtonText.Length != 0) { 8216if (other.Title.Length != 0) { 8219if (other.Message.Length != 0) { 8222if (other.PrimaryButtonText.Length != 0) { 8225if (other.SecondaryButtonText.Length != 0) { 9008if (LinkText.Length != 0) hash ^= LinkText.GetHashCode(); 9009if (LinkUrl.Length != 0) hash ^= LinkUrl.GetHashCode(); 9062if (LinkText.Length != 0) { 9066if (LinkUrl.Length != 0) { 9086if (LinkText.Length != 0) { 9089if (LinkUrl.Length != 0) { 9110if (other.LinkText.Length != 0) { 9113if (other.LinkUrl.Length != 0) { 9548if (Label.Length != 0) hash ^= Label.GetHashCode(); 9549if (Placeholder.Length != 0) hash ^= Placeholder.GetHashCode(); 9553if (Value.Length != 0) hash ^= Value.GetHashCode(); 9605if (Label.Length != 0) { 9609if (Placeholder.Length != 0) { 9622if (Value.Length != 0) { 9637if (Label.Length != 0) { 9640if (Placeholder.Length != 0) { 9650if (Value.Length != 0) { 9666if (other.Label.Length != 0) { 9669if (other.Placeholder.Length != 0) { 9679if (other.Value.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 (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\Aspire.Dashboard\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\Aspire.Dashboard\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\Aspire.Dashboard\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) {
Components\Controls\Chart\ChartContainer.razor.cs (2)
229{ Length: 0 } => Loc[nameof(ControlsStrings.LabelEmpty)], 287var id = newTab.Id?.Substring("tab-".Length);
Components\Controls\StructuredLogDetails.razor.cs (1)
141for (var i = 0; i < value.Length; i++)
Components\Dialogs\FilterDialog.razor.cs (1)
127if (_formModel.Value is { Length: > 0 } value)
Components\Interactions\InteractionsProvider.cs (2)
516if (interaction.PrimaryButtonText is { Length: > 0 } primaryText) 535return interaction.SecondaryButtonText is { Length: > 0 } secondaryText
Components\Pages\Resources.razor.cs (3)
129&& (_filter.Length == 0 || resource.MatchesFilter(_filter)) 610if (current.GetResourcePropertyValue(KnownProperties.Resource.ParentName) is { Length: > 0 } value) 775var id = newTab.Id?.Substring("tab-".Length);
Configuration\PostConfigureDashboardOptions.cs (1)
43if (_configuration[DashboardConfigNames.DashboardFrontendUrlName.ConfigKey] is { Length: > 0 } frontendUrls)
ConsoleLogs\AnsiParser.cs (5)
31while (currentPos < text.Length) 52outputBuilder ??= new StringBuilder(text.Length); 82var outputBuilder = new StringBuilder(text.Length * 2); 163if (i < text.Length - 1) 171textLength = text.Length - textStartIndex;
ConsoleLogs\UrlParser.cs (2)
27builder ??= new StringBuilder(text.Length * 2); 44if (nextCharIndex < text.Length)
Extensions\StringExtensions.cs (1)
13var sanitizedBuilder = new StringBuilder(capacity: input.Length);
Model\ResourceViewModel.cs (1)
309if (value.Length > 12)
Otlp\Model\ColorGenerator.cs (1)
53if (s.Length != 7)
Otlp\Model\MetricValues\DimensionScope.cs (1)
28Name = name != null && name.Length > 0 ? name : NoDimensions;
Otlp\Model\OtlpHelpers.cs (2)
90return value.Length > maxLength ? value[..maxLength] : value; 438if (incomingId.Length >= ShortenedIdLength)
Otlp\Model\OtlpLogEntry.cs (3)
132if (GetProperty(logEntry, ExceptionStackTraceField) is { Length: > 0 } stackTrace) 137if (GetProperty(logEntry, ExceptionMessageField) is { Length: > 0 } message) 139if (GetProperty(logEntry, ExceptionTypeField) is { Length: > 0 } type)
Otlp\Model\OtlpScope.cs (1)
21Name = name is { Length: > 0 } ? name : UnknownScopeName;
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\Storage\ApplicationKey.cs (11)
21if (instanceId.Length >= name.Length + 2 && 23instanceId[name.Length] == '-') 25return new ApplicationKey(name, instanceId.Substring(name.Length + 1)); 61if (name.Length != Name.Length + InstanceId.Length + 1) 66if (!name.AsSpan(0, Name.Length).Equals(Name, StringComparisons.ResourceName)) 70if (name[Name.Length] != '-') 74if (!name.AsSpan(Name.Length + 1, InstanceId.Length).Equals(InstanceId, StringComparisons.ResourceName))
src\Shared\IConfigurationExtensions.cs (2)
37if (primaryValue is not null && !fallbackOnEmpty || primaryValue is string { Length: > 0 }) 43if (secondaryValue is not null && !fallbackOnEmpty || secondaryValue is string { Length: > 0 })
Utils\DashboardUIHelpers.cs (1)
67static string Repeat(string s, int n) => new StringBuilder(s.Length * n)
Aspire.Dashboard.Components.Tests (3)
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 (3)
tests\Shared\Logging\XunitLoggerProvider.cs (3)
78var additionalLinePrefix = "|" + new string(' ', firstLinePrefix.Length - 1); 98message = message.Substring(0, message.Length - Environment.NewLine.Length);
Aspire.EndToEnd.Tests (1)
tests\Shared\TemplatesTesting\AspireProject.cs (1)
220InfoTable = ProjectInfo.Parse(line.Substring("$ENDPOINTS: ".Length));
Aspire.Hosting (179)
ApplicationModel\ContainerFileSystemCallbackAnnotation.cs (1)
127var relativePath = file.Substring(fullPath.Length + 1);
ApplicationModel\ExpressionResolver.cs (1)
99var value = expr.Format.Length == 0 ? null : string.Format(CultureInfo.InvariantCulture, expr.Format, args);
ApplicationModel\ModelName.cs (4)
45if (name.Length < 1 || name.Length > 64) 52for (var i = 0; i < name.Length; i++) 80if (name[name.Length - 1] == '-')
ApplicationModel\ReferenceExpression.cs (4)
59if (Format.Length == 0) 167var sb = new StringBuilder(input.Length + 4); 169for (var i = 0; i < input.Length; i++) 195idx + 1 < s.Length && s[idx + 1] == s[idx];
ApplicationModel\ResourceNotificationService.cs (2)
132&& resourceEvent.Snapshot.State?.Text is { Length: > 0 } stateText 544if (_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 (144)
491if (ApplicationName.Length != 0) hash ^= ApplicationName.GetHashCode(); 524if (ApplicationName.Length != 0) { 538if (ApplicationName.Length != 0) { 553if (other.ApplicationName.Length != 0) { 900if (Name.Length != 0) hash ^= Name.GetHashCode(); 901if (DisplayName.Length != 0) hash ^= DisplayName.GetHashCode(); 973if (Name.Length != 0) { 977if (DisplayName.Length != 0) { 1019if (Name.Length != 0) { 1022if (DisplayName.Length != 0) { 1058if (other.Name.Length != 0) { 1061if (other.DisplayName.Length != 0) { 1354if (CommandName.Length != 0) hash ^= CommandName.GetHashCode(); 1355if (ResourceName.Length != 0) hash ^= ResourceName.GetHashCode(); 1356if (ResourceType.Length != 0) hash ^= ResourceType.GetHashCode(); 1402if (CommandName.Length != 0) { 1406if (ResourceName.Length != 0) { 1410if (ResourceType.Length != 0) { 1428if (CommandName.Length != 0) { 1431if (ResourceName.Length != 0) { 1434if (ResourceType.Length != 0) { 1452if (other.CommandName.Length != 0) { 1455if (other.ResourceName.Length != 0) { 1458if (other.ResourceType.Length != 0) { 1937if (UniqueName.Length != 0) hash ^= UniqueName.GetHashCode(); 1977if (UniqueName.Length != 0) { 1996if (UniqueName.Length != 0) { 2015if (other.UniqueName.Length != 0) { 2213if (Name.Length != 0) hash ^= Name.GetHashCode(); 2256if (Name.Length != 0) { 2278if (Name.Length != 0) { 2299if (other.Name.Length != 0) { 2545if (FullUrl.Length != 0) hash ^= FullUrl.GetHashCode(); 2601if (FullUrl.Length != 0) { 2630if (FullUrl.Length != 0) { 2657if (other.FullUrl.Length != 0) { 2864if (DisplayName.Length != 0) hash ^= DisplayName.GetHashCode(); 2905if (DisplayName.Length != 0) { 2922if (DisplayName.Length != 0) { 2940if (other.DisplayName.Length != 0) { 3141if (Source.Length != 0) hash ^= Source.GetHashCode(); 3142if (Target.Length != 0) hash ^= Target.GetHashCode(); 3143if (MountType.Length != 0) hash ^= MountType.GetHashCode(); 3189if (Source.Length != 0) { 3193if (Target.Length != 0) { 3197if (MountType.Length != 0) { 3215if (Source.Length != 0) { 3218if (Target.Length != 0) { 3221if (MountType.Length != 0) { 3239if (other.Source.Length != 0) { 3242if (other.Target.Length != 0) { 3245if (other.MountType.Length != 0) { 3480if (Key.Length != 0) hash ^= Key.GetHashCode(); 3481if (Description.Length != 0) hash ^= Description.GetHashCode(); 3482if (Exception.Length != 0) hash ^= Exception.GetHashCode(); 3531if (Key.Length != 0) { 3535if (Description.Length != 0) { 3539if (Exception.Length != 0) { 3556if (Key.Length != 0) { 3559if (Description.Length != 0) { 3562if (Exception.Length != 0) { 3580if (other.Key.Length != 0) { 3583if (other.Description.Length != 0) { 3586if (other.Exception.Length != 0) { 3766if (ResourceName.Length != 0) hash ^= ResourceName.GetHashCode(); 3767if (Type.Length != 0) hash ^= Type.GetHashCode(); 3804if (ResourceName.Length != 0) { 3808if (Type.Length != 0) { 3822if (ResourceName.Length != 0) { 3825if (Type.Length != 0) { 3840if (other.ResourceName.Length != 0) { 3843if (other.Type.Length != 0) { 4075if (Name.Length != 0) hash ^= Name.GetHashCode(); 4123if (Name.Length != 0) { 4149if (Name.Length != 0) { 4173if (other.Name.Length != 0) { 4650if (Name.Length != 0) hash ^= Name.GetHashCode(); 4651if (ResourceType.Length != 0) hash ^= ResourceType.GetHashCode(); 4652if (DisplayName.Length != 0) hash ^= DisplayName.GetHashCode(); 4653if (Uid.Length != 0) hash ^= Uid.GetHashCode(); 4747if (Name.Length != 0) { 4751if (ResourceType.Length != 0) { 4755if (DisplayName.Length != 0) { 4759if (Uid.Length != 0) { 4808if (Name.Length != 0) { 4811if (ResourceType.Length != 0) { 4814if (DisplayName.Length != 0) { 4817if (Uid.Length != 0) { 4860if (other.Name.Length != 0) { 4863if (other.ResourceType.Length != 0) { 4866if (other.DisplayName.Length != 0) { 4869if (other.Uid.Length != 0) { 5426if (ResourceName.Length != 0) hash ^= ResourceName.GetHashCode(); 5427if (ResourceType.Length != 0) hash ^= ResourceType.GetHashCode(); 5464if (ResourceName.Length != 0) { 5468if (ResourceType.Length != 0) { 5482if (ResourceName.Length != 0) { 5485if (ResourceType.Length != 0) { 5500if (other.ResourceName.Length != 0) { 5503if (other.ResourceType.Length != 0) { 6701if (Text.Length != 0) hash ^= Text.GetHashCode(); 6744if (Text.Length != 0) { 6766if (Text.Length != 0) { 6787if (other.Text.Length != 0) { 6969if (ResourceName.Length != 0) hash ^= ResourceName.GetHashCode(); 7007if (ResourceName.Length != 0) { 7025if (ResourceName.Length != 0) { 7043if (other.ResourceName.Length != 0) { 8020if (Title.Length != 0) hash ^= Title.GetHashCode(); 8021if (Message.Length != 0) hash ^= Message.GetHashCode(); 8022if (PrimaryButtonText.Length != 0) hash ^= PrimaryButtonText.GetHashCode(); 8023if (SecondaryButtonText.Length != 0) hash ^= SecondaryButtonText.GetHashCode(); 8112if (Title.Length != 0) { 8116if (Message.Length != 0) { 8120if (PrimaryButtonText.Length != 0) { 8124if (SecondaryButtonText.Length != 0) { 8169if (Title.Length != 0) { 8172if (Message.Length != 0) { 8175if (PrimaryButtonText.Length != 0) { 8178if (SecondaryButtonText.Length != 0) { 8217if (other.Title.Length != 0) { 8220if (other.Message.Length != 0) { 8223if (other.PrimaryButtonText.Length != 0) { 8226if (other.SecondaryButtonText.Length != 0) { 9009if (LinkText.Length != 0) hash ^= LinkText.GetHashCode(); 9010if (LinkUrl.Length != 0) hash ^= LinkUrl.GetHashCode(); 9063if (LinkText.Length != 0) { 9067if (LinkUrl.Length != 0) { 9087if (LinkText.Length != 0) { 9090if (LinkUrl.Length != 0) { 9111if (other.LinkText.Length != 0) { 9114if (other.LinkUrl.Length != 0) { 9549if (Label.Length != 0) hash ^= Label.GetHashCode(); 9550if (Placeholder.Length != 0) hash ^= Placeholder.GetHashCode(); 9554if (Value.Length != 0) hash ^= Value.GetHashCode(); 9606if (Label.Length != 0) { 9610if (Placeholder.Length != 0) { 9623if (Value.Length != 0) { 9638if (Label.Length != 0) { 9641if (Placeholder.Length != 0) { 9651if (Value.Length != 0) { 9667if (other.Label.Length != 0) { 9670if (other.Placeholder.Length != 0) { 9680if (other.Value.Length != 0) {
ContainerResourceBuilderExtensions.cs (1)
292var digest = parsedReference.Digest[prefix.Length..];
Dashboard\DashboardLifecycleHook.cs (5)
254&& configuration["AppHost:ResourceService:ApiKey"] is { Length: > 0 } resourceServiceApiKey) 280if (configuration["DEBUG_SESSION_PORT"] is { Length: > 0 } sessionPort) 294if (configuration["DEBUG_SESSION_TOKEN"] is { Length: > 0 } sessionToken) 298if (configuration["DEBUG_SESSION_SERVER_CERTIFICATE"] is { Length: > 0 } sessionCertificate) 462category["Aspire.Dashboard.".Length..] : category;
Dashboard\DashboardService.cs (2)
292var resolvedContent = content.Length > LogMaxBatchCharacters 299currentChars += resolvedContent.Length;
Dcp\DcpExecutor.cs (2)
461for (var i = 0; i < applicationName.Length; i++) 1317var shortApplicationName = _normalizedApplicationName.Length < 32 ? _normalizedApplicationName : _normalizedApplicationName.Substring(0, 32);
Dcp\Model\ModelCommon.cs (1)
231if (candidate.Length > 253)
Exec\ExecResourceManager.cs (1)
235var commandUnwrapped = command.AsSpan(1, command.Length - 2).ToString();
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\IConfigurationExtensions.cs (2)
37if (primaryValue is not null && !fallbackOnEmpty || primaryValue is string { Length: > 0 }) 43if (secondaryValue is not null && !fallbackOnEmpty || secondaryValue is string { 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 (4)
src\Aspire.Hosting\ApplicationModel\ModelName.cs (4)
45if (name.Length < 1 || name.Length > 64) 52for (var i = 0; i < name.Length; i++) 80if (name[name.Length - 1] == '-')
Aspire.Hosting.Analyzers.Tests (1)
AnalyzerTest.cs (1)
32.GetCustomAttribute<TargetFrameworkAttribute>()!.FrameworkName[".NETCoreApp,Version=v".Length..];
Aspire.Hosting.Azure (8)
Provisioning\Internal\DefaultProvisioningContextProvider.cs (3)
70var maxApplicationNameSize = ResourceGroupNameHelpers.MaxResourceGroupNameLength - prefix.Length - suffix.Length - 2; // extra '-'s 73if (normalizedApplicationName.Length > maxApplicationNameSize)
Provisioning\Internal\DefaultUserPrincipalProvider.cs (1)
28switch (part.Length % 4)
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.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)
289if (secretName.Length > 127)
Aspire.Hosting.Kubernetes (1)
KubernetesPublishingContext.cs (1)
153resourceName = resourceName.Substring(baseName.Length + 1); // +1 for the hyphen
Aspire.Hosting.Orleans (1)
ProviderConfiguration.cs (1)
25var providerType = resourceType.EndsWith(resource) ? resourceType[..^resource.Length] : resourceType;
Aspire.Hosting.RabbitMQ (4)
RabbitMQBuilderExtensions.cs (4)
184if (existingTag.Length > alpine.Length) 235if (tag.Length == 1) 242for (var i = 1; i < tag.Length; i++)
Aspire.Hosting.SqlServer.Tests (1)
AddSqlServerTests.cs (1)
75Assert.True(env.Value.Length >= 8);
Aspire.Hosting.Testing (4)
DistributedApplicationFactory.cs (2)
303SetDefault(key["DOTNET_".Length..], value); 309SetDefault(key["ASPNETCORE_".Length..], value);
DistributedApplicationTestingBuilder.cs (2)
331if (appHostAssembly is not null && GetDcpCliPath(appHostAssembly) is { Length: > 0 }) 359if (asm is not null && GetDcpCliPath(asm) is { Length: > 0 })
Aspire.Hosting.Testing.Tests (7)
TestingBuilderTests.cs (3)
66Assert.True(serviceAHttpEndpoint.Host.Length > 0); 139Assert.True(workerEndpoint.Host.Length > 0); 144Assert.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 (16)
AddParameterTests.cs (1)
215Assert.Equal(10, parameterResource.Value.Length);
Dashboard\DashboardServiceTests.cs (7)
66l => Assert.Equal(LongLineCharacters, l.Text.Split(' ')[1].Length), 67l => Assert.Equal(LongLineCharacters, l.Text.Split(' ')[1].Length)); 71l => Assert.Equal(LongLineCharacters, l.Text.Split(' ')[1].Length), 119l => Assert.Equal(DashboardServiceImpl.LogMaxBatchCharacters, l.Text.Length)); 123l => Assert.Equal(LongLineCharacters, l.Text.Split(' ')[1].Length), 124l => Assert.Equal(LongLineCharacters, l.Text.Split(' ')[1].Length)); 128l => Assert.Equal(LongLineCharacters, l.Text.Split(' ')[1].Length));
tests\Shared\Logging\XunitLoggerProvider.cs (3)
78var additionalLinePrefix = "|" + new string(' ', firstLinePrefix.Length - 1); 98message = message.Substring(0, message.Length - Environment.NewLine.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.Microsoft.Data.SqlClient (2)
src\Vendoring\OpenTelemetry.Instrumentation.SqlClient\SqlClientTraceInstrumentationOptions.cs (2)
190bool isNamedPipe = maybeProtocol.Length > 0 && 196if (pipeName.Length > 0)
Aspire.Microsoft.EntityFrameworkCore.SqlServer (2)
src\Vendoring\OpenTelemetry.Instrumentation.SqlClient\SqlClientTraceInstrumentationOptions.cs (2)
190bool isNamedPipe = maybeProtocol.Length > 0 && 196if (pipeName.Length > 0)
Aspire.Playground.Tests (4)
Infrastructure\DistributedApplicationExtensions.cs (1)
141AssertDoesNotContain(resourceLogs, log => log.Category is { Length: > 0 } category && assertableResourceLogNames.Contains(category) && log.Level >= LogLevel.Error);
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)
220InfoTable = ProjectInfo.Parse(line.Substring("$ENDPOINTS: ".Length));
BasicWebSite (1)
src\Mvc\test\WebSites\Common\TestResponseGenerator.cs (1)
32.ToDictionary(kvp => kvp.Key.Substring("link_".Length), kvp => (object)kvp.Value[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) {
BoundTreeGenerator (1)
BoundNodeClassWriter.cs (1)
1704elementType = typeName[immutableArrayPrefix.Length..^1];
BuildActionTelemetryTable (4)
Program.cs (4)
292part = part.Substring(prefix.Length); 316if (part.Length == 0) 324if (description.Length == 0) 339part = part.Substring(description.Length).TrimStart();
BuildBoss (3)
CompilerNuGetCheckerUtil.cs (1)
250var buildAssetRelativePath = buildAssetFilePath.Substring(tuple.BuildOutputDirectory.Length + 1);
TargetsCheckerUtil.cs (2)
111if (value.Length <= 3) 119value[value.Length - 1] == ')';
BuildValidator (2)
CompilationDiff.cs (1)
296string getRelativePath(string dataFilePath) => dataFilePath.Substring(debugPath.Length);
LocalSourceResolver.cs (1)
36onDiskPath = Path.GetFullPath(Path.Combine(Options.SourcePath, originalFilePath.Substring(link.Prefix.Length)));
ClientSample (7)
src\Shared\CommandLineUtils\CommandLine\AnsiConsole.cs (2)
77while (endIndex != message.Length && 86if (endIndex == message.Length)
src\Shared\CommandLineUtils\CommandLine\CommandLineApplication.cs (3)
480var maxArgLen = arguments.Max(a => a.Name.Length); 496var maxOptLen = options.Max(o => o.Template.Length); 512var maxCmdLen = commands.Max(c => c.Name.Length);
src\Shared\CommandLineUtils\CommandLine\CommandOption.cs (2)
29if (optName.Length == 1 && !IsEnglishLetter(optName[0])) 40ValueName = part.Substring(1, part.Length - 2);
CodeGenerator (35)
FeatureCollectionGenerator.cs (1)
32{new string(' ', className.Length)}{feature}")}
HttpUtilities\HttpUtilities.cs (7)
210if (tmpReturn.Length > 0) 249if (method.Length > length) 255if (result.Length == length) 260if (result.Length < length) 262var count = length - result.Length; 292MaskLength = method.Item1.Length 308Debug.Assert(str.Length == sizeof(ulong), string.Format(CultureInfo.InvariantCulture, "String must be exactly {0} (ASCII) characters long.", sizeof(ulong)));
src\Servers\Kestrel\shared\KnownHeaders.cs (26)
506return prefix.Length != 0 ? $"{prefix}.{identifier}" : identifier; 572if (Name.Length >= 8) 576else if (Name.Length >= 4) 580else if (Name.Length >= 2) 602while (index != Name.Length) 604if (Name.Length - index >= 8) 609else if (Name.Length - index >= 4) 614else if (Name.Length - index >= 2) 634while (index != Name.Length) 636if (Name.Length - index >= 8) 649else if (Name.Length - index >= 4) 661else if (Name.Length - index >= 2) 695if (Name.Length >= 8) 699else if (Name.Length >= 4) 703else if (Name.Length >= 2) 721while (index != Name.Length) 723if (Name.Length - index >= 8) 732else if (Name.Length - index >= 4) 740else if (Name.Length - index >= 2) 791HeadersByLength = requestHeaders.OrderBy(x => x.Name.Length).GroupBy(x => x.Name.Length), 798HeadersByLength = responseHeaders.OrderBy(x => x.Name.Length).GroupBy(x => x.Name.Length), 805HeadersByLength = responseTrailers.OrderBy(x => x.Name.Length).GroupBy(x => x.Name.Length), 1324{AppendSwitch(loop.Headers.GroupBy(x => x.Name.Length).OrderBy(x => x.Key))}
src\Shared\runtime\Http2\Hpack\H2StaticTable.Http2.cs (1)
103value.Length != 0 ? Encoding.ASCII.GetBytes(value) : Array.Empty<byte>());
ConfigurationSchemaGenerator (6)
ConfigSchemaEmitter.cs (2)
443if (description.Length > 0) 529var remaining = value.Length - index;
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);
Crossgen2Tasks (3)
CommonFilePulledFromSdkRepo\Logger.cs (1)
83if (format.Length >= 12
CommonFilePulledFromSdkRepo\NuGetUtils.NuGet.cs (2)
26if (path.Length == 3) 31char separator = path[path.Length - 4];
csc (3)
src\Compilers\Shared\BuildProtocol.cs (1)
581writer.Write(value.Length);
src\Compilers\Shared\RuntimeHostInfo.cs (2)
44if (Environment.GetEnvironmentVariable(DotNetHostPathEnvironmentName) is { Length: > 0 } pathToDotNet) 49if (Environment.GetEnvironmentVariable(DotNetExperimentalHostPathEnvironmentName) is { Length: > 0 } pathToDotNetExperimental)
CSharpSyntaxGenerator (2)
AbstractFileWriter.cs (2)
284? name.Substring(0, name.Length - post.Length)
CustomPolicyProvider (2)
Authorization\MinimumAgeAuthorizeAttribute.cs (1)
27if (int.TryParse(Policy.AsSpan(POLICY_PREFIX.Length), out var age))
Authorization\MinimumAgePolicyProvider.cs (1)
42int.TryParse(policyName.Substring(POLICY_PREFIX.Length), out var age))
DemoConsole (1)
NameCreationService.cs (1)
36string suffix = name[type.Name.Length..];
Diagnostics.EFCore.FunctionalTests (3)
MigrationsEndPointMiddlewareTest.cs (3)
166Assert.True(content.Length > 512); 198Assert.True(content.Length > 512); 227Assert.True(content.Length > 512);
dotnet-dev-certs (9)
src\Shared\CertificateGeneration\CertificateManager.cs (1)
205if ((byteArray.Length == AspNetHttpsOidFriendlyName.Length && byteArray[0] == (byte)'A') || byteArray.Length == 0)
src\Shared\CertificateGeneration\UnixCertificateManager.cs (1)
341? Path.Combine("$HOME", certDir[homeDirectoryWithSlash.Length..])
src\Shared\CommandLineUtils\CommandLine\AnsiConsole.cs (2)
77while (endIndex != message.Length && 86if (endIndex == message.Length)
src\Shared\CommandLineUtils\CommandLine\CommandLineApplication.cs (3)
480var maxArgLen = arguments.Max(a => a.Name.Length); 496var maxOptLen = options.Max(o => o.Template.Length); 512var maxCmdLen = commands.Max(c => c.Name.Length);
src\Shared\CommandLineUtils\CommandLine\CommandOption.cs (2)
29if (optName.Length == 1 && !IsEnglishLetter(optName[0])) 40ValueName = part.Substring(1, part.Length - 2);
dotnet-getdocument (7)
src\Shared\CommandLineUtils\CommandLine\AnsiConsole.cs (2)
77while (endIndex != message.Length && 86if (endIndex == message.Length)
src\Shared\CommandLineUtils\CommandLine\CommandLineApplication.cs (3)
480var maxArgLen = arguments.Max(a => a.Name.Length); 496var maxOptLen = options.Max(o => o.Template.Length); 512var maxCmdLen = commands.Max(c => c.Name.Length);
src\Shared\CommandLineUtils\CommandLine\CommandOption.cs (2)
29if (optName.Length == 1 && !IsEnglishLetter(optName[0])) 40ValueName = part.Substring(1, part.Length - 2);
dotnet-openapi (7)
src\Shared\CommandLineUtils\CommandLine\AnsiConsole.cs (2)
77while (endIndex != message.Length && 86if (endIndex == message.Length)
src\Shared\CommandLineUtils\CommandLine\CommandLineApplication.cs (3)
480var maxArgLen = arguments.Max(a => a.Name.Length); 496var maxOptLen = options.Max(o => o.Template.Length); 512var maxCmdLen = commands.Max(c => c.Name.Length);
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-sql-cache (7)
src\Shared\CommandLineUtils\CommandLine\AnsiConsole.cs (2)
77while (endIndex != message.Length && 86if (endIndex == message.Length)
src\Shared\CommandLineUtils\CommandLine\CommandLineApplication.cs (3)
480var maxArgLen = arguments.Max(a => a.Name.Length); 496var maxOptLen = options.Max(o => o.Template.Length); 512var maxCmdLen = commands.Max(c => c.Name.Length);
src\Shared\CommandLineUtils\CommandLine\CommandOption.cs (2)
29if (optName.Length == 1 && !IsEnglishLetter(optName[0])) 40ValueName = part.Substring(1, part.Length - 2);
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-svcutil-lib (1371)
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\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)
163if (argument.Name.Length > maxNameLength) 165maxNameLength = argument.Name.Length; 174int helpTextIndent = argHelpPrefix.Length + maxArgumentnLength + argHelpSeperator.Length; 224_nameStart = s_nameMidpoint - (name.Length / 2); 287while (index < text.Length) 348while ((index < text.Length) && char.IsWhiteSpace(text[index])) 364index += Environment.NewLine.Length; 411for (int end = index; end < text.Length; end++) 416return text.Length - index; 421if ((index + Environment.NewLine.Length) > text.Length) 426for (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-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\Shared\CommandLineUtils\CommandLine\AnsiConsole.cs (2)
77while (endIndex != message.Length && 86if (endIndex == message.Length)
src\Shared\CommandLineUtils\CommandLine\CommandLineApplication.cs (3)
480var maxArgLen = arguments.Max(a => a.Name.Length); 496var maxOptLen = options.Max(o => o.Template.Length); 512var maxCmdLen = commands.Max(c => c.Name.Length);
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\Shared\CommandLineUtils\CommandLine\AnsiConsole.cs (2)
77while (endIndex != message.Length && 86if (endIndex == message.Length)
src\Shared\CommandLineUtils\CommandLine\CommandLineApplication.cs (3)
480var maxArgLen = arguments.Max(a => a.Name.Length); 496var maxOptLen = options.Max(o => o.Template.Length); 512var maxCmdLen = commands.Max(c => c.Name.Length);
src\Shared\CommandLineUtils\CommandLine\CommandOption.cs (2)
29if (optName.Length == 1 && !IsEnglishLetter(optName[0])) 40ValueName = part.Substring(1, part.Length - 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 (202)
JsonWriter.cs (1)
179for (int i = 0; i < value.Length; i++)
Program.cs (1)
1140var spacing = new string(' ', count: 15 - severity.Length);
src\Compilers\Core\Portable\FileSystem\FileUtilities.cs (2)
133if (path!.Length == 1) 175Debug.Assert(path.Length == 1 || !PathUtilities.IsDirectorySeparator(path[1]));
src\Compilers\Core\Portable\FileSystem\PathUtilities.cs (36)
52int lastSeparator = s.Length; 58if (lastSeparator != s.Length) 71if (s.Length == 0 || IsAnyDirectorySeparator(s[s.Length - 1])) 138var rootLength = GetPathRoot(path, isUnixLike).Length; 139if (path.Length > rootLength) 141var i = path.Length; 212int length = path.Length; 287return path.Length > 0 && IsDirectorySeparator(path[0]) 314if (path.Length > 0 && path[0] == '.') 316if (path.Length == 1 || IsDirectorySeparator(path[1])) 323if (path.Length == 2 || IsDirectorySeparator(path[2])) 334if (path.Length >= 1 && IsDirectorySeparator(path[0])) 341if (path.Length >= 2 && path[1] == VolumeSeparatorChar && (path.Length <= 2 || !IsDirectorySeparator(path[2]))) 375return path.Length >= 2 && 386return path.Length >= 3 && path[1] == VolumeSeparatorChar && IsDirectorySeparator(path[2]); 440char c = root[root.Length - 1]; 479if (path.Length > 0 && IsDirectorySeparator(path[path.Length - 1])) 481return path.Substring(0, path.Length - 1); 608return parentPath.Length > 0 609&& childPath.Length > parentPath.Length 610&& PathsEqual(childPath, parentPath, parentPath.Length) 611&& (IsDirectorySeparator(parentPath[parentPath.Length - 1]) || IsDirectorySeparator(childPath[parentPath.Length])); 616var relativePath = childPath.Substring(parentPath.Length); 619int start = ConsumeDirectorySeparators(relativePath, relativePath.Length, 0); 648return PathsEqual(path1, path2, Math.Max(path1.Length, path2.Length)); 656if (path1.Length < length || path2.Length < length) 714if (!(oldPrefix?.Length > 0)) continue; 723var replacement = replacementPrefix + filePath.Substring(oldPrefix.Length); 841if (!isDriveRooted && !(p.Length > 1 && p[0] == AltDirectorySeparatorChar))
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\Compilers\Core\Portable\InternalUtilities\StringExtensions.cs (15)
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.Substring(0, name.Length - AttributeSuffix.Length); 165return name.Length > AttributeSuffix.Length && name.EndsWith(AttributeSuffix, comparison); 171while (i < str.Length) 178if (i < str.Length && char.IsLowSurrogate(str[i])) 208if (arg.Length > 1 && arg[0] == '"' && arg[arg.Length - 1] == '"') 211return arg.Substring(1, arg.Length - 2); 223while (x < string1.Length && x < string2.Length && 235while (x < string1.Length && x < string2.Length &&
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\Compilers\Core\Portable\InternalUtilities\UnicodeCharacterUtilities.cs (1)
103int nameLength = name.Length;
src\Compilers\Core\Portable\Syntax\SyntaxTreeExtensions.cs (2)
95var n1 = s1.Length; 96var n2 = s2.Length;
src\Compilers\Core\Portable\Text\TextChangeRangeExtensions.cs (1)
105return new TextChangeRange(textChange.Span, textChange.NewText?.Length ?? 0);
src\Dependencies\Collections\Extensions\IEnumerableExtensions.cs (2)
213return str.Length == 0; 236return source.Length == 0;
src\RoslynAnalyzers\Microsoft.CodeAnalysis.Analyzers\Core\MetaAnalyzers\ReleaseTrackingHelper.cs (1)
77string versionString = lineText[ReleasePrefix.Length..].Trim();
src\RoslynAnalyzers\Utilities\Compiler\Extensions\StringExtensions.cs (1)
15return Encoding.UTF8.GetByteCount(value) == value.Length;
src\RoslynAnalyzers\Utilities\Compiler\Options\AnalyzerOptionsExtensions.cs (2)
359if (trimmedSuffix.Length >= 2 && 363for (int i = 1; i < trimmedSuffix.Length - 2; i++)
src\RoslynAnalyzers\Utilities\Compiler\Options\SymbolNamesWithValueOption.cs (2)
109parts.SymbolName.Length == 1)) 145Debug.Assert(parts.SymbolName.Length >= 2);
src\RoslynAnalyzers\Utilities\Compiler\RulesetToEditorconfigConverter.cs (2)
208if (comment.Length > 0) 213if (trimmedCommentPart.Length > 0)
src\RoslynAnalyzers\Utilities\Compiler\WellKnownTypeProvider.cs (1)
220for (int i = 0; i < fullTypeName.Length; i++)
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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\CodeGeneration\ParameterName.cs (1)
42BestNameForParameter = trimmed.Length > 0 ? tryMakeCamelCase ? trimmed.ToCamelCase() : trimmed : nameBasedOnArgument;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EditorConfig\Parsing\Sections\SectionMatcher.Lexer.cs (5)
15public readonly bool IsDone => Position >= headerText.Length; 54if (position < headerText.Length) 85if (position < headerText.Length && 113if (position >= headerText.Length) 171return str.Length == 0 || str == "-"
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\VirtualChars\AbstractVirtualCharService.cs (8)
31if (index + 1 < tokenText.Length) 117Debug.Assert(lastVC.Span.End == token.Span.End - "\"".Length, "Last span has to end right before the end of the string token."); 121Debug.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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\VirtualChars\AbstractVirtualCharService.ITextInfo.cs (1)
30public readonly int Length(string text) => text.Length;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\VirtualChars\VirtualCharSequence.Chunks.cs (3)
84public override int Length => data.Length; 89if (stringIndex < 0 || stringIndex >= data.Length) 104Debug.Assert(index + 1 >= data.Length ||
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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\TokenStream.cs (2)
337length = text.ConvertTabToSpace(_options.TabSize, initialColumn, text.Length); 341length = text.Length;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\TreeData.Node.cs (1)
30return lineText.GetColumnFromLineOffset(lineText.Length, tabSize);
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\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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\Naming\IdentifierNameParts.cs (2)
47? newBaseName[prefix.Length..] 53? newBaseName[..^suffix.Length]
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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\NamingStyle.WordSpanEnumerator.cs (1)
52Current = new TextSpan(Current.End + _wordSeparator.Length, 0);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Serialization\ObjectWriter.cs (2)
504var bytes = new byte[(uint)value.Length * sizeof(char)]; 510WriteCompressedUInt((uint)value.Length);
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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\SyntaxFacts\ISyntaxFactsExtensions.cs (2)
251if (name.Length == 0) 261for (var i = 1; i < name.Length; i++)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.cs (1)
198Debug.Assert(reader.Position == symbolKey.Length);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.SymbolKeyReader.cs (1)
259while (Position < Data.Length)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\Base64Utilities.cs (2)
329decodedLength = (encodedString.Length * 3) / 4 - padding; 336var index = attributeData.Length - 1;
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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\BKTree.cs (4)
74Span<char> lowerCaseCharacters = value.Length < 512 75? stackalloc char[value.Length] 76: new char[value.Length]; 78for (var i = 0; i < value.Length; i++)
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++) 89Span<char> 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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\PathMetadataUtilities.cs (2)
31if (rootNamespace is { Length: > 0 } && 69@namespace = @namespace[(rootNamespace.Length + 1)..];
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\StringBreaker.cs (2)
24for (var start = 0; start < text.Length;) 42var length = identifier.Length;
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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\WordSimilarityChecker.cs (6)
80=> value.Length <= 4 ? 1 : 2; 87if (_source.Length < 3) 113if (Math.Abs(_source.Length - candidateText.Length) <= _threshold) 142var lengthDifference = Math.Abs(originalText.Length - candidateText.Length);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\ISymbolExtensions.cs (1)
795(symbol.Name.Length == 1 || uint.TryParse(symbol.Name[1..], out _) || symbol.Name.All(n => n.Equals('_')));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\ITypeSymbolExtensions.cs (1)
363return shortName.Length == 0
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Extensions\ProjectExtensions.cs (2)
75analyzerConfigDirectory.Length > bestPath.Length)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Extensions\SyntaxGeneratorExtensions_CreateEqualsMethod.cs (1)
366if (name.Length > 0)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\LanguageServices\TypeInferenceService\AbstractTypeInferenceService.cs (3)
67if (name.Length == prefix.Length) 72var nextChar = name[prefix.Length];
GenerateRulesMissingDocumentation (1)
Program.cs (1)
29if (!bool.TryParse(args[0][validateOnlyPrefix.Length..], out var validateOnly))
GenericHostWebSite (1)
src\Mvc\test\WebSites\Common\TestResponseGenerator.cs (1)
32.ToDictionary(kvp => kvp.Key.Substring("link_".Length), kvp => (object)kvp.Value[0]);
GetDocument.Insider (7)
src\Shared\CommandLineUtils\CommandLine\AnsiConsole.cs (2)
77while (endIndex != message.Length && 86if (endIndex == message.Length)
src\Shared\CommandLineUtils\CommandLine\CommandLineApplication.cs (3)
480var maxArgLen = arguments.Max(a => a.Name.Length); 496var maxOptLen = options.Max(o => o.Template.Length); 512var maxCmdLen = commands.Max(c => c.Name.Length);
src\Shared\CommandLineUtils\CommandLine\CommandOption.cs (2)
29if (optName.Length == 1 && !IsEnglishLetter(optName[0])) 40ValueName = part.Substring(1, part.Length - 2);
http2cat (14)
src\Shared\runtime\Http2\Hpack\H2StaticTable.Http2.cs (1)
103value.Length != 0 ? Encoding.ASCII.GetBytes(value) : Array.Empty<byte>());
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\Shared\ServerInfrastructure\BufferExtensions.cs (1)
118var sourceLength = data.Length;
src\Shared\ServerInfrastructure\StringUtilities.cs (2)
122length += str.Length; 136i = tupleStr.Length;
HttpStress (7)
Program.cs (7)
334if (r.Length > 0) 376Console.WriteLine(" Tracing: " + (logPath == null ? (object)false : logPath.Length == 0 ? (object)true : logPath)); 430for (int i = 0; i < contentSource.Length; i++) 459await context.Response.WriteAsync(contentSource.Substring(0, contentSource.Length / 2)); 465var writeTask = context.Response.WriteAsync(contentSource.Substring(0, contentSource.Length)); 653int offset = _random.Next(0, input.Length); 654int length = _random.Next(0, input.Length - offset + 1);
IdeBenchmarks (2)
RegexClassifierBenchmarks.cs (2)
43return GetClassificationSpansAsync(code, new TextSpan(0, code.Length), parseOptions: null).Result; 50return GetClassificationSpansAsync(code, new TextSpan(0, code.Length), parseOptions: null).Result;
IdeCoreBenchmarks (4)
ClassificationBenchmarks.cs (1)
98var span = new TextSpan(0, text.Length);
SyntacticChangeRangeBenchmark.cs (3)
72var newText = _text.WithChanges(new TextChange(new TextSpan(0, addedText.Length), addedText)); 81var newText = _text.WithChanges(new TextChange(new TextSpan(_text.Length - addedText.Length, addedText.Length), addedText));
Identity.DefaultUI.WebSite (1)
src\Identity\test\InMemory.Test\InMemoryUserStore.cs (1)
429if (mergedCodes.Length > 0)
Identity.ExternalClaims (2)
Pages\Account\Manage\EnableAuthenticator.cshtml.cs (2)
120while (currentPosition + 4 < unformattedKey.Length) 125if (currentPosition < unformattedKey.Length)
IdentitySample.PasskeyConformance (1)
Program.cs (1)
58if (request.Attestation is { Length: > 0 } attestation)
IIS.Common.TestLib (1)
TestConnections.cs (1)
118var actual = await Receive(expected.Length);
IIS.FunctionalTests (28)
Http2TrailersResetTests.cs (2)
119Assert.Equal((2 * body.Length).ToString(CultureInfo.InvariantCulture), contentLength.First()); 137Assert.Equal(body.Length.ToString(CultureInfo.InvariantCulture), contentLength.First());
src\Servers\IIS\IIS\test\Common.FunctionalTests\CompressionTests.cs (2)
50requestLength += message.Length; 92requestLength += message.Length;
src\Servers\IIS\IIS\test\Common.FunctionalTests\RequestPathBaseTests.cs (1)
101var length = int.Parse(headers.Single(h => h.StartsWith("Content-Length: ", StringComparison.Ordinal))["Content-Length: ".Length..], CultureInfo.InvariantCulture);
src\Servers\IIS\IIS\test\Common.FunctionalTests\RequestResponseTests.cs (7)
168Assert.Equal(expected: 110000, actual: responseText.Length); 202Assert.Equal(requestBody.Length * 2, responseText.Length); 224$"Content-Length: {testString.Length}\r\n" + 261requestLength += message.Length; 649Assert.Equal(200000000, (await _fixture.Client.GetStringAsync($"/LargeResponseFile")).Length); 809var length = int.Parse(headers.Single(h => h.StartsWith("Content-Length: ", StringComparison.Ordinal)).Substring("Content-Length: ".Length), CultureInfo.InvariantCulture);
src\Servers\IIS\IIS\test\Common.FunctionalTests\WebSocketTests.cs (2)
195Debug.Assert(expectedMessage.Length > 0); 196var received = new byte[expectedMessage.Length];
src\Shared\runtime\Http2\Hpack\H2StaticTable.Http2.cs (1)
103value.Length != 0 ? Encoding.ASCII.GetBytes(value) : Array.Empty<byte>());
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\Shared\ServerInfrastructure\BufferExtensions.cs (1)
118var sourceLength = data.Length;
src\Shared\ServerInfrastructure\StringUtilities.cs (2)
122length += str.Length; 136i = tupleStr.Length;
IIS.LongTests (14)
src\Shared\runtime\Http2\Hpack\H2StaticTable.Http2.cs (1)
103value.Length != 0 ? Encoding.ASCII.GetBytes(value) : Array.Empty<byte>());
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\Shared\ServerInfrastructure\BufferExtensions.cs (1)
118var sourceLength = data.Length;
src\Shared\ServerInfrastructure\StringUtilities.cs (2)
122length += str.Length; 136i = tupleStr.Length;
IIS.NewHandler.FunctionalTests (14)
src\Shared\runtime\Http2\Hpack\H2StaticTable.Http2.cs (1)
103value.Length != 0 ? Encoding.ASCII.GetBytes(value) : Array.Empty<byte>());
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\Shared\ServerInfrastructure\BufferExtensions.cs (1)
118var sourceLength = data.Length;
src\Shared\ServerInfrastructure\StringUtilities.cs (2)
122length += str.Length; 136i = tupleStr.Length;
IIS.NewShim.FunctionalTests (14)
src\Shared\runtime\Http2\Hpack\H2StaticTable.Http2.cs (1)
103value.Length != 0 ? Encoding.ASCII.GetBytes(value) : Array.Empty<byte>());
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\Shared\ServerInfrastructure\BufferExtensions.cs (1)
118var sourceLength = data.Length;
src\Shared\ServerInfrastructure\StringUtilities.cs (2)
122length += str.Length; 136i = tupleStr.Length;
IIS.ShadowCopy.Tests (3)
src\Shared\ServerInfrastructure\BufferExtensions.cs (1)
118var sourceLength = data.Length;
src\Shared\ServerInfrastructure\StringUtilities.cs (2)
122length += str.Length; 136i = tupleStr.Length;
IISExpress.FunctionalTests (26)
src\Servers\IIS\IIS\test\Common.FunctionalTests\CompressionTests.cs (2)
50requestLength += message.Length; 92requestLength += message.Length;
src\Servers\IIS\IIS\test\Common.FunctionalTests\RequestPathBaseTests.cs (1)
101var length = int.Parse(headers.Single(h => h.StartsWith("Content-Length: ", StringComparison.Ordinal))["Content-Length: ".Length..], CultureInfo.InvariantCulture);
src\Servers\IIS\IIS\test\Common.FunctionalTests\RequestResponseTests.cs (7)
168Assert.Equal(expected: 110000, actual: responseText.Length); 202Assert.Equal(requestBody.Length * 2, responseText.Length); 224$"Content-Length: {testString.Length}\r\n" + 261requestLength += message.Length; 649Assert.Equal(200000000, (await _fixture.Client.GetStringAsync($"/LargeResponseFile")).Length); 809var length = int.Parse(headers.Single(h => h.StartsWith("Content-Length: ", StringComparison.Ordinal)).Substring("Content-Length: ".Length), CultureInfo.InvariantCulture);
src\Servers\IIS\IIS\test\Common.FunctionalTests\WebSocketTests.cs (2)
195Debug.Assert(expectedMessage.Length > 0); 196var received = new byte[expectedMessage.Length];
src\Shared\runtime\Http2\Hpack\H2StaticTable.Http2.cs (1)
103value.Length != 0 ? Encoding.ASCII.GetBytes(value) : Array.Empty<byte>());
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\Shared\ServerInfrastructure\BufferExtensions.cs (1)
118var sourceLength = data.Length;
src\Shared\ServerInfrastructure\StringUtilities.cs (2)
122length += str.Length; 136i = tupleStr.Length;
illink (33)
ILLink.RoslynAnalyzer (10)
CompilationExtensions.cs (2)
145return name.Length > AttributeSuffix.Length && name.EndsWith(AttributeSuffix, comparison);
src\tools\illink\src\ILLink.Shared\DataFlow\CompilerGeneratedNames.cs (5)
10return memberName.Length > 0 && memberName[0] == '<'; 34return typeName.Length > i + 1 && typeName[i + 1] == 'd'; 47return fieldName.Length > i + 1 && fieldName[i + 1] == '2'; 68return methodName.Length > i + 1 && methodName[i + 1] == 'b'; 86return methodName.Length > i + 1 && methodName[i + 1] == 'g';
src\tools\illink\src\ILLink.Shared\TrimAnalysis\HandleCallAction.cs (2)
257else if (interfaceName is KnownStringValue stringValue && stringValue.Contents.Length == 0) 1693if (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);
InMemory.FunctionalTests (48)
ChunkedRequestTests.cs (3)
491transferEncodingHeaderLine.Length + 2 + 492headerLine.Length + 2 + 493trailingHeaderLine.Length + 1;
ConnectionMiddlewareTests.cs (1)
65Assert.Equal(sendString.Length, middleware.BytesRead);
Http2\Http2ConnectionTests.cs (2)
6033(byte)headerName.Length, // Header name length 6044for (var i = 0; i < headerName.Length; i++)
Http2\Http2StreamTests.cs (7)
104withLength: 45 + method.Length, 3557Assert.Equal((int)Http2PeerSettings.DefaultMaxFrameSize, _decodedHeaders[HeaderNames.ETag].Length); 3594Assert.Equal((int)Http2PeerSettings.DefaultMaxFrameSize, _decodedHeaders[HeaderNames.ETag].Length); 3595Assert.Equal(30, _decodedHeaders[HeaderNames.TE].Length); 3643Assert.Equal((int)Http2PeerSettings.DefaultMaxFrameSize, _decodedHeaders[HeaderNames.ETag].Length); 3644Assert.Equal((int)Http2PeerSettings.DefaultMaxFrameSize, _decodedHeaders[HeaderNames.TE].Length); 3706Assert.Equal((int)Http2PeerSettings.DefaultMaxFrameSize - 20, _decodedHeaders[HeaderNames.ETag].Length);
HttpsConnectionMiddlewareTests.cs (2)
1102var request = Encoding.UTF8.GetBytes($"POST / HTTP/1.1\r\nHost: localhost\r\nContent-Length: {expectedBody.Length}\r\n\r\n{expectedBody}"); 1523: Encoding.UTF8.GetBytes($"POST / HTTP/1.0\r\nContent-Length: {body.Length}\r\n\r\n{body}");
MaxRequestBodySizeTests.cs (9)
71Assert.True(requestBody.Length > maxRequestBodySize); 94$"Content-Length: {requestBody.Length}", 103$"{customApplicationResponse.Length}", 118Assert.True(chunkedPayload.Length > maxRequestBodySize); 150$"{customApplicationResponse.Length}", 416var globalMaxRequestBodySize = chunkedPayload.Length - 1; 466var globalMaxRequestBodySize = chunkedPayload.Length; 507var globalMaxRequestBodySize = chunkedPayload.Length - 1; 524feature.MaxRequestBodySize = chunkedPayload.Length;
MaxRequestLineSizeTests.cs (1)
65await using (var server = CreateServer(requestLine.Length - 1, testMeterFactory))
RequestBodyTimeoutTests.cs (1)
185context.Response.ContentLength = response.Length;
RequestHeaderLimitsTests.cs (2)
32await using (var server = CreateServer(maxRequestHeadersTotalSize: headers.Length + extraLimit, meterFactory: testMeterFactory)) 100await using (var server = CreateServer(maxRequestHeadersTotalSize: headers.Length - 1, meterFactory: testMeterFactory))
RequestTests.cs (1)
1360var data = new byte[message.Length];
ResponseTests.cs (6)
1735httpContext.Response.ContentLength = ex.Message.Length; 1752$"Content-Length: {expectedResponse.Length}", 3523context.Response.ContentLength = response.Length; 3536$"Content-Length: {response.Length}", 3574context.Response.ContentLength = response.Length; 3587$"Content-Length: {response.Length}",
src\Servers\Kestrel\shared\test\CertHelper.cs (1)
180var name = testMethodName.Length > 63 ? testMethodName.Substring(0, 63) : testMethodName;
src\Servers\Kestrel\shared\test\RevocationResponder.cs (4)
50string path = authority.AiaHttpUri.Substring(UriPrefix.Length - 1); 57string path = authority.CdpUri.Substring(UriPrefix.Length - 1); 64string path = authority.OcspUri.Substring(UriPrefix.Length - 1); 304string base64 = HttpUtility.UrlDecode(request.RawUrl.Substring(prefix.Length + 1));
src\Servers\Kestrel\shared\test\StreamBackedTestConnection.cs (4)
81for (var index = 0; index < text.Length; index++) 96var actual = new char[expected.Length]; 101while (offset < expected.Length) 103var data = new byte[expected.Length];
src\Servers\Kestrel\shared\test\StringExtensions.cs (2)
12var ellipsis = s.Length > 128 15return s.Substring(0, Math.Min(128, s.Length))
src\Shared\TypeNameHelper\TypeNameHelper.cs (2)
88builder.Replace(DefaultNestedTypeDelimiter, options.NestedTypeDelimiter, builder.Length - name.Length, name.Length);
InProcessWebSite (3)
src\Servers\IIS\IIS\test\testassets\InProcessWebSite\Startup.cs (2)
963await fileStream.WriteAsync(Encoding.UTF8.GetBytes(fileContent), 0, fileContent.Length); 988ctx.Request.Headers.ContentLength = ctx.Request.Path.Value.Length;
src\Servers\IIS\IIS\test\testassets\InProcessWebSite\Startup.WebSockets.cs (1)
169int closeFromServerLength = closeFromServerCmd.Length;
installer.tasks (2)
StaticFileRegeneration\TpnSectionHeader.cs (2)
18return line.Length > 2 && line.All(c => SectionSeparatorChars.Contains(c)); 30if (line.Length > 2 &&
IntegrationTestsWebsite (16)
artifacts\obj\IntegrationTestsWebsite\Release\net10.0\Protos\Greet.cs (16)
176if (Name.Length != 0) hash ^= Name.GetHashCode(); 209if (Name.Length != 0) { 223if (Name.Length != 0) { 238if (other.Name.Length != 0) { 582if (FirstName.Length != 0) hash ^= FirstName.GetHashCode(); 583if (LastName.Length != 0) hash ^= LastName.GetHashCode(); 620if (FirstName.Length != 0) { 624if (LastName.Length != 0) { 638if (FirstName.Length != 0) { 641if (LastName.Length != 0) { 656if (other.FirstName.Length != 0) { 659if (other.LastName.Length != 0) { 993if (Message.Length != 0) hash ^= Message.GetHashCode(); 1026if (Message.Length != 0) { 1040if (Message.Length != 0) { 1055if (other.Message.Length != 0) {
InteractiveHost.UnitTests (3)
SynchronizedTextWriter.cs (3)
54for (int i = start, n = builder.Length - mark.Length; i <= n; i++) 57while (j < mark.Length && builder[i + j] == mark[j]) 62if (j == mark.Length)
Interop.FunctionalTests (7)
HttpClientHttp2InteropTests.cs (6)
274while (!readResult.IsCompleted && readResult.Buffer.Length < "Hello World".Length) 280var sequence = readResult.Buffer.Slice(0, "Hello World".Length); 331while (!readResult.IsCompleted && readResult.Buffer.Length < "Hello World".Length) 337var sequence = readResult.Buffer.Slice(0, "Hello World".Length); 347while (!readResult.IsCompleted && readResult.Buffer.Length < "Hello World".Length) 1723var responseBuffer = new byte["Hello World".Length];
src\Shared\Buffers.MemoryPool\UnmanagedBufferAllocator.cs (1)
88int maxAlloc = checked(Encoding.UTF8.GetMaxByteCount(myString.Length) + 1);
InteropClient (14)
artifacts\obj\InteropClient\Release\net10.0\Messages.cs (12)
624if (Message.Length != 0) hash ^= Message.GetHashCode(); 665if (Message.Length != 0) { 682if (Message.Length != 0) { 700if (other.Message.Length != 0) { 1394if (Username.Length != 0) hash ^= Username.GetHashCode(); 1395if (OauthScope.Length != 0) hash ^= OauthScope.GetHashCode(); 1440if (Username.Length != 0) { 1444if (OauthScope.Length != 0) { 1461if (Username.Length != 0) { 1464if (OauthScope.Length != 0) { 1485if (other.Username.Length != 0) { 1488if (other.OauthScope.Length != 0) {
InteropClient.cs (2)
861Assert.IsTrue(email.Length > 0); // spec requires nonempty client email. 888start += header.Length;
InteropWebsite (12)
artifacts\obj\InteropWebsite\Release\net10.0\Messages.cs (12)
624if (Message.Length != 0) hash ^= Message.GetHashCode(); 665if (Message.Length != 0) { 682if (Message.Length != 0) { 700if (other.Message.Length != 0) { 1394if (Username.Length != 0) hash ^= Username.GetHashCode(); 1395if (OauthScope.Length != 0) hash ^= OauthScope.GetHashCode(); 1440if (Username.Length != 0) { 1444if (OauthScope.Length != 0) { 1461if (Username.Length != 0) { 1464if (OauthScope.Length != 0) { 1485if (other.Username.Length != 0) { 1488if (other.OauthScope.Length != 0) {
IOperationGenerator (4)
IOperationClassWriter.cs (4)
249int indentation = lines[0].Length - lines[0].TrimStart().Length; 1100Debug.Assert(typeName.Length > 0); 1112arrayType = typeName[ImmutableArrayPrefix.Length..^1];
Kestrel.SampleApp (1)
Startup.cs (1)
61context.Response.ContentLength = response.Length;
Metrics (197)
Program.cs (2)
102if (index == -1 || index == arg.Length - 1) 144if (value.Length == 0)
src\Compilers\Core\Portable\FileSystem\FileUtilities.cs (2)
133if (path!.Length == 1) 175Debug.Assert(path.Length == 1 || !PathUtilities.IsDirectorySeparator(path[1]));
src\Compilers\Core\Portable\FileSystem\PathUtilities.cs (36)
52int lastSeparator = s.Length; 58if (lastSeparator != s.Length) 71if (s.Length == 0 || IsAnyDirectorySeparator(s[s.Length - 1])) 138var rootLength = GetPathRoot(path, isUnixLike).Length; 139if (path.Length > rootLength) 141var i = path.Length; 212int length = path.Length; 287return path.Length > 0 && IsDirectorySeparator(path[0]) 314if (path.Length > 0 && path[0] == '.') 316if (path.Length == 1 || IsDirectorySeparator(path[1])) 323if (path.Length == 2 || IsDirectorySeparator(path[2])) 334if (path.Length >= 1 && IsDirectorySeparator(path[0])) 341if (path.Length >= 2 && path[1] == VolumeSeparatorChar && (path.Length <= 2 || !IsDirectorySeparator(path[2]))) 375return path.Length >= 2 && 386return path.Length >= 3 && path[1] == VolumeSeparatorChar && IsDirectorySeparator(path[2]); 440char c = root[root.Length - 1]; 479if (path.Length > 0 && IsDirectorySeparator(path[path.Length - 1])) 481return path.Substring(0, path.Length - 1); 608return parentPath.Length > 0 609&& childPath.Length > parentPath.Length 610&& PathsEqual(childPath, parentPath, parentPath.Length) 611&& (IsDirectorySeparator(parentPath[parentPath.Length - 1]) || IsDirectorySeparator(childPath[parentPath.Length])); 616var relativePath = childPath.Substring(parentPath.Length); 619int start = ConsumeDirectorySeparators(relativePath, relativePath.Length, 0); 648return PathsEqual(path1, path2, Math.Max(path1.Length, path2.Length)); 656if (path1.Length < length || path2.Length < length) 714if (!(oldPrefix?.Length > 0)) continue; 723var replacement = replacementPrefix + filePath.Substring(oldPrefix.Length); 841if (!isDriveRooted && !(p.Length > 1 && p[0] == AltDirectorySeparatorChar))
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\Compilers\Core\Portable\InternalUtilities\StringExtensions.cs (15)
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.Substring(0, name.Length - AttributeSuffix.Length); 165return name.Length > AttributeSuffix.Length && name.EndsWith(AttributeSuffix, comparison); 171while (i < str.Length) 178if (i < str.Length && char.IsLowSurrogate(str[i])) 208if (arg.Length > 1 && arg[0] == '"' && arg[arg.Length - 1] == '"') 211return arg.Substring(1, arg.Length - 2); 223while (x < string1.Length && x < string2.Length && 235while (x < string1.Length && x < string2.Length &&
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\Compilers\Core\Portable\InternalUtilities\UnicodeCharacterUtilities.cs (1)
103int nameLength = name.Length;
src\Compilers\Core\Portable\Syntax\SyntaxTreeExtensions.cs (2)
95var n1 = s1.Length; 96var n2 = s2.Length;
src\Compilers\Core\Portable\Text\TextChangeRangeExtensions.cs (1)
105return new TextChangeRange(textChange.Span, textChange.NewText?.Length ?? 0);
src\Dependencies\Collections\Extensions\IEnumerableExtensions.cs (2)
213return str.Length == 0; 236return source.Length == 0;
src\RoslynAnalyzers\Utilities\Compiler\CodeMetrics\CodeAnalysisMetricData.cs (1)
141if (index >= 0 && index < symbolName.Length)
src\RoslynAnalyzers\Utilities\Compiler\Extensions\StringExtensions.cs (1)
15return Encoding.UTF8.GetByteCount(value) == value.Length;
src\RoslynAnalyzers\Utilities\Compiler\Options\AnalyzerOptionsExtensions.cs (2)
359if (trimmedSuffix.Length >= 2 && 363for (int i = 1; i < trimmedSuffix.Length - 2; i++)
src\RoslynAnalyzers\Utilities\Compiler\Options\SymbolNamesWithValueOption.cs (2)
109parts.SymbolName.Length == 1)) 145Debug.Assert(parts.SymbolName.Length >= 2);
src\RoslynAnalyzers\Utilities\Compiler\RulesetToEditorconfigConverter.cs (2)
208if (comment.Length > 0) 213if (trimmedCommentPart.Length > 0)
src\RoslynAnalyzers\Utilities\Compiler\WellKnownTypeProvider.cs (1)
220for (int i = 0; i < fullTypeName.Length; i++)
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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\CodeGeneration\ParameterName.cs (1)
42BestNameForParameter = trimmed.Length > 0 ? tryMakeCamelCase ? trimmed.ToCamelCase() : trimmed : nameBasedOnArgument;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EditorConfig\Parsing\Sections\SectionMatcher.Lexer.cs (5)
15public readonly bool IsDone => Position >= headerText.Length; 54if (position < headerText.Length) 85if (position < headerText.Length && 113if (position >= headerText.Length) 171return str.Length == 0 || str == "-"
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\VirtualChars\AbstractVirtualCharService.cs (8)
31if (index + 1 < tokenText.Length) 117Debug.Assert(lastVC.Span.End == token.Span.End - "\"".Length, "Last span has to end right before the end of the string token."); 121Debug.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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\VirtualChars\AbstractVirtualCharService.ITextInfo.cs (1)
30public readonly int Length(string text) => text.Length;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\VirtualChars\VirtualCharSequence.Chunks.cs (3)
84public override int Length => data.Length; 89if (stringIndex < 0 || stringIndex >= data.Length) 104Debug.Assert(index + 1 >= data.Length ||
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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\TokenStream.cs (2)
337length = text.ConvertTabToSpace(_options.TabSize, initialColumn, text.Length); 341length = text.Length;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\TreeData.Node.cs (1)
30return lineText.GetColumnFromLineOffset(lineText.Length, tabSize);
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\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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\Naming\IdentifierNameParts.cs (2)
47? newBaseName[prefix.Length..] 53? newBaseName[..^suffix.Length]
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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\NamingStyle.WordSpanEnumerator.cs (1)
52Current = new TextSpan(Current.End + _wordSeparator.Length, 0);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Serialization\ObjectWriter.cs (2)
504var bytes = new byte[(uint)value.Length * sizeof(char)]; 510WriteCompressedUInt((uint)value.Length);
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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\SyntaxFacts\ISyntaxFactsExtensions.cs (2)
251if (name.Length == 0) 261for (var i = 1; i < name.Length; i++)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.cs (1)
198Debug.Assert(reader.Position == symbolKey.Length);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.SymbolKeyReader.cs (1)
259while (Position < Data.Length)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\Base64Utilities.cs (2)
329decodedLength = (encodedString.Length * 3) / 4 - padding; 336var index = attributeData.Length - 1;
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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\BKTree.cs (4)
74Span<char> lowerCaseCharacters = value.Length < 512 75? stackalloc char[value.Length] 76: new char[value.Length]; 78for (var i = 0; i < value.Length; i++)
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++) 89Span<char> 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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\PathMetadataUtilities.cs (2)
31if (rootNamespace is { Length: > 0 } && 69@namespace = @namespace[(rootNamespace.Length + 1)..];
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\StringBreaker.cs (2)
24for (var start = 0; start < text.Length;) 42var length = identifier.Length;
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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\WordSimilarityChecker.cs (6)
80=> value.Length <= 4 ? 1 : 2; 87if (_source.Length < 3) 113if (Math.Abs(_source.Length - candidateText.Length) <= _threshold) 142var lengthDifference = Math.Abs(originalText.Length - candidateText.Length);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\ISymbolExtensions.cs (1)
795(symbol.Name.Length == 1 || uint.TryParse(symbol.Name[1..], out _) || symbol.Name.All(n => n.Equals('_')));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\ITypeSymbolExtensions.cs (1)
363return shortName.Length == 0
Metrics.Legacy (197)
src\Compilers\Core\Portable\FileSystem\FileUtilities.cs (2)
133if (path!.Length == 1) 175Debug.Assert(path.Length == 1 || !PathUtilities.IsDirectorySeparator(path[1]));
src\Compilers\Core\Portable\FileSystem\PathUtilities.cs (36)
52int lastSeparator = s.Length; 58if (lastSeparator != s.Length) 71if (s.Length == 0 || IsAnyDirectorySeparator(s[s.Length - 1])) 138var rootLength = GetPathRoot(path, isUnixLike).Length; 139if (path.Length > rootLength) 141var i = path.Length; 212int length = path.Length; 287return path.Length > 0 && IsDirectorySeparator(path[0]) 314if (path.Length > 0 && path[0] == '.') 316if (path.Length == 1 || IsDirectorySeparator(path[1])) 323if (path.Length == 2 || IsDirectorySeparator(path[2])) 334if (path.Length >= 1 && IsDirectorySeparator(path[0])) 341if (path.Length >= 2 && path[1] == VolumeSeparatorChar && (path.Length <= 2 || !IsDirectorySeparator(path[2]))) 375return path.Length >= 2 && 386return path.Length >= 3 && path[1] == VolumeSeparatorChar && IsDirectorySeparator(path[2]); 440char c = root[root.Length - 1]; 479if (path.Length > 0 && IsDirectorySeparator(path[path.Length - 1])) 481return path.Substring(0, path.Length - 1); 608return parentPath.Length > 0 609&& childPath.Length > parentPath.Length 610&& PathsEqual(childPath, parentPath, parentPath.Length) 611&& (IsDirectorySeparator(parentPath[parentPath.Length - 1]) || IsDirectorySeparator(childPath[parentPath.Length])); 616var relativePath = childPath.Substring(parentPath.Length); 619int start = ConsumeDirectorySeparators(relativePath, relativePath.Length, 0); 648return PathsEqual(path1, path2, Math.Max(path1.Length, path2.Length)); 656if (path1.Length < length || path2.Length < length) 714if (!(oldPrefix?.Length > 0)) continue; 723var replacement = replacementPrefix + filePath.Substring(oldPrefix.Length); 841if (!isDriveRooted && !(p.Length > 1 && p[0] == AltDirectorySeparatorChar))
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\Compilers\Core\Portable\InternalUtilities\StringExtensions.cs (15)
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.Substring(0, name.Length - AttributeSuffix.Length); 165return name.Length > AttributeSuffix.Length && name.EndsWith(AttributeSuffix, comparison); 171while (i < str.Length) 178if (i < str.Length && char.IsLowSurrogate(str[i])) 208if (arg.Length > 1 && arg[0] == '"' && arg[arg.Length - 1] == '"') 211return arg.Substring(1, arg.Length - 2); 223while (x < string1.Length && x < string2.Length && 235while (x < string1.Length && x < string2.Length &&
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\Compilers\Core\Portable\InternalUtilities\UnicodeCharacterUtilities.cs (1)
103int nameLength = name.Length;
src\Compilers\Core\Portable\Syntax\SyntaxTreeExtensions.cs (2)
95var n1 = s1.Length; 96var n2 = s2.Length;
src\Compilers\Core\Portable\Text\TextChangeRangeExtensions.cs (1)
105return new TextChangeRange(textChange.Span, textChange.NewText?.Length ?? 0);
src\Dependencies\Collections\Extensions\IEnumerableExtensions.cs (2)
213return str.Length == 0; 236return source.Length == 0;
src\RoslynAnalyzers\Tools\Metrics\Program.cs (2)
102if (index == -1 || index == arg.Length - 1) 144if (value.Length == 0)
src\RoslynAnalyzers\Utilities\Compiler\CodeMetrics\CodeAnalysisMetricData.cs (1)
141if (index >= 0 && index < symbolName.Length)
src\RoslynAnalyzers\Utilities\Compiler\Extensions\StringExtensions.cs (1)
15return Encoding.UTF8.GetByteCount(value) == value.Length;
src\RoslynAnalyzers\Utilities\Compiler\Options\AnalyzerOptionsExtensions.cs (2)
359if (trimmedSuffix.Length >= 2 && 363for (int i = 1; i < trimmedSuffix.Length - 2; i++)
src\RoslynAnalyzers\Utilities\Compiler\Options\SymbolNamesWithValueOption.cs (2)
109parts.SymbolName.Length == 1)) 145Debug.Assert(parts.SymbolName.Length >= 2);
src\RoslynAnalyzers\Utilities\Compiler\RulesetToEditorconfigConverter.cs (2)
208if (comment.Length > 0) 213if (trimmedCommentPart.Length > 0)
src\RoslynAnalyzers\Utilities\Compiler\WellKnownTypeProvider.cs (1)
220for (int i = 0; i < fullTypeName.Length; i++)
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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\CodeGeneration\ParameterName.cs (1)
42BestNameForParameter = trimmed.Length > 0 ? tryMakeCamelCase ? trimmed.ToCamelCase() : trimmed : nameBasedOnArgument;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EditorConfig\Parsing\Sections\SectionMatcher.Lexer.cs (5)
15public readonly bool IsDone => Position >= headerText.Length; 54if (position < headerText.Length) 85if (position < headerText.Length && 113if (position >= headerText.Length) 171return str.Length == 0 || str == "-"
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\VirtualChars\AbstractVirtualCharService.cs (8)
31if (index + 1 < tokenText.Length) 117Debug.Assert(lastVC.Span.End == token.Span.End - "\"".Length, "Last span has to end right before the end of the string token."); 121Debug.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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\VirtualChars\AbstractVirtualCharService.ITextInfo.cs (1)
30public readonly int Length(string text) => text.Length;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\VirtualChars\VirtualCharSequence.Chunks.cs (3)
84public override int Length => data.Length; 89if (stringIndex < 0 || stringIndex >= data.Length) 104Debug.Assert(index + 1 >= data.Length ||
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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\TokenStream.cs (2)
337length = text.ConvertTabToSpace(_options.TabSize, initialColumn, text.Length); 341length = text.Length;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\TreeData.Node.cs (1)
30return lineText.GetColumnFromLineOffset(lineText.Length, tabSize);
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\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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\Naming\IdentifierNameParts.cs (2)
47? newBaseName[prefix.Length..] 53? newBaseName[..^suffix.Length]
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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\NamingStyle.WordSpanEnumerator.cs (1)
52Current = new TextSpan(Current.End + _wordSeparator.Length, 0);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Serialization\ObjectWriter.cs (2)
504var bytes = new byte[(uint)value.Length * sizeof(char)]; 510WriteCompressedUInt((uint)value.Length);
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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\SyntaxFacts\ISyntaxFactsExtensions.cs (2)
251if (name.Length == 0) 261for (var i = 1; i < name.Length; i++)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.cs (1)
198Debug.Assert(reader.Position == symbolKey.Length);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.SymbolKeyReader.cs (1)
259while (Position < Data.Length)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\Base64Utilities.cs (2)
329decodedLength = (encodedString.Length * 3) / 4 - padding; 336var index = attributeData.Length - 1;
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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\BKTree.cs (4)
74Span<char> lowerCaseCharacters = value.Length < 512 75? stackalloc char[value.Length] 76: new char[value.Length]; 78for (var i = 0; i < value.Length; i++)
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++) 89Span<char> 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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\PathMetadataUtilities.cs (2)
31if (rootNamespace is { Length: > 0 } && 69@namespace = @namespace[(rootNamespace.Length + 1)..];
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\StringBreaker.cs (2)
24for (var start = 0; start < text.Length;) 42var length = identifier.Length;
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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\WordSimilarityChecker.cs (6)
80=> value.Length <= 4 ? 1 : 2; 87if (_source.Length < 3) 113if (Math.Abs(_source.Length - candidateText.Length) <= _threshold) 142var lengthDifference = Math.Abs(originalText.Length - candidateText.Length);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\ISymbolExtensions.cs (1)
795(symbol.Name.Length == 1 || uint.TryParse(symbol.Name[1..], out _) || symbol.Name.All(n => n.Equals('_')));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\ITypeSymbolExtensions.cs (1)
363return shortName.Length == 0
Microsoft.Analyzers.Extra (4)
CallAnalysis\Fixers\LegacyLoggingFixer.FixDetails.cs (3)
73if (argName.Length == 0) 125Level = method.Name.Substring("Log".Length); 265var endIndex = message.Length;
CallAnalysis\StartsEndsWith.cs (1)
48if (s != null && s.Length == 1)
Microsoft.Analyzers.Extra.Tests (2)
Resources\RoslynTestUtils.cs (2)
99start += seq.Length; 125start += seq.Length;
Microsoft.Analyzers.Local (3)
ApiLifecycle\Json\TextScanner.cs (1)
129for (var i = 0; i < next.Length; i += 1)
ApiLifecycle\Utils.cs (2)
76for (var i = 0; i < baseTypesString.Length; i++) 93results.Add(baseTypesString.Substring(start, baseTypesString.Length - start).Trim());
Microsoft.Analyzers.Local.Tests (2)
Resources\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.Arcade.Test.Common (1)
AssertEx.cs (1)
404if (trimmedLine.Length > 0)
Microsoft.AspNetCore (1)
WebApplicationBuilder.cs (1)
276if (env.IsDevelopment() && env.ApplicationName is { Length: > 0 })
Microsoft.AspNetCore.Analyzer.Testing (1)
TestSource.cs (1)
46line = line.Substring(0, markerStartIndex) + line.Substring(markerEndIndex + MarkerEnd.Length);
Microsoft.AspNetCore.Antiforgery (3)
Internal\DefaultAntiforgeryTokenSerializer.cs (1)
36var count = serializedToken.Length;
src\Shared\HttpExtensions.cs (2)
27if (contentType.Length < MultipartFormContentType.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.App.Analyzers.Test (7)
RouteEmbeddedLanguage\Infrastructure\FormattedClassification.cs (2)
43var remainder = ClassificationName.Substring("regex - ".Length); 51var remainder = ClassificationName.Substring("json - ".Length);
RouteEmbeddedLanguage\Infrastructure\MarkupTestFile.cs (2)
116currentIndexInInput = matchIndexInInput + matchString.Length; 117inputOutputOffset += matchString.Length;
RouteEmbeddedLanguage\RoutePatternParserTests.cs (3)
88current = current.Substring(0, current.Length - 2) + "\""; 108for (var start = stringText[0] == '@' ? 2 : 1; start < stringText.Length - 1; start++) 112stringText.Substring(start + 1, stringText.Length - (start + 1)),
Microsoft.AspNetCore.App.UnitTests (5)
SharedFxTests.cs (1)
283? fileName.Substring(0, fileName.Length - 4)
TargetingPackTests.cs (4)
234? fileName.Substring(0, fileName.Length - 4) 254? fileName.Substring(0, fileName.Length - 4) 281if (parts[2].Length > 0) 328? fileName.Substring(0, fileName.Length - 4)
Microsoft.AspNetCore.Authentication.BearerToken (1)
BearerTokenHandler.cs (1)
99? authorization["Bearer ".Length..]
Microsoft.AspNetCore.Authentication.Cookies (7)
CookieAuthenticationHandler.cs (1)
454if (path.Length == 1)
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;
Microsoft.AspNetCore.Authentication.JwtBearer (1)
JwtBearerHandler.cs (1)
86token = authorization.Substring("Bearer ".Length).Trim();
Microsoft.AspNetCore.Authentication.JwtBearer.Tools.Tests (1)
UserJwtsTests.cs (1)
687var buffer = new Span<byte>(new byte[key.Length]);
Microsoft.AspNetCore.Authentication.Negotiate (5)
Internal\LdapAdapter.cs (4)
69var groupCN = DistinguishedNameSeparatorRegex.Split(groupDN)[0].Substring("CN=".Length); 81var entrySize = user.Length * 2; //Approximate the size of stored key in memory cache. 85entrySize += claim.Length * 2; //Approximate the size of stored value in memory cache. 127var nestedGroupCN = DistinguishedNameSeparatorRegex.Split(nestedGroupDN)[0].Substring("CN=".Length);
NegotiateHandler.cs (1)
112token = authorization.Substring(AuthHeaderPrefix.Length).Trim();
Microsoft.AspNetCore.Authentication.OpenIdConnect (3)
OpenIdConnectHandler.cs (3)
1186var nonceDecodedValue = Options.StringDataFormat.Unprotect(nonceKey.Substring(Options.NonceCookie.Name.Length, nonceKey.Length - Options.NonceCookie.Name.Length));
Microsoft.AspNetCore.Authentication.Test (3)
DynamicSchemeTests.cs (1)
150var name = (remainder.Value.Length > 0) ? remainder.Value.Substring(1) : null;
OpenIdConnect\OpenIdConnectTests.cs (1)
580timestamp = keyname.Substring(noncePrefix.Length);
PolicyTests.cs (1)
476var name = (remainder.Value.Length > 0) ? remainder.Value.Substring(1) : null;
Microsoft.AspNetCore.Components (44)
NavigationManager.cs (9)
272return uri.Substring(_baseUri.OriginalString.Length); 277if (_baseUri.OriginalString.EndsWith('/') && uriPathOnly.Equals(_baseUri.OriginalString.AsSpan(0, _baseUri.OriginalString.Length - 1), StringComparison.Ordinal)) 285return uri.Substring(_baseUri.OriginalString.Length - 1); 298return uri[_baseUri.OriginalString.Length..]; 303if (_baseUri.OriginalString.EndsWith('/') && MemoryExtensions.Equals(uriPathOnly, _baseUri.OriginalString.AsSpan(0, _baseUri.OriginalString.Length - 1), StringComparison.Ordinal)) 311return uri[(_baseUri.OriginalString.Length - 1)..]; 563length = baseUri.OriginalString.Length; 569if (baseUri.OriginalString.EndsWith('/') && uriPathOnly.Equals(baseUri.OriginalString.AsSpan(0, baseUri.OriginalString.Length - 1), StringComparison.Ordinal)) 577length = baseUri.OriginalString.Length - 1;
NavigationManagerExtensions.cs (1)
753uri.Length - queryStartIndex :
Rendering\SimplifiedStringHashComparer.cs (1)
27var keyLength = key.Length;
RenderTree\RenderTreeDiffBuilder.cs (1)
978newFrame.AttributeNameField.Length >= 3 &&
Routing\RouteContext.cs (3)
23using var uriBuffer = path.Length < 128 ? 24new UriBuffer(stackalloc byte[path.Length]) : 25new UriBuffer(path.Length);
Routing\SupplyParameterFromQueryValueProvider.cs (1)
98return url.AsMemory(queryStartPos..(queryEndPos < 0 ? url.Length : queryEndPos));
src\Http\Routing\src\Constraints\LengthRouteConstraint.cs (1)
106var length = valueString.Length;
src\Http\Routing\src\Constraints\MaxLengthRouteConstraint.cs (1)
70return valueString.Length <= MaxLength;
src\Http\Routing\src\Constraints\MinLengthRouteConstraint.cs (1)
70return valueString.Length >= MinLength;
src\Http\Routing\src\ParameterPolicyActivator.cs (1)
84inlineParameterPolicy.Length - indexOfFirstOpenParens - 2);
src\Http\Routing\src\PathTokenizer.cs (9)
35if (_path.Length == 0) 43if (_path.Length == 1) 58for (var i = 1; i < _path.Length - 1; i++) 97Debug.Assert(_path[_path.Length - 1] != '/'); 100return new StringSegment(_path, currentSegmentStart, _path.Length - currentSegmentStart); 156if (_path == null || _path.Length <= 1) 172if (_index >= _path.Length) 186if (_path[_path.Length - 1] == '/') 193_length = _path.Length - _index;
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\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\Http\Routing\src\Patterns\RoutePatternParser.cs (5)
209var inside = text.Substring(1, text.Length - 2); 428if (parameterName.Length == 0 || parameterName.AsSpan().IndexOfAny(InvalidParameterNameChars) >= 0) 493get { return (_index < _template.Length && _index >= 0) ? _template[_index] : (char)0; } 516return _index >= _template.Length; 521return ++_index < _template.Length;
Microsoft.AspNetCore.Components.Endpoints (11)
DependencyInjection\WebAssemblySettingsEmitter.cs (1)
22=> Environment.GetEnvironmentVariable(name) is { Length: > 0 } value ? value : null;
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)..];
Microsoft.AspNetCore.Components.Endpoints.Tests (11)
Binding\FormDataMapperTests.cs (6)
2011var expected = new FormFileCollection { new FormFile(new MemoryStream(Encoding.UTF8.GetBytes(expectedString)), 0, expectedString.Length, "file", "file.txt") }; 2028Assert.Equal(expectedString.Length, browserFile.Size); 2042new FormFile(new MemoryStream(Encoding.UTF8.GetBytes(expectedString1)), 0, expectedString1.Length, "file", "file1.txt"), 2043new FormFile(new MemoryStream(Encoding.UTF8.GetBytes(expectedString2)), 0, expectedString2.Length, "file", "file2.txt") 2063Assert.Equal(expectedString1.Length, browserFile1.Size); 2070Assert.Equal(expectedString1.Length, browserFile2.Size);
TypeNameHashTest.cs (5)
25Assert.Equal(ExpectedHashLength, hash.Length); 35Assert.Equal(ExpectedHashLength, hash.Length); 48Assert.Equal(ExpectedHashLength, hash.Length); 64Assert.True(type.FullName.Length > TypeNameHash.MaxStackBufferSize); 65Assert.Equal(ExpectedHashLength, hash.Length);
Microsoft.AspNetCore.Components.QuickGrid (3)
Columns\GridSort.cs (3)
159var length = body.Member.Name.Length; 165length += parentMember.Member.Name.Length + 1; 184nextPos -= body.Member.Name.Length;
Microsoft.AspNetCore.Components.Server (3)
Circuits\RemoteScrollToLocationHash.cs (1)
40if (hashIndex > -1 && locationAbsolute.Length > hashIndex + 1)
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.Server.Tests (1)
ProtectedBrowserStorageTest.cs (1)
344var unprotectedString = protectedString.Substring(expectedPrefix.Length);
Microsoft.AspNetCore.Components.Web (2)
Routing\NavLink.cs (2)
232var prefixLength = prefix.Length; 233if (value.Length > prefixLength)
Microsoft.AspNetCore.Components.WebAssembly (5)
.packages\microsoft.dotnet.hotreload.agent\10.0.100-preview.7.25358.102\contentFiles\cs\net6.0\HotReloadAgent.cs (1)
112Debug.Assert(Capabilities.Length > 0);
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)
Microsoft.AspNetCore.Components.WebAssembly.Server (1)
ComponentsWebAssemblyApplicationBuilderExtensions.cs (1)
26=> Environment.GetEnvironmentVariable(name) is { Length: > 0 } value ? value : null;
Microsoft.AspNetCore.Components.WebView (2)
IpcCommon.cs (1)
43var messageAfterPrefix = message.AsSpan(_ipcMessagePrefix.Length);
Services\WebViewScrollToLocationHash.cs (1)
34if (hashIndex > -1 && locationAbsolute.Length > hashIndex + 1)
Microsoft.AspNetCore.Components.WebView.Test (1)
StaticContentProviderTests.cs (1)
115public long Length => _fileContents.Length;
Microsoft.AspNetCore.Components.WebViewE2E.Test (1)
BasicBlazorHybridTest.cs (1)
87_latestControlDivValue = msg.Substring(NewControlDivValueMessage.Length + 1);
Microsoft.AspNetCore.CookiePolicy.Test (6)
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;
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.Internal.Tests (12)
SafeHandles\SecureLocalAllocHandleTests.cs (3)
16int cbExpected = expected.Length * sizeof(char); 18for (int i = 0; i < expected.Length; i++) 27Assert.Equal(expected, new string((char*)duplicateHandle.DangerousGetHandle(), 0, expected.Length)); // contents the same data
UnsafeBufferUtilTests.cs (9)
45int cbExpected = expected.Length * sizeof(char); 47for (int i = 0; i < expected.Length; i++) 57string actual = new string((char*)testHandle.DangerousGetHandle(), 0, expected.Length); 67int cbExpected = expected.Length * sizeof(char); 69for (int i = 0; i < expected.Length; i++) 73char* dest = stackalloc char[expected.Length]; 79string actual = new string(dest, 0, expected.Length); 88int cbExpected = expected.Length * sizeof(char); 98string actual = new string((char*)testHandle.DangerousGetHandle(), 0, expected.Length);
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)
403index += 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 (5)
src\Shared\WebEncoders\WebEncoders.cs (5)
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)
Microsoft.AspNetCore.DataProtection.Tests (2)
Repositories\FileSystemXmlRepositoryTests.cs (2)
111var filenameNoSuffix = filename.Substring(0, filename.Length - ".xml".Length);
Microsoft.AspNetCore.DeveloperCertificates.XPlat (2)
src\Shared\CertificateGeneration\CertificateManager.cs (1)
205if ((byteArray.Length == AspNetHttpsOidFriendlyName.Length && byteArray[0] == (byte)'A') || byteArray.Length == 0)
src\Shared\CertificateGeneration\UnixCertificateManager.cs (1)
341? Path.Combine("$HOME", certDir[homeDirectoryWithSlash.Length..])
Microsoft.AspNetCore.Diagnostics (4)
src\Shared\HttpExtensions.cs (2)
27if (contentType.Length < MultipartFormContentType.Length)
src\Shared\TypeNameHelper\TypeNameHelper.cs (2)
88builder.Replace(DefaultNestedTypeDelimiter, options.NestedTypeDelimiter, builder.Length - name.Length, name.Length);
Microsoft.AspNetCore.Grpc.JsonTranscoding (23)
Internal\GrpcProtocolHelpers.cs (1)
11switch (base64.Length % 4)
Internal\JsonRequestHelpers.cs (3)
426if (bodyFieldName.Length + 1 < variable.Length && 428variable[bodyFieldName.Length] == '.')
Internal\JsonTranscodingRouteAdapter.cs (2)
122var constraint = suffix.Length > 0 ? $":regex({Regex.Escape(suffix)}$)" : string.Empty; 158finalValue = finalValue[..^catchAllSuffix.Length];
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\Grpc\JsonTranscoding\src\Shared\Legacy.cs (9)
87nanosToAdd = parsedFraction * SubsecondScalingFactors[subseconds.Length]; 187if (secondsText[0] == '0' && secondsText.Length > 1) 202nanos = parsedFraction * SubsecondScalingFactors[subseconds.Length] * multiplier; 274var builder = new StringBuilder(text.Length * 2); 280for (int i = 0; i < text.Length; i++) 296(i + 1 < text.Length && // case 3 out 323var result = new StringBuilder(name.Length); 350for (var i = 0; i < input.Length; i++) 357if (c == '_' && i < input.Length - 1)
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\Grpc\JsonTranscoding\src\Shared\X509CertificateHelpers.cs (2)
154int separatorFirstChar = delimiterIndex + subjectName1.Length + 1; 156for (var i = separatorFirstChar + 1; i < x509ExtensionFormattedString.Length; i++)
Microsoft.AspNetCore.Grpc.JsonTranscoding.Tests (76)
artifacts\obj\Microsoft.AspNetCore.Grpc.JsonTranscoding.Tests\Release\net10.0\Proto\Httpbody.cs (8)
139if (Name.Length != 0) hash ^= Name.GetHashCode(); 177if (Name.Length != 0) { 195if (Name.Length != 0) { 213if (other.Name.Length != 0) { 361if (Name.Length != 0) hash ^= Name.GetHashCode(); 394if (Name.Length != 0) { 408if (Name.Length != 0) { 423if (other.Name.Length != 0) {
artifacts\obj\Microsoft.AspNetCore.Grpc.JsonTranscoding.Tests\Release\net10.0\Proto\Issue045270\Hello.cs (8)
141if (Name.Length != 0) hash ^= Name.GetHashCode(); 179if (Name.Length != 0) { 197if (Name.Length != 0) { 215if (other.Name.Length != 0) { 368if (Message.Length != 0) hash ^= Message.GetHashCode(); 406if (Message.Length != 0) { 424if (Message.Length != 0) { 442if (other.Message.Length != 0) {
artifacts\obj\Microsoft.AspNetCore.Grpc.JsonTranscoding.Tests\Release\net10.0\Proto\Issue048192\Customhttp.cs (20)
920if (Selector.Length != 0) hash ^= Selector.GetHashCode(); 927if (Body.Length != 0) hash ^= Body.GetHashCode(); 928if (ResponseBody.Length != 0) hash ^= ResponseBody.GetHashCode(); 996if (Selector.Length != 0) { 1020if (Body.Length != 0) { 1029if (ResponseBody.Length != 0) { 1043if (Selector.Length != 0) { 1064if (Body.Length != 0) { 1067if (ResponseBody.Length != 0) { 1083if (other.Selector.Length != 0) { 1086if (other.Body.Length != 0) { 1089if (other.ResponseBody.Length != 0) { 1347if (Kind.Length != 0) hash ^= Kind.GetHashCode(); 1348if (Path.Length != 0) hash ^= Path.GetHashCode(); 1385if (Kind.Length != 0) { 1389if (Path.Length != 0) { 1403if (Kind.Length != 0) { 1406if (Path.Length != 0) { 1421if (other.Kind.Length != 0) { 1424if (other.Path.Length != 0) {
artifacts\obj\Microsoft.AspNetCore.Grpc.JsonTranscoding.Tests\Release\net10.0\Proto\Issue048192\Hello.cs (8)
124if (Name.Length != 0) hash ^= Name.GetHashCode(); 157if (Name.Length != 0) { 171if (Name.Length != 0) { 186if (other.Name.Length != 0) { 314if (Message.Length != 0) hash ^= Message.GetHashCode(); 347if (Message.Length != 0) { 361if (Message.Length != 0) { 376if (other.Message.Length != 0) {
artifacts\obj\Microsoft.AspNetCore.Grpc.JsonTranscoding.Tests\Release\net10.0\Proto\Transcoding.cs (32)
647if (Name.Length != 0) hash ^= Name.GetHashCode(); 668if (FieldName.Length != 0) hash ^= FieldName.GetHashCode(); 670if (HidingFieldName.Length != 0) hash ^= HidingFieldName.GetHashCode(); 781if (Name.Length != 0) { 847if (FieldName.Length != 0) { 854if (HidingFieldName.Length != 0) { 870if (Name.Length != 0) { 921if (FieldName.Length != 0) { 927if (HidingFieldName.Length != 0) { 944if (other.Name.Length != 0) { 1019if (other.FieldName.Length != 0) { 1027if (other.HidingFieldName.Length != 0) { 1448if (Subfield.Length != 0) hash ^= Subfield.GetHashCode(); 1483if (Subfield.Length != 0) { 1498if (Subfield.Length != 0) { 1514if (other.Subfield.Length != 0) { 1888if (SingleString.Length != 0) hash ^= SingleString.GetHashCode(); 2040if (SingleString.Length != 0) { 2105if (SingleString.Length != 0) { 2168if (other.SingleString.Length != 0) { 2456if (Subfield.Length != 0) hash ^= Subfield.GetHashCode(); 2489if (Subfield.Length != 0) { 2503if (Subfield.Length != 0) { 2518if (other.Subfield.Length != 0) { 3271if (Message.Length != 0) hash ^= Message.GetHashCode(); 3320if (Message.Length != 0) { 3346if (Message.Length != 0) { 3371if (other.Message.Length != 0) { 3583if (Subfield.Length != 0) hash ^= Subfield.GetHashCode(); 3618if (Subfield.Length != 0) { 3633if (Subfield.Length != 0) { 3649if (other.Subfield.Length != 0) {
Microsoft.AspNetCore.Grpc.Microbenchmarks (16)
artifacts\obj\Microsoft.AspNetCore.Grpc.Microbenchmarks\Release\net10.0\Proto\Chat.cs (8)
138if (Name.Length != 0) hash ^= Name.GetHashCode(); 139if (Message.Length != 0) hash ^= Message.GetHashCode(); 176if (Name.Length != 0) { 180if (Message.Length != 0) { 194if (Name.Length != 0) { 197if (Message.Length != 0) { 212if (other.Name.Length != 0) { 215if (other.Message.Length != 0) {
artifacts\obj\Microsoft.AspNetCore.Grpc.Microbenchmarks\Release\net10.0\Proto\Greet.cs (8)
128if (Name.Length != 0) hash ^= Name.GetHashCode(); 161if (Name.Length != 0) { 175if (Name.Length != 0) { 190if (other.Name.Length != 0) { 335if (Message.Length != 0) hash ^= Message.GetHashCode(); 373if (Message.Length != 0) { 391if (Message.Length != 0) { 409if (other.Message.Length != 0) {
Microsoft.AspNetCore.Grpc.Swagger (15)
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\Grpc\JsonTranscoding\src\Shared\Legacy.cs (9)
87nanosToAdd = parsedFraction * SubsecondScalingFactors[subseconds.Length]; 187if (secondsText[0] == '0' && secondsText.Length > 1) 202nanos = parsedFraction * SubsecondScalingFactors[subseconds.Length] * multiplier; 274var builder = new StringBuilder(text.Length * 2); 280for (int i = 0; i < text.Length; i++) 296(i + 1 < text.Length && // case 3 out 323var result = new StringBuilder(name.Length); 350for (var i = 0; i < input.Length; i++) 357if (c == '_' && i < input.Length - 1)
src\Grpc\JsonTranscoding\src\Shared\ServiceDescriptorHelpers.cs (3)
617for (var i = 0; i < input.Length; i++) 661if (input.Length > 0 && input[input.Length - 1] == '#')
Microsoft.AspNetCore.Grpc.Swagger.Tests (76)
artifacts\obj\Microsoft.AspNetCore.Grpc.Swagger.Tests\Release\net10.0\Proto\Body.cs (8)
387if (RequestBody_.Length != 0) hash ^= RequestBody_.GetHashCode(); 420if (RequestBody_.Length != 0) { 434if (RequestBody_.Length != 0) { 449if (other.RequestBody_.Length != 0) { 577if (Message.Length != 0) hash ^= Message.GetHashCode(); 610if (Message.Length != 0) { 624if (Message.Length != 0) { 639if (other.Message.Length != 0) {
artifacts\obj\Microsoft.AspNetCore.Grpc.Swagger.Tests\Release\net10.0\Proto\Greeter.cs (8)
129if (Name.Length != 0) hash ^= Name.GetHashCode(); 162if (Name.Length != 0) { 176if (Name.Length != 0) { 191if (other.Name.Length != 0) { 325if (Message.Length != 0) hash ^= Message.GetHashCode(); 358if (Message.Length != 0) { 372if (Message.Length != 0) { 387if (other.Message.Length != 0) {
artifacts\obj\Microsoft.AspNetCore.Grpc.Swagger.Tests\Release\net10.0\Proto\Messages.cs (20)
250if (Name.Length != 0) hash ^= Name.GetHashCode(); 300if (Name.Length != 0) { 327if (Name.Length != 0) { 352if (other.Name.Length != 0) { 565if (Subfield.Length != 0) hash ^= Subfield.GetHashCode(); 600if (Subfield.Length != 0) { 615if (Subfield.Length != 0) { 631if (other.Subfield.Length != 0) { 1005if (SingleString.Length != 0) hash ^= SingleString.GetHashCode(); 1157if (SingleString.Length != 0) { 1222if (SingleString.Length != 0) { 1285if (other.SingleString.Length != 0) { 1573if (Subfield.Length != 0) hash ^= Subfield.GetHashCode(); 1606if (Subfield.Length != 0) { 1620if (Subfield.Length != 0) { 1635if (other.Subfield.Length != 0) { 2344if (Message.Length != 0) hash ^= Message.GetHashCode(); 2379if (Message.Length != 0) { 2394if (Message.Length != 0) { 2410if (other.Message.Length != 0) {
artifacts\obj\Microsoft.AspNetCore.Grpc.Swagger.Tests\Release\net10.0\Proto\Parameters.cs (24)
191if (ParameterString.Length != 0) hash ^= ParameterString.GetHashCode(); 232if (ParameterString.Length != 0) { 249if (ParameterString.Length != 0) { 267if (other.ParameterString.Length != 0) { 446if (ParameterTwo.Length != 0) hash ^= ParameterTwo.GetHashCode(); 497if (ParameterTwo.Length != 0) { 522if (ParameterTwo.Length != 0) { 546if (other.ParameterTwo.Length != 0) { 967if (ParameterTwo.Length != 0) hash ^= ParameterTwo.GetHashCode(); 1008if (ParameterTwo.Length != 0) { 1025if (ParameterTwo.Length != 0) { 1046if (other.ParameterTwo.Length != 0) { 1233if (NestedParameterTwo.Length != 0) hash ^= NestedParameterTwo.GetHashCode(); 1281if (NestedParameterTwo.Length != 0) { 1303if (NestedParameterTwo.Length != 0) { 1325if (other.NestedParameterTwo.Length != 0) { 1777if (RequestBody_.Length != 0) hash ^= RequestBody_.GetHashCode(); 1810if (RequestBody_.Length != 0) { 1824if (RequestBody_.Length != 0) { 1839if (other.RequestBody_.Length != 0) { 1967if (Message.Length != 0) hash ^= Message.GetHashCode(); 2000if (Message.Length != 0) { 2014if (Message.Length != 0) { 2029if (other.Message.Length != 0) {
artifacts\obj\Microsoft.AspNetCore.Grpc.Swagger.Tests\Release\net10.0\Proto\Responsebody.cs (4)
349if (Message.Length != 0) hash ^= Message.GetHashCode(); 394if (Message.Length != 0) { 417if (Message.Length != 0) { 439if (other.Message.Length != 0) {
artifacts\obj\Microsoft.AspNetCore.Grpc.Swagger.Tests\Release\net10.0\Proto\Xmldoc.cs (12)
142if (Name.Length != 0) hash ^= Name.GetHashCode(); 175if (Name.Length != 0) { 189if (Name.Length != 0) { 204if (other.Name.Length != 0) { 355if (Name.Length != 0) hash ^= Name.GetHashCode(); 393if (Name.Length != 0) { 411if (Name.Length != 0) { 429if (other.Name.Length != 0) { 787if (Message.Length != 0) hash ^= Message.GetHashCode(); 820if (Message.Length != 0) { 834if (Message.Length != 0) { 849if (other.Message.Length != 0) {
Microsoft.AspNetCore.HeaderParsing (1)
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\Shared\HttpExtensions.cs (2)
27if (contentType.Length < MultipartFormContentType.Length)
src\Shared\TypeNameHelper\TypeNameHelper.cs (2)
88builder.Replace(DefaultNestedTypeDelimiter, options.NestedTypeDelimiter, builder.Length - name.Length, name.Length);
Microsoft.AspNetCore.Hosting.FunctionalTests (1)
ShutdownTests.cs (1)
76output += data.Substring(StartedMessage.Length) + '\n';
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\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)
97while ((uint)i < (uint)value.Length) 105buffer ??= new StringBuilder(value.Length * 3); 126count += value.Length - i; 139buffer ??= new StringBuilder(value.Length * 3); 152if (count == value.Length && !requiresEscaping) 187Span<char> pathBuffer = uriComponent.Length <= StackAllocThreshold ? stackalloc char[StackAllocThreshold] : new char[uriComponent.Length]; 189var length = UrlDecoder.DecodeInPlace(pathBuffer.Slice(position, uriComponent.Length - position)); 203Span<char> pathBuffer = uriComponent.Length < StackAllocThreshold ? stackalloc char[StackAllocThreshold] : new char[uriComponent.Length + 1]; 245return value1.Length == value2.Length || value1[value2.Length] == '/'; 288if (value1.Length == value2.Length || value1[value2.Length] == '/') 290remaining = new PathString(value1[value2.Length..]); 338if (value1.Length == value2.Length || value1[value2.Length] == '/') 340matched = new PathString(value1.Substring(0, value2.Length)); 341remaining = new PathString(value1[value2.Length..]);
Microsoft.AspNetCore.Http.Abstractions.Tests (5)
MapPathMiddlewareTests.cs (2)
93Assert.Equal(string.Concat(basePath, requestPath.AsSpan(0, matchPath.Length)), (string)context.Items["test.PathBase"]!); 94Assert.Equal(requestPath.Substring(matchPath.Length), context.Items["test.Path"]);
PathStringTests.cs (3)
388var testString = new string('a', PathString.StackAllocThreshold + offset - path.Length); 390Assert.Equal(PathString.StackAllocThreshold + offset, sut.Value!.Length); 402Assert.Equal(PathString.StackAllocThreshold + offset + 1, sut.Value!.Length);
Microsoft.AspNetCore.Http.Connections (5)
src\Shared\WebEncoders\WebEncoders.cs (5)
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)
Microsoft.AspNetCore.Http.Connections.Client (1)
Internal\Utils.cs (1)
49if (newQueryString.Length > 0 && newQueryString[0] == '?')
Microsoft.AspNetCore.Http.Extensions (17)
src\Shared\TypeNameHelper\TypeNameHelper.cs (2)
88builder.Replace(DefaultNestedTypeDelimiter, options.NestedTypeDelimiter, builder.Length - name.Length, name.Length);
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\Shared\ResultsHelpers\SharedUrlHelper.cs (3)
44if (url.Length == 1) 59if (url[0] == '~' && url.Length > 1 && url[1] == '/') 62if (url.Length == 2)
Microsoft.AspNetCore.HttpLogging (6)
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.HttpLogging.Tests (16)
FileLoggerProcessorTests.cs (16)
49await WaitForFile(filePath, _messageOne.Length).DefaultTimeout(); 88await WaitForFile(filePathToday, _messageOne.Length).DefaultTimeout(); 95await WaitForFile(filePathTomorrow, _messageTwo.Length).DefaultTimeout(); 135await WaitForFile(filePath2, _messageTwo.Length).DefaultTimeout(); 178await WaitForFile(lastFilePath, _messageOne.Length).DefaultTimeout(); 233await WaitForFile(lastFilePath, _messageOne.Length).DefaultTimeout(); 292await WaitForFile(filePath, _messageOne.Length).DefaultTimeout(); 305await WaitForFile(filePath, _messageOne.Length).DefaultTimeout(); 327await WaitForFile(GetLogFilePath(path, options.FileName, _today, 6), _messageOne.Length).DefaultTimeout(); 378await WaitForFile(filePath2, _messageTwo.Length).DefaultTimeout(); 389await WaitForFile(filePath3, _messageThree.Length).DefaultTimeout(); 444await WaitForFile(filePath3, _messageThree.Length).DefaultTimeout(); 455await WaitForFile(filePath4, _messageFour.Length).DefaultTimeout(); 510await WaitForFile(filePath1, _messageOne.Length).DefaultTimeout(); 525await WaitForFile(filePath2, _messageTwo.Length).DefaultTimeout(); 558if (File.ReadAllText(filePath).Length >= 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 (4)
SignInManager.cs (4)
580var user = options.UserId is { Length: > 0 } userId ? await UserManager.FindByIdAsync(userId) : null; 857if (result.Principal.FindFirstValue(ClaimTypes.NameIdentifier) is not { Length: > 0 } userId || 858result.Principal.FindFirstValue(ClaimTypes.Email) is not { Length: > 0 } userName || 859result.Principal.FindFirstValue(ClaimTypes.Name) is not { Length: > 0 } userDisplayName)
Microsoft.AspNetCore.Identity.EntityFrameworkCore.Test (1)
UserStoreEncryptPersonalDataTest.cs (1)
59return data.Substring(pad.Length);
Microsoft.AspNetCore.Identity.InMemory.Test (1)
InMemoryUserStore.cs (1)
429if (mergedCodes.Length > 0)
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.InternalTesting.Tests (9)
AssemblyTestLogTests.cs (8)
305longTestName.Substring(0, testFileName.Length / 2), 306testFileName.Substring(0, testFileName.Length / 2)); 310longTestName.Substring(longTestName.Length - testFileName.Length / 2, testFileName.Length / 2), 311testFileName.Substring(testFileName.Length - testFileName.Length / 2, testFileName.Length / 2));
XunitLoggerProviderTest.cs (1)
79Assert.Equal(0, testTestOutputHelper.Output.Length);
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.Localization.Tests (1)
CustomRequestCultureProviderTest.cs (1)
68if (segments.Length > 1 && segments[0].Length == 2)
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\Shared\TypeNameHelper\TypeNameHelper.cs (2)
88builder.Replace(DefaultNestedTypeDelimiter, options.NestedTypeDelimiter, builder.Length - name.Length, name.Length);
Microsoft.AspNetCore.Mvc.Abstractions.Test (17)
ModelBinding\ModelMetadataTest.cs (6)
271var property = typeof(string).GetProperty(nameof(string.Length)); 310var property = typeof(string).GetProperty(nameof(string.Length)); 314Assert.Equal(nameof(string.Length), metadata.Name); 316Assert.Equal(nameof(string.Length), metadata.PropertyName); 325var property = typeof(string).GetProperty(nameof(string.Length)); 355var property = typeof(string).GetProperty(nameof(string.Length));
ModelBinding\ModelStateDictionaryTest.cs (11)
327var metadata = provider.GetMetadataForProperty(typeof(string), nameof(string.Length)); 757var metadata = provider.GetMetadataForProperty(typeof(string), nameof(string.Length)); 816var metadata = provider.GetMetadataForProperty(typeof(string), nameof(string.Length)); 860var metadata = provider.GetMetadataForProperty(typeof(string), nameof(string.Length)); 890var metadata = provider.GetMetadataForProperty(typeof(string), nameof(string.Length)); 918var metadata = provider.GetMetadataForProperty(typeof(string), nameof(string.Length)); 980var metadata = provider.GetMetadataForProperty(typeof(string), nameof(string.Length)); 1004var metadata = provider.GetMetadataForProperty(typeof(string), nameof(string.Length)); 1094var metadata = provider.GetMetadataForProperty(typeof(string), nameof(string.Length)); 1119var metadata = provider.GetMetadataForProperty(typeof(string), nameof(string.Length)); 1194var metadata = provider.GetMetadataForProperty(typeof(string), nameof(string.Length));
Microsoft.AspNetCore.Mvc.Api.Analyzers (12)
SymbolApiConventionMatcher.cs (12)
127if (name.Length < conventionName.Length) 132if (name.Length == conventionName.Length) 146return char.IsUpper(name[conventionName.Length]); 151if (name.Length < conventionName.Length) 157if (name.Length == conventionName.Length) 164var index = name.Length - conventionName.Length - 1; 180return string.Compare(name, index, conventionName, 1, conventionName.Length - 1, StringComparison.Ordinal) == 0;
Microsoft.AspNetCore.Mvc.Core (80)
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 (7)
326if (url.Length == 1) 341if (url[0] == '~' && url.Length > 1 && url[1] == '/') 344if (url.Length == 2) 377Debug.Assert(pageName.Length > 0); 419if (virtualPath.Length == 0) 435if (virtualPath.Length == 0) 478if (virtualPath.Length == 0)
Routing\ViewEnginePath.cs (1)
33if (index == first.Length - 1)
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\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\Shared\ResultsHelpers\SharedUrlHelper.cs (3)
44if (url.Length == 1) 59if (url[0] == '~' && url.Length > 1 && url[1] == '/') 62if (url.Length == 2)
Microsoft.AspNetCore.Mvc.Core.Test (22)
Formatters\MediaTypeTest.cs (4)
18var result = new MediaType(mediaType, 0, mediaType.Length); 82var result = new MediaType(mediaType, 0, mediaType.Length); 158var parsedMediaType = new MediaType(mediaType, 0, mediaType.Length); 172var parsedMediaType = new MediaType(mediaType, 0, mediaType.Length);
ModelBinding\DefaultModelBindingContextTest.cs (4)
91.ForProperty(typeof(string), nameof(string.Length)) 102var propertyMetadata = metadataProvider.GetMetadataForProperty(typeof(string), nameof(string.Length)); 119.ForProperty(typeof(string), nameof(string.Length)) 131var propertyMetadata = metadataProvider.GetMetadataForProperty(typeof(string), nameof(string.Length));
ModelBinding\Metadata\DefaultBindingMetadataProviderTest.cs (7)
162ModelMetadataIdentity.ForProperty(typeof(string).GetProperty(nameof(string.Length)), typeof(int), typeof(string)), 185ModelMetadataIdentity.ForProperty(typeof(string).GetProperty(nameof(string.Length)), typeof(int), typeof(string)), 208ModelMetadataIdentity.ForProperty(typeof(string).GetProperty(nameof(string.Length)), typeof(int), typeof(string)), 231ModelMetadataIdentity.ForProperty(typeof(string).GetProperty(nameof(string.Length)), typeof(int), typeof(string)), 254ModelMetadataIdentity.ForProperty(typeof(string).GetProperty(nameof(string.Length)), typeof(int), typeof(string)), 421ModelMetadataIdentity.ForProperty(typeof(string).GetProperty(nameof(string.Length)), typeof(int), typeof(string)), 642ModelMetadataIdentity.ForProperty(typeof(string).GetProperty(nameof(string.Length)), typeof(int), typeof(string)),
ModelBinding\Metadata\DefaultValidationMetadataProviderTest.cs (5)
17var key = ModelMetadataIdentity.ForProperty(typeof(string).GetProperty(nameof(string.Length)), typeof(int), typeof(string)); 37var key = ModelMetadataIdentity.ForProperty(typeof(string).GetProperty(nameof(string.Length)), typeof(int), typeof(string)); 116var key = ModelMetadataIdentity.ForProperty(typeof(string).GetProperty(nameof(string.Length)), typeof(int), typeof(string)); 135var key = ModelMetadataIdentity.ForProperty(typeof(string).GetProperty(nameof(string.Length)), typeof(int), typeof(string)); 154var key = ModelMetadataIdentity.ForProperty(typeof(string).GetProperty(nameof(string.Length)), typeof(int), typeof(string));
ModelBinding\Validation\DefaultComplexObjectValidationStrategyTest.cs (1)
217public int Id => _string.Length;
ValidationProblemDetailsTest.cs (1)
56var metadata = provider.GetMetadataForProperty(typeof(string), nameof(string.Length));
Microsoft.AspNetCore.Mvc.DataAnnotations.Test (17)
DataAnnotationsMetadataProviderTest.cs (8)
1111var property = typeof(string).GetProperty(nameof(string.Length)); 1132var property = typeof(string).GetProperty(nameof(string.Length)); 1455var property = typeof(string).GetProperty(nameof(string.Length)); 1483var property = typeof(string).GetProperty(nameof(string.Length)); 1505var property = typeof(string).GetProperty(nameof(string.Length)); 1525var property = typeof(string).GetProperty(nameof(string.Length)); 1545var property = typeof(string).GetProperty(nameof(string.Length)); 1566var property = typeof(string).GetProperty(nameof(string.Length));
DataAnnotationsModelValidatorTest.cs (9)
49_metadataProvider.GetMetadataForProperty(typeof(string), nameof(string.Length)), 51"Hello".Length, 52nameof(string.Length) 129var model = container.Length; 158var model = container.Length; 189var model = container.Length; 291new[] { nameof(string.Length) }, 334var metadata = _metadataProvider.GetMetadataForProperty(typeof(string), nameof(string.Length)); 336var model = container.Length;
Microsoft.AspNetCore.Mvc.Formatters.Xml.Test (2)
XmlDataContractSerializerInputFormatterTest.cs (1)
538var expectedBytes = new byte[sampleString.Length + bom.Length];
XmlSerializerInputFormatterTest.cs (1)
558var expectedBytes = new byte[sampleString.Length + bom.Length];
Microsoft.AspNetCore.Mvc.FunctionalTests (5)
AsyncActionsTests.cs (3)
39Assert.Equal(0, responseBody.Length); 51Assert.Equal(0, responseBody.Length); 212Assert.Equal(0, responseBody.Length);
BasicTests.cs (1)
154Assert.Equal(0, responseContent.Length);
TempDataInCookiesTest.cs (1)
75Assert.True(cookie.Length <= ChunkingCookieManager.DefaultChunkSize);
Microsoft.AspNetCore.Mvc.IntegrationTests (10)
BindingSourceMetadataProviderIntegrationTest.cs (1)
139fileCollection.Add(new FormFile(memoryStream, 0, data.Length, name, fileName)
FormCollectionModelBindingIntegrationTest.cs (1)
166fileCollection.Add(new FormFile(memoryStream, 0, data.Length, name, fileName)
FormFileModelBindingIntegrationTest.cs (1)
1274fileCollection.Add(new FormFile(memoryStream, 0, data.Length, name, fileName)
TryUpdateModelIntegrationTest.cs (1)
1285fileCollection.Add(new FormFile(memoryStream, 0, data.Length, name, fileName)
ValidationIntegrationTests.cs (3)
1338public int ValidateNeverLength => ValidateNever.Length; 1564public int ControlLength => Control.Length; 1654public int ControlLength => Control.Length;
ValidationWithRecordIntegrationTests.cs (3)
1187public int ValidateNeverLength => ValidateNever.Length; 1372public int ControlLength => Control.Length; 1460public int ControlLength => Control.Length;
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)
80PhysicalPath.Length > _root.Length && 81(PhysicalPath[_root.Length] == Path.DirectorySeparatorChar || PhysicalPath[_root.Length] == Path.AltDirectorySeparatorChar)) 83_relativePhysicalPath = PhysicalPath.Substring(_root.Length + 1); // Include leading separator
RuntimeViewCompiler.cs (1)
384if (relativePath.Length == 0)
src\Mvc\Mvc.Razor\src\ViewPath.cs (1)
18var length = path.Length;
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.Razor.RuntimeCompilation.Test (7)
TestInfrastructure\DirectoryNode.cs (7)
82var directoryLength = directory.Path.Length; 87if (string.Compare(path, directoryLength, filePath, directoryLength, path.Length - directoryLength, StringComparison.OrdinalIgnoreCase) == 0) 114if (path[path.Length - 1] != '/') 120while ((index = path.IndexOf('/', directory.Path.Length)) != -1 && index != path.Length) 155var startIndex = parentDirectory.Path.Length; 157if (string.Compare(path, startIndex, directoryPath, startIndex, directoryPath.Length - startIndex, StringComparison.OrdinalIgnoreCase) == 0)
Microsoft.AspNetCore.Mvc.Razor.Test (2)
RazorPageTest.cs (2)
1218value?.ToString().Length ?? 0, 1254value.Item3?.ToString().Length ?? 0,
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)
166sizeInBytes += matchedUrl.Length * sizeof(char); 200var xLength = xExtIndex >= 0 ? xExtIndex : x.Length; 201var yLength = yExtIndex >= 0 ? yExtIndex : y.Length; 217var 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.TagHelpers.Test (40)
CacheTagHelperTest.cs (1)
250finalEntry.VerifySet(e => e.Size = childContent1.Length * 2);
DefaultFileVersionProviderTest.cs (1)
258var expectedSize = expected.Length * sizeof(char);
EnvironmentTagHelperTest.cs (2)
148Assert.True(output.Content.GetContent().Length == 0); 181Assert.True(output.Content.GetContent().Length == 0);
FormTagHelperTest.cs (11)
120Assert.True(output.Content.GetContent().Length == 0); 174Assert.True(output.Content.GetContent().Length == 0); 364Assert.True(output.Content.GetContent().Length == 0); 428Assert.True(output.Content.GetContent().Length == 0); 499Assert.True(output.Content.GetContent().Length == 0); 552Assert.True(output.Content.GetContent().Length == 0); 676Assert.True(output.Content.GetContent().Length == 0); 733Assert.True(output.Content.GetContent().Length == 0); 791Assert.True(output.Content.GetContent().Length == 0); 845Assert.True(output.Content.GetContent().Length == 0); 1002Assert.True(output.Content.GetContent().Length == 0);
ImageTagHelperTest.cs (4)
157Assert.True(output.Content.GetContent().Length == 0); 209Assert.True(output.Content.GetContent().Length == 0); 252Assert.True(output.Content.GetContent().Length == 0); 284Assert.True(output.Content.GetContent().Length == 0);
JavaScriptResourcesTest.cs (3)
16var expected = resource.Substring(0, resource.Length - 2); 33var expected = resource.Substring(0, resource.Length - 2); 78var expected = resource.Substring(0, resource.Length - 2);
LinkTagHelperTest.cs (3)
406Assert.True(output.Content.GetContent().Length == 0); 543Assert.True(output.PostElement.GetContent().Length == 0); 562Assert.True(output.PostElement.GetContent().Length == 0);
PersistComponentStateTagHelperTest.cs (12)
101var message = content["<!--Blazor-WebAssembly-Component-State:".Length..^"-->".Length]; 102Assert.True(message.Length > 0); 131var message = content["<!--Blazor-WebAssembly-Component-State:".Length..^"-->".Length]; 132Assert.True(message.Length > 0); 161var payload = content["<!--Blazor-Server-Component-State:".Length..^"-->".Length]; 163Assert.True(message.Length > 0); 214var payload = content["<!--Blazor-Server-Component-State:".Length..^"-->".Length]; 216Assert.True(message.Length > 0);
ScriptTagHelperTest.cs (3)
382Assert.True(output.Content.GetContent().Length == 0); 471Assert.True(output.PostElement.GetContent().Length == 0); 491Assert.True(output.PostElement.GetContent().Length == 0);
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.Mvc.ViewFeatures.Test (8)
CachedExpressionCompilerTest.cs (1)
858var expression = GetTestModelExpression(m => differentModel.Length);
ModelStateDictionaryExtensionsTest.cs (1)
218var metadata = provider.GetMetadataForProperty(typeof(string), nameof(string.Length));
PageRemoteAttributeTest.cs (1)
174propertyName: nameof(string.Length));
RemoteAttributeBaseTest.cs (3)
350.ForProperty(typeof(string), nameof(string.Length)) 390.ForProperty(typeof(string), nameof(string.Length)) 496propertyName: nameof(string.Length));
RemoteAttributeTest.cs (2)
377propertyName: nameof(string.Length)); 424propertyName: nameof(string.Length));
Microsoft.AspNetCore.OpenApi (2)
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.OutputCaching.Tests (2)
OutputCacheEntryFormatterTests.cs (1)
106var arr = new byte[hex.Length / 2];
OutputCacheTests.cs (1)
1017Assert.True(Guid.TryParse(s.Substring(s.Length - 36), out value));
Microsoft.AspNetCore.Razor.Test (1)
TagHelpers\DefaultTagHelperContentTest.cs (1)
402Assert.True(tagHelperContent.GetContent().Length > 0);
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 (7)
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)
65schemeSplit += Uri.SchemeDelimiter.Length;
Microsoft.AspNetCore.Routing (55)
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 (1)
113MemoryExtensions.EndsWith(requestHost, host.Slice(WildcardHost.Length), StringComparison.OrdinalIgnoreCase))
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) 58for (var i = 1; i < _path.Length - 1; i++) 97Debug.Assert(_path[_path.Length - 1] != '/'); 100return new StringSegment(_path, currentSegmentStart, _path.Length - currentSegmentStart); 156if (_path == null || _path.Length <= 1) 172if (_index >= _path.Length) 186if (_path[_path.Length - 1] == '/') 193_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\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.AsSpan().IndexOfAny(InvalidParameterNameChars) >= 0) 493get { return (_index < _template.Length && _index >= 0) ? _template[_index] : (char)0; } 516return _index >= _template.Length; 521return ++_index < _template.Length;
src\Shared\HttpExtensions.cs (2)
27if (contentType.Length < MultipartFormContentType.Length)
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.Routing.Microbenchmarks (11)
Matching\FastPathTokenizerBenchmarkBase.cs (2)
20var length = path.Length - start; 30var length = path.Length - start;
Matching\JumpTableMultipleEntryBenchmark.cs (3)
30_segments[i] = new PathSegment(1, _strings[i].Length - 2); 71else if (segment.Length != @string.Length) 161text = string.Create(text.Length, text, static (buffer, state) =>
Matching\JumpTableSingleEntryBenchmark.cs (1)
60else if (segment.Length != "hello-world".Length)
src\Http\Routing\test\UnitTests\Matching\BarebonesMatcher.cs (5)
63(comparand.Length != end - start || 69comparand.Length, 80var length = path.Length - start; 85(comparand.Length != length || 91comparand.Length,
Microsoft.AspNetCore.Routing.Tests (11)
Matching\BarebonesMatcher.cs (5)
63(comparand.Length != end - start || 69comparand.Length, 80var length = path.Length - start; 85(comparand.Length != length || 91comparand.Length,
Matching\ILEmitTrieJumpTableTest.cs (4)
84Assert.Equal(entry.Length, length); 145Assert.Equal(entry.Length, length); 209Assert.Equal(entry.Length, length); 240var pathSegment = new PathSegment(0, segment.Length);
UriBuildingContextTest.cs (2)
20uriBuilldingContext.EncodeValue(value, 0, value.Length, encodeSlashes: true); 36uriBuilldingContext.EncodeValue(value, 0, value.Length, encodeSlashes: false);
Microsoft.AspNetCore.Server.HttpSys (22)
HttpSysOptions.cs (1)
49if (value?.Length > MaximumRequestQueueNameLength)
RequestProcessing\Request.cs (5)
97Path = originalPath[pathBase.Length..]; 102PathBase = originalPath[..pathBase.Length]; 103Path = originalPath[pathBase.Length..]; 112while (originalOffset < originalPath.Length && baseOffset < pathBase.Length)
src\Shared\Buffers.MemoryPool\UnmanagedBufferAllocator.cs (1)
88int maxAlloc = checked(Encoding.UTF8.GetMaxByteCount(myString.Length) + 1);
src\Shared\HttpSys\RequestProcessing\HeaderParser.cs (1)
20for (; current < value!.Length; current++)
src\Shared\HttpSys\RequestProcessing\RequestHeaders.Generated.cs (4)
1048switch (key.Length) 1254switch (key.Length) 1502switch (key.Length) 1749switch (key.Length)
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.HttpSys.FunctionalTests (20)
ResponseTrailersTests.cs (8)
124httpContext.Response.ContentLength = body.Length; 140Assert.Equal(body.Length.ToString(CultureInfo.InvariantCulture), response.Content.Headers.GetValues(HeaderNames.ContentLength).Single()); 154httpContext.Response.ContentLength = body.Length * 2; 165Assert.Equal((2 * body.Length).ToString(CultureInfo.InvariantCulture), contentLength.First()); 179httpContext.Response.ContentLength = body.Length; 190Assert.Equal(body.Length.ToString(CultureInfo.InvariantCulture), contentLength.First()); 205httpContext.Response.ContentLength = body.Length; 216Assert.Equal(body.Length.ToString(CultureInfo.InvariantCulture), contentLength.First());
src\Shared\runtime\Http2\Hpack\H2StaticTable.Http2.cs (1)
103value.Length != 0 ? Encoding.ASCII.GetBytes(value) : Array.Empty<byte>());
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\Shared\ServerInfrastructure\BufferExtensions.cs (1)
118var sourceLength = data.Length;
Microsoft.AspNetCore.Server.IIS (19)
Core\IISHttpContext.cs (8)
169if (pathBase.Length > 1 && pathBase[^1] == '/') 196else if (originalPath.Length == pathBase.Length + 1 204else if (originalPath.Length == pathBase.Length + 1 209PathBase = originalPath[..pathBase.Length]; 219while (originalOffset < originalPath.Length && baseOffset < pathBase.Length)
src\Shared\Buffers.MemoryPool\UnmanagedBufferAllocator.cs (1)
88int maxAlloc = checked(Encoding.UTF8.GetMaxByteCount(myString.Length) + 1);
src\Shared\HttpSys\RequestProcessing\HeaderParser.cs (1)
20for (; current < value!.Length; current++)
src\Shared\HttpSys\RequestProcessing\RequestHeaders.Generated.cs (4)
1048switch (key.Length) 1254switch (key.Length) 1502switch (key.Length) 1749switch (key.Length)
src\Shared\ServerInfrastructure\BufferExtensions.cs (1)
118var sourceLength = data.Length;
src\Shared\ServerInfrastructure\StringUtilities.cs (2)
122length += str.Length; 136i = tupleStr.Length;
src\Shared\TypeNameHelper\TypeNameHelper.cs (2)
88builder.Replace(DefaultNestedTypeDelimiter, options.NestedTypeDelimiter, builder.Length - name.Length, name.Length);
Microsoft.AspNetCore.Server.Kestrel.Core (87)
Internal\Http\DateHeaderValueManager.cs (1)
47var dateBytes = new byte[DatePreambleBytes.Length + dateValue.Length];
Internal\Http\Http1Connection.cs (5)
363previousValue == null || previousValue.Length != target.Length || 436previousValue == null || previousValue.Length != queryLength || 482previousValue == null || previousValue.Length != target.Length || 540previousValue == null || previousValue.Length != target.Length || 572previousValue == 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)
324if (Method == HttpMethod.Options && path.Length == 1 && path[0] == '*') 333var requestLineLength = _methodText!.Length + Scheme!.Length + hostText.Length + path.Length; 450Path = PathDecoder.DecodePath(pathBuffer, pathEncoded, RawTarget!, QueryString!.Length);
Internal\Http3\Http3Stream.cs (6)
1086if (Method == HttpMethod.Options && path.Length == 1 && path[0] == '*') 1095var requestLineLength = _methodText!.Length + Scheme!.Length + hostText.Length + path.Length; 1212Path = 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)
234var lengthResult = y!.Length.CompareTo(x!.Length);
KestrelConfigurationLoader.cs (1)
182if (socketPath.Length == 0 || socketPath[0] != '/')
src\Shared\Buffers.MemoryPool\UnmanagedBufferAllocator.cs (1)
88int maxAlloc = checked(Encoding.UTF8.GetMaxByteCount(myString.Length) + 1);
src\Shared\CertificateGeneration\CertificateManager.cs (1)
205if ((byteArray.Length == AspNetHttpsOidFriendlyName.Length && byteArray[0] == (byte)'A') || byteArray.Length == 0)
src\Shared\CertificateGeneration\UnixCertificateManager.cs (1)
341? Path.Combine("$HOME", certDir[homeDirectoryWithSlash.Length..])
src\Shared\Hpack\DynamicHPackEncoder.cs (2)
93var headerLength = HeaderField.GetLength(name.Length, valueEncoding?.GetByteCount(value) ?? value.Length);
src\Shared\runtime\Http2\Hpack\H2StaticTable.Http2.cs (1)
103value.Length != 0 ? Encoding.ASCII.GetBytes(value) : Array.Empty<byte>());
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\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\Shared\ServerInfrastructure\BufferExtensions.cs (1)
118var sourceLength = data.Length;
src\Shared\ServerInfrastructure\StringUtilities.cs (2)
122length += str.Length; 136i = tupleStr.Length;
Microsoft.AspNetCore.Server.Kestrel.Core.Tests (67)
AsciiDecoding.cs (4)
41Assert.Equal(s.Length, asciiBytes.Length); 78Assert.Equal(expectedByteRange.Length, s.Length); 104Assert.False(StringUtilities.BytesOrdinalEqualsStringAndAscii(s.Substring(0, s.Length - 1), span)); 108Assert.False(StringUtilities.BytesOrdinalEqualsStringAndAscii(s.Substring(1, s.Length - 1), span));
Http1\Http1ConnectionTests.cs (4)
74_serviceContext.ServerOptions.Limits.MaxRequestHeadersTotalSize = headerLine.Length - 1; 114_serviceContext.ServerOptions.Limits.MaxRequestHeadersTotalSize = headerLine.Length; 269options.Limits.MaxRequestHeadersTotalSize = headerLine1.Length; 459_serviceContext.ServerOptions.Limits.MaxRequestLineSize = "GET / HTTP/1.1\r\n".Length;
HttpParserTests.cs (2)
467Assert.Equal(buffer1.GetPosition(headerLine.Length - 1), reader1.Position); 468Assert.Equal(headerLine.Length - 1, reader1.Consumed);
HttpUtilitiesTest.cs (2)
51Assert.Equal(length, expectedKnownString?.Length ?? 0); 80Assert.Equal(expectedKnownString?.Length ?? 0, length);
PipelineExtensionTests.cs (4)
48AssertExtensions.Equal(expected, reader.Buffer.Slice(0, numAsStr.Length).ToArray()); 65AssertExtensions.Equal(expected, readResult.Buffer.Slice(0, numAsStr.Length).ToArray()); 90var written = reader.Buffer.Slice(spacer.Length, numAsString.Length); 144Assert.Equal(input.Length, reader.Buffer.Length);
src\Servers\Kestrel\shared\KnownHeaders.cs (26)
506return prefix.Length != 0 ? $"{prefix}.{identifier}" : identifier; 572if (Name.Length >= 8) 576else if (Name.Length >= 4) 580else if (Name.Length >= 2) 602while (index != Name.Length) 604if (Name.Length - index >= 8) 609else if (Name.Length - index >= 4) 614else if (Name.Length - index >= 2) 634while (index != Name.Length) 636if (Name.Length - index >= 8) 649else if (Name.Length - index >= 4) 661else if (Name.Length - index >= 2) 695if (Name.Length >= 8) 699else if (Name.Length >= 4) 703else if (Name.Length >= 2) 721while (index != Name.Length) 723if (Name.Length - index >= 8) 732else if (Name.Length - index >= 4) 740else if (Name.Length - index >= 2) 791HeadersByLength = requestHeaders.OrderBy(x => x.Name.Length).GroupBy(x => x.Name.Length), 798HeadersByLength = responseHeaders.OrderBy(x => x.Name.Length).GroupBy(x => x.Name.Length), 805HeadersByLength = responseTrailers.OrderBy(x => x.Name.Length).GroupBy(x => x.Name.Length), 1324{AppendSwitch(loop.Headers.GroupBy(x => x.Name.Length).OrderBy(x => x.Key))}
src\Servers\Kestrel\shared\test\CertHelper.cs (1)
180var name = testMethodName.Length > 63 ? testMethodName.Substring(0, 63) : testMethodName;
src\Servers\Kestrel\shared\test\RevocationResponder.cs (4)
50string path = authority.AiaHttpUri.Substring(UriPrefix.Length - 1); 57string path = authority.CdpUri.Substring(UriPrefix.Length - 1); 64string path = authority.OcspUri.Substring(UriPrefix.Length - 1); 304string base64 = HttpUtility.UrlDecode(request.RawUrl.Substring(prefix.Length + 1));
src\Servers\Kestrel\shared\test\StreamBackedTestConnection.cs (4)
81for (var index = 0; index < text.Length; index++) 96var actual = new char[expected.Length]; 101while (offset < expected.Length) 103var data = new byte[expected.Length];
src\Servers\Kestrel\shared\test\StringExtensions.cs (2)
12var ellipsis = s.Length > 128 15return s.Substring(0, Math.Min(128, s.Length))
src\Shared\test\Shared.Tests\runtime\Http2\DynamicTableTest.cs (1)
101int maxCount = maxSize / (2 * "header-0".Length + HeaderField.RfcOverhead);
src\Shared\test\Shared.Tests\runtime\Http2\HPackDecoderTest.cs (6)
542_decoder.Decode(encoded[..(_literalHeaderNameString.Length / 2)], endHeaders: false, handler: _handler); 543_decoder.Decode(encoded[(_literalHeaderNameString.Length / 2)..], endHeaders: true, handler: _handler); 590_decoder.Decode(encoded[..^(_headerValueString.Length / 2)], endHeaders: false, handler: _handler); 591_decoder.Decode(encoded[^(_headerValueString.Length / 2)..], endHeaders: true, handler: _handler); 950Assert.Equal(expectedHeaderName.Length + expectedHeaderValue.Length + 32, dynamicTable.Size);
src\Shared\test\Shared.Tests\runtime\Http3\QPackDecoderTest.cs (4)
220_decoder.Decode(encoded[..(_literalHeaderFieldString.Length / 2)], endHeaders: false, handler: _handler); 221_decoder.Decode(encoded[(_literalHeaderFieldString.Length / 2)..], endHeaders: true, handler: _handler); 268_decoder.Decode(encoded[..^(_headerValueString.Length / 2)], endHeaders: false, handler: _handler); 269_decoder.Decode(encoded[^(_headerValueString.Length / 2)..], endHeaders: true, handler: _handler);
StartLineTests.cs (2)
221Assert.True(query.Length == 0 || !ReferenceEquals(query, Http1Connection.QueryString)); 314Assert.True(query.Length == 0 || !ReferenceEquals(query, Http1Connection.QueryString));
UTF8Decoding.cs (1)
23Assert.Equal(1, s.Length);
Microsoft.AspNetCore.Server.Kestrel.Microbenchmarks (9)
DotSegmentRemovalBenchmark.cs (5)
25private readonly byte[] _noDotSegmentsBytes = new byte[_noDotSegments.Length]; 26private readonly byte[] _singleDotSegmentsBytes = new byte[_singleDotSegments.Length]; 27private readonly byte[] _doubleDotSegmentsBytes = new byte[_doubleDotSegments.Length]; 28private readonly byte[] _oneSingleDotSegmentsBytes = new byte[_singleDotSegments.Length]; 29private readonly byte[] _oneDoubleDotSegmentsBytes = new byte[_doubleDotSegments.Length];
InMemoryTransportBenchmark.cs (3)
71var response = Encoding.ASCII.GetString(await _connection.GetResponseAsync(expectedResponse.Length)); 94await _connection.ReadResponseAsync(_plaintextExpectedResponse.Length); 101await _connection.ReadResponseAsync(_plaintextPipelinedExpectedResponse.Length);
NamedPipesTransportBenchmark.cs (1)
30private static readonly byte[] _responseBuffer = new byte[_plaintextExpectedResponse.Length];
Microsoft.AspNetCore.Server.Kestrel.Transport.NamedPipes (1)
src\Shared\Buffers.MemoryPool\UnmanagedBufferAllocator.cs (1)
88int maxAlloc = checked(Encoding.UTF8.GetMaxByteCount(myString.Length) + 1);
Microsoft.AspNetCore.Server.Kestrel.Transport.Quic (3)
src\Shared\Buffers.MemoryPool\UnmanagedBufferAllocator.cs (1)
88int maxAlloc = checked(Encoding.UTF8.GetMaxByteCount(myString.Length) + 1);
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.Shared.Tests (69)
runtime\Http2\DynamicTableTest.cs (1)
101int maxCount = maxSize / (2 * "header-0".Length + HeaderField.RfcOverhead);
runtime\Http2\HPackDecoderTest.cs (6)
542_decoder.Decode(encoded[..(_literalHeaderNameString.Length / 2)], endHeaders: false, handler: _handler); 543_decoder.Decode(encoded[(_literalHeaderNameString.Length / 2)..], endHeaders: true, handler: _handler); 590_decoder.Decode(encoded[..^(_headerValueString.Length / 2)], endHeaders: false, handler: _handler); 591_decoder.Decode(encoded[^(_headerValueString.Length / 2)..], endHeaders: true, handler: _handler); 950Assert.Equal(expectedHeaderName.Length + expectedHeaderValue.Length + 32, dynamicTable.Size);
runtime\Http3\QPackDecoderTest.cs (4)
220_decoder.Decode(encoded[..(_literalHeaderFieldString.Length / 2)], endHeaders: false, handler: _handler); 221_decoder.Decode(encoded[(_literalHeaderFieldString.Length / 2)..], endHeaders: true, handler: _handler); 268_decoder.Decode(encoded[..^(_headerValueString.Length / 2)], endHeaders: false, handler: _handler); 269_decoder.Decode(encoded[^(_headerValueString.Length / 2)..], endHeaders: true, handler: _handler);
src\Shared\CommandLineUtils\CommandLine\AnsiConsole.cs (2)
77while (endIndex != message.Length && 86if (endIndex == message.Length)
src\Shared\CommandLineUtils\CommandLine\CommandLineApplication.cs (3)
480var maxArgLen = arguments.Max(a => a.Name.Length); 496var maxOptLen = options.Max(o => o.Template.Length); 512var maxCmdLen = commands.Max(c => c.Name.Length);
src\Shared\CommandLineUtils\CommandLine\CommandOption.cs (2)
29if (optName.Length == 1 && !IsEnglishLetter(optName[0])) 40ValueName = part.Substring(1, part.Length - 2);
src\Shared\Hpack\DynamicHPackEncoder.cs (2)
93var headerLength = HeaderField.GetLength(name.Length, valueEncoding?.GetByteCount(value) ?? value.Length);
src\Shared\HttpSys\RequestProcessing\HeaderParser.cs (1)
20for (; current < value!.Length; current++)
src\Shared\HttpSys\RequestProcessing\RequestHeaders.Generated.cs (4)
1048switch (key.Length) 1254switch (key.Length) 1502switch (key.Length) 1749switch (key.Length)
src\Shared\runtime\Http2\Hpack\H2StaticTable.Http2.cs (1)
103value.Length != 0 ? Encoding.ASCII.GetBytes(value) : Array.Empty<byte>());
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\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\Shared\ServerInfrastructure\BufferExtensions.cs (1)
118var sourceLength = data.Length;
src\Shared\ServerInfrastructure\StringUtilities.cs (2)
122length += str.Length; 136i = tupleStr.Length;
src\Shared\TypeNameHelper\TypeNameHelper.cs (2)
88builder.Replace(DefaultNestedTypeDelimiter, options.NestedTypeDelimiter, builder.Length - name.Length, name.Length);
src\Shared\WebEncoders\WebEncoders.cs (5)
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)
UrlDecoderTests.cs (4)
19var destination = new char[input.Length]; 37var destination = new char[input.Length]; 107Assert.Equal(input.Length, length); 145Assert.Equal(input.Length, length);
WebEncodersTests.cs (1)
55byte[] roundTripped = WebEncoders.Base64UrlDecode("xx" + actualBase64Url + "yyy", 2, actualBase64Url.Length); // also helps test offsets
Microsoft.AspNetCore.SignalR.Client (1)
src\Shared\ThrowHelpers\ArgumentNullThrowHelper.cs (1)
47else if (argument.Length == 0)
Microsoft.AspNetCore.SignalR.Client.Core (1)
src\Shared\ThrowHelpers\ArgumentNullThrowHelper.cs (1)
47else if (argument.Length == 0)
Microsoft.AspNetCore.SignalR.Client.Tests (1)
ServerSentEventsTransportTests.cs (1)
513Debug.Assert(buffer.Length > _contents[_index].Length);
Microsoft.AspNetCore.SignalR.Common.Tests (1)
Internal\Protocol\Utf8BufferTextWriterTests.cs (1)
106Assert.Equal(2004, result.Length);
Microsoft.AspNetCore.StaticAssets.Tests (3)
StaticAssetsIntegrationTests.cs (3)
504new("Content-Length", resource.Content.Length.ToString(CultureInfo.InvariantCulture)), 583new("Content-Length", "Hello, World!".Length.ToString(CultureInfo.InvariantCulture)), 1081public long Length => testResource.Content.Length;
Microsoft.AspNetCore.WebSockets (5)
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 (23)
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\Shared\WebEncoders\WebEncoders.cs (5)
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)
Microsoft.AspNetCore.WebUtilities.Microbenchmarks (2)
HttpRequestStreamReaderReadLineBenchmark.cs (2)
33Debug.Assert(result.Length == Length - 2); 42Debug.Assert(result.Length == Length - 2);
Microsoft.AspNetCore.WebUtilities.Tests (2)
HttpRequestStreamReaderTest.cs (1)
49Assert.Equal(5000, result.Length);
HttpResponseStreamWriterTest.cs (1)
305Assert.Equal(byteLength + newLine.Length, stream.Length);
Microsoft.Build.Framework (15)
EnvironmentUtilities.cs (1)
78return (processPath?.Length != 0) ? processPath : null;
FileClassifier.cs (8)
147dir = dir.Substring(0, dir.Length - devEnvExeRelativePath.Length); 238if (directory?.Length > 0) 323path = path.Substring(0, path.Length - 1); 341return (fileSpec.Length > 0) && IsSlash(fileSpec[fileSpec.Length - 1]); 356if (fileSpec.Length >= 1 && !EndsWithSlash(fileSpec)) 394IsMicrosoftAssembly(filePath.AsSpan(containingNugetCache.Length));
InterningWriteTranslator.cs (1)
135&& splitId < str.Length - 1
MSBuildNameIgnoreCaseComparer.cs (5)
34return Equals(x, y, 0, y?.Length ?? 0); 39return GetHashCode(obj, 0, obj?.Length ?? 0); 52if (start < 0 || start > (constrainedString?.Length ?? 0) - lengthToCompare) 70if (lengthToCompare != compareToString.Length) 88for (int i = 0; i < compareToString.Length; i++)
Microsoft.Build.Tasks.CodeAnalysis (17)
src\Compilers\Core\MSBuildTask\CanonicalError.cs (2)
264if (message.Length > 400) 349if (location.Length > 0)
src\Compilers\Core\MSBuildTask\CommandLineBuilderExtension.cs (1)
256if ((metadataValue != null) && (metadataValue.Length > 0))
src\Compilers\Core\MSBuildTask\Csc.cs (3)
372if (alias.Length == 0) 473else if (singleIdentifier.Length > 0) 693else if (errorMessage != null && errorMessage.Length > 0)
src\Compilers\Core\MSBuildTask\MapSourceRoots.cs (3)
75=> (path[path.Length - 1] == '/') ? path : path + '/'; 79if (path.Length == 0) 84char c = path[path.Length - 1];
src\Compilers\Core\MSBuildTask\Utilities.cs (1)
39if (metadataValue == null || metadataValue.Length == 0)
src\Compilers\Core\MSBuildTask\Vbc.cs (3)
349if (originalBaseAddress.Length > 2) 659if (!_isDoneOutputtingErrorMessage && singleLine.Length == 0) 761if ((originalDefineConstants == null) || (originalDefineConstants.Length == 0))
src\Compilers\Core\Portable\InternalUtilities\UnicodeCharacterUtilities.cs (1)
103int nameLength = name.Length;
src\Compilers\Shared\BuildProtocol.cs (1)
581writer.Write(value.Length);
src\Compilers\Shared\RuntimeHostInfo.cs (2)
44if (Environment.GetEnvironmentVariable(DotNetHostPathEnvironmentName) is { Length: > 0 } pathToDotNet) 49if (Environment.GetEnvironmentVariable(DotNetExperimentalHostPathEnvironmentName) is { Length: > 0 } pathToDotNetExperimental)
Microsoft.Build.Tasks.CodeAnalysis.Sdk (17)
src\Compilers\Core\MSBuildTask\CanonicalError.cs (2)
264if (message.Length > 400) 349if (location.Length > 0)
src\Compilers\Core\MSBuildTask\CommandLineBuilderExtension.cs (1)
256if ((metadataValue != null) && (metadataValue.Length > 0))
src\Compilers\Core\MSBuildTask\Csc.cs (3)
372if (alias.Length == 0) 473else if (singleIdentifier.Length > 0) 693else if (errorMessage != null && errorMessage.Length > 0)
src\Compilers\Core\MSBuildTask\MapSourceRoots.cs (3)
75=> (path[path.Length - 1] == '/') ? path : path + '/'; 79if (path.Length == 0) 84char c = path[path.Length - 1];
src\Compilers\Core\MSBuildTask\Utilities.cs (1)
39if (metadataValue == null || metadataValue.Length == 0)
src\Compilers\Core\MSBuildTask\Vbc.cs (3)
349if (originalBaseAddress.Length > 2) 659if (!_isDoneOutputtingErrorMessage && singleLine.Length == 0) 761if ((originalDefineConstants == null) || (originalDefineConstants.Length == 0))
src\Compilers\Core\Portable\InternalUtilities\UnicodeCharacterUtilities.cs (1)
103int nameLength = name.Length;
src\Compilers\Shared\BuildProtocol.cs (1)
581writer.Write(value.Length);
src\Compilers\Shared\RuntimeHostInfo.cs (2)
44if (Environment.GetEnvironmentVariable(DotNetHostPathEnvironmentName) is { Length: > 0 } pathToDotNet) 49if (Environment.GetEnvironmentVariable(DotNetExperimentalHostPathEnvironmentName) is { Length: > 0 } pathToDotNetExperimental)
Microsoft.Build.Tasks.CodeAnalysis.UnitTests (1)
TargetTests.cs (1)
914var compilerApiVersion = Version.Parse(compilerApiVersionString.Substring("roslyn".Length));
Microsoft.Cci.Extensions (8)
Comparers\ApiComparer.cs (2)
54return x.Length.CompareTo(y.Length);
Writers\CSharp\CSDeclarationWriter.Attributes.cs (1)
336StringBuilder sb = new StringBuilder(str.Length + 4);
Writers\CSharp\CSDeclarationWriter.Methods.cs (1)
332else if (_platformNotSupportedExceptionMessage.Length > 0)
Writers\Syntax\IndentionSyntaxWriter.cs (2)
37if (_needToWriteIndent && _indent.Length > 0) 69return _indent.Length / SpacesInIndent;
Writers\Syntax\TokenSyntaxWriter.cs (2)
67return _indent.Length / SpacesInIndent; 92if (_needToWriteIndent && _indent.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)
196Size = (value.Length + 1) * sizeof(char),
CodeGen\ILBuilderEmit.cs (1)
744bool success = (value.Length > module.CommonCompilation.DataSectionStringLiteralThreshold)
CodeGen\PrivateImplementationDetails.cs (1)
358previousText[..Math.Min(previousText.Length, 500)]));
Collections\Rope.cs (2)
105wrote = Math.Min(maxLength, _value.Length); 109public override int Length => _value.Length;
CommandLine\AnalyzerConfig.cs (2)
107(e1, e2) => e1.NormalizedDirectory.Length.CompareTo(e2.NormalizedDirectory.Length));
CommandLine\AnalyzerConfig.SectionNameMatching.cs (3)
469public bool IsDone => Position >= _sectionName.Length; 479if (nextPos < _sectionName.Length && 587return 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) 785if (arg.Length == 0 || !(arg[0] == '/' || arg[0] == '-')) 796if (arg.Length > optionName.Length) 798if (!(arg[optionName.Length] == ':' || arg[optionName.Length] == '=')) 804optionValue = arg.Substring(optionName.Length + 1).Trim('"'); 1438=> pathMap.Sort((x, y) => -x.Key.Length.CompareTo(y.Key.Length));
CommandLine\CommonCompiler.cs (2)
170if (hash != null && hash.Length >= 8 && hash[0] != '<') 1728return 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)
221if (id.Length > 1 && id[0] == 'N' && id[1] == ':') 244if (id.Length > 1 && id[0] == 'N' && id[1] == ':') 293name = name.Substring(0, name.Length - 6) + "Item"; 310name = name.Substring(0, name.Length - 4) + "this[]"; 708if (id.Length < 2) 1517return index >= id.Length ? '\0' : id[index]; 1535index = id.Length; 1556while (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)
133if (path!.Length == 1) 175Debug.Assert(path.Length == 1 || !PathUtilities.IsDirectorySeparator(path[1]));
FileSystem\PathUtilities.cs (36)
52int lastSeparator = s.Length; 58if (lastSeparator != s.Length) 71if (s.Length == 0 || IsAnyDirectorySeparator(s[s.Length - 1])) 138var rootLength = GetPathRoot(path, isUnixLike).Length; 139if (path.Length > rootLength) 141var i = path.Length; 212int length = path.Length; 287return path.Length > 0 && IsDirectorySeparator(path[0]) 314if (path.Length > 0 && path[0] == '.') 316if (path.Length == 1 || IsDirectorySeparator(path[1])) 323if (path.Length == 2 || IsDirectorySeparator(path[2])) 334if (path.Length >= 1 && IsDirectorySeparator(path[0])) 341if (path.Length >= 2 && path[1] == VolumeSeparatorChar && (path.Length <= 2 || !IsDirectorySeparator(path[2]))) 375return path.Length >= 2 && 386return path.Length >= 3 && path[1] == VolumeSeparatorChar && IsDirectorySeparator(path[2]); 440char c = root[root.Length - 1]; 479if (path.Length > 0 && IsDirectorySeparator(path[path.Length - 1])) 481return path.Substring(0, path.Length - 1); 608return parentPath.Length > 0 609&& childPath.Length > parentPath.Length 610&& PathsEqual(childPath, parentPath, parentPath.Length) 611&& (IsDirectorySeparator(parentPath[parentPath.Length - 1]) || IsDirectorySeparator(childPath[parentPath.Length])); 616var relativePath = childPath.Substring(parentPath.Length); 619int start = ConsumeDirectorySeparators(relativePath, relativePath.Length, 0); 648return PathsEqual(path1, path2, Math.Max(path1.Length, path2.Length)); 656if (path1.Length < length || path2.Length < length) 714if (!(oldPrefix?.Length > 0)) continue; 723var replacement = replacementPrefix + filePath.Substring(oldPrefix.Length); 841if (!isDriveRooted && !(p.Length > 1 && p[0] == AltDirectorySeparatorChar))
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 (15)
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.Substring(0, name.Length - AttributeSuffix.Length); 165return name.Length > AttributeSuffix.Length && name.EndsWith(AttributeSuffix, comparison); 171while (i < str.Length) 178if (i < str.Length && char.IsLowSurrogate(str[i])) 208if (arg.Length > 1 && arg[0] == '"' && arg[arg.Length - 1] == '"') 211return arg.Substring(1, arg.Length - 2); 223while (x < string1.Length && x < string2.Length && 235while (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)
114if (i <= _input.Length) 124return _offset >= _input.Length; 271typeNameBuilder.Append(DecodeGenericName(_input.Length)); 291if (decodedTypeName.Length != 0) 315Debug.Assert(i == _input.Length || s_typeNameDelimiters.Contains(_input[i])); 406i = _input.Length; 411i = _input.Length; 589Debug.Assert(suffixStartsAt > 0 && suffixStartsAt < emittedTypeName.Length - 1); 684for (int i = 0; i < pstrName.Length; i++) 815while (pair.Key.Length == namespaceNameLength) 1013if (name.Length == 0) 1058return fullyQualified.Length == namespaceName.Length + typeName.Length + 1 && 1059fullyQualified[namespaceName.Length] == MetadataHelpers.DotDelimiter && 1087var 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) 3870if (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++) 834if (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 3331Debug.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)
31Debug.Assert(fileExtension.Length > 0 && fileExtension[0] == '.'); 44for (int i = 0; i < hintName.Length; i++)
SourceGeneration\Nodes\SyntaxValueProvider_ForAttributeWithSimpleName.cs (3)
305return name.Length + "Attribute".Length == matchAgainst.Length &&
src\Dependencies\CodeAnalysis.Debugging\CustomDebugInfoEncoder.cs (2)
153Debug.Assert(info.LocalName.Length <= IdentifierSize); 160builder.WriteBytes(0, sizeof(char) * (IdentifierSize - info.LocalName.Length));
src\Dependencies\CodeAnalysis.Debugging\CustomDebugInfoReader.cs (7)
503if (importString.Length >= 2 && importString[0] == '@') 557return import.Length > 0 && import[0] == 'Z'; 690if (import.Length == 0) 724if (pos >= import.Length) 742if (pos >= import.Length) 830if (offset <= separatorPos && separatorPos < input.Length) 833after = separatorPos + 1 == input.Length
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; 126int nameLength = 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)
780where !c.Span.IsEmpty || c.NewText?.Length > 0 789var 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)
110for (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 (221)
MetaAnalyzers\DiagnosticDescriptorCreationAnalyzer.cs (5)
999if (part.TrimEnd().Length == part.Length && 1019=> s.Trim().Length != s.Length; 1291if (ruleId.Length < 3)
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\ReleaseTrackingHelper.cs (1)
77string versionString = lineText[ReleasePrefix.Length..].Trim();
src\Compilers\Core\Portable\FileSystem\FileUtilities.cs (2)
133if (path!.Length == 1) 175Debug.Assert(path.Length == 1 || !PathUtilities.IsDirectorySeparator(path[1]));
src\Compilers\Core\Portable\FileSystem\PathUtilities.cs (36)
52int lastSeparator = s.Length; 58if (lastSeparator != s.Length) 71if (s.Length == 0 || IsAnyDirectorySeparator(s[s.Length - 1])) 138var rootLength = GetPathRoot(path, isUnixLike).Length; 139if (path.Length > rootLength) 141var i = path.Length; 212int length = path.Length; 287return path.Length > 0 && IsDirectorySeparator(path[0]) 314if (path.Length > 0 && path[0] == '.') 316if (path.Length == 1 || IsDirectorySeparator(path[1])) 323if (path.Length == 2 || IsDirectorySeparator(path[2])) 334if (path.Length >= 1 && IsDirectorySeparator(path[0])) 341if (path.Length >= 2 && path[1] == VolumeSeparatorChar && (path.Length <= 2 || !IsDirectorySeparator(path[2]))) 375return path.Length >= 2 && 386return path.Length >= 3 && path[1] == VolumeSeparatorChar && IsDirectorySeparator(path[2]); 440char c = root[root.Length - 1]; 479if (path.Length > 0 && IsDirectorySeparator(path[path.Length - 1])) 481return path.Substring(0, path.Length - 1); 608return parentPath.Length > 0 609&& childPath.Length > parentPath.Length 610&& PathsEqual(childPath, parentPath, parentPath.Length) 611&& (IsDirectorySeparator(parentPath[parentPath.Length - 1]) || IsDirectorySeparator(childPath[parentPath.Length])); 616var relativePath = childPath.Substring(parentPath.Length); 619int start = ConsumeDirectorySeparators(relativePath, relativePath.Length, 0); 648return PathsEqual(path1, path2, Math.Max(path1.Length, path2.Length)); 656if (path1.Length < length || path2.Length < length) 714if (!(oldPrefix?.Length > 0)) continue; 723var replacement = replacementPrefix + filePath.Substring(oldPrefix.Length); 841if (!isDriveRooted && !(p.Length > 1 && p[0] == AltDirectorySeparatorChar))
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\Compilers\Core\Portable\InternalUtilities\StringExtensions.cs (15)
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.Substring(0, name.Length - AttributeSuffix.Length); 165return name.Length > AttributeSuffix.Length && name.EndsWith(AttributeSuffix, comparison); 171while (i < str.Length) 178if (i < str.Length && char.IsLowSurrogate(str[i])) 208if (arg.Length > 1 && arg[0] == '"' && arg[arg.Length - 1] == '"') 211return arg.Substring(1, arg.Length - 2); 223while (x < string1.Length && x < string2.Length && 235while (x < string1.Length && x < string2.Length &&
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\Compilers\Core\Portable\InternalUtilities\UnicodeCharacterUtilities.cs (1)
103int nameLength = name.Length;
src\Compilers\Core\Portable\Syntax\SyntaxTreeExtensions.cs (2)
95var n1 = s1.Length; 96var n2 = s2.Length;
src\Compilers\Core\Portable\Text\TextChangeRangeExtensions.cs (1)
105return new TextChangeRange(textChange.Span, textChange.NewText?.Length ?? 0);
src\Dependencies\Collections\Extensions\IEnumerableExtensions.cs (2)
213return str.Length == 0; 236return source.Length == 0;
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\RoslynAnalyzers\Microsoft.CodeAnalysis.BannedApiAnalyzers\Core\SymbolIsBannedAnalyzerBase.cs (1)
426else if (index == text.Length - 1)
src\RoslynAnalyzers\Utilities\Compiler\CodeMetrics\CodeAnalysisMetricData.cs (1)
141if (index >= 0 && index < symbolName.Length)
src\RoslynAnalyzers\Utilities\Compiler\Extensions\StringExtensions.cs (1)
15return Encoding.UTF8.GetByteCount(value) == value.Length;
src\RoslynAnalyzers\Utilities\Compiler\Options\AnalyzerOptionsExtensions.cs (2)
359if (trimmedSuffix.Length >= 2 && 363for (int i = 1; i < trimmedSuffix.Length - 2; i++)
src\RoslynAnalyzers\Utilities\Compiler\Options\SymbolNamesWithValueOption.cs (2)
109parts.SymbolName.Length == 1)) 145Debug.Assert(parts.SymbolName.Length >= 2);
src\RoslynAnalyzers\Utilities\Compiler\RulesetToEditorconfigConverter.cs (2)
208if (comment.Length > 0) 213if (trimmedCommentPart.Length > 0)
src\RoslynAnalyzers\Utilities\Compiler\WellKnownTypeProvider.cs (1)
220for (int i = 0; i < fullTypeName.Length; i++)
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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\CodeGeneration\ParameterName.cs (1)
42BestNameForParameter = trimmed.Length > 0 ? tryMakeCamelCase ? trimmed.ToCamelCase() : trimmed : nameBasedOnArgument;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EditorConfig\Parsing\Sections\SectionMatcher.Lexer.cs (5)
15public readonly bool IsDone => Position >= headerText.Length; 54if (position < headerText.Length) 85if (position < headerText.Length && 113if (position >= headerText.Length) 171return str.Length == 0 || str == "-"
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\VirtualChars\AbstractVirtualCharService.cs (8)
31if (index + 1 < tokenText.Length) 117Debug.Assert(lastVC.Span.End == token.Span.End - "\"".Length, "Last span has to end right before the end of the string token."); 121Debug.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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\VirtualChars\AbstractVirtualCharService.ITextInfo.cs (1)
30public readonly int Length(string text) => text.Length;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\VirtualChars\VirtualCharSequence.Chunks.cs (3)
84public override int Length => data.Length; 89if (stringIndex < 0 || stringIndex >= data.Length) 104Debug.Assert(index + 1 >= data.Length ||
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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\TokenStream.cs (2)
337length = text.ConvertTabToSpace(_options.TabSize, initialColumn, text.Length); 341length = text.Length;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\TreeData.Node.cs (1)
30return lineText.GetColumnFromLineOffset(lineText.Length, tabSize);
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\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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\Naming\IdentifierNameParts.cs (2)
47? newBaseName[prefix.Length..] 53? newBaseName[..^suffix.Length]
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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\NamingStyle.WordSpanEnumerator.cs (1)
52Current = new TextSpan(Current.End + _wordSeparator.Length, 0);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Serialization\ObjectWriter.cs (2)
504var bytes = new byte[(uint)value.Length * sizeof(char)]; 510WriteCompressedUInt((uint)value.Length);
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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\SyntaxFacts\ISyntaxFactsExtensions.cs (2)
251if (name.Length == 0) 261for (var i = 1; i < name.Length; i++)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.cs (1)
198Debug.Assert(reader.Position == symbolKey.Length);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.SymbolKeyReader.cs (1)
259while (Position < Data.Length)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\Base64Utilities.cs (2)
329decodedLength = (encodedString.Length * 3) / 4 - padding; 336var index = attributeData.Length - 1;
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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\BKTree.cs (4)
74Span<char> lowerCaseCharacters = value.Length < 512 75? stackalloc char[value.Length] 76: new char[value.Length]; 78for (var i = 0; i < value.Length; i++)
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++) 89Span<char> 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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\PathMetadataUtilities.cs (2)
31if (rootNamespace is { Length: > 0 } && 69@namespace = @namespace[(rootNamespace.Length + 1)..];
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\StringBreaker.cs (2)
24for (var start = 0; start < text.Length;) 42var length = identifier.Length;
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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\WordSimilarityChecker.cs (6)
80=> value.Length <= 4 ? 1 : 2; 87if (_source.Length < 3) 113if (Math.Abs(_source.Length - candidateText.Length) <= _threshold) 142var lengthDifference = Math.Abs(originalText.Length - candidateText.Length);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\ISymbolExtensions.cs (1)
795(symbol.Name.Length == 1 || uint.TryParse(symbol.Name[1..], out _) || symbol.Name.All(n => n.Equals('_')));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\ITypeSymbolExtensions.cs (1)
363return shortName.Length == 0
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Extensions\ProjectExtensions.cs (2)
75analyzerConfigDirectory.Length > bestPath.Length)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Extensions\SyntaxGeneratorExtensions_CreateEqualsMethod.cs (1)
366if (name.Length > 0)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\LanguageServices\TypeInferenceService\AbstractTypeInferenceService.cs (3)
67if (name.Length == prefix.Length) 72var nextChar = name[prefix.Length];
Microsoft.CodeAnalysis.Analyzers.UnitTests (7)
MetaAnalyzers\ReleaseTrackingAnalyzerTests.cs (7)
585var fileWithDiagnostics = shippedText.Length > 0 ? ReleaseTrackingHelper.ShippedFileName : ReleaseTrackingHelper.UnshippedFileName; 586var diagnosticText = (shippedText.Length > 0 ? shippedText : unshippedText).Split([Environment.NewLine], StringSplitOptions.None).ElementAt(line - 1); 826var fileWithDiagnostics = shippedText.Length > 0 ? ReleaseTrackingHelper.ShippedFileName : ReleaseTrackingHelper.UnshippedFileName; 827var lineCount = (shippedText.Length > 0 ? shippedText : unshippedText).Split([Environment.NewLine], StringSplitOptions.None).Length; 857var fileWithDiagnostics = shippedText.Length > 0 ? ReleaseTrackingHelper.ShippedFileName : ReleaseTrackingHelper.UnshippedFileName; 858var lineCount = (shippedText.Length > 0 ? shippedText : unshippedText).Split([Environment.NewLine], StringSplitOptions.None).Length; 891var fileWithDiagnostics = shippedText.Length > 0 ? ReleaseTrackingHelper.ShippedFileName : ReleaseTrackingHelper.UnshippedFileName;
Microsoft.CodeAnalysis.AnalyzerUtilities (199)
src\Compilers\Core\Portable\FileSystem\FileUtilities.cs (2)
133if (path!.Length == 1) 175Debug.Assert(path.Length == 1 || !PathUtilities.IsDirectorySeparator(path[1]));
src\Compilers\Core\Portable\FileSystem\PathUtilities.cs (36)
52int lastSeparator = s.Length; 58if (lastSeparator != s.Length) 71if (s.Length == 0 || IsAnyDirectorySeparator(s[s.Length - 1])) 138var rootLength = GetPathRoot(path, isUnixLike).Length; 139if (path.Length > rootLength) 141var i = path.Length; 212int length = path.Length; 287return path.Length > 0 && IsDirectorySeparator(path[0]) 314if (path.Length > 0 && path[0] == '.') 316if (path.Length == 1 || IsDirectorySeparator(path[1])) 323if (path.Length == 2 || IsDirectorySeparator(path[2])) 334if (path.Length >= 1 && IsDirectorySeparator(path[0])) 341if (path.Length >= 2 && path[1] == VolumeSeparatorChar && (path.Length <= 2 || !IsDirectorySeparator(path[2]))) 375return path.Length >= 2 && 386return path.Length >= 3 && path[1] == VolumeSeparatorChar && IsDirectorySeparator(path[2]); 440char c = root[root.Length - 1]; 479if (path.Length > 0 && IsDirectorySeparator(path[path.Length - 1])) 481return path.Substring(0, path.Length - 1); 608return parentPath.Length > 0 609&& childPath.Length > parentPath.Length 610&& PathsEqual(childPath, parentPath, parentPath.Length) 611&& (IsDirectorySeparator(parentPath[parentPath.Length - 1]) || IsDirectorySeparator(childPath[parentPath.Length])); 616var relativePath = childPath.Substring(parentPath.Length); 619int start = ConsumeDirectorySeparators(relativePath, relativePath.Length, 0); 648return PathsEqual(path1, path2, Math.Max(path1.Length, path2.Length)); 656if (path1.Length < length || path2.Length < length) 714if (!(oldPrefix?.Length > 0)) continue; 723var replacement = replacementPrefix + filePath.Substring(oldPrefix.Length); 841if (!isDriveRooted && !(p.Length > 1 && p[0] == AltDirectorySeparatorChar))
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\Compilers\Core\Portable\InternalUtilities\StringExtensions.cs (15)
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.Substring(0, name.Length - AttributeSuffix.Length); 165return name.Length > AttributeSuffix.Length && name.EndsWith(AttributeSuffix, comparison); 171while (i < str.Length) 178if (i < str.Length && char.IsLowSurrogate(str[i])) 208if (arg.Length > 1 && arg[0] == '"' && arg[arg.Length - 1] == '"') 211return arg.Substring(1, arg.Length - 2); 223while (x < string1.Length && x < string2.Length && 235while (x < string1.Length && x < string2.Length &&
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\Compilers\Core\Portable\InternalUtilities\UnicodeCharacterUtilities.cs (1)
103int nameLength = name.Length;
src\Compilers\Core\Portable\Syntax\SyntaxTreeExtensions.cs (2)
95var n1 = s1.Length; 96var n2 = s2.Length;
src\Compilers\Core\Portable\Text\TextChangeRangeExtensions.cs (1)
105return new TextChangeRange(textChange.Span, textChange.NewText?.Length ?? 0);
src\Dependencies\Collections\Extensions\IEnumerableExtensions.cs (2)
213return str.Length == 0; 236return source.Length == 0;
src\RoslynAnalyzers\Utilities\Compiler\CodeMetrics\CodeAnalysisMetricData.cs (1)
141if (index >= 0 && index < symbolName.Length)
src\RoslynAnalyzers\Utilities\Compiler\Extensions\StringExtensions.cs (1)
15return Encoding.UTF8.GetByteCount(value) == value.Length;
src\RoslynAnalyzers\Utilities\Compiler\Options\AnalyzerOptionsExtensions.cs (2)
359if (trimmedSuffix.Length >= 2 && 363for (int i = 1; i < trimmedSuffix.Length - 2; i++)
src\RoslynAnalyzers\Utilities\Compiler\Options\SymbolNamesWithValueOption.cs (2)
109parts.SymbolName.Length == 1)) 145Debug.Assert(parts.SymbolName.Length >= 2);
src\RoslynAnalyzers\Utilities\Compiler\RulesetToEditorconfigConverter.cs (2)
208if (comment.Length > 0) 213if (trimmedCommentPart.Length > 0)
src\RoslynAnalyzers\Utilities\Compiler\WellKnownTypeProvider.cs (1)
220for (int i = 0; i < fullTypeName.Length; i++)
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\RoslynAnalyzers\Utilities\FlowAnalysis\FlowAnalysis\Analysis\TaintedDataAnalysis\HardcodedSymmetricAlgorithmKeysSources.cs (2)
41v => v is string s && s.Length % 4 == 0 && IsLegalKeySize(s.Length * 3 / 4))
src\RoslynAnalyzers\Utilities\FlowAnalysis\FlowAnalysis\Analysis\ValueContentAnalysis\ValueContentAbstractValue.cs (2)
66if (((string)literal).Length == 0) 100if (stringVal.Length == 0)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\CodeGeneration\ParameterName.cs (1)
42BestNameForParameter = trimmed.Length > 0 ? tryMakeCamelCase ? trimmed.ToCamelCase() : trimmed : nameBasedOnArgument;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EditorConfig\Parsing\Sections\SectionMatcher.Lexer.cs (5)
15public readonly bool IsDone => Position >= headerText.Length; 54if (position < headerText.Length) 85if (position < headerText.Length && 113if (position >= headerText.Length) 171return str.Length == 0 || str == "-"
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\VirtualChars\AbstractVirtualCharService.cs (8)
31if (index + 1 < tokenText.Length) 117Debug.Assert(lastVC.Span.End == token.Span.End - "\"".Length, "Last span has to end right before the end of the string token."); 121Debug.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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\VirtualChars\AbstractVirtualCharService.ITextInfo.cs (1)
30public readonly int Length(string text) => text.Length;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\VirtualChars\VirtualCharSequence.Chunks.cs (3)
84public override int Length => data.Length; 89if (stringIndex < 0 || stringIndex >= data.Length) 104Debug.Assert(index + 1 >= data.Length ||
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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\TokenStream.cs (2)
337length = text.ConvertTabToSpace(_options.TabSize, initialColumn, text.Length); 341length = text.Length;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\TreeData.Node.cs (1)
30return lineText.GetColumnFromLineOffset(lineText.Length, tabSize);
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\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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\Naming\IdentifierNameParts.cs (2)
47? newBaseName[prefix.Length..] 53? newBaseName[..^suffix.Length]
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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\NamingStyle.WordSpanEnumerator.cs (1)
52Current = new TextSpan(Current.End + _wordSeparator.Length, 0);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Serialization\ObjectWriter.cs (2)
504var bytes = new byte[(uint)value.Length * sizeof(char)]; 510WriteCompressedUInt((uint)value.Length);
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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\SyntaxFacts\ISyntaxFactsExtensions.cs (2)
251if (name.Length == 0) 261for (var i = 1; i < name.Length; i++)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.cs (1)
198Debug.Assert(reader.Position == symbolKey.Length);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.SymbolKeyReader.cs (1)
259while (Position < Data.Length)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\Base64Utilities.cs (2)
329decodedLength = (encodedString.Length * 3) / 4 - padding; 336var index = attributeData.Length - 1;
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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\BKTree.cs (4)
74Span<char> lowerCaseCharacters = value.Length < 512 75? stackalloc char[value.Length] 76: new char[value.Length]; 78for (var i = 0; i < value.Length; i++)
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++) 89Span<char> 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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\PathMetadataUtilities.cs (2)
31if (rootNamespace is { Length: > 0 } && 69@namespace = @namespace[(rootNamespace.Length + 1)..];
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\StringBreaker.cs (2)
24for (var start = 0; start < text.Length;) 42var length = identifier.Length;
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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\WordSimilarityChecker.cs (6)
80=> value.Length <= 4 ? 1 : 2; 87if (_source.Length < 3) 113if (Math.Abs(_source.Length - candidateText.Length) <= _threshold) 142var lengthDifference = Math.Abs(originalText.Length - candidateText.Length);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\ISymbolExtensions.cs (1)
795(symbol.Name.Length == 1 || uint.TryParse(symbol.Name[1..], out _) || symbol.Name.All(n => n.Equals('_')));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\ITypeSymbolExtensions.cs (1)
363return shortName.Length == 0
Microsoft.CodeAnalysis.BannedApiAnalyzers (207)
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\Compilers\Core\Portable\FileSystem\FileUtilities.cs (2)
133if (path!.Length == 1) 175Debug.Assert(path.Length == 1 || !PathUtilities.IsDirectorySeparator(path[1]));
src\Compilers\Core\Portable\FileSystem\PathUtilities.cs (36)
52int lastSeparator = s.Length; 58if (lastSeparator != s.Length) 71if (s.Length == 0 || IsAnyDirectorySeparator(s[s.Length - 1])) 138var rootLength = GetPathRoot(path, isUnixLike).Length; 139if (path.Length > rootLength) 141var i = path.Length; 212int length = path.Length; 287return path.Length > 0 && IsDirectorySeparator(path[0]) 314if (path.Length > 0 && path[0] == '.') 316if (path.Length == 1 || IsDirectorySeparator(path[1])) 323if (path.Length == 2 || IsDirectorySeparator(path[2])) 334if (path.Length >= 1 && IsDirectorySeparator(path[0])) 341if (path.Length >= 2 && path[1] == VolumeSeparatorChar && (path.Length <= 2 || !IsDirectorySeparator(path[2]))) 375return path.Length >= 2 && 386return path.Length >= 3 && path[1] == VolumeSeparatorChar && IsDirectorySeparator(path[2]); 440char c = root[root.Length - 1]; 479if (path.Length > 0 && IsDirectorySeparator(path[path.Length - 1])) 481return path.Substring(0, path.Length - 1); 608return parentPath.Length > 0 609&& childPath.Length > parentPath.Length 610&& PathsEqual(childPath, parentPath, parentPath.Length) 611&& (IsDirectorySeparator(parentPath[parentPath.Length - 1]) || IsDirectorySeparator(childPath[parentPath.Length])); 616var relativePath = childPath.Substring(parentPath.Length); 619int start = ConsumeDirectorySeparators(relativePath, relativePath.Length, 0); 648return PathsEqual(path1, path2, Math.Max(path1.Length, path2.Length)); 656if (path1.Length < length || path2.Length < length) 714if (!(oldPrefix?.Length > 0)) continue; 723var replacement = replacementPrefix + filePath.Substring(oldPrefix.Length); 841if (!isDriveRooted && !(p.Length > 1 && p[0] == AltDirectorySeparatorChar))
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\Compilers\Core\Portable\InternalUtilities\StringExtensions.cs (15)
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.Substring(0, name.Length - AttributeSuffix.Length); 165return name.Length > AttributeSuffix.Length && name.EndsWith(AttributeSuffix, comparison); 171while (i < str.Length) 178if (i < str.Length && char.IsLowSurrogate(str[i])) 208if (arg.Length > 1 && arg[0] == '"' && arg[arg.Length - 1] == '"') 211return arg.Substring(1, arg.Length - 2); 223while (x < string1.Length && x < string2.Length && 235while (x < string1.Length && x < string2.Length &&
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\Compilers\Core\Portable\InternalUtilities\UnicodeCharacterUtilities.cs (1)
103int nameLength = name.Length;
src\Compilers\Core\Portable\Syntax\SyntaxTreeExtensions.cs (2)
95var n1 = s1.Length; 96var n2 = s2.Length;
src\Compilers\Core\Portable\Text\TextChangeRangeExtensions.cs (1)
105return new TextChangeRange(textChange.Span, textChange.NewText?.Length ?? 0);
src\Dependencies\Collections\Extensions\IEnumerableExtensions.cs (2)
213return str.Length == 0; 236return source.Length == 0;
src\RoslynAnalyzers\Utilities\Compiler\CodeMetrics\CodeAnalysisMetricData.cs (1)
141if (index >= 0 && index < symbolName.Length)
src\RoslynAnalyzers\Utilities\Compiler\Extensions\StringExtensions.cs (1)
15return Encoding.UTF8.GetByteCount(value) == value.Length;
src\RoslynAnalyzers\Utilities\Compiler\Options\AnalyzerOptionsExtensions.cs (2)
359if (trimmedSuffix.Length >= 2 && 363for (int i = 1; i < trimmedSuffix.Length - 2; i++)
src\RoslynAnalyzers\Utilities\Compiler\Options\SymbolNamesWithValueOption.cs (2)
109parts.SymbolName.Length == 1)) 145Debug.Assert(parts.SymbolName.Length >= 2);
src\RoslynAnalyzers\Utilities\Compiler\RulesetToEditorconfigConverter.cs (2)
208if (comment.Length > 0) 213if (trimmedCommentPart.Length > 0)
src\RoslynAnalyzers\Utilities\Compiler\WellKnownTypeProvider.cs (1)
220for (int i = 0; i < fullTypeName.Length; i++)
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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\CodeGeneration\ParameterName.cs (1)
42BestNameForParameter = trimmed.Length > 0 ? tryMakeCamelCase ? trimmed.ToCamelCase() : trimmed : nameBasedOnArgument;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EditorConfig\Parsing\Sections\SectionMatcher.Lexer.cs (5)
15public readonly bool IsDone => Position >= headerText.Length; 54if (position < headerText.Length) 85if (position < headerText.Length && 113if (position >= headerText.Length) 171return str.Length == 0 || str == "-"
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\VirtualChars\AbstractVirtualCharService.cs (8)
31if (index + 1 < tokenText.Length) 117Debug.Assert(lastVC.Span.End == token.Span.End - "\"".Length, "Last span has to end right before the end of the string token."); 121Debug.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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\VirtualChars\AbstractVirtualCharService.ITextInfo.cs (1)
30public readonly int Length(string text) => text.Length;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\VirtualChars\VirtualCharSequence.Chunks.cs (3)
84public override int Length => data.Length; 89if (stringIndex < 0 || stringIndex >= data.Length) 104Debug.Assert(index + 1 >= data.Length ||
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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\TokenStream.cs (2)
337length = text.ConvertTabToSpace(_options.TabSize, initialColumn, text.Length); 341length = text.Length;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\TreeData.Node.cs (1)
30return lineText.GetColumnFromLineOffset(lineText.Length, tabSize);
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\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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\Naming\IdentifierNameParts.cs (2)
47? newBaseName[prefix.Length..] 53? newBaseName[..^suffix.Length]
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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\NamingStyle.WordSpanEnumerator.cs (1)
52Current = new TextSpan(Current.End + _wordSeparator.Length, 0);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Serialization\ObjectWriter.cs (2)
504var bytes = new byte[(uint)value.Length * sizeof(char)]; 510WriteCompressedUInt((uint)value.Length);
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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\SyntaxFacts\ISyntaxFactsExtensions.cs (2)
251if (name.Length == 0) 261for (var i = 1; i < name.Length; i++)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.cs (1)
198Debug.Assert(reader.Position == symbolKey.Length);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.SymbolKeyReader.cs (1)
259while (Position < Data.Length)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\Base64Utilities.cs (2)
329decodedLength = (encodedString.Length * 3) / 4 - padding; 336var index = attributeData.Length - 1;
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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\BKTree.cs (4)
74Span<char> lowerCaseCharacters = value.Length < 512 75? stackalloc char[value.Length] 76: new char[value.Length]; 78for (var i = 0; i < value.Length; i++)
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++) 89Span<char> 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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\PathMetadataUtilities.cs (2)
31if (rootNamespace is { Length: > 0 } && 69@namespace = @namespace[(rootNamespace.Length + 1)..];
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\StringBreaker.cs (2)
24for (var start = 0; start < text.Length;) 42var length = identifier.Length;
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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\WordSimilarityChecker.cs (6)
80=> value.Length <= 4 ? 1 : 2; 87if (_source.Length < 3) 113if (Math.Abs(_source.Length - candidateText.Length) <= _threshold) 142var lengthDifference = Math.Abs(originalText.Length - candidateText.Length);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\ISymbolExtensions.cs (1)
795(symbol.Name.Length == 1 || uint.TryParse(symbol.Name[1..], out _) || symbol.Name.All(n => n.Equals('_')));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\ITypeSymbolExtensions.cs (1)
363return shortName.Length == 0
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Extensions\ProjectExtensions.cs (2)
75analyzerConfigDirectory.Length > bestPath.Length)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Extensions\SyntaxGeneratorExtensions_CreateEqualsMethod.cs (1)
366if (name.Length > 0)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\LanguageServices\TypeInferenceService\AbstractTypeInferenceService.cs (3)
67if (name.Length == prefix.Length) 72var nextChar = name[prefix.Length];
SymbolIsBannedAnalyzer.cs (1)
71let span = commentIndex == -1 ? line.Span : new Text.TextSpan(line.Span.Start, trimmedTextWithoutComment.Length)
SymbolIsBannedAnalyzerBase.cs (1)
426else if (index == text.Length - 1)
Microsoft.CodeAnalysis.CodeStyle (210)
src\Analyzers\Core\Analyzers\FileHeaders\AbstractFileHeaderHelper.cs (2)
122var eolLength = Environment.NewLine.Length; 126return new FileHeader(sb.ToString(), fileHeaderStart, fileHeaderEnd, CommentPrefix.Length);
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\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\Analyzers\Core\Analyzers\RemoveUnusedMembers\AbstractRemoveUnusedMembersDiagnosticAnalyzer.cs (2)
947var suffix = methodSymbol.Name[prefix.Length..]; 948return suffix.Length > 0 &&
src\Analyzers\Core\Analyzers\ValidateFormatString\AbstractValidateFormatStringDiagnosticAnalyzer.cs (2)
356invalidPlaceholderText.Length)); 385if (placeholderIndexText.Length > 0 && char.IsWhiteSpace(placeholderIndexText, 0))
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\Compilers\Core\Portable\FileSystem\FileUtilities.cs (2)
133if (path!.Length == 1) 175Debug.Assert(path.Length == 1 || !PathUtilities.IsDirectorySeparator(path[1]));
src\Compilers\Core\Portable\FileSystem\PathUtilities.cs (36)
52int lastSeparator = s.Length; 58if (lastSeparator != s.Length) 71if (s.Length == 0 || IsAnyDirectorySeparator(s[s.Length - 1])) 138var rootLength = GetPathRoot(path, isUnixLike).Length; 139if (path.Length > rootLength) 141var i = path.Length; 212int length = path.Length; 287return path.Length > 0 && IsDirectorySeparator(path[0]) 314if (path.Length > 0 && path[0] == '.') 316if (path.Length == 1 || IsDirectorySeparator(path[1])) 323if (path.Length == 2 || IsDirectorySeparator(path[2])) 334if (path.Length >= 1 && IsDirectorySeparator(path[0])) 341if (path.Length >= 2 && path[1] == VolumeSeparatorChar && (path.Length <= 2 || !IsDirectorySeparator(path[2]))) 375return path.Length >= 2 && 386return path.Length >= 3 && path[1] == VolumeSeparatorChar && IsDirectorySeparator(path[2]); 440char c = root[root.Length - 1]; 479if (path.Length > 0 && IsDirectorySeparator(path[path.Length - 1])) 481return path.Substring(0, path.Length - 1); 608return parentPath.Length > 0 609&& childPath.Length > parentPath.Length 610&& PathsEqual(childPath, parentPath, parentPath.Length) 611&& (IsDirectorySeparator(parentPath[parentPath.Length - 1]) || IsDirectorySeparator(childPath[parentPath.Length])); 616var relativePath = childPath.Substring(parentPath.Length); 619int start = ConsumeDirectorySeparators(relativePath, relativePath.Length, 0); 648return PathsEqual(path1, path2, Math.Max(path1.Length, path2.Length)); 656if (path1.Length < length || path2.Length < length) 714if (!(oldPrefix?.Length > 0)) continue; 723var replacement = replacementPrefix + filePath.Substring(oldPrefix.Length); 841if (!isDriveRooted && !(p.Length > 1 && p[0] == AltDirectorySeparatorChar))
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\Compilers\Core\Portable\InternalUtilities\StringExtensions.cs (15)
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.Substring(0, name.Length - AttributeSuffix.Length); 165return name.Length > AttributeSuffix.Length && name.EndsWith(AttributeSuffix, comparison); 171while (i < str.Length) 178if (i < str.Length && char.IsLowSurrogate(str[i])) 208if (arg.Length > 1 && arg[0] == '"' && arg[arg.Length - 1] == '"') 211return arg.Substring(1, arg.Length - 2); 223while (x < string1.Length && x < string2.Length && 235while (x < string1.Length && x < string2.Length &&
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\Compilers\Core\Portable\InternalUtilities\UnicodeCharacterUtilities.cs (1)
103int nameLength = name.Length;
src\Compilers\Core\Portable\Syntax\SyntaxTreeExtensions.cs (2)
95var n1 = s1.Length; 96var n2 = s2.Length;
src\Compilers\Core\Portable\Text\TextChangeRangeExtensions.cs (1)
105return new TextChangeRange(textChange.Span, textChange.NewText?.Length ?? 0);
src\Dependencies\Collections\Extensions\IEnumerableExtensions.cs (2)
213return str.Length == 0; 236return source.Length == 0;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\CodeGeneration\ParameterName.cs (1)
42BestNameForParameter = trimmed.Length > 0 ? tryMakeCamelCase ? trimmed.ToCamelCase() : trimmed : nameBasedOnArgument;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EditorConfig\Parsing\Sections\SectionMatcher.Lexer.cs (5)
15public readonly bool IsDone => Position >= headerText.Length; 54if (position < headerText.Length) 85if (position < headerText.Length && 113if (position >= headerText.Length) 171return str.Length == 0 || str == "-"
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\VirtualChars\AbstractVirtualCharService.cs (8)
31if (index + 1 < tokenText.Length) 117Debug.Assert(lastVC.Span.End == token.Span.End - "\"".Length, "Last span has to end right before the end of the string token."); 121Debug.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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\VirtualChars\AbstractVirtualCharService.ITextInfo.cs (1)
30public readonly int Length(string text) => text.Length;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\VirtualChars\VirtualCharSequence.Chunks.cs (3)
84public override int Length => data.Length; 89if (stringIndex < 0 || stringIndex >= data.Length) 104Debug.Assert(index + 1 >= data.Length ||
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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\TokenStream.cs (2)
337length = text.ConvertTabToSpace(_options.TabSize, initialColumn, text.Length); 341length = text.Length;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\TreeData.Node.cs (1)
30return lineText.GetColumnFromLineOffset(lineText.Length, tabSize);
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\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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\Naming\IdentifierNameParts.cs (2)
47? newBaseName[prefix.Length..] 53? newBaseName[..^suffix.Length]
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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\NamingStyle.WordSpanEnumerator.cs (1)
52Current = new TextSpan(Current.End + _wordSeparator.Length, 0);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Serialization\ObjectWriter.cs (2)
504var bytes = new byte[(uint)value.Length * sizeof(char)]; 510WriteCompressedUInt((uint)value.Length);
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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\SyntaxFacts\ISyntaxFactsExtensions.cs (2)
251if (name.Length == 0) 261for (var i = 1; i < name.Length; i++)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.cs (1)
198Debug.Assert(reader.Position == symbolKey.Length);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.SymbolKeyReader.cs (1)
259while (Position < Data.Length)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\Base64Utilities.cs (2)
329decodedLength = (encodedString.Length * 3) / 4 - padding; 336var index = attributeData.Length - 1;
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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\BKTree.cs (4)
74Span<char> lowerCaseCharacters = value.Length < 512 75? stackalloc char[value.Length] 76: new char[value.Length]; 78for (var i = 0; i < value.Length; i++)
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++) 89Span<char> 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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\PathMetadataUtilities.cs (2)
31if (rootNamespace is { Length: > 0 } && 69@namespace = @namespace[(rootNamespace.Length + 1)..];
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\StringBreaker.cs (2)
24for (var start = 0; start < text.Length;) 42var length = identifier.Length;
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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\WordSimilarityChecker.cs (6)
80=> value.Length <= 4 ? 1 : 2; 87if (_source.Length < 3) 113if (Math.Abs(_source.Length - candidateText.Length) <= _threshold) 142var lengthDifference = Math.Abs(originalText.Length - candidateText.Length);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\ISymbolExtensions.cs (1)
795(symbol.Name.Length == 1 || uint.TryParse(symbol.Name[1..], out _) || symbol.Name.All(n => n.Equals('_')));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\ITypeSymbolExtensions.cs (1)
363return shortName.Length == 0
Microsoft.CodeAnalysis.CodeStyle.Fixes (12)
src\Analyzers\Core\CodeFixes\ConflictMarkerResolution\AbstractConflictMarkerCodeFixProvider.cs (1)
40private static readonly int s_mergeConflictLength = "<<<<<<<".Length;
src\Analyzers\Core\CodeFixes\GenerateConstructor\GenerateConstructorHelpers.cs (1)
218var fieldNameMinusPrefix = newFieldName[fieldNamingRule.NamingStyle.Prefix.Length..];
src\Analyzers\Core\CodeFixes\MakeMethodSynchronous\AbstractMakeMethodSynchronousCodeFixProvider.cs (3)
62methodSymbol.Name.Length > AsyncSuffix.Length && 76var newName = name[..^AsyncSuffix.Length];
src\Analyzers\Core\CodeFixes\UseObjectInitializer\AbstractUseObjectInitializerCodeFixProvider.cs (1)
136endPosition: existingWhitespace.Length);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Extensions\ProjectExtensions.cs (2)
75analyzerConfigDirectory.Length > bestPath.Length)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Extensions\SyntaxGeneratorExtensions_CreateEqualsMethod.cs (1)
366if (name.Length > 0)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\LanguageServices\TypeInferenceService\AbstractTypeInferenceService.cs (3)
67if (name.Length == prefix.Length) 72var nextChar = name[prefix.Length];
Microsoft.CodeAnalysis.Collections.Package (2)
Extensions\IEnumerableExtensions.cs (2)
213return str.Length == 0; 236return source.Length == 0;
Microsoft.CodeAnalysis.CSharp (101)
Binder\Binder.CapturedParametersFinder.cs (1)
93if (parameter.Name.Length != 0)
Binder\Binder.cs (3)
965var lastSize = Math.Min(last.Length, 12); 966snippet = first.Substring(0, Math.Min(first.Length, 12)) + " ... " + last.Substring(last.Length - lastSize, lastSize);
Binder\Binder_InterpolatedString.cs (3)
195for (int i = 0, formatLength = value.Length; i < formatLength; i++) 208var result = builder.Length == value.Length 959baseStringLength += literalText.Length;
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)
1573else if (stringConstant.StringValue.Length == 0 && lengthMethodRef != null)
CommandLine\CommandLineDiagnosticFormatter.cs (2)
75? normalizedBaseDirectory.Length 76: normalizedBaseDirectory.Length + 1);
CommandLine\CSharpCommandLineParser.cs (3)
701else if (value.Length == 0) 1677if (simpleName.Length == 0 && !outputKind.IsNetModule()) 1688if (simpleName.Length == 0)
Compilation\CSharpCompilation.cs (3)
3911if (bytesText.Length != bytes.Length * 2) 3916for (int i = 0, len = bytesText.Length / 2; i < len; i++) 3933int length = bytesText.Length / 2;
Compilation\CSharpSemanticModel.cs (1)
4500if (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)
838return GetIndexOfFirstNonWhitespaceChar(str, 0, str.Length); 851Debug.Assert(start <= str.Length); 853Debug.Assert(end <= str.Length); 878int len = str.Length - start; 879if (len < prefix.Length) 884for (int i = 0; i < prefix.Length; i++) 905for (; start < str.Length; start++) 910if ((start + 1) < str.Length && str[start + 1] == '\n') 938for (int start = 0; start < text.Length;) 955for (int start = 0; start < text.Length;) 1003skipLength = pattern.Length; 1084int minLength = Math.Min(str1.Length, str2.Length); 1394: 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)
190ImmutableArray<ImmutableArray<string>> previewNamespaces = Features.TryGetValue("InterceptorsNamespaces", out var namespaces) && namespaces.Length > 0 202while (currentIndex < namespaces.Length && namespaces.IndexOf(';', currentIndex) is not -1 and var semicolonIndex)
DocumentationComments\DocumentationCommentIDVisitor.PartVisitor.cs (3)
178if ((object)symbol.ContainingSymbol != null && symbol.ContainingSymbol.Name.Length != 0) 230if ((object)symbol.ContainingNamespace != null && symbol.ContainingNamespace.Name.Length != 0) 280pooled.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)
148if (int.TryParse(name.Substring(GeneratedNames.AnonymousTypeNameWithoutModulePrefix.Length), NumberStyles.None, CultureInfo.InvariantCulture, out int index)) 169if (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)
349LanguageVersionFacts.TryParse(errorText.Substring(versionMarker.Length), out var languageVersion)) 656if (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 (1)
471result = result.WithDiagnosticsGreen(MoveDiagnostics(token.GetDiagnostics(), -prefix.Length));
Parser\Lexer.cs (3)
1622if ((valueText.Length == 0) || !valueText.All(SyntaxFacts.IsHexDigit)) 2080private static readonly int s_conflictMarkerLength = "<<<<<<<".Length; 3837if (this.ScanIdentifier(ref info) && info.Text!.Length > 0)
Parser\LexerCache.cs (1)
174if (key.Length > MaxKeywordLength)
Parser\SlidingTextWindow.cs (1)
398int length = desired.Length;
SymbolDisplay\ObjectDisplay.cs (1)
239for (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)
191var fileDescription = identifier.DisplayFilePath is { Length: not 0 } path ? path 512if (members.Length == 0)
Symbols\AnonymousTypes\AnonymousTypeManager.Templates.cs (2)
517moduleId = moduleId.Substring(0, moduleId.Length - extension.Length);
Symbols\Metadata\PE\PENamedTypeSymbol.cs (1)
2227if (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)
108Debug.Assert(idx < fullName.Length);
Symbols\Source\QuickAttributeChecker.cs (3)
207(name.Length + nameof(System.Attribute).Length) == attributeDescription.Name.Length &&
Symbols\Source\SourceMemberContainerSymbol.cs (1)
495return name is { Length: > 0 } && name.All(c => c >= 'a' && c <= 'z');
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)
470string tail = name.Substring("Item".Length);
Symbols\TypeSymbolExtensions.cs (3)
1788return qualifiedName.Length == 0; 1791return HasNamespaceName(@namespace, qualifiedName, comparison, length: qualifiedName.Length); 1826return (name.Length == length) && (string.Compare(name, 0, namespaceName, offset, length, comparison) == 0);
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)
1254return text.Length > 0 && SyntaxFacts.IsNewLine(text[^1]);
Utilities\ValueSetFactory.FloatingValueSet.cs (1)
170if (b.Length > 1 && more.Length > 1)
Microsoft.CodeAnalysis.CSharp.CodeStyle (22)
src\Analyzers\CSharp\Analyzers\UseCollectionExpression\CSharpUseCollectionExpressionForFluentDiagnosticAnalyzer.cs (3)
438if (name.Length == (ToPrefix.Length + suffix.Length) &&
src\Analyzers\CSharp\Analyzers\UseIndexOrRangeOperator\Helpers.cs (1)
22=> TryGetNoArgInt32Property(namedType, nameof(string.Length)) ??
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\EmbeddedLanguages\VirtualChars\CSharpVirtualCharService.cs (8)
137var endIndexExclusive = tokenText.Length; 142endIndexExclusive -= "u8".Length; 234if (startDelimiter.Length > 0 && !tokenText.StartsWith(startDelimiter)) 240if (endDelimiter.Length > 0 && !tokenText.EndsWith(endDelimiter, StringComparison.OrdinalIgnoreCase)) 246var startIndexInclusive = startDelimiter.Length; 247var endIndexExclusive = tokenText.Length - endDelimiter.Length; 504for (var i = 0; i < 4 && endIndex < tokenText.Length; i++)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\SyntaxTriviaExtensions.cs (2)
109textBuilder.Remove(textBuilder.Length - newLine.Length, newLine.Length);
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\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Engine\Trivia\TriviaDataFactory.cs (1)
135return textSnippet.ConvertTabToSpace(Options.TabSize, initialColumn, textSnippet.Length);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\FormattingHelpers.cs (1)
29var start = lastNewLinePos + NewLine.Length;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Services\SyntaxFacts\CSharpSyntaxFacts.cs (4)
453return this.IsIdentifier(token) && !token.ContainsDiagnostics && token.ToString().Length == identifier.Length; 459return this.IsIdentifier(token) && !token.ContainsDiagnostics && token.ToString().Length == identifier.Length && token.IsVerbatimIdentifier();
Microsoft.CodeAnalysis.CSharp.CodeStyle.Fixes (12)
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\Analyzers\CSharp\CodeFixes\UseCollectionExpression\CSharpCollectionExpressionRewriter.cs (1)
643? preferredIndentation + positionIndentation[firstTokenOnLineIndentationString.Length..]
src\Analyzers\CSharp\CodeFixes\UsePrimaryConstructor\CSharpUsePrimaryConstructorCodeFixProvider.cs (4)
352if (constructorLeadingWhitespace.Length > typeLeadingWhitespace.Length && 355var indentation = constructorLeadingWhitespace[typeLeadingWhitespace.Length..]; 365leadingTrivia.Take(leadingTrivia.Count - 1).Concat(Whitespace(elementLeadingWhitespace[..^indentation.Length])));
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\CSharpCodeGenerationHelpers.cs (2)
132if (tokenText.Length <= 2 || tokenText.Last() != '"') 141if (tokenText.Length <= 1 || tokenText.Last() != '"')
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\ITypeSymbolExtensions.TypeSyntaxGeneratorVisitor.cs (1)
149? null : symbol.Signature.UnmanagedCallingConventionTypes.Select(type => GetConventionForString(type.Name["CallConv".Length..])),
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\StringExtensions.cs (1)
37if (escaped.Length == 0 || escaped[0] != '@')
Microsoft.CodeAnalysis.CSharp.CodeStyle.UnitTests (1)
src\Analyzers\CSharp\Tests\MatchFolderAndNamespace\CSharpMatchFolderAndNamespaceTests.cs (1)
69if (defaultNamespace.Length > 0)
Microsoft.CodeAnalysis.CSharp.CommandLine.UnitTests (11)
CommandLineTests.cs (11)
1882Assert.True(Array.IndexOf(acceptableSurroundingChar, actual[foundIndex + version.Length]) >= 0); 2414Assert.True(embed_cs.Length >= EmbeddedText.CompressionThreshold); 2415Assert.True(embed2_cs.Length < EmbeddedText.CompressionThreshold); 2892if (currentUICultureName.Length == 0 || currentUICultureName.StartsWith("en", StringComparison.OrdinalIgnoreCase)) 5902var modfile = source1.Substring(0, source1.Length - 2) + "netmodule"; 5914modfile = source2.Substring(0, source2.Length - 2) + "netmodule"; 5939var modfile = source1.Substring(0, source1.Length - 2) + "netmodule"; 5959var modfile = source1.Substring(0, source1.Length - 2) + "netmodule"; 9410Assert.Equal(stringStart, text.Substring(0, stringStart.Length)); 9655Assert.Equal('(', text[expectedPath.Length]); 10535index = source.IndexOf(word, index + word.Length, StringComparison.Ordinal);
Microsoft.CodeAnalysis.CSharp.EditorFeatures (25)
AutomaticCompletion\AutomaticLineEnderCommandHandler.cs (1)
658var changes = FormatBasedOnEndToken(newDocument, insertionPosition + bracePair.Length - 1, formattingOptions, cancellationToken);
BlockCommentEditing\BlockCommentEditingCommandHandler.cs (1)
303if (span.Length < "/**/".Length)
CompleteStatement\CompleteStatementCommandHandler.cs (2)
499&& (literalExpression.Token.Text.Length == 1 || literalExpression.Token.Text[^1] != '"')) 505&& (literalExpression.Token.Text.Length == 1 || literalExpression.Token.Text[^1] != '\''))
EventHookup\EventHookupSessionManager.cs (1)
156if (change.OldText.Length > 0 || change.NewText.Any(c => c != ' '))
RawStringLiteral\RawStringLiteralCommandHandler_Return.cs (2)
196textView.Caret.MoveTo(new VirtualSnapshotPoint(nextLine, indentation.Length)); 226textView.Caret.MoveTo(new VirtualSnapshotPoint(nextLine, indentation.Length));
StringCopyPaste\KnownSourcePasteProcessor.cs (4)
182(dollarSignsToAdd == null ? 0 : dollarSignsToAdd.Length); 201UpdateExistingInterpolationBraces(edits, beforeSelection: true, dollarSignsToAdd.Length); 209UpdateExistingInterpolationBraces(edits, beforeSelection: false, dollarSignsToAdd.Length); 271else if (offset < IndentationWhitespace.Length)
StringCopyPaste\StringCopyPasteHelpers.cs (8)
143while (start < value.Length && SyntaxFacts.IsWhitespace(value[start])) 296for (var i = 0; i < value.Length; i++) 299var nextCh = i == value.Length - 1 ? 0 : value[i + 1]; 426for (var i = 0; i < value.Length; i++) 429var nextCh = i == value.Length - 1 ? 0 : value[i + 1]; 455for (var i = 0; i < value.Length; i++) 458var nextCh = i == value.Length - 1 ? 0 : value[i + 1]; 529for (var n = Math.Min(commonIndentPrefix.Length, lineWhitespaceSpan.Length); commonPrefixLength < n; commonPrefixLength++)
StringCopyPaste\UnknownSourcePasteProcessor.cs (6)
192buffer.Append(fullChangeLineText[commonIndentationPrefix.Length..]); 199buffer.Append(fullChangeLineText[commonIndentationPrefix.Length..]); 278else if (offset < indentationWhitespace.Length) 288buffer.Append(lineLeadingWhitespace[commonIndentationPrefix.Length..]); 290else if (!lastChange && lineWithoutLeadingWhitespace.Length > 0 && SyntaxFacts.IsNewLine(lineWithoutLeadingWhitespace[0])) 306buffer.Append(lineLeadingWhitespace[commonIndentationPrefix.Length..]);
Microsoft.CodeAnalysis.CSharp.EditorFeatures.UnitTests (14)
Classification\SemanticClassifierTests_TestMarkup.cs (4)
51var length = code.Length; 72var length = code.Length; 141new TextSpan(allCode.IndexOf(code1, StringComparison.Ordinal), code1.Length), 142new TextSpan(allCode.IndexOf(code2, StringComparison.Ordinal), code2.Length)
Classification\SyntacticClassifierTests.cs (2)
5788var classifications = await GetSyntacticClassificationsAsync(document, [new TextSpan(0, source.Length)]); 5818var classifications = await GetSyntacticClassificationsAsync(document, [new TextSpan(0, source.Length)]);
Completion\CompletionProviders\AbstractCSharpCompletionProviderTests.cs (1)
114position += insertText.Length;
Completion\CompletionProviders\OperatorCompletionProviderTests.cs (1)
628var inlineDescription = operatorSign.Length == 1
Extensions\ContextQuery\AbstractContextTests.cs (4)
37position += insertText.Length; 59position += insertText.Length; 79if (text.Length != position) 86position += insertText.Length;
RawStringLiteral\RawStringLiteralCommandHandlerTests.cs (1)
70var virtualOffset = int.Parse(virtualSpaces.Key["VirtualSpaces-".Length..]);
StringCopyPaste\StringCopyPasteCommandHandlerTests.cs (1)
78var virtualOffset = int.Parse(virtualSpaces.Key["VirtualSpaces-".Length..]);
Microsoft.CodeAnalysis.CSharp.EditorFeatures2.UnitTests (7)
EmbeddedLanguages\Json\CSharpJsonParserTests.cs (1)
151for (var start = stringText[0] == '@' ? 2 : 1; start < stringText.Length - 1; start++)
EmbeddedLanguages\RegularExpressions\CSharpRegexParserTests.cs (1)
97for (var start = stringText[0] == '@' ? 2 : 1; start < stringText.Length - 1; start++)
Recommendations\KeywordRecommenderTests.cs (1)
44var kindName = name[..^"RecommenderTests".Length]; // e.g. ForEachKeywordRecommenderTests -> ForEachKeyword
Recommendations\RecommenderTests.cs (4)
54position += insertText.Length; 127position += insertText.Length; 147if (text.Length != position) 154position += insertText.Length;
Microsoft.CodeAnalysis.CSharp.Emit.UnitTests (4)
CodeGen\CodeGenFunctionPointersTests.cs (3)
3279Diagnostic(ErrorCode.ERR_WrongFuncPtrCallingConvention, "M1").WithArguments("C.M1()", callingConvention).WithLocation(7, 33 + callingConventionKeyword.Length)); 6349Diagnostic(ErrorCode.ERR_CantChangeReturnTypeOnOverride, "M2").WithArguments("Derived.M2()", "Base.M2()", $"delegate*<{refKind1}string, void>").WithLocation(10, 48 + refKind2.Length) 6380Diagnostic(ErrorCode.ERR_CantChangeReturnTypeOnOverride, "M2").WithArguments("Derived.M2()", "Base.M2()", $"delegate*<{(string.IsNullOrWhiteSpace(refKind1) ? "" : refKind1)}string>").WithLocation(10, 42 + refKind2.Length)
CodeGen\CodeGenTupleTest.cs (1)
5476for (int pos = 0; pos < source.Length; pos++)
Microsoft.CodeAnalysis.CSharp.Emit3.UnitTests (21)
Attributes\AttributeTests_Embedded.cs (1)
399Diagnostic(ErrorCode.WRN_ProtectedInSealed, "EmbeddedAttribute").WithArguments("Microsoft.CodeAnalysis.EmbeddedAttribute.EmbeddedAttribute()").WithLocation(6, 10 + ctorAccessModifier.Length)
Attributes\AttributeTests_StructLayout.cs (1)
57int expectedAlignment = int.Parse(typeName.Substring("Pack".Length));
FlowAnalysis\FlowTestBase.cs (4)
142int start = program.IndexOf(StartString, StringComparison.Ordinal) + StartString.Length; 163int start = program.IndexOf(StartString, StringComparison.Ordinal) + StartString.Length; 195int start = program.IndexOf(StartString, StringComparison.Ordinal) + StartString.Length; 216int start = program.IndexOf(StartString, StringComparison.Ordinal) + StartString.Length;
Semantics\ExtensionTests.cs (4)
5153comp2 = CreateCompilationWithIL(src2, expectedTypeIL.Remove(expectedTypeIL.IndexOf(remove), remove.Length)); 8074comp2 = CreateCompilationWithIL(src2, expectedTypeIL.Remove(expectedTypeIL.IndexOf(remove), remove.Length)); 9563comp3 = CreateCompilationWithIL(src3, expectedTypeIL.Remove(expectedTypeIL.IndexOf(remove), remove.Length)); 9847comp3 = CreateCompilationWithIL(src3, expectedTypeIL.Remove(expectedTypeIL.IndexOf(remove), remove.Length));
Semantics\RecordTests.cs (11)
14016Diagnostic(ErrorCode.ERR_CopyConstructorWrongAccessibility, "A").WithArguments("A.A(A)").WithLocation(4, 6 + accessibility.Length) 14103Diagnostic(ErrorCode.WRN_ProtectedInSealed, "A").WithArguments("A.A(A)").WithLocation(4, 6 + accessibility.Length) 15606Diagnostic(ErrorCode.ERR_NonPublicAPIInRecord, "Deconstruct").WithArguments("A.Deconstruct(out int)").WithLocation(4, 11 + accessibility.Length) 18499Diagnostic(ErrorCode.ERR_NonPublicAPIInRecord, "Equals").WithArguments("A.Equals(A)").WithLocation(4, 19 + accessibility.Length), 18502Diagnostic(ErrorCode.WRN_RecordEqualsWithoutGetHashCode, "Equals").WithArguments("A").WithLocation(4, 19 + accessibility.Length) 18525Diagnostic(ErrorCode.ERR_VirtualPrivate, "Equals").WithArguments("A.Equals(A)").WithLocation(4, 19 + accessibility.Length), 18528Diagnostic(ErrorCode.ERR_NonPublicAPIInRecord, "Equals").WithArguments("A.Equals(A)").WithLocation(4, 19 + accessibility.Length), 18531Diagnostic(ErrorCode.WRN_RecordEqualsWithoutGetHashCode, "Equals").WithArguments("A").WithLocation(4, 19 + accessibility.Length) 19058Diagnostic(ErrorCode.ERR_NonProtectedAPIInRecord, "EqualityContract").WithArguments("A.EqualityContract").WithLocation(4, 26 + accessibility.Length) 19081Diagnostic(ErrorCode.ERR_VirtualPrivate, "EqualityContract").WithArguments("A.EqualityContract").WithLocation(4, 26 + accessibility.Length), 19084Diagnostic(ErrorCode.ERR_NonProtectedAPIInRecord, "EqualityContract").WithArguments("A.EqualityContract").WithLocation(4, 26 + accessibility.Length)
Microsoft.CodeAnalysis.CSharp.EndToEnd.UnitTests (3)
EndToEndTests.cs (3)
858var builder = new StringBuilder(preamble.Length + postscript.Length + append.Length * numBinaryExpressions + 5 /* Max num digit characters */ * numBinaryExpressions);
Microsoft.CodeAnalysis.CSharp.ExpressionEvaluator.ResultProvider (12)
src\Compilers\Core\Portable\InternalUtilities\UnicodeCharacterUtilities.cs (1)
103int nameLength = name.Length;
src\Compilers\CSharp\Portable\Parser\CharacterInfo.cs (1)
211int nameLength = name.Length;
src\Compilers\CSharp\Portable\SymbolDisplay\ObjectDisplay.cs (1)
239for (int i = 0; i < value.Length; i++)
src\Compilers\CSharp\Portable\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);
src\ExpressionEvaluator\CSharp\Source\ResultProvider\CSharpFormatter.cs (2)
48return RemoveLeadingAndTrailingContent(expression, 0, expression.Length, IsWhitespace, ch => ch == ';' || IsWhitespace(ch)); 78int length = expression.Length;
Microsoft.CodeAnalysis.CSharp.Features (74)
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)
54if (info.Type is IErrorTypeSymbol { Name.Length: > 0 } &&
Completion\CompletionProviders\DeclarationName\DeclarationNameRecommender.cs (1)
248if (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\FunctionPointerUnmanagedCallingConventionCompletionProvider.cs (1)
111var displayName = type.Name[CallConvPrefix.Length..];
Completion\CompletionProviders\OperatorsAndIndexer\UnnamedSymbolCompletionProvider.cs (1)
196var newPosition = replacementStart + text.Length + positionOffset;
Completion\CompletionProviders\OperatorsAndIndexer\UnnamedSymbolCompletionProvider_Operators.cs (1)
150var newPosition = expressionStart + replacement.Length;
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)
333? indentation + positionIndentation[anchorIndentation.Length..] 596builder.Append(text.ToString(TextSpan.FromBounds(line.Start + commonWhitespacePrefix.Length, line.EndIncludingLineBreak))); 614builder.Append(text.ToString(TextSpan.FromBounds(line.Start + commonWhitespacePrefix.Length, line.EndIncludingLineBreak))); 681var 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)
1606oldToken.Text, Math.Min(oldToken.Text.Length, LongestCommonSubsequence.MaxSequenceLengthForDistanceCalculation), 1607newToken.Text, Math.Min(newToken.Text.Length, LongestCommonSubsequence.MaxSequenceLengthForDistanceCalculation));
EncapsulateField\CSharpEncapsulateFieldService.cs (1)
149.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) ?
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\GenericNameSignatureHelpProvider.cs (1)
63token.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\Analyzers\CSharp\Analyzers\UseCollectionExpression\CSharpUseCollectionExpressionForFluentDiagnosticAnalyzer.cs (3)
438if (name.Length == (ToPrefix.Length + suffix.Length) &&
src\Analyzers\CSharp\Analyzers\UseIndexOrRangeOperator\Helpers.cs (1)
22=> TryGetNoArgInt32Property(namedType, nameof(string.Length)) ??
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\Analyzers\CSharp\CodeFixes\UseCollectionExpression\CSharpCollectionExpressionRewriter.cs (1)
643? preferredIndentation + positionIndentation[firstTokenOnLineIndentationString.Length..]
src\Analyzers\CSharp\CodeFixes\UsePrimaryConstructor\CSharpUsePrimaryConstructorCodeFixProvider.cs (4)
352if (constructorLeadingWhitespace.Length > typeLeadingWhitespace.Length && 355var indentation = constructorLeadingWhitespace[typeLeadingWhitespace.Length..]; 365leadingTrivia.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.Features.UnitTests (5)
EditAndContinue\CSharpEditAndContinueAnalyzerTests.cs (2)
80start += StartTag.Length; 308var oldStatementTextSpan = new TextSpan(oldStatementPosition, oldStatementSource.Length);
EditAndContinue\TopLevelEditingTests.cs (1)
7990$"Delete [()]@{25 + modifier.Length}");
SemanticSearch\CSharpSemanticSearchServiceTests.cs (1)
36lineEnd = text.Length;
src\Analyzers\CSharp\Tests\MatchFolderAndNamespace\CSharpMatchFolderAndNamespaceTests.cs (1)
69if (defaultNamespace.Length > 0)
Microsoft.CodeAnalysis.CSharp.Scripting.UnitTests (9)
CommandLineRunnerTests.cs (1)
778Assert.True(Array.IndexOf(acceptableSurroundingChar, actual[foundIndex + version.Length]) >= 0);
InteractiveSessionTests.cs (1)
1257string unrooted = file.Path[root.Length..];
ObjectFormatterTests.cs (4)
53Assert.Equal(51 + 3, str.Length); 57Assert.Equal(5 + 3, str.Length); 149string actualName = ObjectFormatterHelpers.ParseSimpleMemberName(value, 0, value.Length, out actualNoQuotes, out actualIsCallable); 154actualName = ObjectFormatterHelpers.ParseSimpleMemberName("---" + value + "-", 3, 3 + value.Length, out actualNoQuotes, out actualIsCallable);
ScriptTests.cs (3)
1110byte[] bytes = Enumerable.Repeat((byte)'Q', text.Length + padding).ToArray(); 1111System.Text.Encoding.ASCII.GetBytes(text, 0, text.Length, bytes, padding); 1117text.Length,
Microsoft.CodeAnalysis.CSharp.Semantic.UnitTests (44)
Semantics\DelegateTypeTests.cs (12)
713int offset = methodGroupExpression.Length - methodGroupOnly.Length; 759int offset = methodGroupExpression.Length - methodGroupOnly.Length; 1162int offset = methodGroupExpression.Length - methodGroupOnly.Length; 1283int offset = methodGroupExpression.Length - methodGroupOnly.Length; 1501int offset = methodGroupExpression.Length - methodGroupOnly.Length; 1581int offset = methodGroupExpression.Length - methodGroupOnly.Length;
Semantics\InterpolationTests.cs (12)
3667Diagnostic(ErrorCode.ERR_NotRefStructConstraintNotSatisfied, "{s}").WithArguments("System.Runtime.CompilerServices.DefaultInterpolatedStringHandler.AppendFormatted<T>(T, int, string)", "T", "S").WithLocation(6, 5 + expression.Length) 3752Diagnostic(ErrorCode.ERR_BadCtorArgCount, "new()").WithArguments("string", "0").WithLocation(1, 19 + expression.Length) 4384Diagnostic(ErrorCode.ERR_InterpolatedStringHandlerMethodReturnMalformed, "{1}").WithArguments("System.Runtime.CompilerServices.DefaultInterpolatedStringHandler.AppendFormatted(object)").WithLocation(4, 15 + expression.Length) 4490Diagnostic(ErrorCode.ERR_InterpolatedStringHandlerMethodReturnInconsistent, "{1}").WithArguments("System.Runtime.CompilerServices.DefaultInterpolatedStringHandler.AppendFormatted(object)", "bool").WithLocation(4, 15 + expression1.Length), 4493Diagnostic(ErrorCode.ERR_InterpolatedStringHandlerMethodReturnInconsistent, "Text").WithArguments("System.Runtime.CompilerServices.DefaultInterpolatedStringHandler.AppendLiteral(string)", "void").WithLocation(5, 14 + expression2.Length) 4528Diagnostic(ErrorCode.ERR_InterpolatedStringHandlerMethodReturnInconsistent, "{1}").WithArguments("System.Runtime.CompilerServices.DefaultInterpolatedStringHandler.AppendFormatted(object)", "void").WithLocation(4, 15 + expression1.Length), 4531Diagnostic(ErrorCode.ERR_InterpolatedStringHandlerMethodReturnInconsistent, "Text").WithArguments("System.Runtime.CompilerServices.DefaultInterpolatedStringHandler.AppendLiteral(string)", "bool").WithLocation(5, 14 + expression2.Length) 7717Diagnostic(ErrorCode.ERR_InterpolatedStringHandlerArgumentLocatedAfterInterpolatedString, "1").WithArguments("i", "c").WithLocation(1, 7 + expression.Length), 17364Diagnostic(ErrorCode.ERR_NotInstanceInvalidInterpolatedStringHandlerArgumentName, @"InterpolatedStringHandlerArgument("""")").WithArguments("M(CustomHandler)").WithLocation(6, 10 + mod.Length) 17425Diagnostic(ErrorCode.WRN_InterpolatedStringHandlerArgumentAttributeIgnoredOnLambdaParameters, @"InterpolatedStringHandlerArgument("""")").WithLocation(4, 12 + mod.Length), 17428Diagnostic(ErrorCode.ERR_NotInstanceInvalidInterpolatedStringHandlerArgumentName, @"InterpolatedStringHandlerArgument("""")").WithArguments("lambda expression").WithLocation(4, 12 + mod.Length) 17455Diagnostic(ErrorCode.WRN_InterpolatedStringHandlerArgumentAttributeIgnoredOnLambdaParameters, @"InterpolatedStringHandlerArgument(""i"")").WithLocation(5, 19 + mod.Length)
Semantics\NameLengthTests.cs (4)
457int padding = GeneratedNames.MakeLambdaMethodName("A", -1, 0, 0, 0).Length - 1; 480int padding = GeneratedNames.MakeAnonymousTypeBackingFieldName("A").Length - 1; 528int padding = GeneratedNames.MakeStateMachineTypeName("A", 0, 0).Length - 1; 552int padding = GeneratedNames.MakeFixedFieldImplementationName("A").Length - 1;
Semantics\RawInterpolationTests_Handler.cs (4)
12759Diagnostic(ErrorCode.ERR_NotInstanceInvalidInterpolatedStringHandlerArgumentName, @"InterpolatedStringHandlerArgument("""")").WithArguments("M(CustomHandler)").WithLocation(8, 10 + mod.Length)); 12823Diagnostic(ErrorCode.WRN_InterpolatedStringHandlerArgumentAttributeIgnoredOnLambdaParameters, @"InterpolatedStringHandlerArgument("""")").WithLocation(4, 12 + mod.Length), 12826Diagnostic(ErrorCode.ERR_NotInstanceInvalidInterpolatedStringHandlerArgumentName, @"InterpolatedStringHandlerArgument("""")").WithArguments("lambda expression").WithLocation(4, 12 + mod.Length)); 12854Diagnostic(ErrorCode.WRN_InterpolatedStringHandlerArgumentAttributeIgnoredOnLambdaParameters, @"InterpolatedStringHandlerArgument(""i"")").WithLocation(5, 19 + mod.Length));
Semantics\RecordStructTests.cs (6)
4009Diagnostic(ErrorCode.ERR_NonPublicAPIInRecord, "Deconstruct").WithArguments("A.Deconstruct(out int)").WithLocation(4, 11 + accessibility.Length) 4319Diagnostic(ErrorCode.ERR_ProtectedInStruct, "Equals").WithArguments("A.Equals(A)").WithLocation(4, 11 + accessibility.Length), 4322Diagnostic(ErrorCode.ERR_NonPublicAPIInRecord, "Equals").WithArguments("A.Equals(A)").WithLocation(4, 11 + accessibility.Length), 4325Diagnostic(ErrorCode.WRN_RecordEqualsWithoutGetHashCode, "Equals").WithArguments("A").WithLocation(4, 11 + accessibility.Length) 4349Diagnostic(ErrorCode.ERR_NonPublicAPIInRecord, "Equals").WithArguments("A.Equals(A)").WithLocation(4, 11 + accessibility.Length), 4352Diagnostic(ErrorCode.WRN_RecordEqualsWithoutGetHashCode, "Equals").WithArguments("A").WithLocation(4, 11 + accessibility.Length)
Semantics\ScriptSemanticsTests.cs (2)
510Assert.Empty(model.LookupLabels(source.Length - 1)); // Used to assert. 591var symbols = model.LookupSymbols(text.Length);
SourceGeneration\GeneratorDriverTests.cs (3)
1359var end = start + x.Location.Length; 3398var capacity = header.Length + (expr.Length * count) + 5;
Utilities\ValueSetTests.cs (1)
283Assert.Equal(values.ToString().Length == 0, values.IsEmpty);
Microsoft.CodeAnalysis.CSharp.Symbol.UnitTests (321)
Compilation\CompilationAPITests.cs (1)
3446Diagnostic(ErrorCode.ERR_DuplicateNameInNS, "C").WithArguments("C", "N").WithLocation(3, 8 + accessibility.Length)
Compilation\ReferenceManagerTests.cs (2)
1783var tree2 = tree1.WithInsertAt(text1.Length, text2); 1826var tree2 = tree1.WithInsertAt(text1.Length, text2);
Compilation\SemanticModelGetDeclaredSymbolAPITests.cs (4)
4664Assert.InRange(enclosingTypePosition, 0, text.Length); 4666Assert.InRange(declaringTypePosition, 0, text.Length); 4668Assert.InRange(nestedTypePosition, 0, text.Length); 4670Assert.InRange(otherTypePosition, 0, text.Length);
Compilation\SemanticModelGetSemanticInfoTests_LateBound.cs (1)
829Assert.Equal("dynamic.operator " + op.Substring(0, op.Length - 1) + "(dynamic, dynamic)", semanticInfo.Symbol.ToString());
Symbols\CheckedUserDefinedOperatorsTests.cs (1)
433Diagnostic(ErrorCode.ERR_ParameterIsStaticClass, "C").WithArguments("C").WithLocation(4, 39 + op.Length)
Symbols\DefaultInterfaceImplementationTests.cs (135)
6347Diagnostic(ErrorCode.ERR_EventNeedsBothAccessors, "E1").WithArguments("I1.E1").WithLocation(4, 25 + declModifiers.Length) 6663Diagnostic(ErrorCode.ERR_EventNeedsBothAccessors, "E1").WithArguments("I1.E1").WithLocation(4, 25 + declModifiers.Length) 6695Diagnostic(ErrorCode.ERR_EventNeedsBothAccessors, "E1").WithArguments("I1.E1").WithLocation(4, 25 + declModifiers.Length) 6727Diagnostic(ErrorCode.ERR_EventNeedsBothAccessors, "E1").WithArguments("I1.E1").WithLocation(4, 25 + declModifiers.Length) 6950Diagnostic(ErrorCode.WRN_UnreferencedEvent, "E7").WithArguments("Base.E7").WithLocation(10, 25 + implModifiers.Length) 7053Diagnostic(ErrorCode.WRN_UnreferencedEvent, "E7").WithArguments("Base.E7").WithLocation(10, 25 + implModifiers.Length) 7144Diagnostic(ErrorCode.WRN_UnreferencedEvent, "E7").WithArguments("Base.E7").WithLocation(10, 25 + implModifiers.Length) 7251Diagnostic(ErrorCode.WRN_UnreferencedEvent, "E7").WithArguments("Base.E7").WithLocation(10, 29 + implModifiers.Length) 33440Diagnostic(ErrorCode.ERR_ConcreteMissingBody, "M1").WithArguments("I1.I4.M1()").WithLocation(15, 13 + implModifiers.Length), 33443Diagnostic(ErrorCode.ERR_ConcreteMissingBody, "M1").WithArguments("I1.I2.M1()").WithLocation(14, 13 + implModifiers.Length) 33488Diagnostic(ErrorCode.ERR_ClassDoesntImplementInterface, "I4").WithArguments("I1.I4.M1()", "I4").WithLocation(18, 10 + implModifiers.Length), 33491Diagnostic(ErrorCode.ERR_ClassDoesntImplementInterface, "I2").WithArguments("I1.I2.M1()", "I2").WithLocation(14, 10 + implModifiers.Length) 33657Diagnostic(ErrorCode.ERR_BadMemberFlag, "M1").WithArguments("sealed").WithLocation(14, 28 + implModifiers.Length), 33660Diagnostic(ErrorCode.ERR_BadMemberFlag, "M1").WithArguments("private").WithLocation(14, 28 + implModifiers.Length), 33663Diagnostic(ErrorCode.ERR_BadMemberFlag, "M1").WithArguments("protected").WithLocation(18, 32 + implModifiers.Length), 33666Diagnostic(ErrorCode.ERR_AbstractHasBody, "M1").WithArguments("I1.I4.M1()").WithLocation(18, 32 + implModifiers.Length), 33721Diagnostic(ErrorCode.ERR_BadMemberFlag, "M1").WithArguments("private protected").WithLocation(14, 31 + implModifiers.Length), 33724Diagnostic(ErrorCode.ERR_BadMemberFlag, "M1").WithArguments("protected internal").WithLocation(18, 41 + implModifiers.Length), 33727Diagnostic(ErrorCode.ERR_BadMemberFlag, "M1").WithArguments("override").WithLocation(18, 41 + implModifiers.Length) 33767Diagnostic(ErrorCode.WRN_ExternMethodNoImplementation, "M1").WithArguments("I1.I2.M1()").WithLocation(9, 20 + implModifiers.Length) 33891Diagnostic(ErrorCode.ERR_ExternHasBody, "M1").WithArguments("I1.I2.M1()").WithLocation(9, 20 + implModifiers.Length) 34204Diagnostic(ErrorCode.ERR_BadAccess, "M1").WithArguments("I4.M1()").WithLocation(8, 13 + implModifiers.Length), 34207Diagnostic(ErrorCode.ERR_BadAccess, "M1").WithArguments("I2.M1()").WithLocation(4, 13 + implModifiers.Length) 34219Diagnostic(ErrorCode.ERR_BadAccess, "M1").WithArguments("I4.M1()").WithLocation(8, 13 + implModifiers.Length), 34222Diagnostic(ErrorCode.ERR_BadAccess, "M1").WithArguments("I2.M1()").WithLocation(4, 13 + implModifiers.Length) 35905Diagnostic(ErrorCode.WRN_NullabilityMismatchInExplicitlyImplementedInterface, "I1<string?>").WithLocation(11, 10 + implModifiers.Length) 36108Diagnostic(ErrorCode.WRN_NullabilityMismatchInExplicitlyImplementedInterface, "I1<string>").WithLocation(11, 10 + implModifiers.Length) 36815Diagnostic(ErrorCode.ERR_BadAccess, "M1").WithArguments("I2.M1()").WithLocation(4, 13 + implModifiers.Length), 36818Diagnostic(ErrorCode.ERR_BadAccess, "M1").WithArguments("I4.M1()").WithLocation(8, 13 + implModifiers.Length) 36865Diagnostic(ErrorCode.WRN_NewRequired, "M1").WithArguments("I2.M1()", "I1.M1()").WithLocation(10, 25 + implModifiers.Length), 37596Diagnostic(ErrorCode.ERR_ClassDoesntImplementInterface, "I2").WithArguments("I1.I2.M1", "I2").WithLocation(14, 9 + implModifiers.Length), 37599Diagnostic(ErrorCode.ERR_ClassDoesntImplementInterface, "I4").WithArguments("I1.I4.M1", "I4").WithLocation(15, 9 + implModifiers.Length) 37788Diagnostic(ErrorCode.ERR_BadMemberFlag, "M1").WithArguments("sealed").WithLocation(14, 27 + implModifiers.Length), 37791Diagnostic(ErrorCode.ERR_BadMemberFlag, "M1").WithArguments("private").WithLocation(14, 27 + implModifiers.Length), 37797Diagnostic(ErrorCode.ERR_BadMemberFlag, "M1").WithArguments("protected").WithLocation(19, 31 + implModifiers.Length), 37857Diagnostic(ErrorCode.ERR_BadMemberFlag, "M1").WithArguments("private protected").WithLocation(14, 30 + implModifiers.Length), 37863Diagnostic(ErrorCode.ERR_BadMemberFlag, "M1").WithArguments("protected internal").WithLocation(19, 40 + implModifiers.Length), 37866Diagnostic(ErrorCode.ERR_BadMemberFlag, "M1").WithArguments("override").WithLocation(19, 40 + implModifiers.Length), 38362Diagnostic(ErrorCode.ERR_BadAccess, "M1").WithArguments("I2.M1").WithLocation(4, 12 + implModifiers.Length), 38365Diagnostic(ErrorCode.ERR_BadAccess, "M1").WithArguments("I4.M1.set").WithLocation(11, 12 + implModifiers.Length) 39341Diagnostic(ErrorCode.ERR_BadMemberFlag, "M1").WithArguments("protected").WithLocation(19, 22 + implModifiers.Length) 39392Diagnostic(ErrorCode.ERR_BadMemberFlag, "M1").WithArguments("protected internal").WithLocation(19, 31 + implModifiers.Length) 39443Diagnostic(ErrorCode.ERR_BadMemberFlag, "M1").WithArguments("private protected").WithLocation(19, 30 + implModifiers.Length) 39507Diagnostic(ErrorCode.ERR_DuplicateNameInClass, "M1").WithArguments("I3", "I1<System.String>.M1").WithLocation(21, 21 + implModifiers.Length) 39919Diagnostic(ErrorCode.ERR_BadAccess, "M1").WithArguments("I2.M1").WithLocation(4, 12 + implModifiers.Length), 39922Diagnostic(ErrorCode.ERR_BadAccess, "M1").WithArguments("I4.M1.set").WithLocation(11, 12 + implModifiers.Length) 40622Diagnostic(ErrorCode.ERR_ClassDoesntImplementInterface, "I2").WithArguments("I1.I2.M1", "I2").WithLocation(9, 25 + implModifiers.Length) 40794Diagnostic(ErrorCode.ERR_BadMemberFlag, "M1").WithArguments("sealed").WithLocation(14, 43 + implModifiers.Length), 40797Diagnostic(ErrorCode.ERR_BadMemberFlag, "M1").WithArguments("private").WithLocation(14, 43 + implModifiers.Length), 40800Diagnostic(ErrorCode.ERR_BadMemberFlag, "M1").WithArguments("protected").WithLocation(19, 47 + implModifiers.Length), 40860Diagnostic(ErrorCode.ERR_BadMemberFlag, "M1").WithArguments("private protected").WithLocation(14, 53 + implModifiers.Length), 40863Diagnostic(ErrorCode.ERR_BadMemberFlag, "M1").WithArguments("extern").WithLocation(14, 53 + implModifiers.Length), 40866Diagnostic(ErrorCode.ERR_BadMemberFlag, "M1").WithArguments("protected internal").WithLocation(19, 56 + implModifiers.Length), 40869Diagnostic(ErrorCode.ERR_BadMemberFlag, "M1").WithArguments("override").WithLocation(19, 56 + implModifiers.Length) 40934Diagnostic(ErrorCode.ERR_ExplicitEventFieldImpl, "M1").WithLocation(30, 28 + implModifiers.Length), 40937Diagnostic(ErrorCode.ERR_EventNeedsBothAccessors, "M1").WithArguments("I2.I1.M1").WithLocation(10, 28 + implModifiers.Length), 40940Diagnostic(ErrorCode.ERR_EventNeedsBothAccessors, "M2").WithArguments("I2.I1.M2").WithLocation(14, 28 + implModifiers.Length), 40952Diagnostic(ErrorCode.ERR_ExplicitEventFieldImpl, ".").WithLocation(38, 27 + implModifiers.Length), 41138Diagnostic(ErrorCode.ERR_BadAccess, "M1").WithArguments("I2.M1").WithLocation(4, 28 + implModifiers.Length) 41150Diagnostic(ErrorCode.ERR_BadAccess, "M1").WithArguments("I2.M1").WithLocation(4, 28 + implModifiers.Length) 42484Diagnostic(ErrorCode.ERR_BadAccess, "M1").WithArguments("I2.M1").WithLocation(4, 28 + implModifiers.Length) 51973Diagnostic(ErrorCode.ERR_AbstractHasBody, "M1").WithArguments("I2.I1.M1()").WithLocation(9, 22 + implModifiers.Length), 52028Diagnostic(ErrorCode.ERR_AbstractAndExtern, "M1").WithArguments("I2.I1.M1()").WithLocation(9, 29 + implModifiers.Length), 52093Diagnostic(ErrorCode.ERR_PartialMemberNotExplicit, "M1").WithLocation(9, 30 + implModifiers.Length), 52096Diagnostic(ErrorCode.ERR_PartialMemberCannotBeAbstract, "M1").WithLocation(9, 30 + implModifiers.Length), 52151Diagnostic(ErrorCode.ERR_BadAsyncLacksBody, "M1").WithLocation(9, 28 + implModifiers.Length), 52216Diagnostic(ErrorCode.ERR_BadMemberFlag, "M1").WithArguments("public").WithLocation(9, 29 + implModifiers.Length), 52338Diagnostic(ErrorCode.ERR_InterfaceMemberNotFound, "M1").WithArguments("I2.M1()").WithLocation(8, 22 + implModifiers.Length) 52387Diagnostic(ErrorCode.ERR_SingleTypeNameNotFound, "I1").WithArguments("I1").WithLocation(4, 19 + implModifiers.Length), 52390Diagnostic(ErrorCode.ERR_ExplicitInterfaceImplementationNotInterface, "I1").WithArguments("I1").WithLocation(4, 19 + implModifiers.Length) 53717Diagnostic(ErrorCode.ERR_AbstractAndExtern, "P1").WithArguments("I2.I1.P1").WithLocation(9, 28 + implModifiers.Length), 53842Diagnostic(ErrorCode.ERR_BadMemberFlag, "P1").WithArguments("public").WithLocation(9, 28 + implModifiers.Length), 53871Diagnostic(ErrorCode.ERR_BadMemberFlag, "P1").WithArguments("abstract").WithLocation(9, 21 + implModifiers.Length) 53955Diagnostic(ErrorCode.ERR_BadMemberFlag, "P1").WithArguments("abstract").WithLocation(9, 21 + implModifiers.Length) 53985Diagnostic(ErrorCode.ERR_ExplicitPropertyMissingAccessor, "P1").WithArguments("I2.I1.P1", "I1.P1.set").WithLocation(9, 21 + implModifiers.Length), 54018Diagnostic(ErrorCode.ERR_ExplicitPropertyMissingAccessor, "P1").WithArguments("I2.I1.P1", "I1.P1.get").WithLocation(9, 21 + implModifiers.Length), 54051Diagnostic(ErrorCode.ERR_ExplicitPropertyAddingAccessor, "set").WithArguments("I2.I1.P1.set", "I1.P1").WithLocation(9, 31 + implModifiers.Length), 54084Diagnostic(ErrorCode.ERR_ExplicitPropertyAddingAccessor, "get").WithArguments("I2.I1.P1.get", "I1.P1").WithLocation(9, 26 + implModifiers.Length), 54117Diagnostic(ErrorCode.ERR_ExplicitPropertyAddingAccessor, "set").WithArguments("I2.I1.P1.set", "I1.P1").WithLocation(9, 31 + implModifiers.Length), 54150Diagnostic(ErrorCode.ERR_ExplicitPropertyAddingAccessor, "get").WithArguments("I2.I1.P1.get", "I1.P1").WithLocation(9, 26 + implModifiers.Length), 54185Diagnostic(ErrorCode.ERR_BadAccess, "P1").WithArguments("I1.P1").WithLocation(4, 21 + implModifiers.Length), 54279Diagnostic(ErrorCode.ERR_BadAccess, "P1").WithArguments("I1.P1.get").WithLocation(4, 21 + implModifiers.Length), 54314Diagnostic(ErrorCode.ERR_BadAccess, "P1").WithArguments("I1.P1.set").WithLocation(4, 21 + implModifiers.Length), 55726Diagnostic(ErrorCode.ERR_AbstractHasBody, "throw null").WithArguments("I2.I1.P1.get").WithLocation(9, 27 + implModifiers.Length), 55759Diagnostic(ErrorCode.ERR_AbstractAndExtern, "P1").WithArguments("I2.I1.P1").WithLocation(9, 28 + implModifiers.Length), 55792Diagnostic(ErrorCode.ERR_BadMemberFlag, "P1").WithArguments("public").WithLocation(9, 28 + implModifiers.Length), 55821Diagnostic(ErrorCode.ERR_BadMemberFlag, "P1").WithArguments("abstract").WithLocation(9, 21 + implModifiers.Length) 55847Diagnostic(ErrorCode.ERR_BadMemberFlag, "P1").WithArguments("abstract").WithLocation(9, 21 + implModifiers.Length) 55877Diagnostic(ErrorCode.ERR_ExplicitPropertyMissingAccessor, "P1").WithArguments("I2.I1.P1", "I1.P1.set").WithLocation(9, 21 + implModifiers.Length), 55880Diagnostic(ErrorCode.ERR_ExplicitPropertyAddingAccessor, "get").WithArguments("I2.I1.P1.get", "I1.P1").WithLocation(9, 26 + implModifiers.Length), 55915Diagnostic(ErrorCode.ERR_BadAccess, "P1").WithArguments("I1.P1").WithLocation(4, 21 + implModifiers.Length), 56657Diagnostic(ErrorCode.ERR_AbstractAndExtern, "P1").WithArguments("I2.I1.P1").WithLocation(9, 28 + implModifiers.Length), 56690Diagnostic(ErrorCode.ERR_BadMemberFlag, "P1").WithArguments("public").WithLocation(9, 28 + implModifiers.Length), 56719Diagnostic(ErrorCode.ERR_BadMemberFlag, "P1").WithArguments("abstract").WithLocation(9, 21 + implModifiers.Length), 56722Diagnostic(ErrorCode.ERR_AutoPropertyMustHaveGetAccessor, "set").WithLocation(9, 26 + implModifiers.Length) 56748Diagnostic(ErrorCode.ERR_BadMemberFlag, "P1").WithArguments("abstract").WithLocation(9, 21 + implModifiers.Length), 56751Diagnostic(ErrorCode.ERR_AutoPropertyMustHaveGetAccessor, "set").WithLocation(9, 26 + implModifiers.Length) 56781Diagnostic(ErrorCode.ERR_ExplicitPropertyMissingAccessor, "P1").WithArguments("I2.I1.P1", "I1.P1.get").WithLocation(9, 21 + implModifiers.Length), 56784Diagnostic(ErrorCode.ERR_ExplicitPropertyAddingAccessor, "set").WithArguments("I2.I1.P1.set", "I1.P1").WithLocation(9, 26 + implModifiers.Length), 56819Diagnostic(ErrorCode.ERR_BadAccess, "P1").WithArguments("I1.P1").WithLocation(4, 21 + implModifiers.Length), 57024Diagnostic(ErrorCode.ERR_InterfaceMemberNotFound, "P1").WithArguments("I2.P1").WithLocation(8, 21 + implModifiers.Length) 57086Diagnostic(ErrorCode.ERR_SingleTypeNameNotFound, "I1").WithArguments("I1").WithLocation(4, 18 + implModifiers.Length), 57089Diagnostic(ErrorCode.ERR_ExplicitInterfaceImplementationNotInterface, "I1").WithArguments("I1").WithLocation(4, 18 + implModifiers.Length) 57117Diagnostic(ErrorCode.ERR_InterfaceMemberNotFound, "P1").WithArguments("I2.P1").WithLocation(8, 21 + implModifiers.Length) 57144Diagnostic(ErrorCode.ERR_SingleTypeNameNotFound, "I1").WithArguments("I1").WithLocation(4, 18 + implModifiers.Length), 57147Diagnostic(ErrorCode.ERR_ExplicitInterfaceImplementationNotInterface, "I1").WithArguments("I1").WithLocation(4, 18 + implModifiers.Length) 57175Diagnostic(ErrorCode.ERR_InterfaceMemberNotFound, "P1").WithArguments("I2.P1").WithLocation(8, 21 + implModifiers.Length) 57202Diagnostic(ErrorCode.ERR_SingleTypeNameNotFound, "I1").WithArguments("I1").WithLocation(4, 18 + implModifiers.Length), 57205Diagnostic(ErrorCode.ERR_ExplicitInterfaceImplementationNotInterface, "I1").WithArguments("I1").WithLocation(4, 18 + implModifiers.Length) 58602Diagnostic(ErrorCode.ERR_BadMemberFlag, "P1").WithArguments("extern").WithLocation(9, 44 + implModifiers.Length), 58635Diagnostic(ErrorCode.ERR_BadMemberFlag, "P1").WithArguments("public").WithLocation(9, 44 + implModifiers.Length), 58670Diagnostic(ErrorCode.ERR_ExplicitEventFieldImpl, "P1").WithLocation(9, 37 + implModifiers.Length), 58673Diagnostic(ErrorCode.ERR_BadMemberFlag, "P1").WithArguments("abstract").WithLocation(9, 37 + implModifiers.Length) 58756Diagnostic(ErrorCode.ERR_BadMemberFlag, "P1").WithArguments("abstract").WithLocation(9, 37 + implModifiers.Length) 58788Diagnostic(ErrorCode.ERR_ExplicitEventFieldImpl, "P1").WithLocation(9, 37 + implModifiers.Length), 58791Diagnostic(ErrorCode.ERR_BadMemberFlag, "P1").WithArguments("abstract").WithLocation(9, 37 + implModifiers.Length) 58821Diagnostic(ErrorCode.ERR_BadMemberFlag, "P1").WithArguments("abstract").WithLocation(9, 37 + implModifiers.Length) 58851Diagnostic(ErrorCode.ERR_AbstractEventHasAccessors, "{").WithArguments("I2.I1.P1").WithLocation(9, 40 + implModifiers.Length), 58884Diagnostic(ErrorCode.ERR_AbstractEventHasAccessors, "{").WithArguments("I2.I1.P1").WithLocation(9, 40 + implModifiers.Length), 58917Diagnostic(ErrorCode.ERR_AbstractEventHasAccessors, "{").WithArguments("I2.I1.P1").WithLocation(9, 40 + implModifiers.Length), 58950Diagnostic(ErrorCode.ERR_AbstractEventHasAccessors, "{").WithArguments("I2.I1.P1").WithLocation(9, 40 + implModifiers.Length), 58983Diagnostic(ErrorCode.ERR_AbstractEventHasAccessors, "{").WithArguments("I2.I1.P1").WithLocation(9, 40 + implModifiers.Length), 59016Diagnostic(ErrorCode.ERR_AbstractEventHasAccessors, "{").WithArguments("I2.I1.P1").WithLocation(9, 40 + implModifiers.Length), 59049Diagnostic(ErrorCode.ERR_AbstractEventHasAccessors, "{").WithArguments("I2.I1.P1").WithLocation(9, 40 + implModifiers.Length), 59082Diagnostic(ErrorCode.ERR_EventNeedsBothAccessors, "P1").WithArguments("I1.P1").WithLocation(4, 25 + modifiers.Length), 59085Diagnostic(ErrorCode.ERR_ExplicitPropertyAddingAccessor, "P1").WithArguments("I2.I1.P1.remove", "I1.P1").WithLocation(9, 37 + implModifiers.Length), 59122Diagnostic(ErrorCode.ERR_EventNeedsBothAccessors, "P1").WithArguments("I1.P1").WithLocation(4, 25 + modifiers.Length), 59161Diagnostic(ErrorCode.ERR_EventNeedsBothAccessors, "P1").WithArguments("I1.P1").WithLocation(4, 25 + modifiers.Length), 59164Diagnostic(ErrorCode.ERR_ExplicitPropertyAddingAccessor, "P1").WithArguments("I2.I1.P1.add", "I1.P1").WithLocation(9, 37 + implModifiers.Length), 59201Diagnostic(ErrorCode.ERR_EventNeedsBothAccessors, "P1").WithArguments("I1.P1").WithLocation(4, 25 + modifiers.Length), 59242Diagnostic(ErrorCode.ERR_BadAccess, "P1").WithArguments("I1.P1").WithLocation(4, 37 + implModifiers.Length), 59313Diagnostic(ErrorCode.ERR_InterfaceMemberNotFound, "P1").WithArguments("I2.P1").WithLocation(8, 37 + implModifiers.Length) 59363Diagnostic(ErrorCode.ERR_SingleTypeNameNotFound, "I1").WithArguments("I1").WithLocation(4, 34 + implModifiers.Length), 59366Diagnostic(ErrorCode.ERR_ExplicitInterfaceImplementationNotInterface, "I1").WithArguments("I1").WithLocation(4, 34 + implModifiers.Length) 59396Diagnostic(ErrorCode.ERR_ExplicitEventFieldImpl, ".").WithLocation(9, 36 + implModifiers.Length),
Symbols\Metadata\PE\LoadingNamespacesAndTypes.cs (2)
53XElement elem = new XElement((n.Name.Length == 0 ? "Global" : n.Name)); 71XElement elem = new XElement((n.Name.Length == 0 ? "Global" : n.Name));
Symbols\Source\FileModifierTests.cs (1)
2966Diagnostic(ErrorCode.ERR_FileTypeDisallowedInSignature, "C").WithArguments("C", "E<T>").WithLocation(7, 17 + typeKind.Length));
Symbols\StaticAbstractMembersInInterfacesTests.cs (174)
5691Diagnostic(ErrorCode.ERR_RuntimeDoesNotSupportStaticAbstractMembersInInterfaces, op.Substring(isChecked ? 8 : 0)).WithLocation(4, 31 + type.Length + (isChecked ? 8 : 0)) 5738Diagnostic(ErrorCode.ERR_RuntimeDoesNotSupportStaticAbstractMembersInInterfaces, op.Substring(isChecked ? 8 : 0)).WithLocation(4, 31 + type.Length + (isChecked ? 8 : 0)) 8668(prefixOp + postfixOp).Length == 1 ? 9116Diagnostic(ErrorCode.ERR_RuntimeDoesNotSupportStaticAbstractMembersInInterfaces, prefixOp + postfixOp).WithLocation(12, 31 + checkedKeyword.Length) 12185Diagnostic(ErrorCode.ERR_RuntimeDoesNotSupportStaticAbstractMembersInInterfaces, op).WithLocation(12, 33 + checkedKeyword.Length) 12335Diagnostic(ErrorCode.ERR_RuntimeDoesNotSupportStaticAbstractMembersInInterfaces, op).WithLocation(12, 32 + checkedKeyword.Length) 17601Diagnostic(ErrorCode.ERR_OperatorsMustBeStaticAndPublic, op).WithArguments("C2.operator " + checkedKeyword + op + "(C2)").WithLocation(14, 24 + checkedKeyword.Length), 17607Diagnostic(ErrorCode.ERR_OperatorsMustBeStaticAndPublic, op).WithArguments("C3.operator " + checkedKeyword + op + "(C3)").WithLocation(20, 24 + checkedKeyword.Length), 17613Diagnostic(ErrorCode.ERR_ExplicitImplementationOfOperatorsMustBeStatic, op).WithArguments("C4.operator " + checkedKeyword + op + "(C4)").WithLocation(26, 24 + checkedKeyword.Length), 17616Diagnostic(ErrorCode.ERR_InterfaceMemberNotFound, op).WithArguments("C4.operator " + checkedKeyword + op + "(C4)").WithLocation(26, 24 + checkedKeyword.Length), 17625Diagnostic(ErrorCode.ERR_InterfaceMemberNotFound, op).WithArguments("C6.operator " + checkedKeyword + op + "(C6)").WithLocation(38, 32 + checkedKeyword.Length), 17643Diagnostic(ErrorCode.ERR_InterfaceMemberNotFound, op).WithArguments("C10.operator " + checkedKeyword + op + "(C10)").WithLocation(67, 33 + checkedKeyword.Length) 17744Diagnostic(ErrorCode.ERR_OperatorsMustBeStaticAndPublic, op).WithArguments("C2.operator " + checkedKeyword + op + "(C2)").WithLocation(14, 24 + checkedKeyword.Length), 17750Diagnostic(ErrorCode.ERR_OperatorsMustBeStaticAndPublic, op).WithArguments("C3.operator " + checkedKeyword + op + "(C3)").WithLocation(20, 24 + checkedKeyword.Length), 17756Diagnostic(ErrorCode.ERR_ExplicitImplementationOfOperatorsMustBeStatic, op).WithArguments("C4.operator " + checkedKeyword + op + "(C4)").WithLocation(26, 24 + checkedKeyword.Length), 17759Diagnostic(ErrorCode.ERR_InterfaceMemberNotFound, op).WithArguments("C4.operator " + checkedKeyword + op + "(C4)").WithLocation(26, 24 + checkedKeyword.Length), 17768Diagnostic(ErrorCode.ERR_InterfaceMemberNotFound, op).WithArguments("C6.operator " + checkedKeyword + op + "(C6)").WithLocation(38, 32 + checkedKeyword.Length), 17786Diagnostic(ErrorCode.ERR_InterfaceMemberNotFound, op).WithArguments("C10.operator " + checkedKeyword + op + "(C10)").WithLocation(67, 33 + checkedKeyword.Length) 17881Diagnostic(ErrorCode.ERR_OperatorsMustBeStaticAndPublic, op).WithArguments("C2.operator " + checkedKeyword + op + "(C2)").WithLocation(14, 24 + checkedKeyword.Length), 17884Diagnostic(ErrorCode.ERR_OperatorsMustBeStaticAndPublic, op).WithArguments("C3.operator " + checkedKeyword + op + "(C3)").WithLocation(20, 24 + checkedKeyword.Length), 17887Diagnostic(ErrorCode.ERR_ExplicitImplementationOfOperatorsMustBeStatic, op).WithArguments("C4.operator " + checkedKeyword + op + "(C4)").WithLocation(26, 24 + checkedKeyword.Length), 17890Diagnostic(ErrorCode.ERR_InterfaceMemberNotFound, op).WithArguments("C4.operator " + checkedKeyword + op + "(C4)").WithLocation(26, 24 + checkedKeyword.Length), 17893Diagnostic(ErrorCode.ERR_InterfaceMemberNotFound, op).WithArguments("C6.operator " + checkedKeyword + op + "(C6)").WithLocation(38, 32 + checkedKeyword.Length), 17899Diagnostic(ErrorCode.ERR_InterfaceMemberNotFound, op).WithArguments("C10.operator " + checkedKeyword + op + "(C10)").WithLocation(67, 33 + checkedKeyword.Length) 17994Diagnostic(ErrorCode.ERR_OperatorsMustBeStaticAndPublic, op).WithArguments("C2.operator " + checkedKeyword + op + "(C2)").WithLocation(14, 24 + checkedKeyword.Length), 17997Diagnostic(ErrorCode.ERR_OperatorsMustBeStaticAndPublic, op).WithArguments("C3.operator " + checkedKeyword + op + "(C3)").WithLocation(20, 24 + checkedKeyword.Length), 18000Diagnostic(ErrorCode.ERR_ExplicitImplementationOfOperatorsMustBeStatic, op).WithArguments("C4.operator " + checkedKeyword + op + "(C4)").WithLocation(26, 24 + checkedKeyword.Length), 18003Diagnostic(ErrorCode.ERR_InterfaceMemberNotFound, op).WithArguments("C4.operator " + checkedKeyword + op + "(C4)").WithLocation(26, 24 + checkedKeyword.Length), 18006Diagnostic(ErrorCode.ERR_InterfaceMemberNotFound, op).WithArguments("C6.operator " + checkedKeyword + op + "(C6)").WithLocation(38, 32 + checkedKeyword.Length), 18012Diagnostic(ErrorCode.ERR_InterfaceMemberNotFound, op).WithArguments("C10.operator " + checkedKeyword + op + "(C10)").WithLocation(67, 33 + checkedKeyword.Length) 18136Diagnostic(ErrorCode.ERR_OperatorsMustBeStaticAndPublic, op).WithArguments("C2.operator " + checkedKeyword + op + "(C2, int)").WithLocation(14, 24 + checkedKeyword.Length), 18142Diagnostic(ErrorCode.ERR_OperatorsMustBeStaticAndPublic, op).WithArguments("C3.operator " + checkedKeyword + op + "(C3, int)").WithLocation(20, 24 + checkedKeyword.Length), 18148Diagnostic(ErrorCode.ERR_ExplicitImplementationOfOperatorsMustBeStatic, op).WithArguments("C4.operator " + checkedKeyword + op + "(C4, int)").WithLocation(26, 24 + checkedKeyword.Length), 18151Diagnostic(ErrorCode.ERR_InterfaceMemberNotFound, op).WithArguments("C4.operator " + checkedKeyword + op + "(C4, int)").WithLocation(26, 24 + checkedKeyword.Length), 18160Diagnostic(ErrorCode.ERR_InterfaceMemberNotFound, op).WithArguments("C6.operator " + checkedKeyword + op + "(C6, int)").WithLocation(38, 32 + checkedKeyword.Length), 18178Diagnostic(ErrorCode.ERR_InterfaceMemberNotFound, op).WithArguments("C10.operator " + checkedKeyword + op + "(C10, int)").WithLocation(67, 33 + checkedKeyword.Length) 18273Diagnostic(ErrorCode.ERR_OperatorsMustBeStaticAndPublic, op).WithArguments("C2.operator " + checkedKeyword + op + "(C2, int)").WithLocation(14, 24 + checkedKeyword.Length), 18276Diagnostic(ErrorCode.ERR_OperatorsMustBeStaticAndPublic, op).WithArguments("C3.operator " + checkedKeyword + op + "(C3, int)").WithLocation(20, 24 + checkedKeyword.Length), 18279Diagnostic(ErrorCode.ERR_ExplicitImplementationOfOperatorsMustBeStatic, op).WithArguments("C4.operator " + checkedKeyword + op + "(C4, int)").WithLocation(26, 24 + checkedKeyword.Length), 18282Diagnostic(ErrorCode.ERR_InterfaceMemberNotFound, op).WithArguments("C4.operator " + checkedKeyword + op + "(C4, int)").WithLocation(26, 24 + checkedKeyword.Length), 18285Diagnostic(ErrorCode.ERR_InterfaceMemberNotFound, op).WithArguments("C6.operator " + checkedKeyword + op + "(C6, int)").WithLocation(38, 32 + checkedKeyword.Length), 18291Diagnostic(ErrorCode.ERR_InterfaceMemberNotFound, op).WithArguments("C10.operator " + checkedKeyword + op + "(C10, int)").WithLocation(67, 33 + checkedKeyword.Length) 18379ErrorCode badSignatureError = op.Length != 2 ? ErrorCode.ERR_BadUnaryOperatorSignature : ErrorCode.ERR_BadIncDecSignature; 18380ErrorCode badAbstractSignatureError = op.Length != 2 ? ErrorCode.ERR_BadAbstractUnaryOperatorSignature : ErrorCode.ERR_BadAbstractIncDecSignature; 18385Diagnostic(ErrorCode.ERR_OperatorsMustBeStaticAndPublic, op).WithArguments("I3.operator " + checkedKeyword + op + "(I1)").WithLocation(12, 17 + checkedKeyword.Length), 18388Diagnostic(badSignatureError, op).WithLocation(12, 17 + checkedKeyword.Length), 18391Diagnostic(badSignatureError, op).WithLocation(17, 24 + checkedKeyword.Length), 18394Diagnostic(ErrorCode.ERR_ExplicitImplementationOfOperatorsMustBeStatic, op).WithArguments("I5.operator " + checkedKeyword + op + "(I1)").WithLocation(22, 20 + checkedKeyword.Length), 18397Diagnostic(ErrorCode.ERR_InterfaceMemberNotFound, op).WithArguments("I5.operator " + checkedKeyword + op + "(I1)").WithLocation(22, 20 + checkedKeyword.Length), 18400Diagnostic(badAbstractSignatureError, op).WithLocation(32, 33 + checkedKeyword.Length), 18403Diagnostic(ErrorCode.ERR_OperatorsMustBeStaticAndPublic, op).WithArguments("I8<T>.operator " + checkedKeyword + op + "(T)").WithLocation(42, 16 + checkedKeyword.Length), 18406Diagnostic(badSignatureError, op).WithLocation(42, 16 + checkedKeyword.Length), 18409Diagnostic(badSignatureError, op).WithLocation(47, 23 + checkedKeyword.Length) 18526ErrorCode badSignatureError = op.Length != 2 ? ErrorCode.ERR_BadUnaryOperatorSignature : ErrorCode.ERR_BadIncDecSignature; 18527ErrorCode badAbstractSignatureError = op.Length != 2 ? ErrorCode.ERR_BadAbstractUnaryOperatorSignature : ErrorCode.ERR_BadAbstractIncDecSignature; 18532Diagnostic(ErrorCode.ERR_OperatorsMustBeStaticAndPublic, op).WithArguments("I3.operator " + checkedKeyword + op + "(I1)").WithLocation(12, 17 + checkedKeyword.Length), 18535Diagnostic(ErrorCode.ERR_BadIncDecSignature, op).WithLocation(12, 17 + checkedKeyword.Length), 18538Diagnostic(badSignatureError, op).WithLocation(17, 24 + checkedKeyword.Length), 18541Diagnostic(ErrorCode.ERR_ExplicitImplementationOfOperatorsMustBeStatic, op).WithArguments("I5.operator " + checkedKeyword + op + "(I1)").WithLocation(22, 20 + checkedKeyword.Length), 18544Diagnostic(ErrorCode.ERR_InterfaceMemberNotFound, op).WithArguments("I5.operator " + checkedKeyword + op + "(I1)").WithLocation(22, 20 + checkedKeyword.Length), 18547Diagnostic(badAbstractSignatureError, op).WithLocation(32, 33 + checkedKeyword.Length), 18550Diagnostic(ErrorCode.ERR_OperatorsMustBeStaticAndPublic, op).WithArguments("I8<T>.operator " + checkedKeyword + op + "(T)").WithLocation(42, 16 + checkedKeyword.Length), 18553Diagnostic(ErrorCode.ERR_BadIncDecSignature, op).WithLocation(42, 16 + checkedKeyword.Length), 18556Diagnostic(badSignatureError, op).WithLocation(47, 23 + checkedKeyword.Length) 18673ErrorCode badSignatureError = op.Length != 2 ? ErrorCode.ERR_BadUnaryOperatorSignature : ErrorCode.ERR_BadIncDecSignature; 18674ErrorCode badAbstractSignatureError = op.Length != 2 ? ErrorCode.ERR_BadAbstractUnaryOperatorSignature : ErrorCode.ERR_BadAbstractIncDecSignature; 18679Diagnostic(ErrorCode.ERR_OperatorsMustBeStaticAndPublic, op).WithArguments("I3.operator " + checkedKeyword + op + "(I1)").WithLocation(12, 17 + checkedKeyword.Length), 18682Diagnostic(badSignatureError, op).WithLocation(12, 17 + checkedKeyword.Length), 18685Diagnostic(badSignatureError, op).WithLocation(17, 24 + checkedKeyword.Length), 18688Diagnostic(ErrorCode.ERR_ExplicitImplementationOfOperatorsMustBeStatic, op).WithArguments("I5.operator " + checkedKeyword + op + "(I1)").WithLocation(22, 20 + checkedKeyword.Length), 18691Diagnostic(ErrorCode.ERR_InterfaceMemberNotFound, op).WithArguments("I5.operator " + checkedKeyword + op + "(I1)").WithLocation(22, 20 + checkedKeyword.Length), 18694Diagnostic(badAbstractSignatureError, op).WithLocation(32, 33 + checkedKeyword.Length), 18697Diagnostic(ErrorCode.ERR_OperatorsMustBeStaticAndPublic, op).WithArguments("I8<T>.operator " + checkedKeyword + op + "(T)").WithLocation(42, 16 + checkedKeyword.Length), 18700Diagnostic(badSignatureError, op).WithLocation(42, 16 + checkedKeyword.Length), 18703Diagnostic(badSignatureError, op).WithLocation(47, 23 + checkedKeyword.Length), 18706Diagnostic(ErrorCode.ERR_BadMemberFlag, op).WithArguments("virtual").WithLocation(62, 39 + checkedKeyword.Length), 18709Diagnostic(ErrorCode.ERR_BadMemberFlag, op).WithArguments("virtual").WithLocation(67, 36 + checkedKeyword.Length) 18826ErrorCode badSignatureError = op.Length != 2 ? ErrorCode.ERR_BadUnaryOperatorSignature : ErrorCode.ERR_BadIncDecSignature; 18827ErrorCode badAbstractSignatureError = op.Length != 2 ? ErrorCode.ERR_BadAbstractUnaryOperatorSignature : ErrorCode.ERR_BadAbstractIncDecSignature; 18832Diagnostic(ErrorCode.ERR_OperatorsMustBeStaticAndPublic, op).WithArguments("I3.operator " + checkedKeyword + op + "(I1)").WithLocation(12, 17 + checkedKeyword.Length), 18835Diagnostic(ErrorCode.ERR_BadIncDecSignature, op).WithLocation(12, 17 + checkedKeyword.Length), 18838Diagnostic(badSignatureError, op).WithLocation(17, 24 + checkedKeyword.Length), 18841Diagnostic(ErrorCode.ERR_ExplicitImplementationOfOperatorsMustBeStatic, op).WithArguments("I5.operator " + checkedKeyword + op + "(I1)").WithLocation(22, 20 + checkedKeyword.Length), 18844Diagnostic(ErrorCode.ERR_InterfaceMemberNotFound, op).WithArguments("I5.operator " + checkedKeyword + op + "(I1)").WithLocation(22, 20 + checkedKeyword.Length), 18847Diagnostic(badAbstractSignatureError, op).WithLocation(32, 33 + checkedKeyword.Length), 18850Diagnostic(ErrorCode.ERR_OperatorsMustBeStaticAndPublic, op).WithArguments("I8<T>.operator " + checkedKeyword + op + "(T)").WithLocation(42, 16 + checkedKeyword.Length), 18853Diagnostic(ErrorCode.ERR_BadIncDecSignature, op).WithLocation(42, 16 + checkedKeyword.Length), 18856Diagnostic(badSignatureError, op).WithLocation(47, 23 + checkedKeyword.Length), 18859Diagnostic(ErrorCode.ERR_BadMemberFlag, op).WithArguments("virtual").WithLocation(62, 39 + checkedKeyword.Length), 18862Diagnostic(ErrorCode.ERR_BadMemberFlag, op).WithArguments("virtual").WithLocation(67, 36 + checkedKeyword.Length) 18986Diagnostic(badSignatureError, op).WithLocation(12, 17 + checkedKeyword.Length), 18989Diagnostic(badSignatureError, op).WithLocation(17, 24 + checkedKeyword.Length), 18992Diagnostic(ErrorCode.ERR_InterfaceMemberNotFound, op).WithArguments("I5.operator " + checkedKeyword + op + "(I1, int)").WithLocation(22, 20 + checkedKeyword.Length), 18995Diagnostic(badSignatureError, op).WithLocation(42, 16 + checkedKeyword.Length), 18998Diagnostic(badSignatureError, op).WithLocation(47, 23 + checkedKeyword.Length) 19010Diagnostic(ErrorCode.ERR_InterfacesCantContainConversionOrEqualityOperators, op).WithLocation(12, 17 + checkedKeyword.Length), 19013Diagnostic(ErrorCode.ERR_InterfacesCantContainConversionOrEqualityOperators, op).WithLocation(17, 24 + checkedKeyword.Length), 19022Diagnostic(ErrorCode.ERR_InterfacesCantContainConversionOrEqualityOperators, op).WithLocation(42, 16 + checkedKeyword.Length), 19025Diagnostic(ErrorCode.ERR_InterfacesCantContainConversionOrEqualityOperators, op).WithLocation(47, 23 + checkedKeyword.Length) 19035Diagnostic(ErrorCode.ERR_OperatorsMustBeStaticAndPublic, op).WithArguments("I3.operator " + checkedKeyword + op + "(I1, int)").WithLocation(12, 17 + checkedKeyword.Length), 19038Diagnostic(ErrorCode.ERR_ExplicitImplementationOfOperatorsMustBeStatic, op).WithArguments("I5.operator " + checkedKeyword + op + "(I1, int)").WithLocation(22, 20 + checkedKeyword.Length), 19041Diagnostic(badAbstractSignatureError, op).WithLocation(32, 33 + checkedKeyword.Length), 19044Diagnostic(ErrorCode.ERR_OperatorsMustBeStaticAndPublic, op).WithArguments("I8<T>.operator " + checkedKeyword + op + "(T, int)").WithLocation(42, 16 + checkedKeyword.Length) 19172Diagnostic(badSignatureError, op).WithLocation(12, 17 + checkedKeyword.Length), 19175Diagnostic(badSignatureError, op).WithLocation(17, 24 + checkedKeyword.Length), 19178Diagnostic(ErrorCode.ERR_InterfaceMemberNotFound, op).WithArguments("I5.operator " + checkedKeyword + op + "(I1, int)").WithLocation(22, 20 + checkedKeyword.Length), 19181Diagnostic(badSignatureError, op).WithLocation(42, 16 + checkedKeyword.Length), 19184Diagnostic(badSignatureError, op).WithLocation(47, 23 + checkedKeyword.Length), 19187Diagnostic(ErrorCode.ERR_BadMemberFlag, op).WithArguments("virtual").WithLocation(62, 39 + checkedKeyword.Length), 19190Diagnostic(ErrorCode.ERR_BadMemberFlag, op).WithArguments("virtual").WithLocation(67, 36 + checkedKeyword.Length) 19202Diagnostic(ErrorCode.ERR_InterfacesCantContainConversionOrEqualityOperators, op).WithLocation(12, 17 + checkedKeyword.Length), 19205Diagnostic(ErrorCode.ERR_InterfacesCantContainConversionOrEqualityOperators, op).WithLocation(17, 24 + checkedKeyword.Length), 19214Diagnostic(ErrorCode.ERR_InterfacesCantContainConversionOrEqualityOperators, op).WithLocation(42, 16 + checkedKeyword.Length), 19217Diagnostic(ErrorCode.ERR_InterfacesCantContainConversionOrEqualityOperators, op).WithLocation(47, 23 + checkedKeyword.Length) 19227Diagnostic(ErrorCode.ERR_OperatorsMustBeStaticAndPublic, op).WithArguments("I3.operator " + checkedKeyword + op + "(I1, int)").WithLocation(12, 17 + checkedKeyword.Length), 19230Diagnostic(ErrorCode.ERR_ExplicitImplementationOfOperatorsMustBeStatic, op).WithArguments("I5.operator " + checkedKeyword + op + "(I1, int)").WithLocation(22, 20 + checkedKeyword.Length), 19233Diagnostic(badAbstractSignatureError, op).WithLocation(32, 33 + checkedKeyword.Length), 19236Diagnostic(ErrorCode.ERR_OperatorsMustBeStaticAndPublic, op).WithArguments("I8<T>.operator " + checkedKeyword + op + "(T, int)").WithLocation(42, 16 + checkedKeyword.Length) 19554Diagnostic(ErrorCode.ERR_InvalidModifierForLanguageVersion, op).WithArguments(modifier.Trim(), "10.0", "11.0").WithLocation(14, 33 + checkedKeyword.Length), 19563Diagnostic(ErrorCode.ERR_InvalidModifierForLanguageVersion, op).WithArguments(modifier.Trim(), "10.0", "11.0").WithLocation(19, 32 + checkedKeyword.Length), 19609Diagnostic(ErrorCode.ERR_RuntimeDoesNotSupportStaticAbstractMembersInInterfacesForMember, op).WithArguments("Test1.operator " + checkedKeyword + op + "(Test1)", "I1<Test1>.operator " + checkedKeyword + op + "(Test1)", "Test1").WithLocation(4, 34 + checkedKeyword.Length) 19619Diagnostic(ErrorCode.ERR_RuntimeDoesNotSupportStaticAbstractMembersInInterfaces, op).WithLocation(9, 32 + checkedKeyword.Length) 19661Diagnostic(ErrorCode.ERR_RuntimeDoesNotSupportStaticAbstractMembersInInterfacesForMember, op).WithArguments("Test1.operator " + checkedKeyword + op + "(Test1, int)", "I1<Test1>.operator " + checkedKeyword + op + "(Test1, int)", "Test1").WithLocation(4, 34 + checkedKeyword.Length) 19671Diagnostic(ErrorCode.ERR_RuntimeDoesNotSupportStaticAbstractMembersInInterfaces, op).WithLocation(9, 32 + checkedKeyword.Length) 19713Diagnostic(ErrorCode.ERR_RuntimeDoesNotSupportStaticAbstractMembersInInterfaces, op).WithLocation(4, 27 + checkedKeyword.Length) 19723Diagnostic(ErrorCode.ERR_RuntimeDoesNotSupportStaticAbstractMembersInInterfaces, op).WithLocation(4, 27 + checkedKeyword.Length), 19726Diagnostic(ErrorCode.ERR_RuntimeDoesNotSupportStaticAbstractMembersInInterfaces, op).WithLocation(9, 33 + checkedKeyword.Length) 19768Diagnostic(ErrorCode.ERR_RuntimeDoesNotSupportStaticAbstractMembersInInterfaces, op).WithLocation(4, 27 + checkedKeyword.Length) 19778Diagnostic(ErrorCode.ERR_RuntimeDoesNotSupportStaticAbstractMembersInInterfaces, op).WithLocation(4, 27 + checkedKeyword.Length), 19781Diagnostic(ErrorCode.ERR_RuntimeDoesNotSupportStaticAbstractMembersInInterfaces, op).WithLocation(9, 33 + checkedKeyword.Length) 22819Diagnostic(ErrorCode.ERR_ValConstraintNotSatisfied, "x").WithArguments("I1<T>", "T", "C2").WithLocation(14, 44 + op.Length - 1) 22864Diagnostic(ErrorCode.ERR_RefConstraintNotSatisfied, "x").WithArguments("I1<T>", "T", "C2").WithLocation(14, 44 + op.Length - 1) 28442Diagnostic(ErrorCode.ERR_OperatorsMustBeStaticAndPublic, "int").WithArguments("C2." + op + " operator " + checkedKeyword + "int(C2)").WithLocation(14, 30 + checkedKeyword.Length), 28448Diagnostic(ErrorCode.ERR_OperatorsMustBeStaticAndPublic, "int").WithArguments("C3." + op + " operator " + checkedKeyword + "int(C3)").WithLocation(20, 30 + checkedKeyword.Length), 28454Diagnostic(ErrorCode.ERR_ExplicitImplementationOfOperatorsMustBeStatic, "int").WithArguments("C4." + op + " operator " + checkedKeyword + "int(C4)").WithLocation(26, 30 + checkedKeyword.Length), 28457Diagnostic(ErrorCode.ERR_InterfaceMemberNotFound, "int").WithArguments("C4." + op + " operator " + checkedKeyword + "int(C4)").WithLocation(26, 30 + checkedKeyword.Length), 28466Diagnostic(ErrorCode.ERR_InterfaceMemberNotFound, "long").WithArguments("C6." + op + " operator " + checkedKeyword + "long(C6)").WithLocation(38, 37 + checkedKeyword.Length), 28484Diagnostic(ErrorCode.ERR_InterfaceMemberNotFound, "int").WithArguments("C10." + op + " operator " + checkedKeyword + "int(C10)").WithLocation(67, 38 + checkedKeyword.Length) 28579Diagnostic(ErrorCode.ERR_OperatorsMustBeStaticAndPublic, "int").WithArguments("C2." + op + " operator " + checkedKeyword + "int(C2)").WithLocation(14, 30 + checkedKeyword.Length), 28582Diagnostic(ErrorCode.ERR_OperatorsMustBeStaticAndPublic, "int").WithArguments("C3." + op + " operator " + checkedKeyword + "int(C3)").WithLocation(20, 30 + checkedKeyword.Length), 28585Diagnostic(ErrorCode.ERR_ExplicitImplementationOfOperatorsMustBeStatic, "int").WithArguments("C4." + op + " operator " + checkedKeyword + "int(C4)").WithLocation(26, 30 + checkedKeyword.Length), 28588Diagnostic(ErrorCode.ERR_InterfaceMemberNotFound, "int").WithArguments("C4." + op + " operator " + checkedKeyword + "int(C4)").WithLocation(26, 30 + checkedKeyword.Length), 28591Diagnostic(ErrorCode.ERR_InterfaceMemberNotFound, "long").WithArguments("C6." + op + " operator " + checkedKeyword + "long(C6)").WithLocation(38, 37 + checkedKeyword.Length), 28597Diagnostic(ErrorCode.ERR_InterfaceMemberNotFound, "int").WithArguments("C10." + op + " operator " + checkedKeyword + "int(C10)").WithLocation(67, 38 + checkedKeyword.Length) 28688Diagnostic(ErrorCode.ERR_ConversionNotInvolvingContainedType, "int").WithLocation(12, 23 + checkedKeyword.Length), 28691Diagnostic(ErrorCode.ERR_InterfacesCantContainConversionOrEqualityOperators, "int").WithLocation(12, 23 + checkedKeyword.Length), 28694Diagnostic(ErrorCode.ERR_ConversionNotInvolvingContainedType, "int").WithLocation(17, 30 + checkedKeyword.Length), 28697Diagnostic(ErrorCode.ERR_InterfacesCantContainConversionOrEqualityOperators, "int").WithLocation(17, 30 + checkedKeyword.Length), 28700Diagnostic(ErrorCode.ERR_ExplicitImplementationOfOperatorsMustBeStatic, "int").WithArguments("I5<T>." + op + " operator " + checkedKeyword + "int(T)").WithLocation(22, 29 + checkedKeyword.Length), 28703Diagnostic(ErrorCode.ERR_InterfaceMemberNotFound, "int").WithArguments("I5<T>." + op + " operator " + checkedKeyword + "int(T)").WithLocation(22, 29 + checkedKeyword.Length), 28706Diagnostic(ErrorCode.ERR_AbstractConversionNotInvolvingContainedType, "int").WithLocation(32, 39 + checkedKeyword.Length), 28709Diagnostic(ErrorCode.ERR_ConversionNotInvolvingContainedType, "int").WithLocation(42, 23 + checkedKeyword.Length), 28712Diagnostic(ErrorCode.ERR_InterfacesCantContainConversionOrEqualityOperators, "int").WithLocation(42, 23 + checkedKeyword.Length), 28715Diagnostic(ErrorCode.ERR_ConversionNotInvolvingContainedType, "int").WithLocation(47, 30 + checkedKeyword.Length), 28718Diagnostic(ErrorCode.ERR_InterfacesCantContainConversionOrEqualityOperators, "int").WithLocation(47, 30 + checkedKeyword.Length) 28845Diagnostic(ErrorCode.ERR_ConversionNotInvolvingContainedType, "int").WithLocation(12, 23 + checkedKeyword.Length), 28848Diagnostic(ErrorCode.ERR_InterfacesCantContainConversionOrEqualityOperators, "int").WithLocation(12, 23 + checkedKeyword.Length), 28851Diagnostic(ErrorCode.ERR_ConversionNotInvolvingContainedType, "int").WithLocation(17, 30 + checkedKeyword.Length), 28854Diagnostic(ErrorCode.ERR_InterfacesCantContainConversionOrEqualityOperators, "int").WithLocation(17, 30 + checkedKeyword.Length), 28857Diagnostic(ErrorCode.ERR_ExplicitImplementationOfOperatorsMustBeStatic, "int").WithArguments("I5<T>." + op + " operator " + checkedKeyword + "int(T)").WithLocation(22, 29 + checkedKeyword.Length), 28860Diagnostic(ErrorCode.ERR_InterfaceMemberNotFound, "int").WithArguments("I5<T>." + op + " operator " + checkedKeyword + "int(T)").WithLocation(22, 29 + checkedKeyword.Length), 28863Diagnostic(ErrorCode.ERR_AbstractConversionNotInvolvingContainedType, "int").WithLocation(32, 39 + checkedKeyword.Length), 28866Diagnostic(ErrorCode.ERR_ConversionNotInvolvingContainedType, "int").WithLocation(42, 23 + checkedKeyword.Length), 28869Diagnostic(ErrorCode.ERR_InterfacesCantContainConversionOrEqualityOperators, "int").WithLocation(42, 23 + checkedKeyword.Length), 28872Diagnostic(ErrorCode.ERR_ConversionNotInvolvingContainedType, "int").WithLocation(47, 30 + checkedKeyword.Length), 28875Diagnostic(ErrorCode.ERR_InterfacesCantContainConversionOrEqualityOperators, "int").WithLocation(47, 30 + checkedKeyword.Length), 28878Diagnostic(ErrorCode.ERR_BadMemberFlag, "int").WithArguments("virtual").WithLocation(62, 46 + checkedKeyword.Length), 28881Diagnostic(ErrorCode.ERR_BadMemberFlag, "int").WithArguments("virtual").WithLocation(67, 45 + checkedKeyword.Length) 29069Diagnostic(ErrorCode.ERR_RuntimeDoesNotSupportStaticAbstractMembersInInterfacesForMember, "int").WithArguments("Test1." + op + " operator " + checkedKeyword + "int(Test1)", "I1<Test1>." + op + " operator " + checkedKeyword + "int(Test1)", "Test1").WithLocation(4, 37 + checkedKeyword.Length) 29079Diagnostic(ErrorCode.ERR_RuntimeDoesNotSupportStaticAbstractMembersInInterfaces, "int").WithLocation(9, 39 + checkedKeyword.Length) 29121Diagnostic(ErrorCode.ERR_RuntimeDoesNotSupportStaticAbstractMembersInInterfaces, "int").WithLocation(4, 40 + checkedKeyword.Length) 29131Diagnostic(ErrorCode.ERR_RuntimeDoesNotSupportStaticAbstractMembersInInterfaces, "int").WithLocation(4, 40 + checkedKeyword.Length), 29134Diagnostic(ErrorCode.ERR_RuntimeDoesNotSupportStaticAbstractMembersInInterfaces, "int").WithLocation(9, 39 + checkedKeyword.Length) 31076Diagnostic(ErrorCode.ERR_RuntimeDoesNotSupportStaticAbstractMembersInInterfaces, "int").WithLocation(12, 39 + checkedKeyword.Length)
Microsoft.CodeAnalysis.CSharp.Syntax.UnitTests (90)
Diagnostics\DiagnosticTest.cs (5)
1996Assert.Equal(128, defineName.ValueText.Length); 1997Assert.Equal(2335, defineName.Text.Length); 2002Assert.Equal(2335, errorCodeName.ValueText.Length); 2003Assert.Equal(2335, errorCodeName.Text.Length); 2415return new TextSpan(index, textToFind.Length);
Diagnostics\LocationsTests.cs (1)
71return new TextSpan(index, textToFind.Length);
IncrementalParsing\GrammarAmbiguities.cs (2)
85var start = codeBefore.Length; 86var length = codeToBeReplaced.Length;
IncrementalParsing\IncrementalParsingTests.cs (37)
572var prefixSpan = new TextSpan(source.IndexOf(prefix), length: prefix.Length); 573var suffixSpan = new TextSpan(source.IndexOf(suffix), length: suffix.Length); 2118int locationOfChange = oldText.ToString().IndexOf(txtToCmnt, StringComparison.Ordinal), widthOfChange = txtToCmnt.Length; 2143int locationOfChange = oldText.ToString().IndexOf(txtToCmnt, StringComparison.Ordinal), widthOfChange = txtToCmnt.Length; 2798int widthOfChange = textToRemove.Length; 2826int widthOfChange = textToRemove.Length; 2848int widthOfChange = textToRemove.Length; 2899int widthOfChange = textToRemove.Length; 2932int widthOfChange = textToRemove.Length; 2958int widthOfChange = textToRemove.Length; 2983int widthOfChange = textToRemove.Length; 3012int widthOfChange = textToRemove.Length; 3039int widthOfChange = textToRemove.Length; 3063int widthOfChange = textToRemove.Length; 3093int locationOfChange = oldText.ToString().IndexOf(txtToCmnt, StringComparison.Ordinal), widthOfChange = txtToCmnt.Length; 3121int locationOfChange = oldText.ToString().IndexOf(txtToCmnt, StringComparison.Ordinal), widthOfChange = txtToCmnt.Length; 3144int locationOfChange = oldText.ToString().IndexOf(txtToCmnt, StringComparison.Ordinal), widthOfChange = txtToCmnt.Length; 3305var changedTree = originalTree.WithInsertAt(text.Length, "\r\n hash++;"); 3339Assert.Equal(fullText.Length, incText.Length); 3353Assert.Equal(fullText.Length, incText.Length); 3415currLen += item.Length + 3; 3475var newTree = oldTree.WithInsertAt(text.Length, " "); 3491var newTree = oldTree.WithInsertAt(text.Length, " "); 3734var span = new TextSpan(source.IndexOf(substring) + substring.Length, 0); 3758var span = new TextSpan(source.IndexOf(substring) + substring.Length, 0); 3782var span = new TextSpan(source.IndexOf(substring) + substring.Length, 0); 3806var span = new TextSpan(source.IndexOf(substring) + substring.Length, 0); 3830var span = new TextSpan(source.IndexOf(substring) + substring.Length, 0); 3854var span = new TextSpan(source.IndexOf(substring) + substring.Length, 1); 3880var span = new TextSpan(source.IndexOf(substring) + substring.Length, 0); 3931var span = new TextSpan(source.IndexOf(substring) + substring.Length, 0); 3957var span = new TextSpan(source.IndexOf(substring) + substring.Length, 0); 3975var span = new TextSpan(source.IndexOf(substring) + substring.Length, 0); 3993var span = new TextSpan(source.IndexOf(substring) + substring.Length, 0); 4011var span = new TextSpan(source.IndexOf(substring) + substring.Length, 0);
LexicalAndXml\LexicalTests.cs (17)
111Assert.Equal(text.Length, token.FullWidth); 130Assert.Equal(text.Length, token.FullWidth); 149Assert.Equal(text.Length, token.FullWidth); 599Assert.Equal(text.Length, token.FullWidth); 727Assert.Equal(1, ((string)token.ValueText).Length); 744Assert.Equal(1, ((string)token.ValueText).Length); 761Assert.Equal(1, ((string)token.ValueText).Length); 778Assert.Equal(1, ((string)token.ValueText).Length); 795Assert.Equal(3, ((string)token.ValueText).Length); 812Assert.Equal(4, ((string)token.ValueText).Length); 829Assert.Equal(1, ((string)token.ValueText).Length); 871Assert.Equal(3, ((string)token.ValueText).Length); 3479Assert.Equal(text.Substring(0, text.Length - 1), token.Text); 3480Assert.Equal(text.Substring(0, text.Length - 1), token.Value); 3583Assert.Equal(text.Substring(0, text.Length - 1), token.Text); 3593Assert.Equal(text.Substring(0, text.Length - 1), token.Text); 3747.Max(x => x.Length);
LexicalAndXml\RawStringLiteralLexingTests.cs (1)
192Assert.Equal(input.Length, token.FullWidth);
Parsing\CrefParsingTests.cs (6)
821Diagnostic(ErrorCode.WRN_BadXMLRefSyntax, "operator " + op.Substring(0, op.Length - 2)).WithArguments("operator " + op).WithLocation(1, 16) 861Diagnostic(ErrorCode.WRN_BadXMLRefSyntax, "operator " + op.Substring(0, op.Length - 4)).WithArguments("operator " + op).WithLocation(1, 16) 901Diagnostic(ErrorCode.WRN_BadXMLRefSyntax, "operator " + op.Substring(0, op.Length - 3)).WithArguments("operator " + op).WithLocation(1, 16) 1448Diagnostic(ErrorCode.WRN_BadXMLRefSyntax, "T.operator " + op.Substring(0, op.Length - 2)).WithArguments("T.operator " + op).WithLocation(1, 16) 1506Diagnostic(ErrorCode.WRN_BadXMLRefSyntax, "T.operator " + op.Substring(0, op.Length - 4)).WithArguments("T.operator " + op).WithLocation(1, 16) 1564Diagnostic(ErrorCode.WRN_BadXMLRefSyntax, "T.operator " + op.Substring(0, op.Length - 3)).WithArguments("T.operator " + op).WithLocation(1, 16)
Parsing\MemberDeclarationParsingTests.cs (8)
13392Diagnostic(ErrorCode.ERR_SyntaxError, "=").WithArguments("(").WithLocation(1, 14 + op.Length - 1), 13395Diagnostic(ErrorCode.ERR_IdentifierExpected, "=").WithLocation(1, 14 + op.Length - 1), 13398Diagnostic(ErrorCode.ERR_TupleTooFewElements, ")").WithLocation(1, 19 + op.Length - 1), 13401Diagnostic(ErrorCode.ERR_IdentifierExpected, "=>").WithLocation(1, 21 + op.Length - 1), 13404Diagnostic(ErrorCode.ERR_SyntaxError, "=>").WithArguments(",").WithLocation(1, 21 + op.Length - 1), 13407Diagnostic(ErrorCode.ERR_SyntaxError, "x").WithArguments(",").WithLocation(1, 24 + op.Length - 1), 13410Diagnostic(ErrorCode.ERR_IdentifierExpected, ";").WithLocation(1, 25 + op.Length - 1), 13413Diagnostic(ErrorCode.ERR_CloseParenExpected, ";").WithLocation(1, 25 + op.Length - 1)
Parsing\PatternParsingTests.cs (2)
2992int k1 = random.Next(source.Length); 2993int k2 = random.Next(source.Length);
Parsing\RawInterpolatedStringLiteralCompilingTests.cs (1)
62for (var i = 0; i < text.Length; i++)
Parsing\StatementParsingTests.cs (1)
3370var statement = this.ParseStatement(prefix + text, offset: prefix.Length);
Syntax\SyntaxListTests.cs (1)
293Assert.Equal(alphabet.Length, parsedArgumentList.Arguments.Count);
Syntax\SyntaxNodeTests.cs (6)
674var token = tree.GetCompilationUnitRoot().FindToken("class\n #i".Length); 677token = tree.GetCompilationUnitRoot().FindToken("class\n #i".Length, findInsideTrivia: true); 1780Assert.Equal(rootNode.FullSpan.Length, rootNode.ToFullString().Length); 1781Assert.Equal(rootNode.Span.Length, rootNode.ToString().Length); 1798Assert.Equal(rootNode.FullSpan.Length, rootNode.ToFullString().Length); 1799Assert.Equal(rootNode.Span.Length, rootNode.ToString().Length);
TextExtensions.cs (2)
34int length = oldText.Length; 44int length = oldText.Length;
Microsoft.CodeAnalysis.CSharp.Test.Utilities (13)
CompilationTestUtils.cs (4)
505var content = text.Substring(prefix.Length, text.Length - prefix.Length - suffix.Length);
CSharpTestBase.cs (2)
2213start += startTag.Length; 2461return (ns.Length > 0) ? ns + "." + result : result;
EmitMetadataTestBase.cs (2)
31XElement elem = new XElement((n.Name.Length == 0 ? "Global" : n.Name)); 58if (typeParams.Length > 0)
Extensions.cs (1)
156while (part.Length > 0)
SemanticModelTestBase.cs (1)
30return code.IndexOf(tag, StringComparison.Ordinal) + tag.Length;
SyntaxTreeExtensions.cs (2)
28int length = oldText.Length; 36int length = oldText.Length;
TestAttributesVisitor.cs (1)
161if (name.EndsWith("Attribute")) name = name.Substring(0, name.Length - 9);
Microsoft.CodeAnalysis.CSharp.Workspaces (26)
Classification\Worker.cs (2)
135AddClassification(TextSpan.FromBounds(token.Span.Start, token.Span.End - "u8".Length), type); 136AddClassification(TextSpan.FromBounds(token.Span.End - "u8".Length, token.Span.End), ClassificationTypeNames.Keyword);
Classification\Worker_DocumentationComments.cs (1)
103for (var index = 0; index < text.Length; index++)
Rename\CSharpRenameRewriterLanguageService.cs (1)
1065if (replacementText.EndsWith("Attribute", StringComparison.Ordinal) && replacementText.Length > 9)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\EmbeddedLanguages\VirtualChars\CSharpVirtualCharService.cs (8)
137var endIndexExclusive = tokenText.Length; 142endIndexExclusive -= "u8".Length; 234if (startDelimiter.Length > 0 && !tokenText.StartsWith(startDelimiter)) 240if (endDelimiter.Length > 0 && !tokenText.EndsWith(endDelimiter, StringComparison.OrdinalIgnoreCase)) 246var startIndexInclusive = startDelimiter.Length; 247var endIndexExclusive = tokenText.Length - endDelimiter.Length; 504for (var i = 0; i < 4 && endIndex < tokenText.Length; i++)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\SyntaxTriviaExtensions.cs (2)
109textBuilder.Remove(textBuilder.Length - newLine.Length, newLine.Length);
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\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Engine\Trivia\TriviaDataFactory.cs (1)
135return textSnippet.ConvertTabToSpace(Options.TabSize, initialColumn, textSnippet.Length);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\FormattingHelpers.cs (1)
29var start = lastNewLinePos + NewLine.Length;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Services\SyntaxFacts\CSharpSyntaxFacts.cs (4)
453return this.IsIdentifier(token) && !token.ContainsDiagnostics && token.ToString().Length == identifier.Length; 459return this.IsIdentifier(token) && !token.ContainsDiagnostics && token.ToString().Length == identifier.Length && token.IsVerbatimIdentifier();
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\CSharpCodeGenerationHelpers.cs (2)
132if (tokenText.Length <= 2 || tokenText.Last() != '"') 141if (tokenText.Length <= 1 || tokenText.Last() != '"')
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\ITypeSymbolExtensions.TypeSyntaxGeneratorVisitor.cs (1)
149? null : symbol.Signature.UnmanagedCallingConventionTypes.Select(type => GetConventionForString(type.Name["CallConv".Length..])),
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\StringExtensions.cs (1)
37if (escaped.Length == 0 || escaped[0] != '@')
Microsoft.CodeAnalysis.CSharp.Workspaces.UnitTests (5)
EmbeddedLanguages\VirtualChars\CSharpVirtualCharServiceTests.cs (2)
90=> $"[{ConvertRuneToString(vc)},[{vc.Span.Start - _statementPrefix.Length},{vc.Span.End - _statementPrefix.Length}]]";
Formatting\CSharpFormattingTestBase.cs (2)
27return AssertFormatAsync(code, code, [new TextSpan(0, code.Length)], changedOptionSet, testWithTransformation, parseOptions); 37return AssertFormatAsync(expected, code, [new TextSpan(0, code.Length)], changedOptionSet, testWithTransformation, parseOptions);
Formatting\FormattingMultipleSpanTests.cs (1)
173while (currentIndex < codeWithMarker.Length)
Microsoft.CodeAnalysis.Debugging.Package (9)
CustomDebugInfoEncoder.cs (2)
153Debug.Assert(info.LocalName.Length <= IdentifierSize); 160builder.WriteBytes(0, sizeof(char) * (IdentifierSize - info.LocalName.Length));
CustomDebugInfoReader.cs (7)
503if (importString.Length >= 2 && importString[0] == '@') 557return import.Length > 0 && import[0] == 'Z'; 690if (import.Length == 0) 724if (pos >= import.Length) 742if (pos >= import.Length) 830if (offset <= separatorPos && separatorPos < input.Length) 833after = separatorPos + 1 == input.Length
Microsoft.CodeAnalysis.EditorFeatures (78)
CommentSelection\AbstractToggleBlockCommentBase.cs (6)
237amountToAddToStart = commentInfo.BlockCommentEndString.Length; 246amountToAddToEnd = -commentInfo.BlockCommentStartString.Length; 261DeleteText(textChanges, new TextSpan(spanToRemove.Start, commentInfo.BlockCommentStartString.Length)); 262var endMarkerPosition = spanToRemove.End - commentInfo.BlockCommentEndString.Length; 264if (Equals(blockCommentSelection.GetSubstringFromText(endMarkerPosition, commentInfo.BlockCommentEndString.Length), 267DeleteText(textChanges, new TextSpan(endMarkerPosition, commentInfo.BlockCommentEndString.Length));
CommentSelection\CommentUncommentSelectionCommandHandler.cs (5)
247else if (lastEnd + info.BlockCommentEndString.Length > span.End) 265spansToSelect.Add(new CommentTrackingSpan(TextSpan.FromBounds(positionOfStart, positionOfEnd + info.BlockCommentEndString.Length))); 266DeleteText(textChanges, new TextSpan(positionOfStart, info.BlockCommentStartString.Length)); 267DeleteText(textChanges, new TextSpan(positionOfEnd, info.BlockCommentEndString.Length)); 283DeleteText(textChanges, new TextSpan(line.Start.Position + lineText.IndexOf(info.SingleLineCommentString, StringComparison.Ordinal), info.SingleLineCommentString.Length));
CommentSelection\ToggleBlockCommentCommandHandler.cs (3)
46var closeIdx = allText.IndexOf(commentInfo.BlockCommentEndString, openIdx + commentInfo.BlockCommentStartString.Length, caseSensitive: true); 50closeIdx = allText.Length - commentInfo.BlockCommentEndString.Length; 53var blockCommentSpan = new TextSpan(openIdx, closeIdx + commentInfo.BlockCommentEndString.Length - openIdx);
CommentSelection\ToggleLineCommentCommandHandler.cs (1)
127var spanToRemove = TextSpan.FromBounds(commentIndex, commentIndex + commentInfo.SingleLineCommentString.Length);
DocumentationComments\AbstractDocumentationCommentCommandHandler.cs (1)
365return string.CompareOrdinal(lineText, lineOffset, ExteriorTriviaText, 0, ExteriorTriviaText.Length) == 0;
DocumentationComments\AbstractXmlTagCompletionCommandHandler.cs (2)
139if (GetLocalName(parentStartTag).ValueText.Length > 0 && HasMatchingEndTag(parentElement)) 237if (elementName.Length > 0 &&
DocumentationComments\CopilotGenerateDocumentationCommentProvider.cs (11)
106proposedEdits.Add(new DocumentationCommentProposedEdit(new TextSpan(summaryEndTag + "</summary>".Length + startIndex, 0), symbolName: null, DocumentationCommentTagType.Remarks)); 118var typeParamNameStart = typeParamStartTag + "<typeparam name=\"".Length; 126index = typeParamEndTag + "</typeparam>".Length; 139var paramNameStart = paramStartTag + "<param name=\"".Length; 147index = paramEndTag + "</param>".Length; 166var exceptionNameStart = exceptionStartTag + "<exception cref=\"".Length; 174index = exceptionEndTag + "</exception>".Length; 271characterLimit -= (indentText!.Length + "/// ".Length); 274if (currentLineLength + word.Length >= characterLimit) 289currentLineLength += word.Length;
EditorConfigSettings\Updater\SettingsUpdateHelper.cs (4)
301if (lastValidSpecificHeaderSpanEnd.Value.ToString().Trim().Length != 0) 310if (lastValidHeaderSpanEnd.Value.ToString().Trim().Length != 0) 325if (lastLine.ToString().Trim().Length != 0) 331if (lines.Count > 1 && lastLine.ToString().Trim().Length == 0)
InlineHints\InlineHintsDataTaggerProvider.cs (1)
97if (hint.DisplayParts.Sum(p => p.ToString().Length) == 0)
InlineHints\InlineHintsTag.cs (8)
216leftPadding = first.Text.Length - trimStart.Length; 217rightPadding = trimStart.Length - trimBoth.Length; 224leftPadding = first.Text.Length - trimStart.Length; 232rightPadding = last.Text.Length - trimEnd.Length;
InlineRename\AbstractEditorInlineRenameService.SymbolRenameInfo.cs (2)
102return new TextSpan(location.TextSpan.Start + index, searchName.Length); 122return new TextSpan(location.TextSpan.Start + position, replacementText.Length);
InlineRename\UI\Adornment\RenameFlyout.xaml.cs (1)
274RenameUserInput.SelectText(newIdentifier.Length, 0);
IntelliSense\AsyncCompletion\CommitManager.cs (1)
300view.TryMoveCaretToAndEnsureVisible(new SnapshotPoint(subjectBuffer.CurrentSnapshot, mappedSpan.Start.Position + textChange.NewText?.Length ?? 0));
IntelliSense\AsyncCompletion\Helpers.cs (2)
40.WithDisplayText(item.DisplayText[Completion.Utilities.UnicodeStarAndSpace.Length..]) 161if (textTypedSoFar.Length > 0)
IntelliSense\AsyncCompletion\ItemManager.CompletionListUpdater.cs (11)
62=> _snapshotData.DisplaySuggestionItem && _filterText.Length > 0; 108_highlightMatchingPortions = _filterText.Length > 0 221if (_filterText.Length > 0 && char.IsNumber(_filterText[0]) && !IsAfterDot(_snapshotData.Snapshot, _applicableToSpan)) 232_filterText.Length == 0) 406if (_filterText.Length > 0) 625=> span.MoveTo(item.DisplayTextPrefix?.Length ?? 0).ToSpan(); 781if (_filterText.Length > 0 && CompletionService.IsAllPunctuation(_filterText) && _filterText != item.DisplayText) 789if (_filterText.Length == 0) 807Debug.Assert(_filterText.Length > 0 || item.Rules.MatchPriority != MatchPriority.Default); 863if (_filterText.Length == 0) 929var selectionHint = _filterText.Length == 0 ? UpdateSelectionHint.SoftSelected : initialSelection.SelectionHint;
IntelliSense\AsyncCompletion\ItemManager.cs (1)
165=> session.ApplicableToSpan.GetText(data.Snapshot).Length >= FilterTextLengthToExcludeExpandedItemsExclusive
Interactive\InteractiveWindowResetCommand.cs (2)
38private static readonly int s_noConfigParameterNameLength = NoConfigParameterName.Length; 103(index + s_noConfigParameterNameLength == arguments.Length || char.IsWhiteSpace(arguments[index + s_noConfigParameterNameLength])))
QuickInfo\OnTheFlyDocsView.xaml.cs (1)
237m["ResponseLength"] = responseString.Length;
RenameTracking\RenameTrackingTaggerProvider.StateMachine.cs (1)
176var rightSidePosition = change.OldPosition + change.OldText.Length;
RenameTracking\RenameTrackingTaggerProvider.TrackingSession.cs (1)
179if (initialCheck && token.Span.Length != this.OriginalName.Length)
Shared\Extensions\ClassificationExtensions.cs (2)
26new SnapshotSpan(textSnapshot, new Span(index, text.Length)), 29index += text.Length;
SignatureHelp\Presentation\Parameter.cs (1)
37_contentLength = content.Length;
SignatureHelp\Presentation\Signature.cs (5)
122var spacerPart = new TaggedText(TextTags.Space, new string(' ', signaturePrefixContent.Length)); 141paramColumnCount += separatorContent.Length + parameterPrefixContext.Length + parameterContent.Length + parameterSuffixContext.Length;
SplitComment\SplitCommentCommandHandler.cs (4)
121if (position + commentStart.Length > line.End) 125for (var c = 0; c < commentStart.Length; c++) 148if (selectionSpan.Start < (trivia.SpanStart + splitCommentService.CommentStart.Length)) 220var startIndex = trivia.SpanStart + commentPrefix.Length;
WpfClassificationExtensions.cs (1)
49position += part.Text.Length;
Microsoft.CodeAnalysis.EditorFeatures.Test.Utilities (22)
AbstractTypingCommandHandlerTest.cs (1)
67textView.Caret.MoveTo(new SnapshotPoint(newSpanshot, (int)caretPosition + text.Length));
BraceHighlighting\MultiCharacterBraceHighlightingTests.cs (1)
48if (position < text.Length)
Classification\AbstractClassifierTests.cs (2)
48var length = code.Length; 60spans = [new TextSpan(0, allCode.Length)];
Classification\FormattedClassification.cs (2)
52var remainder = ClassificationName[kvp.Key.Length..]; 212trimmedClassification = trimmedClassification[..^" name".Length];
CompleteStatement\AbstractCompleteStatementTests.cs (1)
92textView.Caret.MoveTo(new SnapshotPoint(newSpanshot, caretPosition + text.Length));
Completion\AbstractCompletionProviderTests.cs (6)
1074position += insertText.Length; 1106position += insertText.Length; 1149if (code.Length != position) 1155position += insertText.Length; 1188if (code.Length != position) 1194position += insertText.Length;
DocumentationComments\AbstractDocumentationCommentTests.cs (1)
119textView.Caret.MoveTo(new SnapshotPoint(newSpanshot, caretPosition + text.Length));
DocumentationComments\AbstractXmlTagCompletionTests.cs (1)
55textView.Caret.MoveTo(new SnapshotPoint(newSpanshot, caretPosition + text.Length));
Workspaces\EditorTestWorkspace.cs (7)
373currentPositionInInertText + textToAdd.Length >= markupCaretLocation) 379currentPositionInInertText += textToAdd.Length; 380currentPositionInProjectionBuffer += textToAdd.Length; 417if (currentPositionInInertText < inertText.Length - 1) 458if (spanStartLocation == null && positionInMarkup <= markupSpanStart && markupSpanStart <= positionInMarkup + text.Length) 464if (spanEndLocationExclusive == null && positionInMarkup <= markupSpanEndExclusive && markupSpanEndExclusive <= positionInMarkup + text.Length) 471positionInMarkup += text.Length;
Microsoft.CodeAnalysis.EditorFeatures.Text (3)
Shared\Extensions\ITextSnapshotLineExtensions.cs (3)
124if (index + value.Length > snapshot.Length) 127for (var i = 0; i < value.Length; i++) 151if (i + value.Length > snapshot.Length)
Microsoft.CodeAnalysis.EditorFeatures.UnitTests (23)
CodeActions\CodeChangeProviderMetadataTests.cs (1)
142|| nameObj is not string { Length: > 0 })
CommentSelection\CommentUncommentSelectionCommandHandlerTests.cs (1)
809textView.TextBuffer.Delete(new Span(index, marker.Length));
Completion\TestFileSystemCompletionHelper.cs (2)
61let nextSeparator = d.IndexOf(PathUtilities.DirectorySeparatorChar, withTrailingSeparator.Length) 62select d[..((nextSeparator >= 0) ? nextSeparator : d.Length)];
Diagnostics\DiagnosticDataTests.cs (7)
36await VerifyTextSpanAsync(code, 30, 30, 40, 40, new TextSpan(code.Length, 0)); 47await VerifyTextSpanAsync(code, 0, 30, 40, 40, new TextSpan(code.Length, 0)); 58await VerifyTextSpanAsync(code, 0, 30, 0, 40, new TextSpan(code.Length, 0)); 69await VerifyTextSpanAsync(code, 1, 30, 1, 40, new TextSpan(code.Length, 0)); 80await VerifyTextSpanAsync(code, 1, 30, 1, 40, new TextSpan(code.Length, 0)); 91await VerifyTextSpanAsync(code, 1, 30, 2, 40, new TextSpan(code.Length, 0)); 102await VerifyTextSpanAsync(code, 1, 0, 1, 2, new TextSpan(code.Length, 0));
EmbeddedLanguages\StackFrame\StackFrameParserTests.Utilities.cs (4)
73for (var i = 0; i < input.Length - 1; i++) 78for (var j = 0; j + i < input.Length; j++) 120var end = Math.Min(index, originalText.Length - 1); 142if (end < s.Length - 1)
LinkedFiles\LinkedFileDiffMergingEditorTests.cs (4)
86.WithDocumentText(documentId, text.Replace(textString.IndexOf("public"), "public".Length, "internal")) 87.WithDocumentText(linkedDocumentId, linkedText.Replace(textString.LastIndexOf("public"), "public".Length, "private")); 108.WithDocumentText(document.Id, (await document.GetTextAsync()).Replace(textString.IndexOf("public"), "public".Length, "internal")) 109.WithDocumentText(linkedDocument.Id, sourceText.Replace(textString.LastIndexOf("public"), "public".Length, "private"));
Snippets\RoslynLSPSnippetConvertTests.cs (1)
458if (kvp.Key.Length > 0)
Tagging\TagSpanIntervalTreeTests.cs (1)
162var spans = GetIntersectingSpans(tree, new SnapshotSpan(buffer.CurrentSnapshot, new Span(0, "goo".Length)));
Utilities\BloomFilterTests.cs (2)
35var v = value % Alphabet.Length; 38value /= Alphabet.Length;
Microsoft.CodeAnalysis.EditorFeatures2.UnitTests (22)
Classification\SyntacticChangeRangeComputerTests.vb (1)
39annotatedSpan.Length + newText.Length - spans(0).Length)
FindReferences\FindReferencesTests.vb (5)
113Dim valueUsageInfoField = key.Substring(ValueUsageInfoKey.Length) 127Dim typeOrNamespaceUsageInfoFieldNames = key.Substring(TypeOrNamespaceUsageInfoKey.Length).Split(","c).Select(Function(s) s.Trim) 166Dim additionalPropertyKeys = workspace.Documents.SelectMany(Function(d) d.AnnotatedSpans.Keys.Where(Function(key) key.StartsWith(AdditionalPropertyKey)).Select(Function(key) key.Substring(AdditionalPropertyKey.Length))) 311Dim valueUsageInfoField = key.Substring(ValueUsageInfoKey.Length) 327Dim typeOrNamespaceUsageInfoFieldNames = key.Substring(TypeOrNamespaceUsageInfoKey.Length).Split(","c).Select(Function(s) s.Trim)
GoToDefinition\CSharpGoToDefinitionTests.vb (1)
2025definition = definition.Insert(searchFound + highlight.Length, "|]")
IntelliSense\CSharpCompletionCommandHandlerTests.vb (11)
5084For i = 1 To "ConfigureAwait".Length 5343For i As Integer = 1 To "System.".Length 5363For i As Integer = 1 To "Sys.".Length 5948Assert.Equal(New Span(testDocument.CursorPosition.Value - "Custom".Length, "Custom".Length), secondChange.OldSpan) 6817For i = 1 To "ze".Length 6824For i = 1 To "Normali".Length 6870For i = 1 To "ze".Length 6877For i = 1 To "Normali".Length 10723state.SendBackspaces("wl".Length) 10744state.SendBackspaces("console".Length)
IntelliSense\CSharpCompletionCommandHandlerTests_DefaultsSource.vb (1)
530For i = 0 To typedChars.Length - 1
IntelliSense\CSharpCompletionCommandHandlerTests_XmlDoc.vb (1)
757state.SendTypeChars(keyword.Substring(0, keyword.Length - 1))
IntelliSense\VisualBasicCompletionCommandHandlerTests_XmlDoc.vb (1)
682state.SendTypeChars(keyword.Substring(0, keyword.Length - 1))
Rename\InlineRenameTests.vb (1)
1886textBuffer.Delete(New Span(caretPosition, "Bar".Length))
Microsoft.CodeAnalysis.ExpressionEvaluator.ExpressionCompiler (6)
CustomTypeInfo.cs (2)
178Debug.Assert(str.Length > 0); 187builder.Add((name.Length == 0) ? null : name);
MetadataUtilities.cs (1)
378if ((lastDotIndex > 0) && (extensionStartIndex < fileName.Length))
PDB\MethodDebugInfo.Portable.cs (1)
472builder.Add(value.Length == 0 ? null : value);
PseudoVariableUtilities.cs (2)
45int n = name.Length; 70alias.FullName.Length == ReturnValuePrefixLength;
Microsoft.CodeAnalysis.ExpressionEvaluator.FunctionResolver (12)
CSharp\Scanner.cs (2)
88int length = _text.Length; 120int length = _text.Length;
src\Compilers\Core\Portable\InternalUtilities\UnicodeCharacterUtilities.cs (1)
103int nameLength = name.Length;
src\Compilers\CSharp\Portable\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);
VisualBasic\Scanner.cs (2)
83int length = _text.Length; 129int length = _text.Length - _offset;
Microsoft.CodeAnalysis.ExpressionEvaluator.FunctionResolver.UnitTests (2)
VisualBasicParsingTests.cs (2)
71var expectedText = kindText.Substring(0, kindText.Length - keywordSuffix.Length);
Microsoft.CodeAnalysis.ExpressionEvaluator.ResultProvider (27)
src\Compilers\Core\Portable\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)
src\Compilers\Core\Portable\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++)
src\ExpressionEvaluator\Core\Source\ExpressionCompiler\CustomTypeInfo.cs (2)
178Debug.Assert(str.Length > 0); 187builder.Add((name.Length == 0) ? null : name);
src\ExpressionEvaluator\Core\Source\ResultProvider\Formatter.cs (4)
227for (int i = 0; i < expr.Length; i++) 294int oldLength = expression.Length; 310return RemoveLeadingAndTrailingContent(expression, 0, expression.Length, IsWhitespace, IsWhitespace); 316int oldLength = expression.Length;
src\ExpressionEvaluator\Core\Source\ResultProvider\Helpers\TypeHelpers.cs (1)
824Debug.Assert((@namespace == null) || (@namespace.Length > 0)); // Type.Namespace is null not empty.
Microsoft.CodeAnalysis.ExpressionEvaluator.ResultProvider.Utilities (9)
Debugger\Engine\DkmClrModuleInstance.cs (1)
99pchField = fieldName.Length;
Debugger\Engine\DkmClrValue.cs (1)
249int length = formatString.Length;
src\ExpressionEvaluator\Core\Source\ExpressionCompiler\CustomTypeInfo.cs (2)
178Debug.Assert(str.Length > 0); 187builder.Add((name.Length == 0) ? null : name);
src\ExpressionEvaluator\Core\Source\ResultProvider\Formatter.cs (4)
227for (int i = 0; i < expr.Length; i++) 294int oldLength = expression.Length; 310return RemoveLeadingAndTrailingContent(expression, 0, expression.Length, IsWhitespace, IsWhitespace); 316int oldLength = expression.Length;
src\ExpressionEvaluator\Core\Source\ResultProvider\Helpers\TypeHelpers.cs (1)
824Debug.Assert((@namespace == null) || (@namespace.Length > 0)); // Type.Namespace is null not empty.
Microsoft.CodeAnalysis.Extensions.Package (19)
src\Compilers\Core\Portable\InternalUtilities\StringExtensions.cs (15)
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.Substring(0, name.Length - AttributeSuffix.Length); 165return name.Length > AttributeSuffix.Length && name.EndsWith(AttributeSuffix, comparison); 171while (i < str.Length) 178if (i < str.Length && char.IsLowSurrogate(str[i])) 208if (arg.Length > 1 && arg[0] == '"' && arg[arg.Length - 1] == '"') 211return arg.Substring(1, arg.Length - 2); 223while (x < string1.Length && x < string2.Length && 235while (x < string1.Length && x < string2.Length &&
src\Dependencies\Collections\Extensions\IEnumerableExtensions.cs (2)
213return str.Length == 0; 236return source.Length == 0;
Symbols\ISymbolExtensions.cs (1)
795(symbol.Name.Length == 1 || uint.TryParse(symbol.Name[1..], out _) || symbol.Name.All(n => n.Equals('_')));
Symbols\ITypeSymbolExtensions.cs (1)
363return shortName.Length == 0
Microsoft.CodeAnalysis.Features (211)
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)
137builder.EnsureCapacity(values.Sum(static value => value.Text.Length)); 191yield return new ClassifiedSpan(new TextSpan(index, text.Length), classificationTypeName); 192index += 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)
150var patternMatch = Pattern.Length > 0 163if (Pattern.Length > 0 && item.HasAdditionalFilterTexts) 221if (Pattern.Length == 0) 241return filterText.Length <= 1 ||
Completion\Providers\AbstractDocCommentCompletionProvider.cs (1)
284var newPosition = replacementSpan.Start + beforeCaretText.Length;
Completion\Providers\ImportCompletionProvider\ExtensionMethodImportCompletionHelper.SymbolComputer.cs (1)
408if (filterReceiverTypeName.Length > 0 && !string.Equals(filterReceiverTypeName, GetReceiverTypeName(method.Parameters[0].Type), StringComparison.Ordinal))
Completion\Providers\ImportCompletionProvider\ImportCompletionItem.cs (1)
175=> 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)
253while (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)
229if (currentLocation + 1 >= stringLiteralText.Length)
Copilot\ICopilotChangeAnalysisService.cs (2)
107var newTextLength = change.NewText!.Length; 379=> codeFixCollection.Provider.GetType().FullName![RoslynPrefix.Length..];
DocumentationComments\AbstractDocumentationCommentFormattingService.cs (2)
557var builder = new StringBuilder(rawText.Length); 562for (var i = 0; i < rawText.Length; i++)
DocumentationComments\AbstractDocumentationCommentSnippetService.cs (17)
44var commentStart = endPosition - "///".Length; 99lines[^1] = lastLine[..^newLine.Length]; 135caretOffset = lines[0].Length + indentText.Length + ExteriorTriviaText.Length + 1; 136spanToReplaceLength = existingCommentText!.Length; 152caretOffset = lines[0].Length + ExteriorTriviaText.Length + 1; 153spanToReplaceLength = existingCommentText!.Length; 303var offset = lines[0].Length + lines[1].Length - newLine.Length; 309newText = newText[..^newLine.Length]; 359var offset = lines[0].Length + lines[1].Length - newLine.Length; 440return new DocumentationCommentSnippet(replaceSpan, insertionText, insertionText.Length, position: null, memberNode: null, indentText: null);
EditAndContinue\EditAndContinueDiagnosticDescriptors.cs (4)
243=> diagnosticId.Length > EncDiagnosticIdPrefix.Length && diagnosticId.StartsWith(EncDiagnosticIdPrefix, StringComparison.Ordinal) && diagnosticId[EncDiagnosticIdPrefix.Length] is >= '0' and <= '9'; 249=> 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.Skip("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)
1742var afterBackslashPosition = _lexer.Position - @"k".Length; 1963if (_lexer.Text.Length - _lexer.Position < "{x}".Length)
EmbeddedLanguages\StackFrame\StackFrameLexer.cs (3)
442for (var i = 0; i < val.Length; i++) 459Position += valueToLookFor.Length; 472Position += valueToLookFor.Length;
EncapsulateField\AbstractEncapsulateFieldService.cs (1)
426if (baseName.Length == 0)
FindUsages\AbstractFindUsagesService_FindReferences.cs (1)
214if (title.Length >= 10)
GenerateType\AbstractGenerateTypeService.Editor.cs (3)
171namespaceToGenerateInto = namespaceToGenerateInto[rootNamespace.Length..]; 238return rootNamespace.Length; 243return rootNamespace.Length + 1;
InitializeParameter\AbstractAddParameterCheckCodeRefactoringProvider.cs (1)
1013return (text[..index], text[(index + Placeholder.Length)..]);
InlineHints\AbstractInlineParameterNameHintsService.cs (6)
179if (name?.Length >= 2 && 196if (name?.Length >= 2 && 260if (nameValue.Length > prefix.Length && 262char.IsUpper(nameValue[prefix.Length])) 264suffix = 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;
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 (1)
67builder.AddText(FeaturesResources.Awaited_task_returns_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..];
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);
SpellCheck\AbstractSpellCheckCodeFixProvider.cs (2)
77if (nameText?.Length >= MinTokenLength) 98if (nameText?.Length >= MinTokenLength)
src\Analyzers\Core\Analyzers\FileHeaders\AbstractFileHeaderHelper.cs (2)
122var eolLength = Environment.NewLine.Length; 126return new FileHeader(sb.ToString(), fileHeaderStart, fileHeaderEnd, CommentPrefix.Length);
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\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\Analyzers\Core\Analyzers\RemoveUnusedMembers\AbstractRemoveUnusedMembersDiagnosticAnalyzer.cs (2)
947var suffix = methodSymbol.Name[prefix.Length..]; 948return suffix.Length > 0 &&
src\Analyzers\Core\Analyzers\ValidateFormatString\AbstractValidateFormatStringDiagnosticAnalyzer.cs (2)
356invalidPlaceholderText.Length)); 385if (placeholderIndexText.Length > 0 && char.IsWhiteSpace(placeholderIndexText, 0))
src\Analyzers\Core\CodeFixes\ConflictMarkerResolution\AbstractConflictMarkerCodeFixProvider.cs (1)
40private static readonly int s_mergeConflictLength = "<<<<<<<".Length;
src\Analyzers\Core\CodeFixes\GenerateConstructor\GenerateConstructorHelpers.cs (1)
218var fieldNameMinusPrefix = newFieldName[fieldNamingRule.NamingStyle.Prefix.Length..];
src\Analyzers\Core\CodeFixes\MakeMethodSynchronous\AbstractMakeMethodSynchronousCodeFixProvider.cs (3)
62methodSymbol.Name.Length > AsyncSuffix.Length && 76var newName = name[..^AsyncSuffix.Length];
src\Analyzers\Core\CodeFixes\UseObjectInitializer\AbstractUseObjectInitializerCodeFixProvider.cs (1)
136endPosition: existingWhitespace.Length);
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\Dependencies\CodeAnalysis.Debugging\CustomDebugInfoEncoder.cs (2)
153Debug.Assert(info.LocalName.Length <= IdentifierSize); 160builder.WriteBytes(0, sizeof(char) * (IdentifierSize - info.LocalName.Length));
src\Dependencies\CodeAnalysis.Debugging\CustomDebugInfoReader.cs (7)
503if (importString.Length >= 2 && importString[0] == '@') 557return import.Length > 0 && import[0] == 'Z'; 690if (import.Length == 0) 724if (pos >= import.Length) 742if (pos >= import.Length) 830if (offset <= separatorPos && separatorPos < input.Length) 833after = separatorPos + 1 == input.Length
TaskList\AbstractTaskListService.cs (5)
87if (index >= message.Length) 96length: token.Length, comparisonType: StringComparison.OrdinalIgnoreCase) != 0) 101if (message.Length > index + token.Length && IsIdentifierCharacter(message[index + token.Length]))
Workspace\CompileTimeSolutionProvider.cs (3)
151var builder = new StringBuilder(filePath.Length); 153for (var i = 0; i < filePath.Length; i++) 221=> PathUtilities.GetRelativePath(projectDirectory, designTimeDocumentFilePath)[..^".g.cs".Length];
Wrapping\SeparatedSyntaxList\SeparatedSyntaxListCodeActionComputer.cs (1)
324currentOffset += " ".Length;
Microsoft.CodeAnalysis.Features.Test.Utilities (7)
EditAndContinue\ActiveStatementTestHelpers.cs (4)
61var end = src.IndexOf(endStr, start + startStr.Length) + endStr.Length; 82var startOfLineCount = start + startStr.Length; 86var end = src.IndexOf(endStr, endOfLineCount) + endStr.Length;
EditAndContinue\EditAndContinueWorkspaceTestBase.cs (2)
459=> new TextSpan(str.IndexOf(substr), substr.Length); 563index += OpeningMarker.Length;
EditAndContinue\Extensions.cs (1)
52i = eoln + LineSeparator.Length;
Microsoft.CodeAnalysis.InteractiveHost (47)
Interactive\Core\InteractiveHost.RemoteService.cs (1)
110Debug.Assert(ascii.Length % 2 == 0);
src\Compilers\Core\Portable\FileSystem\FileUtilities.cs (2)
133if (path!.Length == 1) 175Debug.Assert(path.Length == 1 || !PathUtilities.IsDirectorySeparator(path[1]));
src\Compilers\Core\Portable\FileSystem\PathUtilities.cs (36)
52int lastSeparator = s.Length; 58if (lastSeparator != s.Length) 71if (s.Length == 0 || IsAnyDirectorySeparator(s[s.Length - 1])) 138var rootLength = GetPathRoot(path, isUnixLike).Length; 139if (path.Length > rootLength) 141var i = path.Length; 212int length = path.Length; 287return path.Length > 0 && IsDirectorySeparator(path[0]) 314if (path.Length > 0 && path[0] == '.') 316if (path.Length == 1 || IsDirectorySeparator(path[1])) 323if (path.Length == 2 || IsDirectorySeparator(path[2])) 334if (path.Length >= 1 && IsDirectorySeparator(path[0])) 341if (path.Length >= 2 && path[1] == VolumeSeparatorChar && (path.Length <= 2 || !IsDirectorySeparator(path[2]))) 375return path.Length >= 2 && 386return path.Length >= 3 && path[1] == VolumeSeparatorChar && IsDirectorySeparator(path[2]); 440char c = root[root.Length - 1]; 479if (path.Length > 0 && IsDirectorySeparator(path[path.Length - 1])) 481return path.Substring(0, path.Length - 1); 608return parentPath.Length > 0 609&& childPath.Length > parentPath.Length 610&& PathsEqual(childPath, parentPath, parentPath.Length) 611&& (IsDirectorySeparator(parentPath[parentPath.Length - 1]) || IsDirectorySeparator(childPath[parentPath.Length])); 616var relativePath = childPath.Substring(parentPath.Length); 619int start = ConsumeDirectorySeparators(relativePath, relativePath.Length, 0); 648return PathsEqual(path1, path2, Math.Max(path1.Length, path2.Length)); 656if (path1.Length < length || path2.Length < length) 714if (!(oldPrefix?.Length > 0)) continue; 723var replacement = replacementPrefix + filePath.Substring(oldPrefix.Length); 841if (!isDriveRooted && !(p.Length > 1 && p[0] == AltDirectorySeparatorChar))
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\Dependencies\Collections\Extensions\IEnumerableExtensions.cs (2)
213return str.Length == 0; 236return source.Length == 0;
Microsoft.CodeAnalysis.LanguageServer (1)
HostWorkspace\ProjectTelemetry\VsTfmAndFileExtHashingAlgorithm.cs (1)
61for (var i = 0; i < cleartext.Length; i++)
Microsoft.CodeAnalysis.LanguageServer.Protocol (19)
Extensions\ProtocolConversions.cs (1)
282for (var i = 0; i < filePath.Length; i++)
Handler\Completion\CompletionResultFactory.cs (2)
162else if (typedText.Length == 0 && item.Rules.SelectionBehavior != CompletionItemSelectionBehavior.HardSelection) 718if (relativeCaretPosition >= 0 && relativeCaretPosition <= newText.Length)
Handler\InlayHint\InlayHintHandler.cs (8)
124leftPadding = first.Text.Length - trimStart.Length != 0; 125rightPadding = trimStart.Length - trimBoth.Length != 0; 132leftPadding = first.Text.Length - trimStart.Length != 0; 140rightPadding = last.Text.Length - trimEnd.Length != 0;
Handler\InlineCompletions\InlineCompletionsHandler.cs (7)
187var snippetEndPosition = textChange.Span.Start + textChange.NewText!.Length; 237var amountToAdjust = textChangesBefore.Sum(t => t.NewText!.Length - t.Span.Length); 286part = await functionPart.WithSnippetFunctionResultAsync(documentWithDefaultSnippet, new TextSpan(locationInDefaultSnippet, part.DefaultText.Length), simplifierOptions, cancellationToken).ConfigureAwait(false); 292var fieldSpan = new TextSpan(locationInFinalSnippet, part.DefaultText.Length); 297caretSpan = new TextSpan(locationInFinalSnippet, cursorPart.DefaultText.Length); 301locationInFinalSnippet += part.DefaultText.Length; 305locationInDefaultSnippet += originalPart.DefaultText.Length;
Handler\InlineCompletions\XmlSnippetParser.CodeSnippet.cs (1)
186while (currentCharIndex < _code!.Length)
Microsoft.CodeAnalysis.PerformanceSensitiveAnalyzers (201)
src\Compilers\Core\Portable\FileSystem\FileUtilities.cs (2)
133if (path!.Length == 1) 175Debug.Assert(path.Length == 1 || !PathUtilities.IsDirectorySeparator(path[1]));
src\Compilers\Core\Portable\FileSystem\PathUtilities.cs (36)
52int lastSeparator = s.Length; 58if (lastSeparator != s.Length) 71if (s.Length == 0 || IsAnyDirectorySeparator(s[s.Length - 1])) 138var rootLength = GetPathRoot(path, isUnixLike).Length; 139if (path.Length > rootLength) 141var i = path.Length; 212int length = path.Length; 287return path.Length > 0 && IsDirectorySeparator(path[0]) 314if (path.Length > 0 && path[0] == '.') 316if (path.Length == 1 || IsDirectorySeparator(path[1])) 323if (path.Length == 2 || IsDirectorySeparator(path[2])) 334if (path.Length >= 1 && IsDirectorySeparator(path[0])) 341if (path.Length >= 2 && path[1] == VolumeSeparatorChar && (path.Length <= 2 || !IsDirectorySeparator(path[2]))) 375return path.Length >= 2 && 386return path.Length >= 3 && path[1] == VolumeSeparatorChar && IsDirectorySeparator(path[2]); 440char c = root[root.Length - 1]; 479if (path.Length > 0 && IsDirectorySeparator(path[path.Length - 1])) 481return path.Substring(0, path.Length - 1); 608return parentPath.Length > 0 609&& childPath.Length > parentPath.Length 610&& PathsEqual(childPath, parentPath, parentPath.Length) 611&& (IsDirectorySeparator(parentPath[parentPath.Length - 1]) || IsDirectorySeparator(childPath[parentPath.Length])); 616var relativePath = childPath.Substring(parentPath.Length); 619int start = ConsumeDirectorySeparators(relativePath, relativePath.Length, 0); 648return PathsEqual(path1, path2, Math.Max(path1.Length, path2.Length)); 656if (path1.Length < length || path2.Length < length) 714if (!(oldPrefix?.Length > 0)) continue; 723var replacement = replacementPrefix + filePath.Substring(oldPrefix.Length); 841if (!isDriveRooted && !(p.Length > 1 && p[0] == AltDirectorySeparatorChar))
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\Compilers\Core\Portable\InternalUtilities\StringExtensions.cs (15)
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.Substring(0, name.Length - AttributeSuffix.Length); 165return name.Length > AttributeSuffix.Length && name.EndsWith(AttributeSuffix, comparison); 171while (i < str.Length) 178if (i < str.Length && char.IsLowSurrogate(str[i])) 208if (arg.Length > 1 && arg[0] == '"' && arg[arg.Length - 1] == '"') 211return arg.Substring(1, arg.Length - 2); 223while (x < string1.Length && x < string2.Length && 235while (x < string1.Length && x < string2.Length &&
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\Compilers\Core\Portable\InternalUtilities\UnicodeCharacterUtilities.cs (1)
103int nameLength = name.Length;
src\Compilers\Core\Portable\Syntax\SyntaxTreeExtensions.cs (2)
95var n1 = s1.Length; 96var n2 = s2.Length;
src\Compilers\Core\Portable\Text\TextChangeRangeExtensions.cs (1)
105return new TextChangeRange(textChange.Span, textChange.NewText?.Length ?? 0);
src\Dependencies\Collections\Extensions\IEnumerableExtensions.cs (2)
213return str.Length == 0; 236return source.Length == 0;
src\RoslynAnalyzers\Utilities\Compiler\CodeMetrics\CodeAnalysisMetricData.cs (1)
141if (index >= 0 && index < symbolName.Length)
src\RoslynAnalyzers\Utilities\Compiler\Extensions\StringExtensions.cs (1)
15return Encoding.UTF8.GetByteCount(value) == value.Length;
src\RoslynAnalyzers\Utilities\Compiler\Options\AnalyzerOptionsExtensions.cs (2)
359if (trimmedSuffix.Length >= 2 && 363for (int i = 1; i < trimmedSuffix.Length - 2; i++)
src\RoslynAnalyzers\Utilities\Compiler\Options\SymbolNamesWithValueOption.cs (2)
109parts.SymbolName.Length == 1)) 145Debug.Assert(parts.SymbolName.Length >= 2);
src\RoslynAnalyzers\Utilities\Compiler\RulesetToEditorconfigConverter.cs (2)
208if (comment.Length > 0) 213if (trimmedCommentPart.Length > 0)
src\RoslynAnalyzers\Utilities\Compiler\WellKnownTypeProvider.cs (1)
220for (int i = 0; i < fullTypeName.Length; i++)
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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\CodeGeneration\ParameterName.cs (1)
42BestNameForParameter = trimmed.Length > 0 ? tryMakeCamelCase ? trimmed.ToCamelCase() : trimmed : nameBasedOnArgument;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EditorConfig\Parsing\Sections\SectionMatcher.Lexer.cs (5)
15public readonly bool IsDone => Position >= headerText.Length; 54if (position < headerText.Length) 85if (position < headerText.Length && 113if (position >= headerText.Length) 171return str.Length == 0 || str == "-"
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\VirtualChars\AbstractVirtualCharService.cs (8)
31if (index + 1 < tokenText.Length) 117Debug.Assert(lastVC.Span.End == token.Span.End - "\"".Length, "Last span has to end right before the end of the string token."); 121Debug.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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\VirtualChars\AbstractVirtualCharService.ITextInfo.cs (1)
30public readonly int Length(string text) => text.Length;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\VirtualChars\VirtualCharSequence.Chunks.cs (3)
84public override int Length => data.Length; 89if (stringIndex < 0 || stringIndex >= data.Length) 104Debug.Assert(index + 1 >= data.Length ||
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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\TokenStream.cs (2)
337length = text.ConvertTabToSpace(_options.TabSize, initialColumn, text.Length); 341length = text.Length;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\TreeData.Node.cs (1)
30return lineText.GetColumnFromLineOffset(lineText.Length, tabSize);
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\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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\Naming\IdentifierNameParts.cs (2)
47? newBaseName[prefix.Length..] 53? newBaseName[..^suffix.Length]
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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\NamingStyle.WordSpanEnumerator.cs (1)
52Current = new TextSpan(Current.End + _wordSeparator.Length, 0);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Serialization\ObjectWriter.cs (2)
504var bytes = new byte[(uint)value.Length * sizeof(char)]; 510WriteCompressedUInt((uint)value.Length);
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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\SyntaxFacts\ISyntaxFactsExtensions.cs (2)
251if (name.Length == 0) 261for (var i = 1; i < name.Length; i++)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.cs (1)
198Debug.Assert(reader.Position == symbolKey.Length);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.SymbolKeyReader.cs (1)
259while (Position < Data.Length)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\Base64Utilities.cs (2)
329decodedLength = (encodedString.Length * 3) / 4 - padding; 336var index = attributeData.Length - 1;
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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\BKTree.cs (4)
74Span<char> lowerCaseCharacters = value.Length < 512 75? stackalloc char[value.Length] 76: new char[value.Length]; 78for (var i = 0; i < value.Length; i++)
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++) 89Span<char> 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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\PathMetadataUtilities.cs (2)
31if (rootNamespace is { Length: > 0 } && 69@namespace = @namespace[(rootNamespace.Length + 1)..];
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\StringBreaker.cs (2)
24for (var start = 0; start < text.Length;) 42var length = identifier.Length;
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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\WordSimilarityChecker.cs (6)
80=> value.Length <= 4 ? 1 : 2; 87if (_source.Length < 3) 113if (Math.Abs(_source.Length - candidateText.Length) <= _threshold) 142var lengthDifference = Math.Abs(originalText.Length - candidateText.Length);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\ISymbolExtensions.cs (1)
795(symbol.Name.Length == 1 || uint.TryParse(symbol.Name[1..], out _) || symbol.Name.All(n => n.Equals('_')));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\ITypeSymbolExtensions.cs (1)
363return shortName.Length == 0
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Extensions\ProjectExtensions.cs (2)
75analyzerConfigDirectory.Length > bestPath.Length)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Extensions\SyntaxGeneratorExtensions_CreateEqualsMethod.cs (1)
366if (name.Length > 0)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\LanguageServices\TypeInferenceService\AbstractTypeInferenceService.cs (3)
67if (name.Length == prefix.Length) 72var nextChar = name[prefix.Length];
Microsoft.CodeAnalysis.PublicApiAnalyzers (196)
DeclarePublicApiAnalyzer.cs (1)
186var removedText = text[RemovedApiPrefix.Length..];
src\Compilers\Core\Portable\FileSystem\FileUtilities.cs (2)
133if (path!.Length == 1) 175Debug.Assert(path.Length == 1 || !PathUtilities.IsDirectorySeparator(path[1]));
src\Compilers\Core\Portable\FileSystem\PathUtilities.cs (36)
52int lastSeparator = s.Length; 58if (lastSeparator != s.Length) 71if (s.Length == 0 || IsAnyDirectorySeparator(s[s.Length - 1])) 138var rootLength = GetPathRoot(path, isUnixLike).Length; 139if (path.Length > rootLength) 141var i = path.Length; 212int length = path.Length; 287return path.Length > 0 && IsDirectorySeparator(path[0]) 314if (path.Length > 0 && path[0] == '.') 316if (path.Length == 1 || IsDirectorySeparator(path[1])) 323if (path.Length == 2 || IsDirectorySeparator(path[2])) 334if (path.Length >= 1 && IsDirectorySeparator(path[0])) 341if (path.Length >= 2 && path[1] == VolumeSeparatorChar && (path.Length <= 2 || !IsDirectorySeparator(path[2]))) 375return path.Length >= 2 && 386return path.Length >= 3 && path[1] == VolumeSeparatorChar && IsDirectorySeparator(path[2]); 440char c = root[root.Length - 1]; 479if (path.Length > 0 && IsDirectorySeparator(path[path.Length - 1])) 481return path.Substring(0, path.Length - 1); 608return parentPath.Length > 0 609&& childPath.Length > parentPath.Length 610&& PathsEqual(childPath, parentPath, parentPath.Length) 611&& (IsDirectorySeparator(parentPath[parentPath.Length - 1]) || IsDirectorySeparator(childPath[parentPath.Length])); 616var relativePath = childPath.Substring(parentPath.Length); 619int start = ConsumeDirectorySeparators(relativePath, relativePath.Length, 0); 648return PathsEqual(path1, path2, Math.Max(path1.Length, path2.Length)); 656if (path1.Length < length || path2.Length < length) 714if (!(oldPrefix?.Length > 0)) continue; 723var replacement = replacementPrefix + filePath.Substring(oldPrefix.Length); 841if (!isDriveRooted && !(p.Length > 1 && p[0] == AltDirectorySeparatorChar))
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\Compilers\Core\Portable\InternalUtilities\StringExtensions.cs (15)
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.Substring(0, name.Length - AttributeSuffix.Length); 165return name.Length > AttributeSuffix.Length && name.EndsWith(AttributeSuffix, comparison); 171while (i < str.Length) 178if (i < str.Length && char.IsLowSurrogate(str[i])) 208if (arg.Length > 1 && arg[0] == '"' && arg[arg.Length - 1] == '"') 211return arg.Substring(1, arg.Length - 2); 223while (x < string1.Length && x < string2.Length && 235while (x < string1.Length && x < string2.Length &&
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\Compilers\Core\Portable\InternalUtilities\UnicodeCharacterUtilities.cs (1)
103int nameLength = name.Length;
src\Compilers\Core\Portable\Syntax\SyntaxTreeExtensions.cs (2)
95var n1 = s1.Length; 96var n2 = s2.Length;
src\Compilers\Core\Portable\Text\TextChangeRangeExtensions.cs (1)
105return new TextChangeRange(textChange.Span, textChange.NewText?.Length ?? 0);
src\Dependencies\Collections\Extensions\IEnumerableExtensions.cs (2)
213return str.Length == 0; 236return source.Length == 0;
src\RoslynAnalyzers\Utilities\Compiler\CodeMetrics\CodeAnalysisMetricData.cs (1)
141if (index >= 0 && index < symbolName.Length)
src\RoslynAnalyzers\Utilities\Compiler\Extensions\StringExtensions.cs (1)
15return Encoding.UTF8.GetByteCount(value) == value.Length;
src\RoslynAnalyzers\Utilities\Compiler\Options\AnalyzerOptionsExtensions.cs (2)
359if (trimmedSuffix.Length >= 2 && 363for (int i = 1; i < trimmedSuffix.Length - 2; i++)
src\RoslynAnalyzers\Utilities\Compiler\Options\SymbolNamesWithValueOption.cs (2)
109parts.SymbolName.Length == 1)) 145Debug.Assert(parts.SymbolName.Length >= 2);
src\RoslynAnalyzers\Utilities\Compiler\RulesetToEditorconfigConverter.cs (2)
208if (comment.Length > 0) 213if (trimmedCommentPart.Length > 0)
src\RoslynAnalyzers\Utilities\Compiler\WellKnownTypeProvider.cs (1)
220for (int i = 0; i < fullTypeName.Length; i++)
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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\CodeGeneration\ParameterName.cs (1)
42BestNameForParameter = trimmed.Length > 0 ? tryMakeCamelCase ? trimmed.ToCamelCase() : trimmed : nameBasedOnArgument;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EditorConfig\Parsing\Sections\SectionMatcher.Lexer.cs (5)
15public readonly bool IsDone => Position >= headerText.Length; 54if (position < headerText.Length) 85if (position < headerText.Length && 113if (position >= headerText.Length) 171return str.Length == 0 || str == "-"
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\VirtualChars\AbstractVirtualCharService.cs (8)
31if (index + 1 < tokenText.Length) 117Debug.Assert(lastVC.Span.End == token.Span.End - "\"".Length, "Last span has to end right before the end of the string token."); 121Debug.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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\VirtualChars\AbstractVirtualCharService.ITextInfo.cs (1)
30public readonly int Length(string text) => text.Length;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\VirtualChars\VirtualCharSequence.Chunks.cs (3)
84public override int Length => data.Length; 89if (stringIndex < 0 || stringIndex >= data.Length) 104Debug.Assert(index + 1 >= data.Length ||
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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\TokenStream.cs (2)
337length = text.ConvertTabToSpace(_options.TabSize, initialColumn, text.Length); 341length = text.Length;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\TreeData.Node.cs (1)
30return lineText.GetColumnFromLineOffset(lineText.Length, tabSize);
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\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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\Naming\IdentifierNameParts.cs (2)
47? newBaseName[prefix.Length..] 53? newBaseName[..^suffix.Length]
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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\NamingStyle.WordSpanEnumerator.cs (1)
52Current = new TextSpan(Current.End + _wordSeparator.Length, 0);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Serialization\ObjectWriter.cs (2)
504var bytes = new byte[(uint)value.Length * sizeof(char)]; 510WriteCompressedUInt((uint)value.Length);
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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\SyntaxFacts\ISyntaxFactsExtensions.cs (2)
251if (name.Length == 0) 261for (var i = 1; i < name.Length; i++)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.cs (1)
198Debug.Assert(reader.Position == symbolKey.Length);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.SymbolKeyReader.cs (1)
259while (Position < Data.Length)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\Base64Utilities.cs (2)
329decodedLength = (encodedString.Length * 3) / 4 - padding; 336var index = attributeData.Length - 1;
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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\BKTree.cs (4)
74Span<char> lowerCaseCharacters = value.Length < 512 75? stackalloc char[value.Length] 76: new char[value.Length]; 78for (var i = 0; i < value.Length; i++)
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++) 89Span<char> 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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\PathMetadataUtilities.cs (2)
31if (rootNamespace is { Length: > 0 } && 69@namespace = @namespace[(rootNamespace.Length + 1)..];
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\StringBreaker.cs (2)
24for (var start = 0; start < text.Length;) 42var length = identifier.Length;
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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\WordSimilarityChecker.cs (6)
80=> value.Length <= 4 ? 1 : 2; 87if (_source.Length < 3) 113if (Math.Abs(_source.Length - candidateText.Length) <= _threshold) 142var lengthDifference = Math.Abs(originalText.Length - candidateText.Length);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\ISymbolExtensions.cs (1)
795(symbol.Name.Length == 1 || uint.TryParse(symbol.Name[1..], out _) || symbol.Name.All(n => n.Equals('_')));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\ITypeSymbolExtensions.cs (1)
363return shortName.Length == 0
Microsoft.CodeAnalysis.PublicApiAnalyzers.CodeFixes (1)
DeclarePublicApiFix.cs (1)
293if (siblingNamesToRemove is { Length: > 0 })
Microsoft.CodeAnalysis.PublicApiAnalyzers.UnitTests (66)
DeclarePublicAPIAnalyzerTestsBase.cs (66)
290expectedDiagnostics = [GetCSharpResultAt(2, 8 + EnabledModifierCSharp.Length, DeclareNewApiRule, "C")]; 305var expectedDiagnostics = new[] { GetCSharpResultAt(2, 8 + EnabledModifierCSharp.Length, DeclareNewApiRule, "C") }; 328""", @"", @"", GetCSharpResultAt(2, 8 + EnabledModifierCSharp.Length, DeclareNewApiRule, "C")); 354GetCSharpResultAt(2, 8 + EnabledModifierCSharp.Length, DeclareNewApiRule, "C"), 356GetCSharpResultAt(2, 8 + EnabledModifierCSharp.Length, DeclareNewApiRule, "C.C() -> void"), 358GetCSharpResultAt(4, 10 + EnabledModifierCSharp.Length, DeclareNewApiRule, "C.Field -> int"), 360GetCSharpResultAt(5, 21 + EnabledModifierCSharp.Length, DeclareNewApiRule, "C.Property.get -> int"), 362GetCSharpResultAt(5, 26 + EnabledModifierCSharp.Length, DeclareNewApiRule, "C.Property.set -> void"), 364GetCSharpResultAt(6, 11 + EnabledModifierCSharp.Length, DeclareNewApiRule, "C.Method() -> void"), 366GetCSharpResultAt(7, 37 + EnabledModifierCSharp.Length, DeclareNewApiRule, "C.ArrowExpressionProperty.get -> int")); 385GetCSharpResultAt(2, 8 + EnabledModifierCSharp.Length, DeclareNewApiRule, "C"), 387GetCSharpResultAt(2, 8 + EnabledModifierCSharp.Length, DeclareNewApiRule, "C.C() -> void"), 389GetCSharpResultAt(4, 14 + EnabledModifierCSharp.Length, DeclareNewApiRule, $"C.Field -> {message}"), 391GetCSharpResultAt(5, 25 + EnabledModifierCSharp.Length, DeclareNewApiRule, $"C.Property.get -> {message}"), 393GetCSharpResultAt(5, 30 + EnabledModifierCSharp.Length, DeclareNewApiRule, "C.Property.set -> void"), 395GetCSharpResultAt(6, 11 + EnabledModifierCSharp.Length, DeclareNewApiRule, $"C.Method({message} p) -> void"), 397GetCSharpResultAt(7, 41 + EnabledModifierCSharp.Length, DeclareNewApiRule, $"C.ArrowExpressionProperty.get -> {message}")); 545GetCSharpResultAt(2, 8 + EnabledModifierCSharp.Length, DeclareNewApiRule, "C.C() -> void")); 706var secondDiagnostic = new[] { GetCSharpResultAt(6, 11 + EnabledModifierCSharp.Length, DeclareNewApiRule, "C.Method() -> void") }; 1221GetCSharpResultAt(21, 11 + EnabledModifierCSharp.Length, OverloadWithOptionalParametersShouldHaveMostParameters, "Method4", OverloadWithOptionalParametersShouldHaveMostParameters.HelpLinkUri), 1223GetCSharpResultAt(26, 11 + EnabledModifierCSharp.Length, OverloadWithOptionalParametersShouldHaveMostParameters, "Method5", OverloadWithOptionalParametersShouldHaveMostParameters.HelpLinkUri), 1225GetCSharpResultAt(31, 11 + EnabledModifierCSharp.Length, OverloadWithOptionalParametersShouldHaveMostParameters, "Method6", OverloadWithOptionalParametersShouldHaveMostParameters.HelpLinkUri), 1227GetCSharpResultAt(32, 11 + EnabledModifierCSharp.Length, OverloadWithOptionalParametersShouldHaveMostParameters, "Method6", OverloadWithOptionalParametersShouldHaveMostParameters.HelpLinkUri) 1342GetCSharpResultAt(4, 13 + EnabledModifierCSharp.Length, AnnotateApiRule, "C.Field -> string"), 1343GetCSharpResultAt(4, 13 + EnabledModifierCSharp.Length, ObliviousApiRule, "Field"), 1344GetCSharpResultAt(5, 24 + EnabledModifierCSharp.Length, AnnotateApiRule, "C.Property.get -> string"), 1345GetCSharpResultAt(5, 24 + EnabledModifierCSharp.Length, ObliviousApiRule, "Property.get"), 1346GetCSharpResultAt(5, 29 + EnabledModifierCSharp.Length, AnnotateApiRule, "C.Property.set -> void"), 1347GetCSharpResultAt(5, 29 + EnabledModifierCSharp.Length, ObliviousApiRule, "Property.set"), 1348GetCSharpResultAt(6, 13 + EnabledModifierCSharp.Length, AnnotateApiRule, "C.Method(string x) -> string"), 1349GetCSharpResultAt(6, 13 + EnabledModifierCSharp.Length, ObliviousApiRule, "Method"), 1350GetCSharpResultAt(7, 40 + EnabledModifierCSharp.Length, AnnotateApiRule, "C.ArrowExpressionProperty.get -> string"), 1351GetCSharpResultAt(7, 40 + EnabledModifierCSharp.Length, ObliviousApiRule, "ArrowExpressionProperty.get") 1377GetCSharpResultAt(4, 14 + EnabledModifierCSharp.Length, AnnotateApiRule, $"C.Field -> {annotated}"), 1378GetCSharpResultAt(5, 25 + EnabledModifierCSharp.Length, AnnotateApiRule, $"C.Property.get -> {annotated}"), 1379GetCSharpResultAt(6, 14 + EnabledModifierCSharp.Length, AnnotateApiRule, $"C.Method({annotated} x) -> {annotated}"), 1380GetCSharpResultAt(7, 41 + EnabledModifierCSharp.Length, AnnotateApiRule, $"C.ArrowExpressionProperty.get -> {annotated}")); 1427GetCSharpResultAt(4, 13 + EnabledModifierCSharp.Length, ObliviousApiRule, "Field"), 1429GetCSharpResultAt(9, 24 + EnabledModifierCSharp.Length, ObliviousApiRule, "Property.get"), 1430GetCSharpResultAt(9, 29 + EnabledModifierCSharp.Length, ObliviousApiRule, "Property.set"), 1431GetCSharpResultAt(10, 11 + EnabledModifierCSharp.Length, ObliviousApiRule, "Method"), 1432GetCSharpResultAt(11, 13 + EnabledModifierCSharp.Length, ObliviousApiRule, "Method2"), 1433GetCSharpResultAt(12, 40 + EnabledModifierCSharp.Length, ObliviousApiRule, "ArrowExpressionProperty.get"), 1435GetCSharpResultAt(20, 30 + EnabledModifierCSharp.Length, ObliviousApiRule, "this.get"), 1436GetCSharpResultAt(20, 50 + EnabledModifierCSharp.Length, ObliviousApiRule, "this.set") 1469GetCSharpResultAt(4, 11 + EnabledModifierCSharp.Length, ObliviousApiRule, "M<T>"), 1470GetCSharpResultAt(11, 8 + EnabledModifierCSharp.Length, ObliviousApiRule, "D<T>"), 1471GetCSharpResultAt(12, 25 + EnabledModifierCSharp.Length, ObliviousApiRule, "F<T>") 1525GetCSharpResultAt(5, 11 + EnabledModifierCSharp.Length, ObliviousApiRule, "M1<T>"), 1526GetCSharpResultAt(6, 11 + EnabledModifierCSharp.Length, ObliviousApiRule, "M2<T>"), 1527GetCSharpResultAt(7, 11 + EnabledModifierCSharp.Length, ObliviousApiRule, "M3<T, U>") 1554GetCSharpResultAt(6, 11 + EnabledModifierCSharp.Length, ObliviousApiRule, "M1<T>") 1649GetCSharpResultAt(7, 13 + EnabledModifierCSharp.Length, ObliviousApiRule, "field") 1697GetCSharpResultAt(10, 12 + EnabledModifierCSharp.Length, DeclareNewApiRule, "Other.Namespace.D"), 1699GetCSharpResultAt(12, 10 + EnabledModifierCSharp.Length, DeclareNewApiRule, "Other.Namespace.D.D() -> void")); 1735GetCSharpResultAt(line: 3, 12 + EnabledModifierCSharp.Length, DeclareNewApiRule, "My.Namespace.C"), 1737GetCSharpResultAt(5, 10 + EnabledModifierCSharp.Length, DeclareNewApiRule, "My.Namespace.C.C() -> void")); 2101GetCSharpResultAt(5, 13 + EnabledModifierCSharp.Length, AnnotateApiRule, "C.ObliviousField -> string"), 2103GetCSharpResultAt(5, 13 + EnabledModifierCSharp.Length, ObliviousApiRule, "ObliviousField") 2120GetCSharpResultAt(3, 15 + EnabledModifierCSharp.Length, DeclareNewApiRule, "C"), 2122GetCSharpResultAt(5, 18 + EnabledModifierCSharp.Length, DeclareNewApiRule, "static C.M<T>() -> void") 2136GetCSharpResultAt(3, 15 + EnabledModifierCSharp.Length, DeclareNewApiRule, "C<T>") 2155GetCSharpResultAt(3, 15 + EnabledModifierCSharp.Length, DeclareNewApiRule, "~C<T1, T2>"), 2157GetCSharpResultAt(3, 15 + EnabledModifierCSharp.Length, ObliviousApiRule, "C<T1, T2>") 2176GetCSharpResultAt(3, 15 + EnabledModifierCSharp.Length, DeclareNewApiRule, "~C<T>"), 2178GetCSharpResultAt(3, 15 + EnabledModifierCSharp.Length, ObliviousApiRule, "C<T>")
Microsoft.CodeAnalysis.Rebuild (1)
CompilationOptionsReader.cs (1)
466if (value is null or { Length: 0 })
Microsoft.CodeAnalysis.Remote.ServiceHub (1)
Host\TestUtils.cs (1)
77if (result.Length > 0)
Microsoft.CodeAnalysis.Remote.Workspaces (6)
BrokeredServiceDescriptors.cs (2)
26name => CommonMethodNameTransforms.CamelCase(name.EndsWith(AsyncSuffix, StringComparison.OrdinalIgnoreCase) ? name.Substring(0, name.Length - AsyncSuffix.Length) : name);
ServiceDescriptors.cs (4)
119return interfaceName.Substring(InterfaceNamePrefix.Length, interfaceName.Length - InterfaceNamePrefix.Length - InterfaceNameSuffix.Length);
Microsoft.CodeAnalysis.ResxSourceGenerator (200)
AbstractResxGenerator.cs (5)
417if (name.Length == 0) 423var docCommentString = value.Length > maxDocCommentLength ? value.Substring(0, maxDocCommentLength) + " ..." : value; 732var builder = new StringBuilder(name.Length); 795var stringLiteral = new StringBuilder(original.Length + 3); 802for (var i = 0; i < original.Length; i++)
src\Compilers\Core\Portable\FileSystem\FileUtilities.cs (2)
133if (path!.Length == 1) 175Debug.Assert(path.Length == 1 || !PathUtilities.IsDirectorySeparator(path[1]));
src\Compilers\Core\Portable\FileSystem\PathUtilities.cs (36)
52int lastSeparator = s.Length; 58if (lastSeparator != s.Length) 71if (s.Length == 0 || IsAnyDirectorySeparator(s[s.Length - 1])) 138var rootLength = GetPathRoot(path, isUnixLike).Length; 139if (path.Length > rootLength) 141var i = path.Length; 212int length = path.Length; 287return path.Length > 0 && IsDirectorySeparator(path[0]) 314if (path.Length > 0 && path[0] == '.') 316if (path.Length == 1 || IsDirectorySeparator(path[1])) 323if (path.Length == 2 || IsDirectorySeparator(path[2])) 334if (path.Length >= 1 && IsDirectorySeparator(path[0])) 341if (path.Length >= 2 && path[1] == VolumeSeparatorChar && (path.Length <= 2 || !IsDirectorySeparator(path[2]))) 375return path.Length >= 2 && 386return path.Length >= 3 && path[1] == VolumeSeparatorChar && IsDirectorySeparator(path[2]); 440char c = root[root.Length - 1]; 479if (path.Length > 0 && IsDirectorySeparator(path[path.Length - 1])) 481return path.Substring(0, path.Length - 1); 608return parentPath.Length > 0 609&& childPath.Length > parentPath.Length 610&& PathsEqual(childPath, parentPath, parentPath.Length) 611&& (IsDirectorySeparator(parentPath[parentPath.Length - 1]) || IsDirectorySeparator(childPath[parentPath.Length])); 616var relativePath = childPath.Substring(parentPath.Length); 619int start = ConsumeDirectorySeparators(relativePath, relativePath.Length, 0); 648return PathsEqual(path1, path2, Math.Max(path1.Length, path2.Length)); 656if (path1.Length < length || path2.Length < length) 714if (!(oldPrefix?.Length > 0)) continue; 723var replacement = replacementPrefix + filePath.Substring(oldPrefix.Length); 841if (!isDriveRooted && !(p.Length > 1 && p[0] == AltDirectorySeparatorChar))
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\Compilers\Core\Portable\InternalUtilities\StringExtensions.cs (15)
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.Substring(0, name.Length - AttributeSuffix.Length); 165return name.Length > AttributeSuffix.Length && name.EndsWith(AttributeSuffix, comparison); 171while (i < str.Length) 178if (i < str.Length && char.IsLowSurrogate(str[i])) 208if (arg.Length > 1 && arg[0] == '"' && arg[arg.Length - 1] == '"') 211return arg.Substring(1, arg.Length - 2); 223while (x < string1.Length && x < string2.Length && 235while (x < string1.Length && x < string2.Length &&
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\Compilers\Core\Portable\InternalUtilities\UnicodeCharacterUtilities.cs (1)
103int nameLength = name.Length;
src\Compilers\Core\Portable\Syntax\SyntaxTreeExtensions.cs (2)
95var n1 = s1.Length; 96var n2 = s2.Length;
src\Compilers\Core\Portable\Text\TextChangeRangeExtensions.cs (1)
105return new TextChangeRange(textChange.Span, textChange.NewText?.Length ?? 0);
src\Dependencies\Collections\Extensions\IEnumerableExtensions.cs (2)
213return str.Length == 0; 236return source.Length == 0;
src\RoslynAnalyzers\Utilities\Compiler\CodeMetrics\CodeAnalysisMetricData.cs (1)
141if (index >= 0 && index < symbolName.Length)
src\RoslynAnalyzers\Utilities\Compiler\Extensions\StringExtensions.cs (1)
15return Encoding.UTF8.GetByteCount(value) == value.Length;
src\RoslynAnalyzers\Utilities\Compiler\Options\AnalyzerOptionsExtensions.cs (2)
359if (trimmedSuffix.Length >= 2 && 363for (int i = 1; i < trimmedSuffix.Length - 2; i++)
src\RoslynAnalyzers\Utilities\Compiler\Options\SymbolNamesWithValueOption.cs (2)
109parts.SymbolName.Length == 1)) 145Debug.Assert(parts.SymbolName.Length >= 2);
src\RoslynAnalyzers\Utilities\Compiler\RulesetToEditorconfigConverter.cs (2)
208if (comment.Length > 0) 213if (trimmedCommentPart.Length > 0)
src\RoslynAnalyzers\Utilities\Compiler\WellKnownTypeProvider.cs (1)
220for (int i = 0; i < fullTypeName.Length; i++)
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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\CodeGeneration\ParameterName.cs (1)
42BestNameForParameter = trimmed.Length > 0 ? tryMakeCamelCase ? trimmed.ToCamelCase() : trimmed : nameBasedOnArgument;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EditorConfig\Parsing\Sections\SectionMatcher.Lexer.cs (5)
15public readonly bool IsDone => Position >= headerText.Length; 54if (position < headerText.Length) 85if (position < headerText.Length && 113if (position >= headerText.Length) 171return str.Length == 0 || str == "-"
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\VirtualChars\AbstractVirtualCharService.cs (8)
31if (index + 1 < tokenText.Length) 117Debug.Assert(lastVC.Span.End == token.Span.End - "\"".Length, "Last span has to end right before the end of the string token."); 121Debug.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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\VirtualChars\AbstractVirtualCharService.ITextInfo.cs (1)
30public readonly int Length(string text) => text.Length;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\VirtualChars\VirtualCharSequence.Chunks.cs (3)
84public override int Length => data.Length; 89if (stringIndex < 0 || stringIndex >= data.Length) 104Debug.Assert(index + 1 >= data.Length ||
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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\TokenStream.cs (2)
337length = text.ConvertTabToSpace(_options.TabSize, initialColumn, text.Length); 341length = text.Length;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\TreeData.Node.cs (1)
30return lineText.GetColumnFromLineOffset(lineText.Length, tabSize);
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\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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\Naming\IdentifierNameParts.cs (2)
47? newBaseName[prefix.Length..] 53? newBaseName[..^suffix.Length]
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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\NamingStyle.WordSpanEnumerator.cs (1)
52Current = new TextSpan(Current.End + _wordSeparator.Length, 0);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Serialization\ObjectWriter.cs (2)
504var bytes = new byte[(uint)value.Length * sizeof(char)]; 510WriteCompressedUInt((uint)value.Length);
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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\SyntaxFacts\ISyntaxFactsExtensions.cs (2)
251if (name.Length == 0) 261for (var i = 1; i < name.Length; i++)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.cs (1)
198Debug.Assert(reader.Position == symbolKey.Length);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.SymbolKeyReader.cs (1)
259while (Position < Data.Length)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\Base64Utilities.cs (2)
329decodedLength = (encodedString.Length * 3) / 4 - padding; 336var index = attributeData.Length - 1;
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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\BKTree.cs (4)
74Span<char> lowerCaseCharacters = value.Length < 512 75? stackalloc char[value.Length] 76: new char[value.Length]; 78for (var i = 0; i < value.Length; i++)
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++) 89Span<char> 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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\PathMetadataUtilities.cs (2)
31if (rootNamespace is { Length: > 0 } && 69@namespace = @namespace[(rootNamespace.Length + 1)..];
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\StringBreaker.cs (2)
24for (var start = 0; start < text.Length;) 42var length = identifier.Length;
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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\WordSimilarityChecker.cs (6)
80=> value.Length <= 4 ? 1 : 2; 87if (_source.Length < 3) 113if (Math.Abs(_source.Length - candidateText.Length) <= _threshold) 142var lengthDifference = Math.Abs(originalText.Length - candidateText.Length);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\ISymbolExtensions.cs (1)
795(symbol.Name.Length == 1 || uint.TryParse(symbol.Name[1..], out _) || symbol.Name.All(n => n.Equals('_')));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\ITypeSymbolExtensions.cs (1)
363return shortName.Length == 0
Microsoft.CodeAnalysis.ResxSourceGenerator.UnitTests (6)
Verifiers\CSharpSourceGeneratorVerifier`1+Test.cs (3)
102if (!expectedNames.Contains(name.Substring(currentTestPrefix.Length))) 104throw new InvalidOperationException($"Unexpected test resource: {name.Substring(currentTestPrefix.Length)}"); 123var name = resourceName.Substring(expectedPrefix.Length);
Verifiers\VisualBasicSourceGeneratorVerifier`1+Test.cs (3)
87if (!expectedNames.Contains(name.Substring(currentTestPrefix.Length))) 89throw new InvalidOperationException($"Unexpected test resource: {name.Substring(currentTestPrefix.Length)}"); 108var name = resourceName.Substring(expectedPrefix.Length);
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\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.Test.Utilities (23)
Assert\ArtifactUploadUtil.cs (2)
97var destFilePath = filePath.Substring(directory.Length); 98if (destFilePath.Length > 0 && destFilePath[0] == Path.DirectorySeparatorChar)
Assert\AssertEx.cs (6)
432int n = first.Length, m = second.Length; 629if (trimmedLine.Length > 0) 732var result = new StringBuilder(str.Length); 735while (i < str.Length) 738if (c == '\r' && i < str.Length && str[i] == '\n')
Compilation\ControlFlowGraphVerifier.cs (1)
1827GetFlowGraph(_builder, _compilation, g, _region, $"#A{id}{_idSuffix}", _currentIndent.Length + 4, _associatedSymbol);
Compilation\OperationTreeVerifier.cs (5)
165if (lines.Length <= 1 && text.Length < 25) 173var prefix = firstLine.Length <= maxTokenLength ? firstLine : firstLine.Substring(0, maxTokenLength); 174var suffix = lastLine.Length <= maxTokenLength ? lastLine : lastLine.Substring(lastLine.Length - maxTokenLength, maxTokenLength); 202_currentIndent = _currentIndent.Substring(indent.Length);
FX\EnsureEnglishUICulture.cs (1)
20if (currentUICultureName.Length == 0 || currentUICultureName.StartsWith("en", StringComparison.OrdinalIgnoreCase))
MarkedSource\MarkupTestFile.cs (2)
118currentIndexInInput = matchIndexInInput + matchString.Length; 119inputOutputOffset += matchString.Length;
Metadata\ILValidation.cs (3)
481=> (text.Length < maxLength) ? text : text[..maxLength]; 484=> (text.Length < maxLength) ? text : text.Substring(text.Length - maxLength - 1, maxLength);
Metadata\MetadataValidation.cs (2)
147yield return (ns.Length == 0) ? name : (ns + "." + name); 159yield return (ns.Length == 0) ? name : (ns + "." + name);
TestHelpers.cs (1)
86for (int i = 0; i < text.Length; i++)
Microsoft.CodeAnalysis.Threading.Package (2)
src\Dependencies\Collections\Extensions\IEnumerableExtensions.cs (2)
213return str.Length == 0; 236return source.Length == 0;
Microsoft.CodeAnalysis.UnitTests (52)
CachingLookupTests.cs (1)
83return s.Substring(s.Length - 2);
Collections\ImmutableSegmentedDictionaryTest.cs (2)
311Assert.True(map.Keys.All((key, arg) => key.Length == arg, 1)); 324Assert.True(map.Values.All((key, arg) => key.Length == arg, 1));
Collections\RopeTests.cs (2)
110Assert.Equal(r.Length, concatted.Length); 112for (int i = 0; i < concatted.Length; i++)
EmbeddedTextTests.cs (3)
193AssertEx.Equal(BitConverter.GetBytes(Encoding.Unicode.GetPreamble().Length + LargeSource.Length * sizeof(char)), text.Blob.Take(4)); 203var actual = SourceText.From(new StringReader(SmallSource), SmallSource.Length, Encoding.UTF8, SourceHashAlgorithm.Sha1); 218var actual = SourceText.From(new StringReader(LargeSource), LargeSource.Length, Encoding.UTF8, SourceHashAlgorithm.Sha1);
MetadataReferences\MetadataHelpersTests.cs (2)
445"A".Length, 497nestedNS.Key.Length,
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))
StringTableTests.cs (2)
91var ptrResult = StringTable.TextEqualsASCII(str, new ReadOnlySpan<byte>(ptr, ascii.Length)); 93var substrResult = StringTable.TextEquals(str, "xxx" + ascii + "yyy", 3, ascii.Length);
Text\CompositeTextTests.cs (2)
58for (var sourceTextCount = minSourceTextCount; sourceTextCount <= Math.Min(maxSourceTextCount, contents.Length); sourceTextCount++) 79var maximalSourceTextLength = (contents.Length - requestedSourceTextCount) + 1;
Text\LargeTextTests.cs (11)
48Assert.Equal(HelloWorld.Length, text.Length); 66Assert.Throws<IndexOutOfRangeException>(() => text[HelloWorld.Length]); 67for (int i = HelloWorld.Length - 1; i >= 0; i--) 79char[] buffer = new char[HelloWorld.Length + destOffset]; 126char[] buffer = new char[HelloWorld.Length]; 127for (int start = 0; start < text.Length; start += HelloWorld.Length) 129text.CopyTo(start, buffer, 0, HelloWorld.Length); 201CheckLine(data, lineNumber: 0, start: 0, length: 3, newlineLength: newline.Length, lineText: "goo"); 202CheckLine(data, lineNumber: 1, start: 3 + newline.Length, length: 4, newlineLength: 0, lineText: " bar"); 214var newlineLength = Environment.NewLine.Length; 335var actualSourceText = CreateSourceText(actual, expected.Length);
Text\SourceTextStreamTests.cs (4)
51using (var stream = new SourceTextStream(sourceText, bufferSize: text.Length * 2)) 53var buffer = new byte[baseText.Length + 1]; 54Assert.Equal(baseText.Length, stream.Read(buffer, 0, buffer.Length)); 55Assert.True(buffer.Take(baseText.Length).SequenceEqual(encoding.GetBytes(baseText)));
Text\SourceTextTests.cs (10)
203using (var writer = new LargeTextWriter(encoding, checksumAlgorithm, source.Length)) 266allSourceTexts.Add(LargeText.Decode(new StringReader(randomText), randomText.Length, encoding, algorithm)); 356var actualSourceText = SourceText.From(actual, expected.Length); 360Assert.Same(s_utf8, SourceText.From(actual, expected.Length, s_utf8).Encoding); 361Assert.Same(s_unicode, SourceText.From(actual, expected.Length, s_unicode).Encoding); 362Assert.Null(SourceText.From(actual, expected.Length, null).Encoding); 372var actualSourceText = SourceText.From(actual, expected.Length); 379Assert.Same(s_utf8, SourceText.From(actual, expected.Length, s_utf8).Encoding); 380Assert.Same(s_unicode, SourceText.From(actual, expected.Length, s_unicode).Encoding); 381Assert.Null(SourceText.From(actual, expected.Length, null).Encoding);
Text\StringText_LineTest.cs (2)
23Assert.Equal(3 + newLine.Length, line.EndIncludingLineBreak); 100Assert.Equal(Environment.NewLine.Length, line.SpanIncludingLineBreak.Length);
Text\StringTextTest.cs (3)
154CheckLine(data, lineNumber: 0, start: 0, length: 3, newlineLength: newLine.Length, lineText: "goo"); 155CheckLine(data, lineNumber: 1, start: 3 + newLine.Length, length: 4, newlineLength: 0, lineText: " bar"); 167var newlineLength = Environment.NewLine.Length;
Text\StringTextTests_Default.cs (1)
61Assert.Equal(3 + newLine.Length, data.Lines[1].Span.Start);
Text\TextChangeTests.cs (4)
383Assert.Equal(str.Length + n, text.Length); 395for (int i = 0; i < str.Length; i++) 403Assert.Equal(str.Length, text.Length); 1005editedLength = editedLength - newChange.Span.Length + newChange.NewText.Length;
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)
562If unquoted.Length = 0 Then 811AddDiagnostic(diagnostics, ERRID.ERR_SwitchNeedsBool, name.Substring(0, name.Length - 1)) 820AddDiagnostic(diagnostics, ERRID.ERR_SwitchNeedsBool, name.Substring(0, name.Length - 1)) 1041AddDiagnostic(diagnostics, ERRID.ERR_SwitchNeedsBool, name.Substring(0, name.Length - 1)) 1857If trimmedSymbolList.Length > 0 AndAlso IsConnectorPunctuation(trimmedSymbolList(trimmedSymbolList.Length - 1)) Then 2315If simpleName.Length = 0 AndAlso Not kind.IsNetModule() Then 2325If ext.Length = 0 Then 2342If 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)
2767If argumentName.Length = 0 Then
Compilation\VisualBasicCompilation.vb (3)
2681If bytesText.Length <> bytes.Length * 2 Then 2685For i As Integer = 0 To bytesText.Length \ 2 - 1 2701For 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)
169Integer.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)
3129Debug.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)
329If members.Length = 0 Then
Symbols\AnonymousTypes\AnonymousTypeManager_Templates.vb (2)
204moduleId = 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.vb (1)
2255If eventName IsNot Nothing AndAlso eventName.Length > 0 AndAlso Not FindDefaultEvent(eventName) 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\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)
593Return If(Me.Name?.Length, 0) > 0 598Return Me.Name.Length > 0 783Return 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\Workspaces\SharedUtilitiesAndExtensions\Compiler\VisualBasic\Formatting\Engine\Trivia\TriviaDataFactory.Analyzer.vb (1)
66result.HasTrailingSpace = trivia.ToFullString().Length <> 3
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\Workspaces\SharedUtilitiesAndExtensions\Compiler\VisualBasic\Services\SyntaxFacts\VisualBasicSyntaxFacts.vb (2)
458Return IsIdentifier(token) AndAlso Not token.ContainsDiagnostics AndAlso token.ToString().Length = identifier.Length
Microsoft.CodeAnalysis.VisualBasic.CodeStyle.Fixes (9)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\VisualBasic\CodeGeneration\EnumMemberGenerator.vb (1)
114Dim lastTwoChars = numericText.Substring(numericText.Length - 2, 2)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\VisualBasic\CodeGeneration\ExpressionGenerator.StringPiece.vb (2)
82While i < value.Length 118If i < value.Length AndAlso value(i) = vbLf Then
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\Workspaces\SharedUtilitiesAndExtensions\Workspace\VisualBasic\Utilities\VisualBasicSimplificationHelpers.vb (1)
11If identifierToken.Kind <> SyntaxKind.IdentifierToken OrElse identifierToken.ValueText.Length = 0 Then
Microsoft.CodeAnalysis.VisualBasic.CommandLine.UnitTests (4)
CommandLineTests.vb (4)
2887If currentUICultureName.Length = 0 OrElse currentUICultureName.StartsWith("en", StringComparison.OrdinalIgnoreCase) Then 3340Assert.True(embed_vb.Length >= EmbeddedText.CompressionThreshold) 3341Assert.True(embed2_vb.Length < EmbeddedText.CompressionThreshold) 7906index = source.IndexOf(word, index + word.Length, StringComparison.Ordinal)
Microsoft.CodeAnalysis.VisualBasic.EditorFeatures (10)
AutomaticEndConstructCorrection\AutomaticEndConstructCorrector.vb (5)
293If text.Length = 0 OrElse text.Length < positionInText Then 297If text.Length <= positionInText OrElse Not Char.IsLetter(text(positionInText)) Then 324For index = position To text.Length - 1 330Return text.Length - 1
AutomaticEndConstructCorrection\LetterOnlyTrackingSpan.vb (4)
95If trimmedText.Length = 0 Then 101Dim position = span.Start.Position + text.IndexOf(trimmedText, StringComparison.Ordinal) + trimmedText.Length 116If text.Length = 0 Then 124GetNextWordIndex(text, text.Length - 1, firstLetterIndex, lastLetterIndex)
EndConstructGeneration\EndConstructStatementVisitor_IfStatement.vb (1)
48Dim position = If(ifBlock.Statements.Any(), ifBlock.Statements(0).SpanStart, ifBlock.IfStatement.Span.End + _state.NewLineCharacter.Length)
Microsoft.CodeAnalysis.VisualBasic.Emit.UnitTests (37)
Attributes\AttributeTests.vb (1)
5342~~~~~~~~~~~~~~~~~~~~~~~~~~{(New String("~"c, targets.Length))}~~~"
Attributes\AttributeTests_StructLayout.vb (1)
81Dim expectedAlignment As Integer = Integer.Parse(typeName.Substring("Pack".Length))
CodeGen\CodeGenScriptTests.vb (2)
240Dim symbols = model.LookupSymbols(text.Length) 264Assert.Empty(model.LookupLabels(source.Length - 1))
CodeGen\CodeGenVBCore.vb (1)
3211If indent.Length > 0 Then
Emit\EmitMetadata.vb (1)
167If typeParams.Length > 0 Then
PDB\PDBVariableInitializerTests.vb (30)
103Dim expectedStart1 = " Property ".Length + 1 104Dim expectedEnd1 = " Property P As Integer = 1".Length + 1 137Dim expectedStart1 = " Property ".Length + 1 138Dim expectedEnd1 = " Property P = 1".Length + 1 171Dim expectedStart1 = " Property ".Length + 1 172Dim expectedEnd1 = " Property P As New Integer".Length + 1 199Dim expectedStart1 = " Dim ".Length + 1 200Dim expectedEnd1 = " Dim F(1)".Length + 1 202Dim expectedStart2 = " Dim F(1), ".Length + 1 203Dim expectedEnd2 = " Dim F(1), G(2)".Length + 1 233Dim expectedStart1 = " Dim ".Length + 1 234Dim expectedEnd1 = " Dim F(1)".Length + 1 236Dim expectedStart2 = " Dim F(1), ".Length + 1 237Dim expectedEnd2 = " Dim F(1), G(2)".Length + 1 266Dim expectedStart1 = " Dim ".Length + 1 267Dim expectedEnd1 = " Dim F".Length + 1 269Dim expectedStart2 = " Dim F, ".Length + 1 270Dim expectedEnd2 = " Dim F, G".Length + 1 300Dim expectedStart1 = " Dim ".Length + 1 301Dim expectedEnd1 = " Dim F".Length + 1 303Dim expectedStart2 = " Dim F, ".Length + 1 304Dim expectedEnd2 = " Dim F, G".Length + 1 333Dim expectedStart1 = " Dim ".Length + 1 334Dim expectedEnd1 = " Dim F As New C()".Length + 1 363Dim expectedStart1 = " Dim ".Length + 1 364Dim expectedEnd1 = " Dim F As New C()".Length + 1 392Dim expectedStart1 = " Dim ".Length + 1 393Dim expectedEnd1 = " Dim F = 1".Length + 1 422Dim expectedStart1 = " Dim ".Length + 1 423Dim expectedEnd1 = " Dim F = 1".Length + 1
XmlLiteralTests.vb (1)
4551Dim squiggles = New String("~"c, identifier.Length)
Microsoft.CodeAnalysis.VisualBasic.ExpressionCompiler (1)
SyntaxHelpers.vb (1)
90Dim n = expr.Length
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.Features.UnitTests (10)
EditAndContinue\TopLevelEditingTests.vb (1)
6805If visibility.Length > 0 Then
EditAndContinue\VisualBasicEditAndContinueAnalyzerTests.vb (7)
58Replace(s_startTag, New String(" "c, s_startTag.Length)). 59Replace(s_endTag, New String(" "c, s_endTag.Length)). 60Replace(s_startSpanMark, New String(" "c, s_startSpanMark.Length)). 61Replace(s_endSpanMark, New String(" "c, s_startSpanMark.Length)). 74start += s_startTag.Length 86span = TextSpan.FromBounds(source.IndexOf(s_startSpanMark, start, length, StringComparison.Ordinal) + s_startSpanMark.Length, 476Dim oldStatementTextSpan = New TextSpan(oldStatementPosition, oldStatementSource.Length)
SimplifyTypeNames\SimplifyTypeNamesTests.vb (2)
1875Assert.Equal(span.Length, "A.B".Length) 1909Assert.Equal(span.Length, "System".Length)
Microsoft.CodeAnalysis.VisualBasic.ResultProvider (8)
src\Compilers\VisualBasic\Portable\Scanner\CharacterInfo.vb (3)
337Dim nameLength As Integer = name.Length 358For i = 0 To text.Length - 1 363characters = New Char(text.Length - 1) {}
src\Compilers\VisualBasic\Portable\Scanner\KeywordTable.vb (2)
311For i As Integer = 0 To s.Length - 1 318result = New Char(s.Length - 1) {}
src\Compilers\VisualBasic\Portable\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
Microsoft.CodeAnalysis.VisualBasic.Scripting.UnitTests (2)
ObjectFormatterTests.vb (2)
57Assert.Equal(51 + 3, str.Length) 61Assert.Equal(5 + 3, str.Length)
Microsoft.CodeAnalysis.VisualBasic.Semantic.UnitTests (15)
Binding\BindingScopeTests.vb (3)
21Dim expectedEnd As Integer = expectedStart + expectedScopeText.Length 25For position As Integer = 0 To treeText.Length - 1 30Dim locationText = If(treeText.Length > position + 50, treeText.Substring(position, 50), treeText.Substring(position))
Compilation\SemanticModelGetDeclaredSymbolAPITests.vb (2)
1261paramSymbol2.Locations.Single().SourceSpan.Start - "Optional ".Length) 2669Dim position = FindPositionFromText(tree, text) + text.Length - 1
Semantics\NameLengthTests.vb (10)
85Dim _longSquiggle_ As New String("~"c, s_longSymbolName.Length) 231Dim _squiggle2 As New String("~"c, substring2.Length) 286Dim _longSquiggle_ As New String("~"c, s_longSymbolName.Length) 342Dim _longSquiggle_ As New String("~"c, s_longSymbolName.Length) 384Dim _longSquiggle_ As New String("~"c, s_longSymbolName.Length) 419Dim __longSpace___ As New String(" "c, s_longSymbolName.Length) 420Dim _longSquiggle_ As New String("~"c, s_longSymbolName.Length) 449Dim _longSquiggle_ As New String("~"c, s_longLocalName.Length) 472Dim _longSquiggle_ As New String("~"c, s_longLocalName.Length) 509Dim longSquiggle As New String("~"c, longName.Length)
Microsoft.CodeAnalysis.VisualBasic.Symbol.UnitTests (2)
DocumentationComments\DocCommentTests.vb (1)
10976FormatXmlSimple(errors, op, If(op.Length = 1, "~", "~~")),
SymbolsTests\SymbolErrorTests.vb (1)
16351Dim squiggle As New String("~"c, witheventname.Length())
Microsoft.CodeAnalysis.VisualBasic.Syntax.UnitTests (72)
IncrementalParser\IncrementalParser.vb (52)
107For i As Integer = 0 To _s.Length - 1 168.changeSpan = New TextSpan(code.Length, 0), 190.changeSpan = New TextSpan(code.Length, 0), 213.changeSpan = New TextSpan(code.Length, 0), 229.changeSpan = New TextSpan(code.Length, 0), 248.changeSpan = New TextSpan(code.Length, 0), 263.changeSpan = New TextSpan(code.Length, 0), 673.changeSpan = New TextSpan(code.IndexOf(change, StringComparison.Ordinal), change.Length), 792Dim newText = oldText.WithChanges(New TextChange(New TextSpan(insertionPoint, replace.Length), "{")) 885Dim newText = oldText.Replace(start:=position, length:=str.Length, newText:=str) 987Dim position = oldText.ToString().IndexOf(str, StringComparison.Ordinal) + str.Length 1052Dim position = oldText.ToString().Length 1079Dim newText = oldText.Replace(start:=position + str.Length, length:=0, newText:=vbCrLf) 1105Dim newText = oldText.Replace(start:=position, length:=str.Length, newText:=String.Empty) 1163span = New TextSpan(0, code1.Length) 1266Dim newText = oldText.Replace(start:=position, length:=str.Length, newText:="") 1290Dim newText = oldText.Replace(start:=position, length:=str.Length, newText:="") 1314Dim newText = oldText.Replace(start:=position, length:=str.Length, newText:="Async Function ") 1338Dim newText = oldText.Replace(start:=position, length:=str.Length, newText:="Async Function ") 1361Dim newText = oldText.Replace(start:=position, length:=str.Length, newText:="") 1384Dim newText = oldText.Replace(start:=position, length:=str.Length, newText:="Async Function ") 1404Dim newText = oldText.Replace(start:=position, length:=str.Length, newText:="") 1424Dim newText = oldText.Replace(start:=position, length:=str.Length, newText:="Iterator Function ") 1444Dim newText = oldText.Replace(start:=position, length:=str.Length, newText:="") 1464Dim newText = oldText.Replace(start:=position, length:=str.Length, newText:="Iterator Function ") 1553Dim endOfOld = oldSource.Length - newSource.Length + endOfNew 1583Dim newText = oldText.Replace(start:=position + "&HFFFFFFFFFF:".Length, length:=0, newText:=vbCrLf) 1699Dim newTree1 = oldTree1.WithInsertAt(text.Length, " ") 1715Dim newTree2 = oldTree2.WithInsertAt(text.Length, " ") 1768Dim newText = oldText.Replace(start:=position, length:=TextToRemove.Length, newText:=TextToAdd) 1795Dim newText = oldText.Replace(start:=position, length:=TextToRemove.Length, newText:=TextToAdd) 1824Dim newText = oldText.Replace(start:=position, length:=TextToRemove.Length, newText:=TextToAdd) 1888Dim newText = oldText.Replace(start:=position, length:=TextToRemove.Length, newText:=TextToAdd) 1921Dim newText = oldText.Replace(start:=position, length:=TextToRemove.Length, newText:=TextToAdd) 1955Dim newText = oldText.Replace(start:=position, length:=TextToRemove.Length, newText:=TextToAdd) 1985Dim newText = oldText.Replace(start:=position, length:=TextToRemove.Length, newText:=TextToAdd) 2016Dim newText = oldText.Replace(start:=position, length:=TextToRemove.Length, newText:=TextToAdd) 2048Dim newText = oldText.Replace(start:=position, length:=TextToRemove.Length, newText:=TextToAdd) 2078Dim newText = oldText.Replace(start:=position, length:=TextToRemove.Length, newText:=TextToAdd) 2110Dim newText = oldText.Replace(start:=position, length:=TextToRemove.Length, newText:=TextToAdd) 2212Dim newText = oldText.Replace(start:=position, length:=TextToRemove.Length, newText:=TextToAdd) 2244Dim newText = oldText.Replace(start:=position, length:=TextToRemove.Length, newText:=TextToAdd) 2278Dim newText = oldText.Replace(start:=position, length:=TextToRemove.Length, newText:=TextToAdd) 2304Dim newText = oldText.Replace(start:=position, length:=TextToRemove.Length, newText:=TextToAdd) 2335Dim newText = oldText.Replace(start:=position, length:=TextToRemove.Length, newText:=TextToAdd) 2368Dim newText = oldText.Replace(start:=position, length:=TextToRemove.Length, newText:=TextToAdd) 2405Dim newText = oldText.Replace(start:=position, length:=TextToRemove.Length, newText:=TextToAdd) 2433Dim newText = oldText.Replace(start:=position, length:=TextToRemove.Length, newText:=TextToAdd) 2467Dim newText = oldText.Replace(start:=position, length:=TextToRemove.Length, newText:=TextToAdd) 2487Dim position = source.Length 2546Dim newText = oldText.Replace(start:=position, length:=toReplace.Length, newText:="Property")
IncrementalParser\IPEndBlockStatements.vb (7)
27.changeSpan = New TextSpan(code.Length, 0), 91.changeSpan = New TextSpan(code.IndexOf("End Function", StringComparison.Ordinal), change.Length), 156.changeSpan = New TextSpan(code.Length, 0), 221.changeSpan = New TextSpan(code.IndexOf("End Sub", StringComparison.Ordinal), change.Length), 294.changeSpan = New TextSpan(code.Length, 0), 440.changeSpan = New TextSpan(code.Length, 0), 542.changeSpan = New TextSpan(code.Length, 0),
LocationTests.vb (1)
59Return New TextSpan(index, textToFind.Length)
Parser\ParseDirectives.vb (1)
3395Return GetStartPosition(tree, text) + text.Length
Parser\ParseStatements.vb (5)
2274Dim leading = SyntaxFactory.ParseLeadingTrivia(prefix + forEachText, offset:=prefix.Length) 2280Dim trailing = SyntaxFactory.ParseTrailingTrivia(prefix + forEachText, offset:=prefix.Length) 2285Dim t = SyntaxFactory.ParseToken(prefix + forEachText, offset:=prefix.Length, startStatement:=True) 2288Dim tokens = SyntaxFactory.ParseTokens(prefix + forEachText, offset:=prefix.Length) 2292Dim statement = SyntaxFactory.ParseExecutableStatement(prefix + forEachText, offset:=prefix.Length)
QuickTokenTableTests.vb (1)
17Assert.Equal(s.Length - 1, qt.Length)
Scanner\ScanConditionalTests.vb (1)
37Dim disabled = s.GetDisabledTextAt(New TextSpan(0, Str.Length))
Scanner\XmlScannerTests.vb (1)
345Assert.Equal(2, value.Length)
Syntax\ManualTests.vb (1)
142Assert.Equal(LineVisibility.Visible, tree.GetLineVisibility(source.Length - 2))
Syntax\SyntaxListTests.vb (1)
218Assert.Equal(alphabet.Length, parsedArgumentList.Arguments.Count)
TestSyntaxNodes.vb (1)
1986Dim openParenToken = CType(tree.GetRoot().FindToken(location + "List".Length), SyntaxToken)
Microsoft.CodeAnalysis.VisualBasic.Test.Utilities (16)
CompilationTestUtils.vb (7)
470Dim startCommentIndex As Integer = text.IndexOf(bindMarker, StringComparison.Ordinal) + bindMarker.Length 472Dim endCommentIndex As Integer = text.Length 494Dim bindPoint = text.LastIndexOf(bindText, startCommentIndex - bindMarker.Length, StringComparison.Ordinal) 887If actualText.StartsWith(expectedText, StringComparison.Ordinal) AndAlso actualText.Substring(expectedText.Length).Trim().Length > 0 Then 889.AppendLine(actualText.Substring(expectedText.Length)) 1012New String("~"c, Math.Max(Math.Min(sourceLocation.SourceSpan.Length, lineText.Length - offsetInLine + 1), 1)) + Environment.NewLine
Extensions.vb (1)
28While curr.Length > 0
ParserTestUtilities.vb (4)
184Dim count As Integer = If(s1.Length < s2.Length, s1.Length, s2.Length)
SemanticModelTestBase.vb (2)
52Dim bindCommentIndex As Integer = text.IndexOf(bindMarker, StringComparison.Ordinal) + bindMarker.Length 54Dim bindPoint = text.LastIndexOf(bindText, bindCommentIndex - bindMarker.Length, StringComparison.Ordinal)
SyntaxTreeExtensions.vb (2)
20Dim length As Integer = oldText.Length 28Dim length As Integer = oldText.Length
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\Workspaces\SharedUtilitiesAndExtensions\Compiler\VisualBasic\Formatting\Engine\Trivia\TriviaDataFactory.Analyzer.vb (1)
66result.HasTrailingSpace = trivia.ToFullString().Length <> 3
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\Workspaces\SharedUtilitiesAndExtensions\Compiler\VisualBasic\Services\SyntaxFacts\VisualBasicSyntaxFacts.vb (2)
458Return IsIdentifier(token) AndAlso Not token.ContainsDiagnostics AndAlso token.ToString().Length = identifier.Length
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\VisualBasic\CodeGeneration\EnumMemberGenerator.vb (1)
114Dim lastTwoChars = numericText.Substring(numericText.Length - 2, 2)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\VisualBasic\CodeGeneration\ExpressionGenerator.StringPiece.vb (2)
82While i < value.Length 118If i < value.Length AndAlso value(i) = vbLf Then
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\Workspaces\SharedUtilitiesAndExtensions\Workspace\VisualBasic\Utilities\VisualBasicSimplificationHelpers.vb (1)
11If identifierToken.Kind <> SyntaxKind.IdentifierToken OrElse identifierToken.ValueText.Length = 0 Then
Microsoft.CodeAnalysis.VisualBasic.Workspaces.UnitTests (4)
CaseCorrection\VisualBasicCaseCorrectionTestBase.vb (1)
19Dim newNode = Await CaseCorrector.CaseCorrectAsync(document, New TextSpan(0, code.Length))
EmbeddedLanguages\VirtualChars\VisualBasicVirtualCharServiceTests.vb (2)
91Return $"[{ConvertToString(ChrW(vc.Rune.Value))},[{vc.Span.Start - _statementPrefix.Length},{vc.Span.End - _statementPrefix.Length}]]"
Formatting\VisualBasicFormattingTestBase.vb (1)
97Return AssertFormatAsync(expected, code, SpecializedCollections.SingletonEnumerable(New TextSpan(0, code.Length)), changedOptionSet, testWithTransformation, experimental:=experimental)
Microsoft.CodeAnalysis.Workspaces (268)
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)
202if (span.Start == index && span.Length == text.Length && isMatch(text, token, args)) 205var nextIndex = index + text.Length;
FindSymbols\SymbolTree\SymbolTreeInfo_Metadata.cs (1)
778if (containerName.Length == 0)
FindSymbols\SyntaxTree\SyntaxTreeIndex_Create.cs (1)
131if (valueText.Length != token.Width())
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;
PatternMatching\AllLowerCamelCaseMatcher.cs (2)
72if (patternIndex == patternChunkText.Length) 156var maxPatternHumpLength = patternChunkText.Length - patternIndex;
PatternMatching\PatternMatcher.cs (12)
115for (var i = 0; i < pattern.Length; i++) 127for (var i = 0; i < pattern.Length; i++) 169var candidateLength = candidate.Length; 177if (patternChunk.Text.Length == candidateLength) 207PatternMatchKind.Prefix, punctuationStripped, isCaseSensitive, matchedSpan: GetMatchedSpan(0, patternChunk.Text.Length)); 232matchedSpan: GetMatchedSpan(caseSensitiveIndex, patternChunk.Text.Length)); 247matchedSpan: GetMatchedSpan(caseInsensitiveIndex, patternChunk.Text.Length)); 262matchedSpan: GetMatchedSpan(hump.Start, patternChunk.Text.Length)); 287if (patternIsLowercase && caseInsensitiveIndex > 0 && patternChunk.Text.Length >= 3) 294matchedSpan: GetMatchedSpan(caseSensitiveIndex, patternChunk.Text.Length)); 312for (var i = 0; i < text.Length; i++) 451=> 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++)
Rename\ConflictEngine\ConflictResolver.cs (9)
437while (index != -1 && index < oldMetadataName.Length) 450newMetadataNameBuilder.Append(newMetadataName, index + replacementText.Length, newMetadataName.Length - (index + replacementText.Length)); 466Debug.Assert(index <= str1.Length && index <= str2.Length, "Index cannot be greater than the string"); 503if (index + searchText.Length != metadataName.Length) 505var nextChar = metadataName[index + searchText.Length];
Rename\RenameUtilities.cs (2)
264Debug.Assert(subSpan.Start <= replaceInsideString.Length); 265Debug.Assert(subSpan.End <= replaceInsideString.Length);
Rename\SymbolicRenameLocations.ReferenceProcessing.cs (4)
372var renameTextLength = renameText.Length; 390var renameTextLength = renameText.Length; 426Debug.Assert(renameText.Length == match.Length); 427var 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\BloomFilter.cs (1)
123var numberOfCharsLeft = key.Length;
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\Compilers\Core\Portable\CodeAnalysisEventSource.Common.cs (1)
196Size = (value.Length + 1) * sizeof(char),
src\Compilers\Core\Portable\FileSystem\FileUtilities.cs (2)
133if (path!.Length == 1) 175Debug.Assert(path.Length == 1 || !PathUtilities.IsDirectorySeparator(path[1]));
src\Compilers\Core\Portable\FileSystem\PathUtilities.cs (36)
52int lastSeparator = s.Length; 58if (lastSeparator != s.Length) 71if (s.Length == 0 || IsAnyDirectorySeparator(s[s.Length - 1])) 138var rootLength = GetPathRoot(path, isUnixLike).Length; 139if (path.Length > rootLength) 141var i = path.Length; 212int length = path.Length; 287return path.Length > 0 && IsDirectorySeparator(path[0]) 314if (path.Length > 0 && path[0] == '.') 316if (path.Length == 1 || IsDirectorySeparator(path[1])) 323if (path.Length == 2 || IsDirectorySeparator(path[2])) 334if (path.Length >= 1 && IsDirectorySeparator(path[0])) 341if (path.Length >= 2 && path[1] == VolumeSeparatorChar && (path.Length <= 2 || !IsDirectorySeparator(path[2]))) 375return path.Length >= 2 && 386return path.Length >= 3 && path[1] == VolumeSeparatorChar && IsDirectorySeparator(path[2]); 440char c = root[root.Length - 1]; 479if (path.Length > 0 && IsDirectorySeparator(path[path.Length - 1])) 481return path.Substring(0, path.Length - 1); 608return parentPath.Length > 0 609&& childPath.Length > parentPath.Length 610&& PathsEqual(childPath, parentPath, parentPath.Length) 611&& (IsDirectorySeparator(parentPath[parentPath.Length - 1]) || IsDirectorySeparator(childPath[parentPath.Length])); 616var relativePath = childPath.Substring(parentPath.Length); 619int start = ConsumeDirectorySeparators(relativePath, relativePath.Length, 0); 648return PathsEqual(path1, path2, Math.Max(path1.Length, path2.Length)); 656if (path1.Length < length || path2.Length < length) 714if (!(oldPrefix?.Length > 0)) continue; 723var replacement = replacementPrefix + filePath.Substring(oldPrefix.Length); 841if (!isDriveRooted && !(p.Length > 1 && p[0] == AltDirectorySeparatorChar))
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\Compilers\Core\Portable\InternalUtilities\StringExtensions.cs (15)
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.Substring(0, name.Length - AttributeSuffix.Length); 165return name.Length > AttributeSuffix.Length && name.EndsWith(AttributeSuffix, comparison); 171while (i < str.Length) 178if (i < str.Length && char.IsLowSurrogate(str[i])) 208if (arg.Length > 1 && arg[0] == '"' && arg[arg.Length - 1] == '"') 211return arg.Substring(1, arg.Length - 2); 223while (x < string1.Length && x < string2.Length && 235while (x < string1.Length && x < string2.Length &&
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\Compilers\Core\Portable\InternalUtilities\UnicodeCharacterUtilities.cs (1)
103int nameLength = name.Length;
src\Compilers\Core\Portable\Syntax\SyntaxTreeExtensions.cs (2)
95var n1 = s1.Length; 96var n2 = s2.Length;
src\Compilers\Core\Portable\Text\TextChangeRangeExtensions.cs (1)
105return new TextChangeRange(textChange.Span, textChange.NewText?.Length ?? 0);
src\Dependencies\Collections\Extensions\IEnumerableExtensions.cs (2)
213return str.Length == 0; 236return source.Length == 0;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\CodeGeneration\ParameterName.cs (1)
42BestNameForParameter = trimmed.Length > 0 ? tryMakeCamelCase ? trimmed.ToCamelCase() : trimmed : nameBasedOnArgument;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EditorConfig\Parsing\Sections\SectionMatcher.Lexer.cs (5)
15public readonly bool IsDone => Position >= headerText.Length; 54if (position < headerText.Length) 85if (position < headerText.Length && 113if (position >= headerText.Length) 171return str.Length == 0 || str == "-"
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\VirtualChars\AbstractVirtualCharService.cs (8)
31if (index + 1 < tokenText.Length) 117Debug.Assert(lastVC.Span.End == token.Span.End - "\"".Length, "Last span has to end right before the end of the string token."); 121Debug.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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\VirtualChars\AbstractVirtualCharService.ITextInfo.cs (1)
30public readonly int Length(string text) => text.Length;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\VirtualChars\VirtualCharSequence.Chunks.cs (3)
84public override int Length => data.Length; 89if (stringIndex < 0 || stringIndex >= data.Length) 104Debug.Assert(index + 1 >= data.Length ||
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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\TokenStream.cs (2)
337length = text.ConvertTabToSpace(_options.TabSize, initialColumn, text.Length); 341length = text.Length;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\TreeData.Node.cs (1)
30return lineText.GetColumnFromLineOffset(lineText.Length, tabSize);
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\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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\Naming\IdentifierNameParts.cs (2)
47? newBaseName[prefix.Length..] 53? newBaseName[..^suffix.Length]
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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\NamingStyle.WordSpanEnumerator.cs (1)
52Current = new TextSpan(Current.End + _wordSeparator.Length, 0);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Serialization\ObjectWriter.cs (2)
504var bytes = new byte[(uint)value.Length * sizeof(char)]; 510WriteCompressedUInt((uint)value.Length);
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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\SyntaxFacts\ISyntaxFactsExtensions.cs (2)
251if (name.Length == 0) 261for (var i = 1; i < name.Length; i++)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.cs (1)
198Debug.Assert(reader.Position == symbolKey.Length);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.SymbolKeyReader.cs (1)
259while (Position < Data.Length)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\Base64Utilities.cs (2)
329decodedLength = (encodedString.Length * 3) / 4 - padding; 336var index = attributeData.Length - 1;
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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\BKTree.cs (4)
74Span<char> lowerCaseCharacters = value.Length < 512 75? stackalloc char[value.Length] 76: new char[value.Length]; 78for (var i = 0; i < value.Length; i++)
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++) 89Span<char> 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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\PathMetadataUtilities.cs (2)
31if (rootNamespace is { Length: > 0 } && 69@namespace = @namespace[(rootNamespace.Length + 1)..];
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\StringBreaker.cs (2)
24for (var start = 0; start < text.Length;) 42var length = identifier.Length;
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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\WordSimilarityChecker.cs (6)
80=> value.Length <= 4 ? 1 : 2; 87if (_source.Length < 3) 113if (Math.Abs(_source.Length - candidateText.Length) <= _threshold) 142var lengthDifference = Math.Abs(originalText.Length - candidateText.Length);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\ISymbolExtensions.cs (1)
795(symbol.Name.Length == 1 || uint.TryParse(symbol.Name[1..], out _) || symbol.Name.All(n => n.Equals('_')));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\ITypeSymbolExtensions.cs (1)
363return shortName.Length == 0
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Extensions\ProjectExtensions.cs (2)
75analyzerConfigDirectory.Length > bestPath.Length)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Extensions\SyntaxGeneratorExtensions_CreateEqualsMethod.cs (1)
366if (name.Length > 0)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\LanguageServices\TypeInferenceService\AbstractTypeInferenceService.cs (3)
67if (name.Length == prefix.Length) 72var nextChar = name[prefix.Length];
Storage\SQLite\v2\Interop\SqlConnection.cs (1)
54var wrote = Encoding.UTF8.GetBytes(value, 0, value.Length, byteArray, 0);
Storage\SQLite\v2\Interop\SqlStatement.cs (1)
74if (value.Length <= OptimizedLengthThreshold)
Storage\SQLite\v2\SQLitePersistentStorage_DocumentIds.cs (1)
34documentKey.FilePath != null && PathUtilities.GetDirectoryName(PathUtilities.GetRelativePath(_solutionDirectory, documentKey.FilePath)) is { Length: > 0 } directoryName
Storage\SQLite\v2\SQLitePersistentStorage_ProjectIds.cs (1)
34projectKey.FilePath != null && PathUtilities.GetRelativePath(_solutionDirectory, projectKey.FilePath) is { Length: > 0 } relativePath
Workspace\Host\PersistentStorage\IPersistentStorageConfiguration.cs (1)
87var prefix = fileName.Length > MaxLength ? fileName[..MaxLength] : fileName;
Workspace\ProjectSystem\ProjectSystemProject.cs (2)
920if (extension?.Length == 0) 1195private 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'");
Workspace\Solution\SourceGeneratedDocumentIdentity.cs (3)
52using var _ = ArrayBuilder<byte>.GetInstance(capacity: (assemblyNameToHash.Length + 1 + generatorIdentity.TypeName.Length + 1 + hintName.Length) * 2 + projectIdBytes.Length, out var hashInput);
Microsoft.CodeAnalysis.Workspaces.MSBuild (1)
MSBuild\BuildHostProcessManager.cs (1)
292if (processStartInfo.Arguments.Length > 0)
Microsoft.CodeAnalysis.Workspaces.MSBuild.BuildHost (83)
MSBuild\ProjectFile\ProjectFile.cs (1)
349return normalizedPath[projectDirectory.Length..];
src\Compilers\Core\Portable\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)
src\Compilers\Core\Portable\FileSystem\FileUtilities.cs (2)
133if (path!.Length == 1) 175Debug.Assert(path.Length == 1 || !PathUtilities.IsDirectorySeparator(path[1]));
src\Compilers\Core\Portable\FileSystem\PathUtilities.cs (36)
52int lastSeparator = s.Length; 58if (lastSeparator != s.Length) 71if (s.Length == 0 || IsAnyDirectorySeparator(s[s.Length - 1])) 138var rootLength = GetPathRoot(path, isUnixLike).Length; 139if (path.Length > rootLength) 141var i = path.Length; 212int length = path.Length; 287return path.Length > 0 && IsDirectorySeparator(path[0]) 314if (path.Length > 0 && path[0] == '.') 316if (path.Length == 1 || IsDirectorySeparator(path[1])) 323if (path.Length == 2 || IsDirectorySeparator(path[2])) 334if (path.Length >= 1 && IsDirectorySeparator(path[0])) 341if (path.Length >= 2 && path[1] == VolumeSeparatorChar && (path.Length <= 2 || !IsDirectorySeparator(path[2]))) 375return path.Length >= 2 && 386return path.Length >= 3 && path[1] == VolumeSeparatorChar && IsDirectorySeparator(path[2]); 440char c = root[root.Length - 1]; 479if (path.Length > 0 && IsDirectorySeparator(path[path.Length - 1])) 481return path.Substring(0, path.Length - 1); 608return parentPath.Length > 0 609&& childPath.Length > parentPath.Length 610&& PathsEqual(childPath, parentPath, parentPath.Length) 611&& (IsDirectorySeparator(parentPath[parentPath.Length - 1]) || IsDirectorySeparator(childPath[parentPath.Length])); 616var relativePath = childPath.Substring(parentPath.Length); 619int start = ConsumeDirectorySeparators(relativePath, relativePath.Length, 0); 648return PathsEqual(path1, path2, Math.Max(path1.Length, path2.Length)); 656if (path1.Length < length || path2.Length < length) 714if (!(oldPrefix?.Length > 0)) continue; 723var replacement = replacementPrefix + filePath.Substring(oldPrefix.Length); 841if (!isDriveRooted && !(p.Length > 1 && p[0] == AltDirectorySeparatorChar))
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\Compilers\Core\Portable\InternalUtilities\JsonWriter.cs (1)
272for (int i = 0; i < value.Length; i++)
src\Compilers\Core\Portable\InternalUtilities\StringExtensions.cs (15)
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.Substring(0, name.Length - AttributeSuffix.Length); 165return name.Length > AttributeSuffix.Length && name.EndsWith(AttributeSuffix, comparison); 171while (i < str.Length) 178if (i < str.Length && char.IsLowSurrogate(str[i])) 208if (arg.Length > 1 && arg[0] == '"' && arg[arg.Length - 1] == '"') 211return arg.Substring(1, arg.Length - 2); 223while (x < string1.Length && x < string2.Length && 235while (x < string1.Length && x < string2.Length &&
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\Compilers\Core\Portable\InternalUtilities\UnicodeCharacterUtilities.cs (1)
103int nameLength = name.Length;
src\Dependencies\Collections\Extensions\IEnumerableExtensions.cs (2)
213return str.Length == 0; 236return source.Length == 0;
Microsoft.CodeAnalysis.Workspaces.MSBuild.UnitTests (2)
VisualStudioMSBuildWorkspaceTests.cs (2)
3331Assert.Equal(5, "//\u00E2\u20AC\u0153".Length); 3332Assert.Equal("//\u00E2\u20AC\u0153".Length, text.Length);
Microsoft.CodeAnalysis.Workspaces.Test.Utilities (1)
Formatting\FormattingTestBase.cs (1)
30return AssertFormatAsync(expected, code, [new TextSpan(0, code.Length)], language, changedOptionSet, testWithTransformation);
Microsoft.CodeAnalysis.Workspaces.UnitTests (20)
Differencing\LongestCommonSubsequenceTests.cs (12)
22=> GetMatchingPairs(oldSequence, oldSequence.Length, newSequence, newSequence.Length); 25=> GetEdits(oldSequence, oldSequence.Length, newSequence, newSequence.Length); 28=> ComputeDistance(oldSequence, oldSequence.Length, newSequence, newSequence.Length); 33var sb = new StringBuilder(expectedPairsStr.Length); 46var newChars = new char[newStr.Length]; 54Assert.True(edit.OldIndex < oldStr.Length); 59Assert.True(edit.NewIndex < newStr.Length); 64Assert.True(edit.OldIndex < oldStr.Length); 65Assert.True(edit.NewIndex < newStr.Length);
SyntaxPathTests.cs (4)
328tree = WithReplace(tree, 0, text.Length, text2); 389tree = WithReplace(tree, 0, text.Length, """ 427var length = oldText.Length; 452length: oldText.Length,
UtilityTest\BKTreeTests.cs (3)
71for (var i = 0; i < value.Length; i++) 85for (var i = 0; i <= value.Length; i++) 99for (var i = 0; i < value.Length - 1; i++)
UtilityTest\NameGeneratorTests.cs (1)
92Func<string, bool> canUse = (s) => s.Length > 5;
Microsoft.CSharp (7)
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)) 711longestColumnName = 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.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.Arcade.Sdk.Tests (1)
Utilities\TestApp.cs (1)
112var destFileName = Path.Combine(destDir, srcFileName.Substring(srcDir.Length).TrimStart(new[] { Path.AltDirectorySeparatorChar, Path.DirectorySeparatorChar }));
Microsoft.DotNet.ArcadeLogging (2)
MessageBuilder.cs (1)
69var result = new StringBuilder(value.Length);
PipelinesLogger.cs (1)
284projectFile = projectFile.Substring(_solutionDirectory.Length).TrimStart('\\');
Microsoft.DotNet.Build.Tasks.Feed (11)
src\CreateAzureDevOpsFeed.cs (4)
83if (CommitSha?.Length < ShaUsableLength) 116if (baseFeedName.Length > MaxLengthForAzDoFeedNames) 166if (versionedFeedName.Length > MaxLengthForAzDoFeedNames) 214return project.Substring(0, Math.Min(3, project.Length));
src\model\SetupTargetFeedConfigV3.cs (3)
266foreach (var prefix in FeedOverrides.Keys.OrderByDescending(f => f.Length)) 279foreach (var prefix in FeedSasUris.Keys.OrderByDescending(f => f.Length)) 292foreach (var prefix in FeedKeys.Keys.OrderByDescending(f => f.Length))
src\model\SetupTargetFeedConfigV4.cs (3)
211foreach (var prefix in FeedOverrides.Keys.OrderByDescending(f => f.Length)) 224foreach (var prefix in FeedSasUris.Keys.OrderByDescending(f => f.Length)) 237foreach (var prefix in FeedKeys.Keys.OrderByDescending(f => f.Length))
src\PushToBuildStorage.cs (1)
553return targetPath.Substring(basePath.Length).TrimStart('/', '\\');
Microsoft.DotNet.Build.Tasks.Installers (3)
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\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)
82for (int i = 0; i < template.Length; i++) 85char nextTemplateChar = i + 1 >= template.Length 112for (; 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)
108if (relativePackagePath.Length > MaxRelativePackagePath)
WorkloadPackageBase.cs (1)
306packageId.Substring(packageId.IndexOf(separator) + separator.Length) :
Microsoft.DotNet.Helix.Client (2)
generated-code\HelixApi.cs (2)
228return result.Substring(1, result.Length - 2); 320result += responseContent.Length < 300 ? responseContent : responseContent.Substring(0, 300);
Microsoft.DotNet.Helix.JobSender (1)
Payloads\DirectoryPayload.cs (1)
61file.FullName.Substring(basePath.Length + 1); // +1 prevents it from including the leading backslash
Microsoft.DotNet.Helix.Sdk (2)
CreateXHarnessAppleWorkItems.cs (1)
108workItemName = workItemName.Substring(0, workItemName.Length - 4);
CreateXUnitWorkItems.cs (1)
128assemblyBaseName = assemblyBaseName.Substring(0, assemblyBaseName.Length - 4);
Microsoft.DotNet.MacOsPkg.Tests (1)
UnpackPackTests.cs (1)
249.Select(f => (f.Substring(basePath.Length + 1), File.GetUnixFileMode(f)))
Microsoft.DotNet.NuGetRepack.Tests (1)
TestHelpers\AssertEx.cs (1)
403if (trimmedLine.Length > 0)
Microsoft.DotNet.RemoteExecutor (6)
PasteArguments.cs (6)
48if (argument.Length == 0 || hasWhitespace) 81if (argument.Length != 0 && ContainsNoWhitespaceOrQuotes(argument)) 90while (idx < argument.Length) 96while (idx < argument.Length && argument[idx] == Backslash) 102if (idx == argument.Length) 141for (int i = 0; i < s.Length; i++)
Microsoft.DotNet.SignTool (8)
src\Configuration.cs (1)
322extension = _fileExtensionSignInfo.OrderByDescending(o => o.Key.Length).FirstOrDefault(f => file.FileName.EndsWith(f.Key, StringComparison.OrdinalIgnoreCase)).Key ?? extension;
src\ContentUtil.cs (1)
55int NumberChars = hash.Length;
src\SignToolTask.cs (1)
593if (pkt.Length != 16) return false;
src\WixPackInfo.cs (2)
34int trimLength = WixPackExtension.Length; 35moniker = filename.Remove(filename.Length - trimLength, trimLength);
src\ZipData.cs (3)
258var relativeName = file.Substring($"{workingDir}\\".Length).Replace('\\', '/'); 330var relativePath = path.Substring(extractDir.Length + 1).Replace(Path.DirectorySeparatorChar, '/'); 356var relativePath = path.Substring(extractDir.Length + 1).Replace(Path.DirectorySeparatorChar, '/');
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.SwaggerGenerator.CodeGenerator (3)
Languages\Language.cs (2)
31relative = relative.Substring(templateDirectory.Length + 1); 32relative = relative.Substring(0, relative.Length - 3); // Remove extension
Modeler\ServiceClientModelFactory.cs (1)
157name = name.Substring(firstTag.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.DotNet.XUnitAssert.Tests (25)
AsyncCollectionAssertsTests.cs (25)
645 "Actual: " + new string(' ', expectedType.Length) + " null", 754 var padding = Math.Max(expectedType.Length, actualType.Length); 792 var padding = Math.Max(expectedType.Length, actualType.Length); 873 var padding = Math.Max(expectedType.Length, actualType.Length); 925 var padding = Math.Max(expectedType.Length, actualType.Length); 965 var padding = Math.Max(expectedType.Length, actualType.Length); 1026 var padding = Math.Max(expectedType.Length, actualType.Length); 1141 var padding = Math.Max(expectedType.Length, actualType.Length); 1191 var padding = Math.Max(expectedType.Length, actualType.Length); 1232 var padding = Math.Max(expectedType.Length, actualType.Length); 1274 var padding = Math.Max(expectedType.Length, actualType.Length); 1332 var padding = Math.Max(expectedType.Length, actualType.Length); 1359 var padding = Math.Max(expectedType.Length, actualType.Length);
Microsoft.Extensions.AI (2)
ChatCompletion\ChatResponse{T}.cs (1)
103var utf8SpanLength = Encoding.UTF8.GetBytes(json, 0, json.Length, buffer, 0);
ChatCompletion\OpenTelemetryChatClient.cs (1)
551if (content.Length > 0)
Microsoft.Extensions.AI.Abstractions (12)
ChatCompletion\ChatResponseExtensions.cs (3)
262else if (update.MessageId is { Length: > 0 } updateMessageId 293if (update.MessageId is { Length: > 0 }) 318if (update.ResponseId is { Length: > 0 })
Contents\AIContentExtensions.cs (1)
101if (text.Length > 0)
Contents\DataContent.cs (1)
233return uri.Length <= MaxLength ?
Contents\DataUriParser.cs (2)
34dataUri = dataUri.Slice(Scheme.Length); 53metadata = metadata.Slice(0, metadata.Length - ";base64".Length);
Functions\AIFunctionFactory.cs (4)
725name.Length > AsyncSuffix.Length) 727name = name.Substring(0, name.Length - AsyncSuffix.Length);
Utilities\AIJsonUtilities.Schema.Create.cs (1)
281: $"#/{PropertiesPropertyName}/{parameterName}/{refUri.AsMemory("#/".Length)}";
Microsoft.Extensions.AI.AzureAIInference (1)
AzureAIInferenceChatClient.cs (1)
474if (string.Concat(input.Contents) is { Length: > 0 } text)
Microsoft.Extensions.AI.Evaluation.NLP (5)
Common\SimpleWordTokenizer.cs (5)
102text = text.Slice("&quot;".Length); 114text = text.Slice("&amp;".Length); 126text = text.Slice("&lt;".Length); 138text = text.Slice("&gt;".Length); 150text = text.Slice("&apos;".Length);
Microsoft.Extensions.AI.Evaluation.Quality (1)
Utilities\JsonOutputFixer.cs (1)
26int markerLength = JsonMarker.Length;
Microsoft.Extensions.AI.Evaluation.Reporting (1)
Formats\Html\HtmlReportWriter.cs (1)
99HtmlTemplateAfter = all.Substring(start + SearchString.Length);
Microsoft.Extensions.AI.Evaluation.Reporting.Tests (2)
ScenarioRunResultTests.cs (2)
221Assert.True(defaultJson.Length > compactJson.Length);
Microsoft.Extensions.AI.Integration.Tests (3)
PromptBasedFunctionCallingChatClient.cs (1)
96if (toolCall.Length == 0)
VerbatimMultiPartHttpHandler.cs (2)
177int start = headers.IndexOf(NamePrefix) + NamePrefix.Length; 182end = headers.Length;
Microsoft.Extensions.AI.Ollama (1)
OllamaChatClient.cs (1)
277if (message.Content?.Length > 0 || contents.Count == 0)
Microsoft.Extensions.AI.Templates.Tests (1)
ProjectRootHelper.cs (1)
28if (Path.GetDirectoryName(callerFilePath) is not { Length: > 0 } testProjectRoot)
Microsoft.Extensions.ApiDescription.Client (2)
CSharpIdentifier.cs (2)
45var builder = new StringBuilder(inputName.Length); 46for (var i = 0; i < inputName.Length; i++)
Microsoft.Extensions.Caching.Hybrid (10)
Internal\DefaultHybridCache.cs (2)
283if (key.Length > _maximumKeyLength) 285_logger.MaximumKeyLengthExceeded(_maximumKeyLength, key.Length);
Internal\DefaultHybridCache.StampedeStateT.cs (1)
550int 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); 166offset += Encoding.GetBytes(value, 0, value.Length, target, offset);
Internal\InbuiltTypeSerializer.cs (1)
58int actual = Encoding.UTF8.GetBytes(value, 0, value.Length, oversized, 0);
Internal\TagSet.cs (2)
206return single.Length; 211max = Math.Max(max, test.Length);
Microsoft.Extensions.Caching.Hybrid.Tests (1)
TagSetTests.cs (1)
174chars[i] = Alphabet[rand.Next(0, Alphabet.Length)];
Microsoft.Extensions.Caching.SqlServer (1)
src\Shared\ThrowHelpers\ArgumentNullThrowHelper.cs (1)
47else if (argument.Length == 0)
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)
49_redactedLength = Base64HashLength + _keyId.Length; 108return ConvertBytesToBase64(CreateSha256Hash(source, _hashKey), destination, RemainingBytesToPadForBase64Hash, _keyId.Length) + _keyId.Length;
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)
645return missing.Length == 0;
Microsoft.Extensions.Configuration.EnvironmentVariables (2)
EnvironmentVariablesConfigurationProvider.cs (2)
144string normalizedKeyWithoutConnectionStringPrefix = Normalize(fullKey.Substring(connectionStringPrefix.Length)); 158data[normalizedKey.Substring(_normalizedPrefix.Length)] = value;
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)
436_lengths.Push(value.Length + ConfigurationPath.KeyDelimiter.Length); 441_lengths.Push(value.Length);
Microsoft.Extensions.DependencyInjection (8)
DependencyInjectionEventSource.cs (6)
116int chunkCount = format.Length / MaxChunkSize + (format.Length % MaxChunkSize > 0 ? 1 : 0); 123format.Substring(i * MaxChunkSize, Math.Min(MaxChunkSize, format.Length - i * MaxChunkSize)), i, chunkCount, 245int chunkCount = descriptorString.Length / MaxChunkSize + (descriptorString.Length % MaxChunkSize > 0 ? 1 : 0); 251descriptorString.Substring(i * MaxChunkSize, Math.Min(MaxChunkSize, descriptorString.Length - i * MaxChunkSize)), i, chunkCount);
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 (4)
Metrics\ListenerSubscription.cs (4)
232if (rule.MeterName.Length != best.MeterName.Length) 234return rule.MeterName.Length > best.MeterName.Length;
Microsoft.Extensions.Diagnostics.Abstractions (2)
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.Probes (1)
src\Shared\Data.Validation\LengthAttribute.cs (1)
116count = s.Length;
Microsoft.Extensions.Diagnostics.ResourceMonitoring (18)
Linux\LinuxUtilizationParserCgroupV1.cs (6)
137stat = stat.Slice(StartingTokens.Length, stat.Length - StartingTokens.Length); 224ReadOnlySpan<char> inactiveMemorySlice = memoryFile.Slice(index + TotalInactiveFile.Length, memoryFile.Length - index - TotalInactiveFile.Length); 274ReadOnlySpan<char> totalMemory = firstLine.Slice(MemTotal.Length, firstLine.Length - MemTotal.Length);
Linux\LinuxUtilizationParserCgroupV2.cs (11)
181stat = stat.Slice(StartingTokens.Length, stat.Length - StartingTokens.Length); 373ReadOnlySpan<char> inactiveMemorySlice = memoryFile.Slice(index + InactiveFile.Length, memoryFile.Length - index - InactiveFile.Length); 419ReadOnlySpan<char> totalMemory = firstLine.Slice(MemTotal.Length, firstLine.Length - MemTotal.Length); 536ReadOnlySpan<char> usageSlice = content.Slice(usageIndex + UsageUsec.Length); 551ReadOnlySpan<char> periodsSlice = content.Slice(periodsIndex + NrPeriods.Length); 654ReadOnlySpan<char> cpuPeriodSlice = quotaBuffer.Slice(index + quotaString.Length, quotaBuffer.Length - index - quotaString.Length); 723ReadOnlySpan<char> periodSlice = content.Slice(index + quotaString.Length);
src\Shared\Data.Validation\LengthAttribute.cs (1)
116count = s.Length;
Microsoft.Extensions.FileProviders.Embedded (12)
EmbeddedFileProvider.cs (7)
89var builder = new StringBuilder(_baseNamespace.Length + subpath.Length); 95subpath = subpath.Substring(1, subpath.Length - 1); 146if (subpath.Length != 0 && !string.Equals(subpath, "/", StringComparison.Ordinal)) 163resourceName.Substring(_baseNamespace.Length), 236for (var i = 1; i < subName.Length; i++) 286var everettId = new StringBuilder(name.Length);
Manifest\EmbeddedFilesManifest.cs (5)
65Debug.Assert(path.Length > 0); 67if (start == path.Length) 72var end = Array.IndexOf(_separators, path[path.Length - 1]) == -1 ? path.Length : path.Length - 1;
Microsoft.Extensions.FileProviders.Physical (6)
Internal\PathUtils.cs (1)
46path[path.Length - 1] != Path.DirectorySeparatorChar)
PhysicalFilesWatcher.cs (5)
293string oldLocation = Path.Combine(e.OldFullPath, newLocation.Substring(e.FullPath.Length + 1)); 348string relativePath = fullPath.Substring(_root.Length); 448return path.Length > 0 && 449(path[path.Length - 1] == Path.DirectorySeparatorChar || 450path[path.Length - 1] == Path.AltDirectorySeparatorChar);
Microsoft.Extensions.FileSystemGlobbing (13)
InMemoryDirectoryInfo.cs (3)
92int endPath = file.Length; 93int beginSegment = FullName.Length + 1; 122int 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)
73socketPath = string.Create(socketPath.Length, socketPath, (buffer, state) =>
Microsoft.Extensions.Http (4)
src\libraries\Common\src\Extensions\TypeNameHelper\TypeNameHelper.cs (2)
102builder.Replace(DefaultNestedTypeDelimiter, options.NestedTypeDelimiter, builder.Length - name.Length, name.Length);
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 (7)
Http\DownstreamDependencyMetadataManager.cs (7)
125else if (routeSpan.Length != route.Length) 137for (int i = 0; i < route.Length; i++) 154if (ch == AsteriskChar && i < route.Length - 1) 161for (int j = 0; j < httpMethod.Length; j++) 306for (int i = hostNameSuffix.Length - 1; i >= 0; i--) 328for (int i = host.Length - 1; i >= 0; i--) 434for (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 (1)
src\Shared\Data.Validation\LengthAttribute.cs (1)
116count = s.Length;
Microsoft.Extensions.Http.Resilience.Tests (8)
artifacts\obj\Microsoft.Extensions.Http.Resilience.Tests\Debug\net8.0\Protos\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)
184if (!result.Succeeded && result.Errors.FirstOrDefault()?.Code is { Length: > 0 } code)
Microsoft.Extensions.Identity.Stores (3)
src\Shared\ThrowHelpers\ArgumentNullThrowHelper.cs (1)
47else if (argument.Length == 0)
UserStoreBase.cs (2)
921if (mergedCodes.Length > 0) 929while (index < mergedCodes.Length)
Microsoft.Extensions.Localization (1)
ResourceManagerStringLocalizerFactory.cs (1)
241return name.Substring(prefix.Length);
Microsoft.Extensions.Localization.Tests (1)
ResourceManagerStringLocalizerTest.cs (1)
204string expectedManifestFileName = cultureName.Length > 0 ? $"testington.{cultureName}.resources" : $"testington.resources";
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\libraries\Common\src\Extensions\TypeNameHelper\TypeNameHelper.cs (2)
102builder.Replace(DefaultNestedTypeDelimiter, options.NestedTypeDelimiter, builder.Length - name.Length, name.Length);
src\libraries\Common\src\System\Text\ValueStringBuilder.cs (5)
154int count = s.Length; 196if (s.Length == 1 && (uint)pos < (uint)_chars.Length) // very common case, e.g. appending strings from NumberFormatInfo like separators, percent symbols, etc. 210if (pos > _chars.Length - s.Length) 212Grow(s.Length); 220_pos += s.Length;
Microsoft.Extensions.Logging.AzureAppServices (2)
BlobAppendReferenceWrapper.cs (1)
90if (uriBuilder.Query != null && uriBuilder.Query.Length > 1)
src\Shared\ThrowHelpers\ArgumentNullThrowHelper.cs (1)
47else if (argument.Length == 0)
Microsoft.Extensions.Logging.Console (4)
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);
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)
443if (loggerName.Length == 0) 448if (loggerName[loggerName.Length - 1] == '*') 450loggerName = loggerName.Substring(0, loggerName.Length - 1); 478if (levelString.Length == 0) 572eventData.Size = checked((str.Length + 1) * sizeof(char)); // size is specified in bytes, including null wide char
Microsoft.Extensions.Logging.Generators (9)
LoggerMessageGenerator.Emitter.cs (6)
134nestedIndentation = new string(' ', nestedIndentation.Length - 4); 181string formatMethodEnd = formatMethodBegin.Length > 0 ? ")" : ""; 582while (index < s.Length) 591if (index >= s.Length) 596StringBuilder sb = new StringBuilder(s.Length); 599while (index < s.Length)
LoggerMessageGenerator.Parser.cs (1)
746int endIndex = message.Length;
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 (7)
Emitter.cs (2)
104if (vt.Namespace.Length > 0) 142if (vt.Namespace.Length > 0)
Parser.cs (3)
725return "global::" + (result.Namespace.Length > 0 ? result.Namespace + "." + result.Name : result.Name); 845var sb = new StringBuilder(s.Length); 848while (index < s.Length)
src\libraries\Common\src\Roslyn\GetBestTypeByMetadataName.cs (2)
157return name.Length > AttributeSuffix.Length && name.EndsWith(AttributeSuffix, comparison);
Microsoft.Extensions.Primitives (11)
InplaceStringBuilder.cs (4)
71Append(value, 0, value.Length); 96|| value.Length - offset < count 156if (offset < 0 || value.Length - offset < count) 163ThrowHelper.ThrowInvalidOperationException(ExceptionResource.Capacity_NotEnough, value.Length, Capacity - _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 (1)
Resolver\DnsPrimitives.cs (1)
97if (name.Length > MaxDomainNameLength ||
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++)
tests\Shared\Logging\XunitLoggerProvider.cs (3)
78var additionalLinePrefix = "|" + new string(' ', firstLinePrefix.Length - 1); 98message = 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 (24)
Http\HttpRouteFormatter.cs (1)
67var parameterTemplateLength = parameterContent.Length + 2;
Http\HttpRouteParser.cs (4)
71var parameterTemplateLength = parameterContent.Length + 2; 100var len = httpRoute.Length; 213bool isLastPosition = pos == httpRoute.Length - 1; 214bool isSecondToLastPosition = pos == httpRoute.Length - 2;
Latency\Internal\LatencyConsoleExporter.cs (5)
65nameColumnWidth = Math.Max(nameColumnWidth, latencyData.Checkpoints[i].Name.Length); 81nameColumnWidth = Math.Max(nameColumnWidth, latencyData.Tags[i].Name.Length); 97nameColumnWidth = Math.Max(nameColumnWidth, latencyData.Measures[i].Name.Length); 132nameColumnWidth = Math.Max(nameColumnWidth, nameHeader.Length); 139_ = sb.AppendLine(_dashes(valueHeader.Length + 1));
Logging\Import\LoggerRuleSelector.cs (2)
108if (current.CategoryName.Length > rule.CategoryName.Length)
Logging\JustInTimeRedactor.cs (8)
52if (_discriminator.Length == 0) 63if (_discriminator.Length == 0) 98int maxLenToRedact = charsInWorkBuffer + DiscriminatorSeparator.Length + _discriminator.Length + MaxDayOfYearLength; 128int maxLenToRedact = inputAsSpan.Length + DiscriminatorSeparator.Length + _discriminator.Length + MaxDayOfYearLength; 142charsInWorkBuffer += DiscriminatorSeparator.Length; 145charsInWorkBuffer += _discriminator.Length;
Sampling\LogSamplingRuleSelector.cs (2)
74if (current.CategoryName.Length > rule.CategoryName.Length)
src\Shared\Data.Validation\LengthAttribute.cs (1)
116count = s.Length;
src\Shared\LogBuffering\SerializedLogRecordFactory.cs (1)
80int charSize = str.Length * sizeof(char);
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.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.ComplianceReports (5)
Parser.cs (3)
97result = result.Substring("global::".Length); 260name = name.Substring(0, name.Length - "Attribute".Length);
src\Generators\Shared\GeneratorUtilities.cs (2)
60_ = shortAttributeNames.Add(n.Substring(index, n.Length - index - "Attribute".Length));
Microsoft.Gen.ComplianceReports.Unit.Tests (1)
test\Generators\Shared\RoslynTestUtils.cs (1)
123start += seq.Length;
Microsoft.Gen.ContextualOptions (2)
src\Generators\Shared\GeneratorUtilities.cs (2)
60_ = shortAttributeNames.Add(n.Substring(index, n.Length - index - "Attribute".Length));
Microsoft.Gen.ContextualOptions.Unit.Tests (1)
test\Generators\Shared\RoslynTestUtils.cs (1)
123start += seq.Length;
Microsoft.Gen.Logging (9)
Emission\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)
Parsing\TemplateProcessor.cs (3)
29var endIndex = message!.Length; 88var endIndex = message!.Length; 124_ = sb.Append(message, scanIndex, message.Length - scanIndex);
src\Generators\Shared\GeneratorUtilities.cs (2)
60_ = shortAttributeNames.Add(n.Substring(index, n.Length - index - "Attribute".Length));
src\Generators\Shared\RoslynExtensions.cs (2)
206return name.Length > AttributeSuffix.Length && name.EndsWith(AttributeSuffix, comparison);
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)
TemplatesExtractorTests.cs (1)
20var result = TemplateProcessor.FindIndexOfAny(message, new[] { '\n', 'a', 'b', 'z' }, 0, message.Length);
test\Generators\Shared\RoslynTestUtils.cs (1)
123start += seq.Length;
Microsoft.Gen.MetadataExtractor (5)
src\Generators\Microsoft.Gen.ComplianceReports\Parser.cs (3)
97result = result.Substring("global::".Length); 260name = name.Substring(0, name.Length - "Attribute".Length);
src\Generators\Shared\GeneratorUtilities.cs (2)
60_ = shortAttributeNames.Add(n.Substring(index, n.Length - index - "Attribute".Length));
Microsoft.Gen.MetadataExtractor.Unit.Tests (1)
test\Generators\Shared\RoslynTestUtils.cs (1)
123start += seq.Length;
Microsoft.Gen.Metrics (5)
MetricFactoryEmitter.cs (1)
47if (str.Length == 1)
src\Generators\Shared\GeneratorUtilities.cs (2)
60_ = shortAttributeNames.Add(n.Substring(index, n.Length - index - "Attribute".Length));
src\Generators\Shared\RoslynExtensions.cs (2)
206return name.Length > AttributeSuffix.Length && name.EndsWith(AttributeSuffix, comparison);
Microsoft.Gen.Metrics.Unit.Tests (1)
test\Generators\Shared\RoslynTestUtils.cs (1)
123start += seq.Length;
Microsoft.Gen.MetricsReports (2)
src\Generators\Shared\GeneratorUtilities.cs (2)
60_ = shortAttributeNames.Add(n.Substring(index, n.Length - index - "Attribute".Length));
Microsoft.Gen.MetricsReports.Unit.Tests (1)
test\Generators\Shared\RoslynTestUtils.cs (1)
123start += seq.Length;
Microsoft.Interop.ComInterfaceGenerator (4)
src\libraries\Common\src\Roslyn\GetBestTypeByMetadataName.cs (2)
157return name.Length > AttributeSuffix.Length && name.EndsWith(AttributeSuffix, comparison);
src\libraries\System.Runtime.InteropServices\gen\Common\ConvertToSourceGeneratedInteropFixer.cs (1)
66if (optionKeyAndValue.Length != 2 || optionKeyAndValue[1].Length < 3)
VirtualMethodPointerStubGenerator.cs (1)
308callingConventions.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\libraries\Common\src\Roslyn\GetBestTypeByMetadataName.cs (2)
157return name.Length > AttributeSuffix.Length && name.EndsWith(AttributeSuffix, comparison);
src\libraries\System.Runtime.InteropServices\gen\Common\ConvertToSourceGeneratedInteropFixer.cs (1)
66if (optionKeyAndValue.Length != 2 || optionKeyAndValue[1].Length < 3)
Microsoft.Interop.LibraryImportGenerator.Downlevel (2)
src\libraries\Common\src\Roslyn\GetBestTypeByMetadataName.cs (2)
157return name.Length > AttributeSuffix.Length && name.EndsWith(AttributeSuffix, comparison);
Microsoft.Interop.SourceGeneration (2)
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.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\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\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)
254int ichSplit = root.Length; 255_ectx.Check(entityPath.Length > ichSplit && entityPath[ichSplit] == Path.DirectorySeparatorChar); 257if (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)
116columnSB.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\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\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\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)
567if (p != -1 && p != operation.Length - 1)
Microsoft.ML.TensorFlow.Tests (1)
TensorflowTests.cs (1)
1929for (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 (117)
Model\BPETokenizer.cs (18)
172if (index < 0 || index == merge.Length - 1 || merge.IndexOf(' ', index + 1) >= 0) 356int prefixLen = ContinuingSubwordPrefix is null ? 0 : ContinuingSubwordPrefix.Length; 373if (mergeValues.b.Length <= prefixLen) 856span = span.Slice(0, span.Length - EndOfWordSuffix.Length); 861span = span.Slice(ContinuingSubwordPrefix.Length); 915bool continuingSubwordPrefix = ContinuingSubwordPrefix is not null && ContinuingSubwordPrefix.Length > 0; 916bool endOfWordSuffix = EndOfWordSuffix is not null && EndOfWordSuffix.Length > 0; 947sSpan = sSpan.Slice(ContinuingSubwordPrefix!.Length); 953sSpan = sSpan.Slice(0, sSpan.Length - EndOfWordSuffix!.Length); 1032span = span.Slice(0, span.Length - EndOfWordSuffix.Length); 1037span = span.Slice(ContinuingSubwordPrefix.Length); 1155if (line.StartsWith("#version", StringComparison.Ordinal) || line.Length == 0) 1161if (index < 0 || index == line.Length - 1 || line.IndexOf(' ', index + 1) >= 0) 1213if (ContinuingSubwordPrefix.Length + s.Length <= buffer.Length) 1216s.CopyTo(buffer.Slice(ContinuingSubwordPrefix.Length)); 1217s = buffer.Slice(0, ContinuingSubwordPrefix.Length + s.Length); 1233if (s.Length + EndOfWordSuffix.Length <= buffer.Length) 1237s = 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)
311if (token.Length == 0) 325if (token[token.Length - 1] == prefixSuffixChar) 601if (buffer.Length < specialToken!.Length) 607charsWritten += specialToken.Length; 667if (token.Length == 0) 726if (buffer.Length < token.Length - delta)
Model\SentencePieceTokenizer.cs (2)
125CharsConsumed = normalizedText?.Length ?? text?.Length ?? textSpan.Length
Model\SentencePieceUnigramModel.cs (5)
363int tokenLength = stringToken.Length; 903charsConsumed += _vocabReverse[ids[index]].Piece.Length; 1188charsConsumed += _vocabReverse[ids[i].Id].Piece.Length; 1264return normalizedText is not null ? normalizedText.Length - charConsumedFromEnd : 0; 1399consumedCharacters += _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\SentencePieceNormalizer.cs (2)
212var tokenLength = token.Length; 247var tokenLength = token.Length;
PreTokenizer\CompositePreTokenizer.cs (1)
84foreach ((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)
318char[] destinationBuffer = new char[expectedDecoded.Length]; 332Assert.True(charactersWritten < expectedDecoded.Length); 341Assert.Equal(expectedDecoded.Length, charactersWritten); 477Assert.Equal(text.Length, length); 480Assert.Equal(text.Length, length); 835char[] destinationBuffer = new char[beginningOfSentenceToken.Length + text.Length]; 842Assert.Equal(OperationStatus.DestinationTooSmall, tokenizer.Decode(ids, destinationBuffer.AsSpan(0, text.Length - 1), considerSpecialTokens: false, out idsConsumed, out charsWritten)); 844Assert.True(charsWritten < text.Length); 845Assert.Equal(OperationStatus.DestinationTooSmall, tokenizer.Decode(ids, destinationBuffer.AsSpan(0, text.Length), considerSpecialTokens: true, out idsConsumed, out charsWritten)); 847Assert.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)
163char[] destinationBuffer = new char[expectedDecoded.Length]; 177Assert.True(charactersWritten < expectedDecoded.Length); 186Assert.Equal(expectedDecoded.Length, charactersWritten); 602Assert.Equal(text.Length, length); 605Assert.Equal(text.Length, length); 746Assert.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)
565if (p != -1 && p != operation.Length - 1) 715var relativePath = fullPath.Substring(_modelLocation.Length + 1);
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)
73while (!string.IsNullOrEmpty(value) && index < value.Length) 130while (!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\Http\Shared\CookieHeaderParserShared.cs (1)
33while (!string.IsNullOrEmpty(value) && index < value.Length)
Microsoft.NET.StringTools (12)
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;
WeakStringCache.cs (1)
87if (str.Length > WeakHandleMinimumLength)
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.NET.StringTools.net35 (12)
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.Simple.cs (3)
119public readonly int Length => (_builder == null ? FirstString.Length : _builder.Length); 137if (other.Length != Length) 148for (int i = 0; i < other.Length; i++)
WeakStringCache.cs (1)
87if (str.Length > WeakHandleMinimumLength)
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.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.VisualBasic.Tests (1)
Microsoft\VisualBasic\ApplicationServices\SingleInstanceTests.cs (1)
189n += str.Length;
Microsoft.VisualStudio.LanguageServices (42)
CodeMarkers\ManagedCodeMarkers.cs (2)
281int byteCount = stringData == null ? 0 : stringData.Length + 1; 311encoding.GetBytes(stringData, 0, stringData.Length, data, 0); // null terminator is already there, just write string over it
ColorSchemes\ColorSchemeApplier.RegistryItemConverter.cs (2)
98WriteDWord(bytes, (uint)color.Name.Length); 100bytes.Write(Encoding.ASCII.GetBytes(color.Name), 0, color.Name.Length);
DebuggerIntelliSense\AbstractDebuggerIntelliSenseContext.cs (1)
242for (var i = 0; i < text.Length; i++)
ErrorReporting\VisualStudioErrorReportingService.ExceptionFormatting.cs (1)
50var stackText = message.Length <= 0
GenerateType\GenerateTypeDialogViewModel.cs (2)
306var folderPath = this.FullFilePath[projectRootPath.Length..]; 663currentFileName = currentFileName[..^undesiredFileExtension.Length];
Implementation\AbstractEditorFactory.cs (1)
360if (originalNewLine.Length > 0 && originalNewLine != targetLineEnding)
InheritanceMargin\MarginGlyph\InheritanceMarginGlyphViewModel.cs (1)
59var suffixString = ServicesVSResources._0_is_inherited[(startOfThePlaceholder + "{0}".Length)..];
Library\ObjectBrowser\AbstractDescriptionBuilder.cs (1)
259var right = memberOfText[(index + specifier.Length)..];
Library\ObjectBrowser\AbstractObjectBrowserLibraryManager.cs (1)
395if (memberName.Length > 0)
Library\ObjectBrowser\ObjectList.cs (2)
639if (longestMatchedName.Length < name.Length)
Library\VsNavInfo\Extensions.cs (1)
33if (start < name.Length)
PickMembers\PickMembersDialogViewModel.cs (1)
53MemberContainers = searchText.Length == 0
Preview\PreviewEngine.cs (1)
287Marshal.ThrowExceptionForHR(lines.ReplaceLines(0, 0, piLineIndex, piLineLength, newTextPtr, newText.Length, changes));
Snippets\SnippetExpansionClient.cs (2)
288_indentDepth = lineText.GetColumnFromLineOffset(lineText.Length, formattingOptions.TabSize); 872placeholderValue.Length > 0)
TaskList\ProjectExternalErrorReporter.cs (1)
331if (!string.IsNullOrEmpty(errorId) && errorId.Length > 2)
UnusedReferences\RemoveUnusedReferencesCommandHandler.cs (1)
126projectFilePath is not string { Length: > 0 } ||
Venus\ContainedDocument.cs (19)
429if (text.Length == 0) 436for (var i = 0; i < text.Length; i++) 473if (start <= text.Length) 475groups.Add(TextSpan.FromBounds(start, text.Length)); 483if (index < 0 || text.Length <= index) 549snippetInRightText.Substring(firstLineOfRightTextSnippet.Length, snippetInRightText.Length - firstLineOfRightTextSnippet.Length - lastLineOfRightTextSnippet.Length)); 570snippetInRightText[firstLineOfRightTextSnippet.Length..]); 587snippetInRightText[..^lastLineOfRightTextSnippet.Length]); 645var returnLength = returnReplacement.Length; 646var newLineLength = newLineReplacement.Length; 649for (var i = 0; i < text.Length; i++) 904return baseIndentationString.GetColumnFromLineOffset(baseIndentationString.Length, editorOptions.GetTabSize()) + additionalIndentation; 1073if (ch != tag[^1] || position < tag.Length) 1078var start = position - tag.Length; 1079var razorTag = snapshot.GetText(start, tag.Length); 1112return CheckCode(snapshot, position - tag2.Length, tag1);
Venus\ContainedLanguageCodeSupport.cs (1)
421var memberName = fullyQualifiedName.Substring(lastDot + 1, fullyQualifiedName.Length - lastDot - 1);
Workspace\SourceGeneratedFileManager.cs (1)
172var slice = filePath.AsSpan()[_temporaryDirectory.Length..];
Microsoft.VisualStudio.LanguageServices.CSharp (6)
CodeModel\CSharpCodeModelService.cs (4)
1360var lengthToStrip = lines[0].GetLeadingWhitespace().Length; 1370if (line.Length > 0) 1372lengthToStrip = Math.Min(lengthToStrip, line.GetLeadingWhitespace().Length); 1381if (line.Length > lengthToStrip)
CodeModel\CSharpCodeModelService.NodeLocator.cs (1)
190var lineEndColumn = lineText.GetColumnFromLineOffset(lineText.Length, indentSize);
Snippets\CSharpSnippetExpansionLanguageHelper.cs (1)
66var commentSpan = new Span(endPosition, commentString.Length);
Microsoft.VisualStudio.LanguageServices.CSharp.UnitTests (11)
PersistentStorage\AbstractPersistentStorageTests.cs (10)
56private static readonly string MediumData1 = string.Join(",", Enumerable.Repeat(SmallData1, MediumSize / SmallData1.Length)); 57private static readonly string MediumData2 = string.Join(",", Enumerable.Repeat(SmallData2, MediumSize / SmallData2.Length)); 59private static readonly string LargeData1 = string.Join(",", Enumerable.Repeat(SmallData1, LargeSize / SmallData1.Length)); 60private static readonly string LargeData2 = string.Join(",", Enumerable.Repeat(SmallData2, LargeSize / SmallData2.Length)); 62private static readonly string ExtraLargeData1 = string.Join(",", Enumerable.Repeat(SmallData1, ExtraLargeSize / SmallData1.Length)); 63private static readonly string ExtraLargeData2 = string.Join(",", Enumerable.Repeat(SmallData2, ExtraLargeSize / SmallData2.Length)); 72Assert.True(MediumData1.Length < SQLite.v2.SQLitePersistentStorage.MaxPooledByteArrayLength); 73Assert.True(MediumData2.Length < SQLite.v2.SQLitePersistentStorage.MaxPooledByteArrayLength); 75Assert.True(LargeData1.Length > SQLite.v2.SQLitePersistentStorage.MaxPooledByteArrayLength); 76Assert.True(LargeData2.Length > SQLite.v2.SQLitePersistentStorage.MaxPooledByteArrayLength);
ProjectSystemShim\CSharpHelpers.cs (1)
123outputPath = arg[(index + outPrefix.Length)..];
Microsoft.VisualStudio.LanguageServices.UnitTests (1)
DebuggerIntelliSense\TestState.vb (1)
103For i As Integer = 0 To item.Length
Microsoft.VisualStudio.LanguageServices.VisualBasic (11)
CodeModel\VisualBasicCodeModelService.NodeNameGenerator.vb (2)
114name = name.Substring(0, name.Length - 7) 116name = name.Substring(0, name.Length - 5)
CodeModel\VisualBasicCodeModelService.vb (7)
849Return If(name IsNot Nothing AndAlso name.Length > 2 AndAlso name.StartsWith("[", StringComparison.Ordinal) AndAlso name.EndsWith("]", StringComparison.Ordinal), 850name.Substring(1, name.Length - 2), 1973parameterName.Substring(0, parameterName.Length - 1), 4039If eventName.Length >= parentName.Length Then 4040If CaseInsensitiveComparison.Equals(eventName.Substring(0, parentName.Length), parentName) Then 4041Return "MyBase" & eventName.Substring(parentName.Length)
Snippets\SnippetCompletionProvider.vb (1)
111snippetClient.TryInsertExpansion(updatedSpan.Start, updatedSpan.Start + completionItem.DisplayText.Length, CancellationToken.None)
Snippets\VisualBasicSnippetExpansionLanguageHelper.vb (1)
95Dim commentSpan = New Span(endSpan.Start.Position, commentString.Length)
Microsoft.Web.Xdt.Extensions (1)
src\Shared\ThrowHelpers\ArgumentNullThrowHelper.cs (1)
47else if (argument.Length == 0)
Mvc.RoutingWebSite (1)
src\Mvc\test\WebSites\Common\TestResponseGenerator.cs (1)
32.ToDictionary(kvp => kvp.Key.Substring("link_".Length), kvp => (object)kvp.Value[0]);
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) {
PrepareTests (2)
MinimizeUtil.cs (2)
190if (Path.GetDirectoryName(destFileName) is { Length: not 0 } directory) 236if (Path.GetDirectoryName(destFilePath) is { Length: not 0 } directory)
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)) 647if (codeProvider.Supports(GeneratorSupport.PartialTypes) && _ccRoot.SubClass.Length == 0) 1315if (ReferenceAssemblyList[i] is ReferenceAssembly refasm && refasm.Path.Length > 0) 1332if (ReferenceAssemblyList[i] is ReferenceAssembly refasm && refasm.Path.Length > 0) 1346asmMissing += $"{(asmMissing.Length > 0 ? ", " : string.Empty)}PresentationCore"; 1350asmMissing += $"{(asmMissing.Length > 0 ? ", " : string.Empty)}PresentationFramework"; 1353if (asmMissing.Length > 0) 1398if (ns != null && ns.Length > 0) 1435if (className.Length > 0) 1455if (typeArgs.Length == 0) 1514if (className.Length == 0 ||!NameValidationHelper.IsValidIdentifierName(className)) 1524if (ns.Length > 0) 1555if (handler.Length == 0) 1616string relPath = TargetPath.Substring(SourceFileInfo.SourcePath.Length); 1649if (_private.Length == 0) 1715if (modifier.Length > 0) 1717if (_privateClass.Length == 0) 1927bool subClassed = _ccRoot.SubClass.Length > 0; 1972bool subClassed = _ccRoot.SubClass.Length > 0; 2028Debug.Assert(_ccRoot != null && _ccRoot.SubClass.Length > 0); 2235if (codeText == null || codeText.Trim().Length == 0) 2262if (localTypeArgNamespace.Length == 0 && localTypeArgClassName.Length == 0) 2301if (genericName.Length > 0 || t.IsGenericType) 2303Debug.Assert(genericName.Length > 0 || t.IsGenericTypeDefinition); 2307Debug.Assert(genericName.Length == 0 && typeArgsList != null); 2468else if (baseClassFullName.Length > 0) 2524else if (IsCompilingEntryPointClass && className.Length == 0) 3012if (className.Length > 0) 3016else if (subClassFullName.Length > 0) 3020else if (modifier.Length > 0) 3043if (subClassFullName.Length > 0) 3151string appClassName = _ccRoot.SubClass.Length > 0 ? _ccRoot.SubClass 3227if (ApplicationFile.Length > 0)
MS\Internal\MarkupCompiler\ParserExtension.cs (4)
195if (localElementFullName.Length > 0 && !_pass2) 242if (xamlUnknownAttributeNode.OwnerTypeFullName.Length > 0) 338if (localTagFullName.Length > 0 && !_pass2) 755if ((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\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\Microsoft.DotNet.Wpf\src\PresentationCore\System\Windows\Media\Knowncolors.cs (1)
283switch (colorString.Length)
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\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\Microsoft.DotNet.Wpf\src\PresentationFramework\System\Windows\Markup\BamlMapTable.cs (1)
1004Debug.Assert(assemblyFullName.Length != 0, "empty assembly");
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\Microsoft.DotNet.Wpf\src\PresentationFramework\System\Windows\Markup\ParserContext.cs (1)
426if (parserContext.XmlSpace != null && parserContext.XmlSpace.Length != 0)
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\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\Microsoft.DotNet.Wpf\src\PresentationFramework\System\Windows\Markup\XamlBrushSerializer.cs (1)
133if (stringValue.Length > 3)
src\Microsoft.DotNet.Wpf\src\PresentationFramework\System\Windows\Markup\XamlParser.cs (1)
733if (xamlPIMappingNode.AssemblyName.Length == 0)
src\Microsoft.DotNet.Wpf\src\PresentationFramework\System\Windows\Markup\XamlReaderHelper.cs (12)
2215prefix = attribName.Substring(NamespacePrefix.Length); 2363MappingParser parser = new MappingParser(mappingUri, MappingProtocol.Length); 2372bool isLocalAssembly = assemblyName == null || assemblyName.Length < 1; 2502return len == value.Length && string.CompareOrdinal(value, 0, _text, _start, len) == 0; 3207$"Set{methodInfo.Name.Substring("Get".Length)}", 3519null != methodInfo.DeclaringType.GetMethod($"Set{methodInfo.Name.Substring("Get".Length)}", 5479for (int i = 0; i < text.Length; i++) 5494Debug.Assert(currentPos > 0 && currentPos < s.Length - 1); 5566int textLength = text.Length; 5577StringBuilder collapsedTextStringBuilder = new StringBuilder(text.Length); 6382if (null != textFlowData.TextNode && textFlowData.TextNode.Text.Length > 0) 6393if (collapsedText.Length > 0)
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\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\Microsoft.DotNet.Wpf\src\PresentationFramework\System\Windows\SystemResourceKey.cs (1)
385srkField = memberName.Remove(memberName.Length - 3);
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\Microsoft.DotNet.Wpf\src\Shared\MS\Internal\ResourceIDHelper.cs (1)
72resourceID = sourcePath.Substring(basePath.Length);
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\Microsoft.DotNet.Wpf\src\Shared\System\Windows\Markup\RuntimeIdentifierPropertyAttribute.cs (1)
96for (int i = 0; i < name.Length; i++)
src\Microsoft.DotNet.Wpf\src\Shared\System\Windows\Markup\TypeConverterHelper.cs (1)
89$"Get{methodInfo.Name.Substring("Set".Length)}",
src\Microsoft.DotNet.Wpf\src\Shared\System\Windows\Markup\XmlCompatibilityReader.cs (1)
961int length = pair.Length;
src\Microsoft.DotNet.Wpf\src\WindowsBase\MS\Internal\IO\Packaging\CompoundFile\ContainerUtilities.cs (1)
115strByteLen = outputString.Length * 2;
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) 761if (contentRange.Length == 0 776int firstByteOffset = Int32.Parse(contentRange.AsSpan(ByteRangeUnit.Length, 777index - 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\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); 972if (_that._text.Length == 0) 1017if (_textStorePosition + _currentLine.Length < _that._text.Length) 1097Debug.Assert(_that._text.Length > 0 && textSourcePosition + line.Length <= _that._text.Length + 1); 1102Math.Min(textSourcePosition + line.Length - 1, _that._text.Length - 1) 1549return BuildHighlightGeometry(origin, 0, _text.Length); 1720if (_text.Length == 0) 1826if (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)
556Debug.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)
700if (selectionStart == newText.Length && 800EditableTextBoxSite.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)
556while (++i < id.Length) 569if (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)
12523if (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; 509clusterMap = new ushort[unicodeString.Length]; 510estimatedNumberOfGlyphs = unicodeString.Length; 519estimatedNumberOfGlyphs = Math.Max(estimatedNumberOfGlyphs, glyphsProp.Length / 5); 533for (int i = 0; i <= glyphsProp.Length; i++) 536char c = i < glyphsProp.Length ? glyphsProp[i] : '\0'; 539if ((c == ',') || (c == ';') || (i == glyphsProp.Length)) 562if (unicodeString.Length <= parsedCharacterCount) 620if ((c == ';') || (i == glyphsProp.Length)) 652while (parsedCharacterCount < unicodeString.Length) 657if (unicodeString.Length <= parsedCharacterCount)
System\Windows\Documents\ImmComposition.cs (9)
844RecordCaretOffset(caretOffset, attributes, compositionString.Length); 935return (compositionString.Length == originalLength) ? compositionString : null; 1106_caretOffset = Math.Min(_caretOffset, text.Length); 1330int requestSize = Marshal.SizeOf(typeof(NativeMethods.RECONVERTSTRING)) + (target.Length * sizeof(short)) + ((_maxSrounding + 1) * sizeof(short) * 2); 1343reconv.dwStrLen = surrounding.Length; // in char count 1345reconv.dwCompStrLen = target.Length; // in char count 1347reconv.dwTargetStrLen = target.Length; // in char count 1375Marshal.Copy(surrounding.ToCharArray(), 0, new IntPtr((void*)p), surrounding.Length); 1434offsetStart = 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; 8117if (instructionName.Length > 0 && instructionName[0] == ' ') 8333pictureUri = instructionName.Substring(uriIndex, instructionName.Length - uriIndex - 1); 8365while (i < instr.Length) 8377if (i < instr.Length) 8382for (; iEnd < instr.Length; iEnd++) 8413if (i < instr.Length) 8456return dn.NavigateUri.Length > 0 ? dn : null; 8471while (i < instr.Length) 8482if (instr[i] == '0' && i < instr.Length - 1 && instr[i + 1] == 'x') 8487for (; i < instr.Length && instr[i] != ' ' && instr[i] != '\\'; i++) 8498for (; i < instr.Length && instr[i] != ' ' && instr[i] != '\\'; i++) 8511if (i < instr.Length) 8531return (dn.Xaml != null && dn.Xaml.Length > 0) ? dn : null; 8553if (i < instr.Length && instr[i] == ' ') 8557for (; i < instr.Length && instr[i] != ' '; i++) 8587if (i < instr.Length && instr[i] == ' ') 8591if (i < instr.Length && instr[i] == '"') 8596for (; i < instr.Length && instr[i] != '"'; i++) 8603if (name != null && name.Length > 0) 9727if (token.Text.Length == 0) 11279if (entry != null && tokenName.Length > 0 && !entry.IsNameSealed) 11342while (nStart < text.Length) 11345while (nEnd < text.Length) 11355if (nStart == 0 && nEnd == text.Length) 11366while (nEnd < text.Length && (text[nEnd] == 0x0d || text[nEnd] == 0x0a)) 11370if (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)
1187if (textData.Length > extraCharsAllowed) 1198if (textData.Length == extraCharsAllowed && Char.IsHighSurrogate(textData, extraCharsAllowed - 1)) 1206if (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) 4995if (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)
573name = name.Substring(1, name.Length-2); 900return (name != null && name.Length > 1 && name[0] == '(' && (name[name.Length - 1] == ')')); 909toParse = 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)
69if (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;
Replay (4)
Replay.cs (1)
227var isOption = line.Length > 0 && line[0] is '-' or '/';
src\Compilers\Shared\BuildProtocol.cs (1)
581writer.Write(value.Length);
src\Compilers\Shared\RuntimeHostInfo.cs (2)
44if (Environment.GetEnvironmentVariable(DotNetHostPathEnvironmentName) is { Length: > 0 } pathToDotNet) 49if (Environment.GetEnvironmentVariable(DotNetExperimentalHostPathEnvironmentName) is { Length: > 0 } pathToDotNetExperimental)
ResultsOfTGenerator (1)
Program.cs (1)
1074public static string TitleCase(this string value) => string.Create(value.Length, value, (c, s) =>
Roslyn.Diagnostics.Analyzers (202)
AbstractRunIterations`1.cs (1)
102ReplaceName(syntaxGenerator, attribute, name[0..^"FactAttribute".Length] + "TheoryAttribute"));
src\Compilers\Core\Portable\FileSystem\FileUtilities.cs (2)
133if (path!.Length == 1) 175Debug.Assert(path.Length == 1 || !PathUtilities.IsDirectorySeparator(path[1]));
src\Compilers\Core\Portable\FileSystem\PathUtilities.cs (36)
52int lastSeparator = s.Length; 58if (lastSeparator != s.Length) 71if (s.Length == 0 || IsAnyDirectorySeparator(s[s.Length - 1])) 138var rootLength = GetPathRoot(path, isUnixLike).Length; 139if (path.Length > rootLength) 141var i = path.Length; 212int length = path.Length; 287return path.Length > 0 && IsDirectorySeparator(path[0]) 314if (path.Length > 0 && path[0] == '.') 316if (path.Length == 1 || IsDirectorySeparator(path[1])) 323if (path.Length == 2 || IsDirectorySeparator(path[2])) 334if (path.Length >= 1 && IsDirectorySeparator(path[0])) 341if (path.Length >= 2 && path[1] == VolumeSeparatorChar && (path.Length <= 2 || !IsDirectorySeparator(path[2]))) 375return path.Length >= 2 && 386return path.Length >= 3 && path[1] == VolumeSeparatorChar && IsDirectorySeparator(path[2]); 440char c = root[root.Length - 1]; 479if (path.Length > 0 && IsDirectorySeparator(path[path.Length - 1])) 481return path.Substring(0, path.Length - 1); 608return parentPath.Length > 0 609&& childPath.Length > parentPath.Length 610&& PathsEqual(childPath, parentPath, parentPath.Length) 611&& (IsDirectorySeparator(parentPath[parentPath.Length - 1]) || IsDirectorySeparator(childPath[parentPath.Length])); 616var relativePath = childPath.Substring(parentPath.Length); 619int start = ConsumeDirectorySeparators(relativePath, relativePath.Length, 0); 648return PathsEqual(path1, path2, Math.Max(path1.Length, path2.Length)); 656if (path1.Length < length || path2.Length < length) 714if (!(oldPrefix?.Length > 0)) continue; 723var replacement = replacementPrefix + filePath.Substring(oldPrefix.Length); 841if (!isDriveRooted && !(p.Length > 1 && p[0] == AltDirectorySeparatorChar))
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\Compilers\Core\Portable\InternalUtilities\StringExtensions.cs (15)
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.Substring(0, name.Length - AttributeSuffix.Length); 165return name.Length > AttributeSuffix.Length && name.EndsWith(AttributeSuffix, comparison); 171while (i < str.Length) 178if (i < str.Length && char.IsLowSurrogate(str[i])) 208if (arg.Length > 1 && arg[0] == '"' && arg[arg.Length - 1] == '"') 211return arg.Substring(1, arg.Length - 2); 223while (x < string1.Length && x < string2.Length && 235while (x < string1.Length && x < string2.Length &&
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\Compilers\Core\Portable\InternalUtilities\UnicodeCharacterUtilities.cs (1)
103int nameLength = name.Length;
src\Compilers\Core\Portable\Syntax\SyntaxTreeExtensions.cs (2)
95var n1 = s1.Length; 96var n2 = s2.Length;
src\Compilers\Core\Portable\Text\TextChangeRangeExtensions.cs (1)
105return new TextChangeRange(textChange.Span, textChange.NewText?.Length ?? 0);
src\Dependencies\Collections\Extensions\IEnumerableExtensions.cs (2)
213return str.Length == 0; 236return source.Length == 0;
src\RoslynAnalyzers\Utilities\Compiler\CodeMetrics\CodeAnalysisMetricData.cs (1)
141if (index >= 0 && index < symbolName.Length)
src\RoslynAnalyzers\Utilities\Compiler\Extensions\StringExtensions.cs (1)
15return Encoding.UTF8.GetByteCount(value) == value.Length;
src\RoslynAnalyzers\Utilities\Compiler\Options\AnalyzerOptionsExtensions.cs (2)
359if (trimmedSuffix.Length >= 2 && 363for (int i = 1; i < trimmedSuffix.Length - 2; i++)
src\RoslynAnalyzers\Utilities\Compiler\Options\SymbolNamesWithValueOption.cs (2)
109parts.SymbolName.Length == 1)) 145Debug.Assert(parts.SymbolName.Length >= 2);
src\RoslynAnalyzers\Utilities\Compiler\RulesetToEditorconfigConverter.cs (2)
208if (comment.Length > 0) 213if (trimmedCommentPart.Length > 0)
src\RoslynAnalyzers\Utilities\Compiler\WellKnownTypeProvider.cs (1)
220for (int i = 0; i < fullTypeName.Length; i++)
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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\CodeGeneration\ParameterName.cs (1)
42BestNameForParameter = trimmed.Length > 0 ? tryMakeCamelCase ? trimmed.ToCamelCase() : trimmed : nameBasedOnArgument;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EditorConfig\Parsing\Sections\SectionMatcher.Lexer.cs (5)
15public readonly bool IsDone => Position >= headerText.Length; 54if (position < headerText.Length) 85if (position < headerText.Length && 113if (position >= headerText.Length) 171return str.Length == 0 || str == "-"
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\VirtualChars\AbstractVirtualCharService.cs (8)
31if (index + 1 < tokenText.Length) 117Debug.Assert(lastVC.Span.End == token.Span.End - "\"".Length, "Last span has to end right before the end of the string token."); 121Debug.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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\VirtualChars\AbstractVirtualCharService.ITextInfo.cs (1)
30public readonly int Length(string text) => text.Length;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\VirtualChars\VirtualCharSequence.Chunks.cs (3)
84public override int Length => data.Length; 89if (stringIndex < 0 || stringIndex >= data.Length) 104Debug.Assert(index + 1 >= data.Length ||
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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\TokenStream.cs (2)
337length = text.ConvertTabToSpace(_options.TabSize, initialColumn, text.Length); 341length = text.Length;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\TreeData.Node.cs (1)
30return lineText.GetColumnFromLineOffset(lineText.Length, tabSize);
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\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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\Naming\IdentifierNameParts.cs (2)
47? newBaseName[prefix.Length..] 53? newBaseName[..^suffix.Length]
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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\NamingStyle.WordSpanEnumerator.cs (1)
52Current = new TextSpan(Current.End + _wordSeparator.Length, 0);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Serialization\ObjectWriter.cs (2)
504var bytes = new byte[(uint)value.Length * sizeof(char)]; 510WriteCompressedUInt((uint)value.Length);
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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\SyntaxFacts\ISyntaxFactsExtensions.cs (2)
251if (name.Length == 0) 261for (var i = 1; i < name.Length; i++)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.cs (1)
198Debug.Assert(reader.Position == symbolKey.Length);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.SymbolKeyReader.cs (1)
259while (Position < Data.Length)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\Base64Utilities.cs (2)
329decodedLength = (encodedString.Length * 3) / 4 - padding; 336var index = attributeData.Length - 1;
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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\BKTree.cs (4)
74Span<char> lowerCaseCharacters = value.Length < 512 75? stackalloc char[value.Length] 76: new char[value.Length]; 78for (var i = 0; i < value.Length; i++)
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++) 89Span<char> 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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\PathMetadataUtilities.cs (2)
31if (rootNamespace is { Length: > 0 } && 69@namespace = @namespace[(rootNamespace.Length + 1)..];
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\StringBreaker.cs (2)
24for (var start = 0; start < text.Length;) 42var length = identifier.Length;
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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\WordSimilarityChecker.cs (6)
80=> value.Length <= 4 ? 1 : 2; 87if (_source.Length < 3) 113if (Math.Abs(_source.Length - candidateText.Length) <= _threshold) 142var lengthDifference = Math.Abs(originalText.Length - candidateText.Length);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\ISymbolExtensions.cs (1)
795(symbol.Name.Length == 1 || uint.TryParse(symbol.Name[1..], out _) || symbol.Name.All(n => n.Equals('_')));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\ITypeSymbolExtensions.cs (1)
363return shortName.Length == 0
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Extensions\ProjectExtensions.cs (2)
75analyzerConfigDirectory.Length > bestPath.Length)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Extensions\SyntaxGeneratorExtensions_CreateEqualsMethod.cs (1)
366if (name.Length > 0)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\LanguageServices\TypeInferenceService\AbstractTypeInferenceService.cs (3)
67if (name.Length == prefix.Length) 72var nextChar = name[prefix.Length];
Roslyn.Diagnostics.Analyzers.UnitTests (4)
ExportedPartsShouldHaveImportingConstructorTests.cs (2)
515ExpectedDiagnostics = { VerifyCS.Diagnostic().WithSpan(1, 2, 1, mefNamespace.Length + 9).WithArguments("C") }, 551ExpectedDiagnostics = { VerifyVB.Diagnostic().WithSpan(1, 2, 1, mefNamespace.Length + 9).WithArguments("C") },
TestExportsShouldNotBeDiscoverableTests.cs (2)
76ExpectedDiagnostics = { VerifyCS.Diagnostic().WithSpan(1, 2, 1, mefNamespace.Length + 9).WithArguments("C") }, 169ExpectedDiagnostics = { VerifyVB.Diagnostic().WithSpan(1, 2, 1, mefNamespace.Length + 9).WithArguments("C") },
Roslyn.Diagnostics.CSharp.Analyzers (32)
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\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\EmbeddedLanguages\VirtualChars\CSharpVirtualCharService.cs (8)
137var endIndexExclusive = tokenText.Length; 142endIndexExclusive -= "u8".Length; 234if (startDelimiter.Length > 0 && !tokenText.StartsWith(startDelimiter)) 240if (endDelimiter.Length > 0 && !tokenText.EndsWith(endDelimiter, StringComparison.OrdinalIgnoreCase)) 246var startIndexInclusive = startDelimiter.Length; 247var endIndexExclusive = tokenText.Length - endDelimiter.Length; 504for (var i = 0; i < 4 && endIndex < tokenText.Length; i++)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\SyntaxTriviaExtensions.cs (2)
109textBuilder.Remove(textBuilder.Length - newLine.Length, newLine.Length);
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\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Engine\Trivia\TriviaDataFactory.cs (1)
135return textSnippet.ConvertTabToSpace(Options.TabSize, initialColumn, textSnippet.Length);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\FormattingHelpers.cs (1)
29var start = lastNewLinePos + NewLine.Length;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Services\SyntaxFacts\CSharpSyntaxFacts.cs (4)
453return this.IsIdentifier(token) && !token.ContainsDiagnostics && token.ToString().Length == identifier.Length; 459return this.IsIdentifier(token) && !token.ContainsDiagnostics && token.ToString().Length == identifier.Length && token.IsVerbatimIdentifier();
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\CSharpCodeGenerationHelpers.cs (2)
132if (tokenText.Length <= 2 || tokenText.Last() != '"') 141if (tokenText.Length <= 1 || tokenText.Last() != '"')
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\ITypeSymbolExtensions.TypeSyntaxGeneratorVisitor.cs (1)
149? null : symbol.Signature.UnmanagedCallingConventionTypes.Select(type => GetConventionForString(type.Name["CallConv".Length..])),
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\StringExtensions.cs (1)
37if (escaped.Length == 0 || escaped[0] != '@')
Roslyn.Diagnostics.VisualBasic.Analyzers (9)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\VisualBasic\Formatting\Engine\Trivia\TriviaDataFactory.CodeShapeAnalyzer.vb (1)
299If xmlCommentText.GetColumnFromLineOffset(xmlCommentText.Length - 3, tabSize) <> indentation Then
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\VisualBasic\Services\SyntaxFacts\VisualBasicSyntaxFacts.vb (1)
458Return IsIdentifier(token) AndAlso Not token.ContainsDiagnostics AndAlso token.ToString().Length = identifier.Length
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\VisualBasic\CodeGeneration\EnumMemberGenerator.vb (1)
114Dim lastTwoChars = numericText.Substring(numericText.Length - 2, 2)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\VisualBasic\CodeGeneration\ExpressionGenerator.StringPiece.vb (2)
82While i < value.Length 118If i < value.Length AndAlso value(i) = vbLf Then
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,
Roslyn.Test.PdbUtilities (5)
Reader\MockSymUnmanagedReader.cs (1)
361count = _name.Length + 1; // + 1 for null terminator
Shared\DummyMetadataImport.cs (4)
108(typeDef.Namespace.IsNil ? 0 : _metadataReaderOpt.GetString(typeDef.Namespace).Length + 1) + 109_metadataReaderOpt.GetString(typeDef.Name).Length; 147(typeRef.Namespace.IsNil ? 0 : _metadataReaderOpt.GetString(typeRef.Namespace).Length + 1) + 148_metadataReaderOpt.GetString(typeRef.Name).Length;
Roslyn.Test.Performance.Utilities (1)
RelativeDirectory.cs (1)
83return _workingDir.Substring(0, configurationIndex + configuration.Length);
Roslyn.VisualStudio.DiagnosticsWindow (1)
Panels\TelemetryPanel.xaml.cs (1)
65if (result.Length > 0)
Roslyn.VisualStudio.Next.UnitTests (1)
Services\PerformanceTrackerServiceTests.cs (1)
196if (lines[i].Trim().Length == 0)
RulesetToEditorconfigConverter (2)
src\RoslynAnalyzers\Utilities\Compiler\RulesetToEditorconfigConverter.cs (2)
208if (comment.Length > 0) 213if (trimmedCommentPart.Length > 0)
RunTests (3)
HelixTestRunner.cs (1)
259if (Environment.GetEnvironmentVariable(knownEnvironmentVariable) is string { Length: > 0 } value)
ProcessTestExecutor.cs (1)
170if (resultData.Length == 0)
TestRunner.cs (1)
28assembliesString = assembliesString.Length > 150 ? $"{assembliesString[..150]}..." : assembliesString;
Sample (1)
Transformers\AddExternalDocsTransformer.cs (1)
12if (operation.OperationId is { Length: > 0 } id &&
Sandbox (36)
artifacts\obj\Sandbox\Release\net10.0\Greet.cs (16)
128if (Name.Length != 0) hash ^= Name.GetHashCode(); 161if (Name.Length != 0) { 175if (Name.Length != 0) { 190if (other.Name.Length != 0) { 332if (Name.Length != 0) hash ^= Name.GetHashCode(); 333if (From.Length != 0) hash ^= From.GetHashCode(); 370if (Name.Length != 0) { 374if (From.Length != 0) { 388if (Name.Length != 0) { 391if (From.Length != 0) { 406if (other.Name.Length != 0) { 409if (other.From.Length != 0) { 559if (Message.Length != 0) hash ^= Message.GetHashCode(); 597if (Message.Length != 0) { 615if (Message.Length != 0) { 633if (other.Message.Length != 0) {
artifacts\obj\Sandbox\Release\net10.0\Transcoding.cs (20)
271if (Name.Length != 0) hash ^= Name.GetHashCode(); 321if (Name.Length != 0) { 348if (Name.Length != 0) { 373if (other.Name.Length != 0) { 586if (Subfield.Length != 0) hash ^= Subfield.GetHashCode(); 621if (Subfield.Length != 0) { 636if (Subfield.Length != 0) { 652if (other.Subfield.Length != 0) { 1026if (SingleString.Length != 0) hash ^= SingleString.GetHashCode(); 1178if (SingleString.Length != 0) { 1243if (SingleString.Length != 0) { 1306if (other.SingleString.Length != 0) { 1594if (Subfield.Length != 0) hash ^= Subfield.GetHashCode(); 1627if (Subfield.Length != 0) { 1641if (Subfield.Length != 0) { 1656if (other.Subfield.Length != 0) { 2379if (Message.Length != 0) hash ^= Message.GetHashCode(); 2419if (Message.Length != 0) { 2438if (Message.Length != 0) { 2457if (other.Message.Length != 0) {
ServerComparison.FunctionalTests (1)
ResponseCompressionTests.cs (1)
174Assert.Equal(HelloWorldBody.Length.ToString(CultureInfo.InvariantCulture), GetContentLength(response));
ServerComparison.TestSites (3)
StartupResponseCompression.cs (3)
29context.Response.ContentLength = helloWorldBody.Length; 40context.Response.ContentLength = helloWorldBody.Length; 57context.Response.ContentLength = body.Length;
Shared (2)
Data.Validation\LengthAttribute.cs (1)
116count = s.Length;
LogBuffering\SerializedLogRecordFactory.cs (1)
80int charSize = str.Length * sizeof(char);
Shared.Tests (1)
JsonSchemaExporter\JsonSchemaExporterTests.cs (1)
86Assert.True(schema.ToJsonString().Length < 100_000);
SignalR.Client.FunctionalTestApp (1)
Startup.cs (1)
83token = token.Substring("Bearer ".Length).Trim();
SocialWeather (4)
Protobuf\WeatherReport.cs (4)
168if (ZipCode.Length != 0) hash ^= ZipCode.GetHashCode(); 225if (ZipCode.Length != 0) { 248if (ZipCode.Length != 0) { 272if (other.ZipCode.Length != 0) {
Sockets.BindTests (4)
src\Servers\Kestrel\shared\test\StreamBackedTestConnection.cs (4)
81for (var index = 0; index < text.Length; index++) 96var actual = new char[expected.Length]; 101while (offset < expected.Length) 103var data = new byte[expected.Length];
Sockets.FunctionalTests (5)
src\Servers\Kestrel\shared\test\StreamBackedTestConnection.cs (4)
81for (var index = 0; index < text.Length; index++) 96var actual = new char[expected.Length]; 101while (offset < expected.Length) 103var data = new byte[expected.Length];
src\Servers\Kestrel\test\FunctionalTests\MaxRequestBufferSizeTests.cs (1)
67totalHeaderSize += _requestLines[i].Length;
Stress.AppHost (1)
InteractionCommands.cs (1)
76if (!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) {
Swaggatherer (9)
src\Shared\CommandLineUtils\CommandLine\AnsiConsole.cs (2)
77while (endIndex != message.Length && 86if (endIndex == message.Length)
src\Shared\CommandLineUtils\CommandLine\CommandLineApplication.cs (3)
480var maxArgLen = arguments.Max(a => a.Name.Length); 496var maxOptLen = options.Max(o => o.Template.Length); 512var maxCmdLen = commands.Max(c => c.Name.Length);
src\Shared\CommandLineUtils\CommandLine\CommandOption.cs (2)
29if (optName.Length == 1 && !IsEnglishLetter(optName[0])) 40ValueName = part.Substring(1, part.Length - 2);
SwaggathererApplication.cs (2)
257var length = Math.Min(text.Length, Math.Max(5, part.Name.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++) 196if (value.Length < 256 || value.Length > 1500 || (value.IndexOf('\0') != -1)) // string.Contains(char) is .NetCore2.1+ specific 867for (int i = 0; i < value.Length; i++) 2657if (value.Length > 512) 2718if (s.Length == 0) 2764var sb = new StringBuilder(s.Length + 10); 2774for (int i = 0; i < baseType.Length; i++) 2790while (i < baseType.Length && baseType[i] >= '0' && baseType[i] <= '9') 2801if (i < baseType.Length && (baseType[i] == '+' || baseType[i] == '.')) 2812if (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) 1235for (int i = 0; i < value.Length; i++) 1612if (e.ReturnType.BaseType.Length == 0 || string.Equals(e.ReturnType.BaseType, typeof(void).FullName, StringComparison.OrdinalIgnoreCase)) 1957if (del.ReturnType.BaseType.Length > 0 && !string.Equals(del.ReturnType.BaseType, "System.Void", StringComparison.OrdinalIgnoreCase)) 1965if (del.ReturnType.BaseType.Length > 0 && !string.Equals(del.ReturnType.BaseType, "System.Void", StringComparison.OrdinalIgnoreCase)) 2383if (value.Length > 1023) 2388if (value[0] != '[' || value[value.Length - 1] != ']') 2397value = value.Substring(1, value.Length - 2); 2401if (value.Length == 1 && value[0] == '_') 2431if (baseType.Length == 0) 2475var sb = new StringBuilder(baseType.Length + 10); 2483for (int i = 0; i < baseType.Length; i++) 2499while (i < baseType.Length && baseType[i] >= '0' && baseType[i] <= '9') 2510if (i < baseType.Length && (baseType[i] == '+' || baseType[i] == '.')) 2521if (lastIndex < baseType.Length)
src\libraries\Common\src\System\CodeDom\CodeTypeReference.cs (3)
135int end = typeName.Length - 1; 367int end = typeName.Length - 1; 371while (start < typeName.Length && char.IsWhiteSpace(typeName[start])) start++;
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)
622for (int i = 0; i < baseType.Length; i++) 628while (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)
218if (key.Length < minLength) minLength = key.Length; 219if (key.Length > maxLength) maxLength = key.Length; 220lengthFilter |= (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)
114static (string s, int index, int count) => s.AsSpan(s.Length + index, count)); 312public override bool Equals(string? x, string? y) => x.AsSpan(IsLeft ? Index : (x!.Length + Index), Count).SequenceEqual(y.AsSpan(IsLeft ? Index : (y!.Length + Index), Count)); 313public override int GetHashCode(string s) => Hashing.GetHashCodeOrdinal(s.AsSpan(IsLeft ? Index : (s.Length + Index), Count)); 318public 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); 319public override int GetHashCode(string s) => Hashing.GetHashCodeOrdinalIgnoreCase(s.AsSpan(IsLeft ? Index : (s.Length + Index), Count)); 324public 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); 325public override int GetHashCode(string s) => Hashing.GetHashCodeOrdinalIgnoreCaseAscii(s.AsSpan(IsLeft ? Index : (s.Length + Index), Count));
System\Collections\Frozen\String\LengthBuckets.cs (1)
54int 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.cs (2)
85if ((uint)(key.Length - _minimumLength) <= (uint)_maximumLengthDiff) 87if (CheckLengthQuick((uint)key.Length))
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\OrdinalStringFrozenSet.cs (2)
75(uint)(item.Length - _minimumLength) <= (uint)_maximumLengthDiff) 77if (CheckLengthQuick((uint)item.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.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 (32)
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 (4)
146if (string.Compare(key, 0, objectName, 0, objectName.Length, StringComparison.OrdinalIgnoreCase) != 0) 153if (string.CompareOrdinal(key, 0, objectName, 0, objectName.Length) != 0) 160int idx = objectName.Length; 161if (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)
40if (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 (69)
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)
2334if ((parentConfigKey.Length == 0) && !inLocation) 2360if ((parentConfigKey.Length > 0) || inLocation) 2815if (this is RuntimeConfigurationRecord && (host != null) && (locationSubPath.Length != 0) && 3081if (trimmedSubPath.Length != subPath.Length) 3091if (trimmedSubPath.Length != subPath.Length) 3095if (InvalidLastSubPathCharacters.IndexOf(subPath[subPath.Length - 1]) != -1) 3202if (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\StringUtil.cs (2)
21return 0 == string.Compare(s1, 0, s2, 0, s2.Length, StringComparison.Ordinal); 27return 0 == string.Compare(s1, 0, s2, 0, s2.Length, StringComparison.OrdinalIgnoreCase);
System\Configuration\StringValidator.cs (3)
37int len = data?.Length ?? 0; 47char[] array = new char[_invalidChars.Length]; 49_invalidChars.CopyTo(0, array, 0, _invalidChars.Length);
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.Data.Common (190)
src\libraries\Common\src\System\Data\Common\AdapterUtil.cs (7)
137int prefixLength = quotePrefix != null ? quotePrefix.Length : 0; 138int suffixLength = quoteSuffix != null ? quoteSuffix.Length : 0; 152int quotedStringLength = quotedString.Length; 364var resultString = new StringBuilder(unQuotedString.Length + quoteSuffix.Length + quoteSuffix.Length); 382buffer.Replace(quoteSuffix, quoteSuffix + quoteSuffix, start, unQuotedString.Length);
src\libraries\Common\src\System\Data\Common\DbConnectionOptions.Common.cs (13)
213int length = connectionString.Length; 375char tmpChar = keyvalue[keyvalue.Length - 1]; 399if ((';' == currentChar) && (currentPosition < connectionString.Length)) 422Debug.Assert(((0 < keyname.Length) && (';' != keyname[0]) && !char.IsWhiteSpace(keyname[0]) && (-1 == keyname.IndexOf('\u0000'))) == compValue, "IsValueValid mismatch with regex"); 425return ((0 < keyname.Length) && (';' != keyname[0]) && !char.IsWhiteSpace(keyname[0]) && (-1 == keyname.IndexOf('\u0000'))); 444if (!match.Success || (match.Length != connectionString.Length)) 454if (0 < keyvalue.Length) 461keyvalue = keyvalue.Substring(1, keyvalue.Length - 2).Replace("\"\"", "\""); 464keyvalue = keyvalue.Substring(1, keyvalue.Length - 2).Replace("\'\'", "\'"); 555int endPosition = connectionString.Length; 613StringBuilder builder = new StringBuilder(_usersConnectionString.Length); 629next = new NameValuePair(current.Name, "*", current.Name.Length + equalstar.Length);
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)) 808if (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) && 139var 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) 1691if (value != null && value != DBNull.Value && ((string)value).Length > MaxLength) 1701if (!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); 2257if ((rootNodeSimpleContent != null && rootNodeSimpleContent.Length > 0)) 2264if ((rootNodeSimpleContent != null && rootNodeSimpleContent.Length > 0)) 2288Tables.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) 547if (((XmlSchemaElement)el).RefName.Name.Length != 0) 697if (dc.SimpleType != null && dc.SimpleType.Name != null && dc.SimpleType.Name.Length != 0) 758if (sel.RefName.Name.Length != 0) 1548Debug.Assert((instanceName != null) && (instanceName.Length != 0), "instanceName cannot be null or empty. There's an error in the XSD compiler"); 1593if (value.Length == 0) 1597if (0 < value.Length) 1608if (0 < value.Length) 2048if ((column.Expression != null) && (column.Expression.Length != 0)) 2054if (xsdType != null && xsdType.Name != null && xsdType.Name.Length > 0) 2162if ((column.Expression != null) && (column.Expression.Length != 0)) 2291if ((column.Expression != null) && (column.Expression.Length != 0)) 2296if (xsdType != null && xsdType.Name != null && xsdType.Name.Length > 0) 2483if (xsdType != null && xsdType.Name != null && xsdType.Name.Length > 0) 2572if (0 != value.Length) 2636if (((XmlSchemaElement)el).RefName.Name.Length != 0) 2683if ((((XmlSchemaElement)choiceEl).RefName.Name.Length != 0) && (!FromInference && ((XmlSchemaElement)choiceEl).MaxOccurs != decimal.One && !(((XmlSchemaElement)choiceEl).SchemaType is XmlSchemaComplexType))) 2758if ((prefix == null) || (prefix.Length == 0)) 2781if ((QualifiedTableName == null) || (QualifiedTableName.Length == 0)) 2800if ((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)
2475if (value.Length == 0 && (((xsi_attrVal = rowElement.GetAttribute(XSI_NIL)) == "1") || xsi_attrVal == "true")) 2511if (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 (87)
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 ((0 < keyValue.Length) && 291int fileNamePosition = DataDirectory.Length; // filename starts right after the '|datadirectory|' keyword 292bool rootFolderEndsWith = (0 < rootFolderPath.Length) && rootFolderPath[rootFolderPath.Length - 1] == '\\'; 293bool fileNameStartsWith = (fileNamePosition < value.Length) && value[fileNamePosition] == '\\'; 324StringBuilder builder = new StringBuilder(_usersConnectionString.Length); 420StringBuilder 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\libraries\Common\src\System\Data\Common\AdapterUtil.cs (7)
137int prefixLength = quotePrefix != null ? quotePrefix.Length : 0; 138int suffixLength = quoteSuffix != null ? quoteSuffix.Length : 0; 152int quotedStringLength = quotedString.Length; 364var resultString = new StringBuilder(unQuotedString.Length + quoteSuffix.Length + quoteSuffix.Length); 382buffer.Replace(quoteSuffix, quoteSuffix + quoteSuffix, start, unQuotedString.Length);
src\libraries\Common\src\System\Data\Common\DbConnectionOptions.Common.cs (13)
213int length = connectionString.Length; 375char tmpChar = keyvalue[keyvalue.Length - 1]; 399if ((';' == currentChar) && (currentPosition < connectionString.Length)) 422Debug.Assert(((0 < keyname.Length) && (';' != keyname[0]) && !char.IsWhiteSpace(keyname[0]) && (-1 == keyname.IndexOf('\u0000'))) == compValue, "IsValueValid mismatch with regex"); 425return ((0 < keyname.Length) && (';' != keyname[0]) && !char.IsWhiteSpace(keyname[0]) && (-1 == keyname.IndexOf('\u0000'))); 444if (!match.Success || (match.Length != connectionString.Length)) 454if (0 < keyvalue.Length) 461keyvalue = keyvalue.Substring(1, keyvalue.Length - 2).Replace("\"\"", "\""); 464keyvalue = keyvalue.Substring(1, keyvalue.Length - 2).Replace("\'\'", "\'"); 555int endPosition = connectionString.Length; 613StringBuilder builder = new StringBuilder(_usersConnectionString.Length); 629next = new NameValuePair(current.Name, "*", current.Name.Length + equalstar.Length);
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\libraries\Common\src\System\Data\ProviderBase\DbMetaDataFactory.cs (1)
408if ((restrictions[i]?.Length > 4096))
System\Data\Odbc\OdbcCommand.cs (1)
572if ((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 (4)
172length = Math.Max(0, ((string)value).Length - valueOffset); 367_len = (0 > iNul) ? text.Length : iNul; 538if ((_len - tempidx) < tokenString.Length) 543if (0 == string.Compare(_sqlstatement, tempidx, tokenString, 0, tokenString.Length, StringComparison.OrdinalIgnoreCase))
System.Diagnostics.DiagnosticSource (46)
src\libraries\Common\src\System\Text\ValueStringBuilder.cs (5)
154int count = s.Length; 196if (s.Length == 1 && (uint)pos < (uint)_chars.Length) // very common case, e.g. appending strings from NumberFormatInfo like separators, percent symbols, etc. 210if (pos > _chars.Length - s.Length) 212Grow(s.Length); 220_pos += s.Length;
System\Diagnostics\Activity.cs (6)
1074return id.Length == 55 && 1333Debug.Assert(ParentId.Length != 0); 1339char lastChar = parentId[parentId.Length - 1]; 1368rootEnd = id.Length; 1379if (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) 256|| !double.TryParse(suffixPart.Slice(c_ParentRatioSamplerPrefix.Length, endingLocation - c_ParentRatioSamplerPrefix.Length), NumberStyles.Float, CultureInfo.InvariantCulture, out double ratio)) 274suffixPart.Slice(c_ParentRateLimitingSamplerPrefix.Length, endingLocation - c_ParentRateLimitingSamplerPrefix.Length), 334if (activityName.Length > 0 && activitySourceName.Length == 1 && activitySourceName[0] == '*') 611Debug.Assert(transformSpec != null && startIdx >= 0 && startIdx < endIdx && endIdx <= transformSpec.Length); 1028newSerializableArgs = 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 && 177while (currentIndex < baggageString.Length && baggageString[currentIndex] != Comma) 183} while (currentIndex < baggageString.Length);
System\Diagnostics\Metrics\MetricsEventSource.cs (4)
726else if (spec.MeterName.Length > 0 727&& spec.MeterName[spec.MeterName.Length - 1] == '*') 729if (spec.MeterName.Length == 1) 736spec.MeterName.Substring(0, spec.MeterName.Length - 1));
System\Diagnostics\W3CPropagator.cs (4)
40if (activity.TraceStateString is { Length: > 0 } traceState) 147while (processed < traceState.Length) 182return processed >= traceState.Length ? traceState : traceState.AsSpan(0, processed).ToString(); 604if (string.IsNullOrEmpty(traceParent) || traceParent.Length != 55)
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.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.Common.Tests (5)
mono\System.Drawing\BitmapTests.cs (1)
304if (sRslt.Length > 0)
mono\System.Drawing\GraphicsTests.cs (3)
1793Assert.True(chars < s.Length); 1942Assert.Throws<ArgumentException>(() => MeasureCharacterRanges(text, text.Length, 1, useSpan)); 1951Assert.Throws<ArgumentException>(() => MeasureCharacterRanges(text, 0, text.Length + 1, useSpan));
System\Drawing\Imaging\EncoderParameterTests.cs (1)
109CheckEncoderParameter(ep, s_anyEncoder, EncoderParameterValueType.ValueTypeAscii, value.Length);
System.Drawing.Primitives (11)
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 (24)
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])) 64char* leftEnd = l + first.Length; 65char* rightEnd = r + second.Length; 221path!.Substring(0, path.Length - 1) :
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\libraries\Common\src\System\Text\ValueStringBuilder.cs (5)
154int count = s.Length; 196if (s.Length == 1 && (uint)pos < (uint)_chars.Length) // very common case, e.g. appending strings from NumberFormatInfo like separators, percent symbols, etc. 210if (pos > _chars.Length - s.Length) 212Grow(s.Length); 220_pos += s.Length;
System\Formats\Tar\TarFile.cs (2)
348foreach ((string fullpath, string entryname) in GetFilesForCreation(sourceDirectoryName, basePath.Length)) 403foreach ((string fullpath, string entryname) in GetFilesForCreation(sourceDirectoryName, basePath.Length))
System\Formats\Tar\TarHeader.Write.cs (1)
1220return result.Length >= FieldLengths.Name ?
System\Formats\Tar\TarHelpers.cs (5)
449if (childFullPath.Length <= parentFullPath.Length) 458if ((childFullPath.Length < parentFullPath.Length + 2) || 459!IsDirectorySeparatorChar(childFullPath[parentFullPath.Length]))
System.IO.Compression.ZipFile (5)
System\IO\Compression\ZipFile.Create.Async.cs (2)
475string entryName = ArchivingUtils.EntryFromPath(fullPath.AsSpan(basePath.Length)); 485string entryName = ArchivingUtils.EntryFromPath(fullPath.AsSpan(basePath.Length), appendPathSeparator: true);
System\IO\Compression\ZipFile.Create.cs (2)
441string entryName = ArchivingUtils.EntryFromPath(fullPath.AsSpan(basePath.Length)); 451string entryName = ArchivingUtils.EntryFromPath(fullPath.AsSpan(basePath.Length), appendPathSeparator: true);
System\IO\Compression\ZipFileExtensions.ZipArchiveEntry.Extract.cs (1)
127if (Path.GetFileName(fileDestinationPath).Length == 0)
System.IO.FileSystem.DriveInfo (1)
System\IO\DriveInfo.UnixOrDefault.cs (1)
31if (driveName.Length == 0)
System.IO.FileSystem.Watcher (20)
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])) 64char* leftEnd = l + first.Length; 65char* rightEnd = r + second.Length; 221path!.Substring(0, path.Length - 1) :
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\libraries\Common\src\System\Text\ValueStringBuilder.cs (5)
154int count = s.Length; 196if (s.Length == 1 && (uint)pos < (uint)_chars.Length) // very common case, e.g. appending strings from NumberFormatInfo like separators, percent symbols, etc. 210if (pos > _chars.Length - s.Length) 212Grow(s.Length); 220_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) 671if (_directory.Length != 0 && _enabled)
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.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)
51if (partName.Length == 0) 208Debug.Assert((partName.Length - file.Length) > 0, 212partName = partName.Substring(0, partName.Length - file.Length); 264Debug.Assert((path.Length - partNameWithoutExtension.Length - RelationshipPartExtensionName.Length - 1) > 0, 268path = path.Substring(0, path.Length - partNameWithoutExtension.Length - RelationshipPartExtensionName.Length - 1); 270Debug.Assert((path.Length - RelationshipPartSegmentName.Length) > 0, 273path = path.Substring(0, path.Length - RelationshipPartSegmentName.Length); // Removing rels segment 347Debug.Assert(partUriString != null && partUriString.Length == 0); 384if (partName.Length == 0) 474if (partName.Length > 0) 476if (partName[partName.Length - 1] == ForwardSlashChar) 497if (partName.Length > 1) 562return (partName.Length == 0 || ((partName.Length == 1) && (partName[0] == ForwardSlashChar))); 684if (partUriExtension.Length > 0) 783Debug.Assert(segments.Length > 0 && segments[0].Length == 0); 791(segments[segments.Length - 1].Length > RelationshipPartExtensionName.Length))
System\IO\Packaging\PackUriHelper.PackUriScheme.cs (2)
80if (fragment.Length == 0 || fragment[0] != '#') 328if (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 1055if (zipFileInfo.FullName.Length == ContentTypeFileName.Length) 1280if (attributeValue!.Length == 0)
System\IO\Packaging\ZipPackagePartPiece.cs (2)
52int searchPosition = path.Length; 83searchPosition -= PartPieceLastExtension.Length;
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.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.HttpListener (53)
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\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\libraries\Common\src\System\Net\Logging\NetEventSource.Common.cs (2)
209Size = (arg1.Length + 1) * sizeof(char) 214Size = (arg2.Length + 1) * sizeof(char)
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\libraries\Common\src\System\Net\WebHeaderEncoding.cs (5)
56internal static int GetByteCount(string myString) => myString.Length; 60if (myString.Length == 0) 77byte[] bytes = new byte[myString.Length]; 78if (myString.Length != 0) 80GetBytes(myString, 0, myString.Length, bytes, 0);
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 (2)
44_user = ParseBasicAuthentication(header.Substring(AuthenticationTypes.Basic.Length + 1)); 54header.Length >= 6 &&
System\Net\Managed\HttpListenerRequest.Managed.cs (1)
104_version = Version.Parse(version.Slice("HTTP/".Length));
System\Net\Managed\ListenerAsyncResult.Managed.cs (3)
144authHeader.Length < AuthenticationTypes.Basic.Length + 2 || 145!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 (72)
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\libraries\Common\src\System\Net\Logging\NetEventSource.Common.cs (2)
209Size = (arg1.Length + 1) * sizeof(char) 214Size = (arg2.Length + 1) * sizeof(char)
src\libraries\Common\src\System\Text\ValueStringBuilder.cs (5)
154int count = s.Length; 196if (s.Length == 1 && (uint)pos < (uint)_chars.Length) // very common case, e.g. appending strings from NumberFormatInfo like separators, percent symbols, etc. 210if (pos > _chars.Length - s.Length) 212Grow(s.Length); 220_pos += s.Length;
System\Net\BufferBuilder.cs (1)
70Append(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)
144if (displayName.Length >= 2 && displayName.StartsWith('\"') && displayName.EndsWith('\"')) 147displayName = displayName.Substring(1, displayName.Length - 2);
System\Net\Mail\MailAddressParser.cs (4)
28int index = data.Length - 1; 40int index = data.Length - 1; 70Debug.Assert(index >= 0 && index < data.Length, $"Index out of range: {index}, {data.Length}");
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)
281EnvelopeHeaders.InternalSet(xSenderHeader, sender.Encode(xSenderHeader.Length, allowUnicode)); 289EnvelopeHeaders.InternalAdd(headerName, address.Encode(headerName.Length, allowUnicode)); 293EnvelopeHeaders.InternalAdd(headerName, address.Encode(headerName.Length, allowUnicode)); 297EnvelopeHeaders.InternalAdd(headerName, address.Encode(headerName.Length, allowUnicode)); 315Headers.InternalAdd(headerName, Sender.Encode(headerName.Length, allowUnicode)); 323Headers.InternalAdd(headerName, From!.Encode(headerName.Length, allowUnicode)); 328Headers.InternalAdd(headerName, To.Encode(headerName.Length, allowUnicode)); 338Headers.InternalAdd(headerName, CC.Encode(headerName.Length, allowUnicode)); 348Headers.InternalAdd(headerName, ReplyTo.Encode(headerName.Length, allowUnicode)); 352Headers.InternalAdd(headerName, ReplyToList.Encode(headerName.Length, allowUnicode)); 396headerName.Length)); 442headerName.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\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.Ping (1)
src\libraries\Common\src\System\Net\NetworkInformation\UnixCommandLinePing.cs (1)
212int afterTime = timeIndex + "time=".Length;
System.Net.Security (2)
System\Security\Authentication\ExtendedProtection\ServiceNameCollection.cs (2)
179if (hostPortAndDistinguisher.Length == 0) 225host.Length == hostPortAndDistinguisher.Length ?
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\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 (5)
System\Net\WebProxy.cs (2)
171int lengthRequired = checked(input.Scheme.Length + 3 + input.Host.Length +
System\Net\WebProxy.NonWasm.cs (3)
43local.Length == (hostString.Length - dot) && 44string.Compare(local, 0, hostString, dot, local.Length, StringComparison.OrdinalIgnoreCase) == 0;
System.Net.WebSockets.Client (1)
src\libraries\Common\src\System\Net\WebSockets\WebSocketValidate.cs (1)
85Encoding.UTF8.GetMaxByteCount(statusDescription.Length) > MaxControlFramePayloadLength &&
System.Private.CoreLib (959)
src\libraries\Common\src\Interop\Linux\procfs\Interop.ProcMountInfo.cs (1)
42if (mount.MountPoint.Length == path.Length)
src\libraries\Common\src\Interop\Linux\procfs\Interop.ProcMountInfo.TryParseMountInfoLine.cs (1)
59line = line.Slice(endOfOptionalFields + Separator.Length);
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])) 64char* leftEnd = l + first.Length; 65char* rightEnd = r + second.Length; 221path!.Substring(0, path.Length - 1) :
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\libraries\Common\src\System\IO\StringParser.cs (2)
55if (_endIndex >= _buffer.Length) 63_endIndex = nextSeparator >= 0 ? nextSeparator : _buffer.Length;
src\libraries\Common\src\System\Memory\FixedBufferExtensions.cs (2)
36if (value == null || value.Length > span.Length) 40for (; i < value.Length; i++)
src\libraries\Common\src\System\Number.Formatting.Common.cs (1)
473if (info.NumberGroupSeparator.Length > 0)
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\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\libraries\Common\src\System\Text\ValueStringBuilder.cs (5)
154int count = s.Length; 196if (s.Length == 1 && (uint)pos < (uint)_chars.Length) // very common case, e.g. appending strings from NumberFormatInfo like separators, percent symbols, etc. 210if (pos > _chars.Length - s.Length) 212Grow(s.Length); 220_pos += s.Length;
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\libraries\System.Private.CoreLib\src\System\BitConverter.cs (1)
816var dst = new Span<char>(ref result.GetRawStringData(), result.Length);
src\libraries\System.Private.CoreLib\src\System\Boolean.cs (2)
101charsWritten = TrueLiteral.Length; 109charsWritten = FalseLiteral.Length;
src\libraries\System.Private.CoreLib\src\System\Buffers\SharedArrayPool.cs (1)
527envVar.Length is > 0 and <= 32) // arbitrary limit that allows for some spaces around the maximum length of a non-negative Int32 (10 digits)
src\libraries\System.Private.CoreLib\src\System\Char.cs (20)
639if ((uint)index >= (uint)s.Length) 654if ((uint)index >= (uint)s.Length) 674if ((uint)index >= (uint)s.Length) 695if ((uint)index >= (uint)s.Length) 712if ((uint)index >= (uint)s.Length) 754if ((uint)index >= (uint)s.Length) 787if ((uint)index >= (uint)s.Length) 829if ((uint)index >= (uint)s.Length) 854if ((uint)index >= (uint)s.Length) 884if ((uint)index >= (uint)s.Length) 901if ((uint)index >= (uint)s.Length) 921if ((uint)index >= (uint)s.Length) 947if ((uint)index >= (uint)s.Length) 971if ((uint)index >= (uint)s.Length) 993if ((uint)index >= (uint)s.Length) 1015if ((uint)index >= (uint)s.Length) 1032if ((uint)index >= (uint)s.Length) 1037if ((uint)(index + 1) < (uint)s.Length) 1139if ((uint)index >= (uint)s.Length) 1153if ((uint)(index + 1) < (uint)s.Length)
src\libraries\System.Private.CoreLib\src\System\CharEnumerator.cs (2)
22int length = _str.Length; 44if ((uint)index >= (uint)s.Length)
src\libraries\System.Private.CoreLib\src\System\Collections\Generic\RandomizedStringEqualityComparer.cs (2)
84(uint)obj.Length * 2, 129obj.Length,
src\libraries\System.Private.CoreLib\src\System\Convert.cs (6)
495if (value.Length != 1) 2362ToBase64CharsLargeNoLineBreaks(bytes, new Span<char>(ref result.GetRawStringData(), result.Length), result.Length); 2372Debug.Assert(result.Length == charsWritten, $"Expected {result.Length} == {charsWritten}"); 2654return FromBase64CharPtr(sPtr, s.Length);
src\libraries\System.Private.CoreLib\src\System\DateOnly.cs (2)
572if (format.Length == 1) 750if (format.Length == 1)
src\libraries\System.Private.CoreLib\src\System\Diagnostics\DebugProvider.cs (2)
90if (s.Length > 0) 104if (_indentString?.Length == indentCount)
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\libraries\System.Private.CoreLib\src\System\Diagnostics\StackTrace.cs (1)
259for (int i = 0; i < fullName.Length; i++)
src\libraries\System.Private.CoreLib\src\System\Diagnostics\Tracing\ActivityTracker.cs (2)
258return string.Concat(providerName, activityName.AsSpan()[..^EventSource.ActivityStartSuffix.Length]); 262return string.Concat(providerName, activityName.AsSpan()[..^EventSource.ActivityStopSuffix.Length]);
src\libraries\System.Private.CoreLib\src\System\Diagnostics\Tracing\EventPipeMetadataGenerator.cs (10)
84uint v1MetadataLength = 24 + ((uint)eventName.Length + 1) * 2; 152WriteToBuffer(pMetadata, totalMetadataLength, ref offset, (byte*)pEventName, ((uint)eventName.Length + 1) * 2); 303EventPipeMetadataGenerator.WriteToBuffer(pMetadataBlob, blobSize, ref offset, (byte*)pParameterName, ((uint)ParameterName.Length + 1) * 2); 348EventPipeMetadataGenerator.WriteToBuffer(pMetadataBlob, blobSize, ref offset, (byte*)pPropertyName, ((uint)property.name.Length + 1) * 2); 370EventPipeMetadataGenerator.WriteToBuffer(pMetadataBlob, blobSize, ref offset, (byte*)pPropertyName, ((uint)property.name.Length + 1) * 2); 397EventPipeMetadataGenerator.WriteToBuffer(pMetadataBlob, blobSize, ref offset, (byte*)pPropertyName, ((uint)name.Length + 1) * 2); 604size += (uint)(sizeof(uint) + ((ParameterName.Length + 1) * 2)); 638ret += (uint)((property.name.Length + 1) * 2); 642ret += (uint)(sizeof(uint) + ((property.name.Length + 1) * 2)); 752((name.Length + 1) * 2));
src\libraries\System.Private.CoreLib\src\System\Diagnostics\Tracing\EventProvider.cs (2)
269dataDescriptor->Size = ((uint)sRet.Length + 1) * 2; 433dataDescriptor->Size = ((uint)sRet.Length + 1) * 2;
src\libraries\System.Private.CoreLib\src\System\Diagnostics\Tracing\EventSource.cs (22)
950descrs[0].Size = ((arg1.Length + 1) * 2); 970descrs[0].Size = ((arg1.Length + 1) * 2); 973descrs[1].Size = ((arg2.Length + 1) * 2); 995descrs[0].Size = ((arg1.Length + 1) * 2); 998descrs[1].Size = ((arg2.Length + 1) * 2); 1001descrs[2].Size = ((arg3.Length + 1) * 2); 1020descrs[0].Size = ((arg1.Length + 1) * 2); 1041descrs[0].Size = ((arg1.Length + 1) * 2); 1066descrs[0].Size = ((arg1.Length + 1) * 2); 1091descrs[1].Size = ((arg2.Length + 1) * 2); 1113descrs[1].Size = ((arg2.Length + 1) * 2); 2262data.Size = (uint)(2 * (msgString.Length + 1)); 3318string taskName = eventName[..^ActivityStartSuffix.Length]; // Remove the Start suffix to get the task name 3340startEventMetadata.Name.AsSpan()[..^ActivityStartSuffix.Length].SequenceEqual( 3341eventName.AsSpan()[..^ActivityStopSuffix.Length])) 5870string evtName = key.Substring("event_".Length); 6001if (keyword.Length != 0) 6087if (i >= eventMessage.Length) 6104else if (i < eventMessage.Length - 1 && 6118while (i < eventMessage.Length && char.IsDigit(eventMessage[i])) 6123if (i < eventMessage.Length && eventMessage[i] == '}') 6132if (i < eventMessage.Length && eventMessage[i] == '!')
src\libraries\System.Private.CoreLib\src\System\Diagnostics\Tracing\FrameworkEventSource.cs (2)
56descrs[2].Size = ((arg3.Length + 1) * 2); 91descrs[2].Size = ((arg3.Length + 1) * 2);
src\libraries\System.Private.CoreLib\src\System\Diagnostics\Tracing\TraceLogging\DataCollector.cs (1)
153nullCharIndex = value.Length;
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\libraries\System.Private.CoreLib\src\System\Diagnostics\Tracing\TraceLogging\Statics.cs (2)
93Encoding.UTF8.GetBytes(name, 0, name.Length, metadata, 2 + prefixSize); 177return fieldName.Length <= 2 && fieldName[0] == '_';
src\libraries\System.Private.CoreLib\src\System\Diagnostics\Tracing\TraceLogging\TraceLoggingDataCollector.cs (1)
89DataCollector.ThreadInstance.AddBinary(value, value == null ? 0 : value.Length * 2);
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\libraries\System.Private.CoreLib\src\System\Enum.cs (8)
1401if (format.Length == 1) 1640if (format.Length == 1) 1652if (format.Length == 1) 1870charsWritten = enumName.Length; 1949WriteMultipleFoundFlagsNames(names, foundItems, new Span<char>(ref result.GetRawStringData(), result.Length)); 1974charsWritten = singleEnumFlagsFormat.Length; 2087resultLength = checked(resultLength + names[index].Length); 2115destination = destination.Slice(name.Length);
src\libraries\System.Private.CoreLib\src\System\Environment.cs (2)
145if (name.Length == 0) 204return (processPath.Length != 0) ? processPath : null;
src\libraries\System.Private.CoreLib\src\System\Environment.GetFolderPathCore.Unix.cs (9)
28if (path.Length == 0 || 198if (pos >= line.Length) continue; 201if (string.CompareOrdinal(line, pos, key, 0, key.Length) != 0) continue; 202pos += key.Length; 206if (pos >= line.Length - 4 || line[pos] != '=') continue; // 4 for ="" and at least one char between quotes 211if (pos >= line.Length - 3 || line[pos] != '"') continue; // 3 for "" and at least one char between quotes 217if (string.CompareOrdinal(line, pos, RelativeToHomePrefix, 0, RelativeToHomePrefix.Length) == 0) 220pos += RelativeToHomePrefix.Length; 250while (pos < line.Length && char.IsWhiteSpace(line[pos])) pos++;
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\libraries\System.Private.CoreLib\src\System\Environment.UnixOrBrowser.cs (1)
29while (lastPos < name.Length && (pos = name.IndexOf('%', lastPos + 1)) >= 0)
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\libraries\System.Private.CoreLib\src\System\Globalization\CalendarData.cs (1)
300if (this.saEraNames[0].Length == 4)
src\libraries\System.Private.CoreLib\src\System\Globalization\CalendarData.Icu.cs (13)
179if (s.Length > 100) 182Span<char> modifiedPattern = stackalloc char[s.Length + 2]; 185while (index < s.Length) 193} while (index < s.Length && s[index] != '\''); 195if (index >= s.Length) 208if (index >= s.Length - 1 || s[index + 1] != 'y') 214if (index + 2 < s.Length && s[index + 2] == 'y') 231while (index < s.Length) 263var destination = input.Length < 128 ? 265new ValueStringBuilder(input.Length); 268while (index < input.Length) 276while (index < input.Length) 359while (index < input.Length && input[index] == value)
src\libraries\System.Private.CoreLib\src\System\Globalization\CharUnicodeInfo.cs (11)
46if ((uint)index >= (uint)s.Length) 113if ((uint)index >= (uint)s.Length) 147if ((uint)index >= (uint)s.Length) 222if ((uint)index >= (uint)s.Length) 351if ((uint)index >= (uint)s.Length) 366Debug.Assert(index < value.Length); 378Debug.Assert(str.Length > 0); 379Debug.Assert(index >= 0 && index < str.Length); 412Debug.Assert((uint)index < (uint)s.Length, "index < s.Length"); 419if ((uint)index < (uint)s.Length) 426if ((uint)index < (uint)s.Length)
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\libraries\System.Private.CoreLib\src\System\Globalization\CompareInfo.Icu.cs (5)
46return _sortName.Length == 0 || 47(_sortName.Length >= 2 && _sortName[0] == 'e' && _sortName[1] == 'n' && (_sortName.Length == 2 || _sortName[2] == '-')); 713sortKeyLength = Interop.Globalization.GetSortKey(_sortHandle, pSource, source.Length, null, 0, options); 730if (Interop.Globalization.GetSortKey(_sortHandle, pSource, source.Length, pSortKey, sortKeyLength, options) != sortKeyLength)
src\libraries\System.Private.CoreLib\src\System\Globalization\CompareInfo.Invariant.cs (2)
22if (source.Length == 0) 29keyData = new byte[source.Length * sizeof(char)];
src\libraries\System.Private.CoreLib\src\System\Globalization\CompareInfo.Nls.cs (1)
387int sourceLength = source.Length;
src\libraries\System.Private.CoreLib\src\System\Globalization\CultureData.cs (23)
732if (name.Length > LocaleNameMaxLength) 738Span<char> normalizedName = stackalloc char[name.Length]; 742while (i < name.Length && name[i] != '-' && name[i] != '_') 757if (i < name.Length) 763while (i < name.Length) 789if (cultureName.Length > LocaleNameMaxLength || !CultureInfo.VerifyCultureName(cultureName, false)) 803if (cultureName.Length == 1 && (cultureName[0] == 'C' || cultureName[0] == 'c')) 943if (!GlobalizationMode.Invariant && Name.Length > 0) 1018EnglishLanguageName.AsSpan(0, _sEnglishLanguage!.Length - 1), 1125if (!GlobalizationMode.Invariant && Name.Length > 0) 1424for (int j = 0; j < time.Length; j++) 1496for (; index < time.Length; index++) 2017for (int i = start; i < str.Length && i <= end; i++) 2022result ??= new StringBuilder(str, start, i - start, str.Length); 2025result ??= new StringBuilder(str, start, i - start, str.Length); 2027if (i < str.Length) 2078} while (index < format.Length && format[index] == cTimePart); 2083if (separatorStart < format.Length) 2102for (int i = startIndex; i < format.Length; ++i) 2112if (i + 1 < format.Length) 2149if (digits.Length < NumberFormatInfo.s_asciiDigits.Length) 2187while ((uint)ffffPos < (uint)digits.Length && digits[ffffPos] != '\uFFFF') 2192} while (ffffPos < digits.Length && index < 10);
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\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\libraries\System.Private.CoreLib\src\System\Globalization\CultureInfo.cs (4)
281for (int idx = 0; idx < name.Length; idx++) 319for (int i = 0; i < cultureName.Length; i++) 472if (_name.Length == 5 && _name[2] == '-') 493else if (_name.Length > 8 && _name.AsSpan(2, 4) is "-Han" && _name[7] == '-') // cultures like zh-Hant-* and zh-Hans-*
src\libraries\System.Private.CoreLib\src\System\Globalization\DateTimeFormat.cs (15)
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); 1410Debug.Assert(dayAbbrev.Length == 3); 1413Debug.Assert(monthAbbrev.Length == 3); 1617Debug.Assert(dayAbbrev.Length == 3); 1620Debug.Assert(monthAbbrev.Length == 3);
src\libraries\System.Private.CoreLib\src\System\Globalization\DateTimeFormatInfo.cs (17)
482if (eraName.Length == 0) 496if (m_eraNames![i].Length > 0) 933for (int i = 0; !foundZ && i < longTimePattern.Length; i++) 2140if (twDtfi.GetEraName(i).Length > 0) 2199if (str.Length > 0) 2345if (((int)value.tokenType & (int)TokenMask) > 0 && value.tokenString.Length <= remaining) 2352int nextCharIndex = str.Index + value.tokenString.Length; 2366((value.tokenString.Length == 1 && str.Value[str.Index] == value.tokenString[0]) || 2367Culture.CompareInfo.Compare(str.Value.Slice(str.Index, value.tokenString.Length), value.tokenString, CompareOptions.IgnoreCase) == 0)) 2371str.Advance(value.tokenString.Length); 2443if (str.Length == 0) 2463if (str.Length >= value.tokenString.Length) 2467if (CompareStringIgnoreCaseOptimized(str, 0, value.tokenString.Length, value.tokenString, 0, value.tokenString.Length)) 2469if (str.Length > value.tokenString.Length)
src\libraries\System.Private.CoreLib\src\System\Globalization\DateTimeFormatInfoScanner.cs (15)
128while (currentIndex < pattern.Length) 135if (currentIndex < pattern.Length) 176if (str.Length == 0) 181if (str.Length == 1) 275while (index < pattern.Length) 294if (index < pattern.Length) 330while ((uint)++index < (uint)pattern.Length && pattern[index] == ch) 409while (i < pattern.Length) 424if ((uint)i < (uint)pattern.Length && pattern[i] == '\'') 604for (int j = 0; j < array[i].Length; j++) 627if (s.Length != 0 && char.IsAsciiDigit(s[0])) 630while ((uint)index < (uint)s.Length && char.IsAsciiDigit(s[index])) 635if (index == s.Length) 640if (index == s.Length - 1) 653if (index == s.Length - 4)
src\libraries\System.Private.CoreLib\src\System\Globalization\DateTimeParse.cs (49)
411if (target.Length > (str.Value.Length - str.Index)) 416if (str.CompareInfo.Compare(str.Value.Slice(str.Index, target.Length), target, CompareOptions.IgnoreCase) != 0) 421int nextCharIndex = str.Index + target.Length; 1268for (int i = 0; i < datePattern.Length && orderCount < 3; i++) 1291for (; i + 1 < datePattern.Length && datePattern[i + 1] == 'y'; i++) 1302for (; i + 1 < datePattern.Length && datePattern[i + 1] == 'M'; i++) 1313for (; i + 1 < datePattern.Length && datePattern[i + 1] == 'd'; i++) 1364for (int i = 0; i < pattern.Length && orderCount < 2; i++) 1387for (; i + 1 < pattern.Length && pattern[i + 1] == 'y'; i++) 1397for (; i + 1 < pattern.Length && pattern[i + 1] == 'M'; i++) 1430for (int i = 0; i < pattern.Length && orderCount < 2; i++) 1452for (; i + 1 < pattern.Length && pattern[i + 1] == 'd'; i++) 1471for (; i + 1 < pattern.Length && pattern[i + 1] == 'M'; i++) 1988if (dtfi.AMDesignator.Length == 0 && dtfi.PMDesignator.Length != 0) 1992if (dtfi.PMDesignator.Length == 0 && dtfi.AMDesignator.Length != 0) 3387int monthsInYear = (dtfi.GetAbbreviatedMonthName(13).Length == 0 ? 12 : 13); 3391int matchStrLen = searchStr.Length; 3486int monthsInYear = (dtfi.GetMonthName(13).Length == 0 ? 12 : 13); 3490int matchStrLen = searchStr.Length; 3583int matchStrLen = searchStr.Length; 3648int matchStrLen = searchStr.Length; 3680maxMatchStrLen = match.Length; 3705str.Index += (searchStr.Length - 1); 3712str.Index += (searchStr.Length - 1); 3734if (dtfi.AMDesignator.Length == 0) 3738if (dtfi.PMDesignator.Length == 0) 3746if (searchStr.Length > 0) 3751str.Index += (searchStr.Length - 1); 3757if (searchStr.Length > 0) 3762str.Index += (searchStr.Length - 1); 3793if (amDesignator.Length > 0 && str.GetChar() == amDesignator[0]) 3800if (pmDesignator.Length > 0 && str.GetChar() == pmDesignator[0]) 4361if (((dtfi.TimeSeparator.Length > 1 && dtfi.TimeSeparator[0] == ':') || !str.Match(':')) && 4372if (((dtfi.DateSeparator.Length > 1 && dtfi.DateSeparator[0] == '/') || !str.Match('/')) && 4482format.Index += (GMTName.Length - 1); 5305if (s.Length > MaxLineLength || (curLineLength + s.Length + 2) > MaxLineLength) 5318curLineLength += s.Length; 5323if (s.Length > MaxLineLength || (curLineLength + s.Length + 6) > MaxLineLength) 5580Index + target.Length <= Length && 5581m_info.Compare(Value.Slice(Index, target.Length), target, CompareOptions.IgnoreCase) == 0; 5586matchLength = target.Length; 5646if (targetPosition < target.Length) 5648int segmentLength = target.Length - targetPosition; 5687Index += (str.Length - 1); 5729int matchLength = word.Length;
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\libraries\System.Private.CoreLib\src\System\Globalization\IdnMapping.cs (33)
63return GetAscii(unicode, index, unicode.Length - index); 72if (index > unicode.Length) 74if (index > unicode.Length - count) 110return GetUnicode(ascii, index, ascii.Length - index); 119if (index > ascii.Length) 121if (index > ascii.Length - count) 159if (originalString.Length == inputLength && 188if (index > 0 || count < unicode.Length) 204throw new ArgumentException(SR.Format(SR.Argument_InvalidCharSequence, unicode.Length - 1), nameof(unicode)); 221if (unicode.Length == 0) 227for (int i = 0; i < unicode.Length; i++) 267if (iLastDot == -1 && unicode.Length > c_labelLimit) 271if (unicode.Length > c_defaultNameLimit - (IsDot(unicode[^1]) ? 0 : 1)) 310if (unicode.Length == 0) 313StringBuilder output = new StringBuilder(unicode.Length); 319while (iNextDot < unicode.Length) 326iNextDot = iNextDot < 0 ? unicode.Length : iNextDot + iAfterLastDot; 332if (iNextDot != unicode.Length) 408output.Remove(iOutputAfterLastDot, c_strAcePrefix.Length); 502if (iNextDot != unicode.Length) 543if (index > 0 || count < ascii.Length) 582if (ascii.Length == 0) 586if (ascii.Length > c_defaultNameLimit - (IsDot(ascii[^1]) ? 0 : 1)) 591StringBuilder output = new StringBuilder(ascii.Length); 598while (iNextDot < ascii.Length) 602if (iNextDot < 0 || iNextDot > ascii.Length) 603iNextDot = ascii.Length; 609if (iNextDot != ascii.Length) 621if (ascii.Length < c_strAcePrefix.Length + iAfterLastDot || 622string.Compare(ascii, iAfterLastDot, c_strAcePrefix, 0, c_strAcePrefix.Length, StringComparison.OrdinalIgnoreCase) != 0) 630iAfterLastDot += c_strAcePrefix.Length; 795if (iNextDot != ascii.Length)
src\libraries\System.Private.CoreLib\src\System\Globalization\IdnMapping.Icu.cs (3)
14Debug.Assert(unicodeString != null && unicodeString.Length >= count); 58Debug.Assert(asciiString != null && asciiString.Length >= count); 83Debug.Assert(asciiString != null && asciiString.Length >= count);
src\libraries\System.Private.CoreLib\src\System\Globalization\IdnMapping.Nls.cs (4)
16Debug.Assert(unicodeString != null && unicodeString.Length >= count); 48Debug.Assert(unicodeString != null && unicodeString.Length >= count); 63Debug.Assert(asciiString != null && asciiString.Length >= count); 95Debug.Assert(asciiString != null && asciiString.Length >= count);
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\libraries\System.Private.CoreLib\src\System\Globalization\JapaneseCalendar.Icu.cs (1)
106if (abbrevEnglishEraNames[^1] is { Length: 0 } or [> '\u007F', ..])
src\libraries\System.Private.CoreLib\src\System\Globalization\JapaneseCalendar.Nls.cs (1)
171if (value.Length != 10) return null;
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\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\libraries\System.Private.CoreLib\src\System\Globalization\NumberFormatInfo.cs (3)
120if (nativeDig[i].Length != 1) 122if (nativeDig[i].Length != 2) 169_allowHyphenDuringParsing = _negativeSign.Length == 1 &&
src\libraries\System.Private.CoreLib\src\System\Globalization\Ordinal.cs (3)
314if ((uint)startIndex > (uint)source.Length) 608if (value.Length == 0) 638if ((uint)startIndex > (uint)source.Length)
src\libraries\System.Private.CoreLib\src\System\Globalization\RegionInfo.cs (1)
31if (name.Length == 0)
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\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\libraries\System.Private.CoreLib\src\System\Globalization\TextInfo.cs (20)
35private bool HasEmptyCultureName { get { return _cultureName.Length == 0; } } 267if (source.Length == 0) 283if (source.Length >= 2) 285nuint lastIndexWhereCanReadTwoChars = (uint)source.Length - 2; 305if ((source.Length & 1) != 0) 327string result = string.FastAllocateString(source.Length); // changing case uses simple folding: doesn't change UTF-16 code unit count 330Span<char> resultSpan = new Span<char>(ref result.GetRawStringData(), result.Length); 344string result = string.FastAllocateString(source.Length); // changing case uses simple folding: doesn't change UTF-16 code unit count 349Span<char> resultSpan = new Span<char>(ref result.GetRawStringData(), result.Length); 356ChangeCaseCore(pSource + currIdx, source.Length - (int)currIdx, pResult + currIdx, result.Length - (int)currIdx, toUpper); 365if (s.Length == 0) 378string result = string.FastAllocateString(s.Length); 381s.AsSpan(0, i).CopyTo(new Span<char>(pResult, result.Length)); 386while (i < s.Length) 522if (str.Length == 0) 532for (int i = 0; i < str.Length; i++) 539if (isDutchCulture && i < str.Length - 1 && (str[i] == 'i' || str[i] == 'I') && (str[i + 1] == 'j' || str[i + 1] == 'J')) 559while (i < str.Length) 613if (i < str.Length)
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\libraries\System.Private.CoreLib\src\System\Guid.cs (3)
1206if (format.Length != 1) 1238bool result = TryFormatCore(new Span<char>(ref guidString.GetRawStringData(), guidString.Length), out int bytesWritten, format); 1239Debug.Assert(result && bytesWritten == guidString.Length, "Formatting guid should have succeeded.");
src\libraries\System.Private.CoreLib\src\System\IO\BinaryWriter.cs (3)
356if (value.Length <= 127 / 3) 365else if (value.Length <= MaxArrayPoolRentalSize / 3) 367byte[] rented = ArrayPool<byte>.Shared.Rent(value.Length * 3); // max expansion: each char -> 3 bytes
src\libraries\System.Private.CoreLib\src\System\IO\Directory.cs (1)
86if (path.Length == 0)
src\libraries\System.Private.CoreLib\src\System\IO\Enumeration\FileSystemName.cs (1)
23int length = expression.Length;
src\libraries\System.Private.CoreLib\src\System\IO\File.cs (2)
98if (path.Length == 0) 107if (path.Length > 0 && PathInternal.IsDirectorySeparator(path[^1]))
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\libraries\System.Private.CoreLib\src\System\IO\FileSystemInfo.cs (1)
51int length = FullPath.Length;
src\libraries\System.Private.CoreLib\src\System\IO\Path.cs (13)
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; 885int relativeToLength = relativeTo.Length; 890int pathLength = path.Length; 908sb.EnsureCapacity(Math.Max(relativeTo.Length, path.Length));
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\libraries\System.Private.CoreLib\src\System\IO\ReadLinesIterator.cs (1)
37Debug.Assert(path.Length > 0);
src\libraries\System.Private.CoreLib\src\System\IO\StreamWriter.cs (1)
503int estimatedLength = checked((format?.Length ?? 0) + args.Length * 8);
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\libraries\System.Private.CoreLib\src\System\Memory.cs (1)
288lengthOfUnderlyingSpan = Unsafe.As<string>(tmpObject).Length;
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); 6068_pos += value.Length; 6316_pos += value.Length;
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\libraries\System.Private.CoreLib\src\System\Number.Formatting.cs (10)
619charsWritten = source.Length; 1384int bufferLength = Math.Max(digits, FormattingHelpers.CountDigits((uint)(-value))) + sNegative.Length; 1389Debug.Assert(p == buffer + sNegative.Length); 1391for (int i = sNegative.Length - 1; i >= 0; i--) 1817int bufferLength = Math.Max(digits, FormattingHelpers.CountDigits((ulong)(-value))) + sNegative.Length; 1822Debug.Assert(p == buffer + sNegative.Length); 1824for (int i = sNegative.Length - 1; i >= 0; i--) 2245int bufferLength = Math.Max(digits, FormattingHelpers.CountDigits(absValue)) + sNegative.Length; 2250Debug.Assert(p == buffer + sNegative.Length); 2252for (int i = sNegative.Length - 1; i >= 0; i--)
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\libraries\System.Private.CoreLib\src\System\Random.cs (1)
402GetItems(choices, new Span<char>(ref destination.GetRawStringData(), destination.Length));
src\libraries\System.Private.CoreLib\src\System\ReadOnlyMemory.cs (1)
210lengthOfUnderlyingSpan = Unsafe.As<string>(tmpObject).Length;
src\libraries\System.Private.CoreLib\src\System\Reflection\AssemblyName.cs (1)
315vsb.EnsureCapacity(codebase.Length);
src\libraries\System.Private.CoreLib\src\System\Reflection\Emit\SymbolType.cs (2)
60if (format == null || curIndex == format.Length) 74if (curIndex != format.Length)
src\libraries\System.Private.CoreLib\src\System\Reflection\Module.cs (1)
189ReadOnlySpan<char> slice = str.AsSpan(0, str.Length - 1);
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\libraries\System.Private.CoreLib\src\System\Resources\ManifestBasedResourceGroveler.cs (1)
429if (missingCultureName.Length == 0)
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\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\libraries\System.Private.CoreLib\src\System\Runtime\InteropServices\Marshal.cs (14)
925long lnb = (s.Length + 1) * (long)SystemMaxDBCSCharSize; 947int nb = (s.Length + 1) * 2; 950if (nb < s.Length) 957s.CopyTo(new Span<char>((char*)ptr, s.Length)); 958((char*)ptr)[s.Length] = '\0'; 970int nb = Encoding.UTF8.GetMaxByteCount(s.Length); 988int nb = (s.Length + 1) * 2; 991if (nb < s.Length) 998s.CopyTo(new Span<char>((char*)ptr, s.Length)); 999((char*)ptr)[s.Length] = '\0'; 1011int nb = Encoding.UTF8.GetMaxByteCount(s.Length); 1029long lnb = (s.Length + 1) * (long)SystemMaxDBCSCharSize; 1227IntPtr bstr = AllocBSTR(s.Length); 1229s.CopyTo(new Span<char>((char*)bstr, s.Length)); // AllocBSTR already included the null terminator
src\libraries\System.Private.CoreLib\src\System\Runtime\InteropServices\Marshal.Unix.cs (1)
37Debug.Assert(bufferLength >= (s.Length + 1) * SystemMaxDBCSCharSize, "Insufficient buffer length passed to StringToAnsiString");
src\libraries\System.Private.CoreLib\src\System\Runtime\InteropServices\Marshalling\AnsiStringMarshaller.cs (1)
79if ((long)Marshal.SystemMaxDBCSCharSize * managed.Length >= buffer.Length)
src\libraries\System.Private.CoreLib\src\System\Runtime\InteropServices\Marshalling\BStrStringMarshaller.cs (3)
75int lengthInBytes = checked(sizeof(char) * managed.Length); 99managed.CopyTo(new Span<char>(ptrToFirstChar, managed.Length)); 100ptrToFirstChar[managed.Length] = '\0'; // null-terminate
src\libraries\System.Private.CoreLib\src\System\Runtime\InteropServices\Marshalling\Utf8StringMarshaller.cs (1)
83if ((long)MaxUtf8BytesPerChar * managed.Length >= buffer.Length)
src\libraries\System.Private.CoreLib\src\System\Runtime\InteropServices\MemoryMarshal.cs (1)
394return (IEnumerable<T>)(object)(index == 0 && length == str.Length ?
src\libraries\System.Private.CoreLib\src\System\Runtime\Loader\AssemblyLoadContext.cs (3)
749Debug.Assert(assemblyName.CultureName?.Length > 0); 756string parentAssemblyName = assemblyName.Name.Substring(0, assemblyName.Name.Length - SatelliteSuffix.Length);
src\libraries\System.Private.CoreLib\src\System\Runtime\Loader\LibraryNameVariation.Unix.cs (2)
32indexOfSuffix += LibraryNameSuffix.Length; 33containsSuffix = indexOfSuffix == libName.Length || libName[indexOfSuffix] == '.';
src\libraries\System.Private.CoreLib\src\System\Runtime\Versioning\FrameworkName.cs (1)
129if (_identifier.Length == 0)
src\libraries\System.Private.CoreLib\src\System\RuntimeType.cs (1)
415if (name.Length == 0 || name.Equals("[DISPID=0]"))
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\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\libraries\System.Private.CoreLib\src\System\SearchValues\Strings\Helpers\RabinKarp.cs (2)
47minimumLength = Math.Min(minimumLength, value.Length); 67if (value.Length > MaxInputLength)
src\libraries\System.Private.CoreLib\src\System\SearchValues\Strings\Helpers\StringSearchValuesHelper.cs (18)
60if (lengthRemaining < candidate.Length) 77(uint)candidate.Length * sizeof(char)); 83return Ascii.EqualsIgnoreCase(ref matchStart, ref candidate.GetRawStringData(), (uint)candidate.Length); 87return Ordinal.EqualsIgnoreCase(ref matchStart, ref candidate.GetRawStringData(), candidate.Length); 120Debug.Assert(value.Length >= 2); 143if (value.Length <= 16) 145if (value.Length > 8) 147SecondReadByteOffset = (value.Length - 8) * sizeof(char); 152else if (value.Length >= 4) 154SecondReadByteOffset = (value.Length - 4) * sizeof(char); 162Debug.Assert(value.Length is 2 or 3); 164SecondReadByteOffset = (value.Length - 2) * sizeof(char); 185Debug.Assert(Value.Length is >= 9 and <= 16); 207Debug.Assert(Value.Length is >= 9 and <= 16); 272Debug.Assert(state.Value.Length is 2 or 3); 321Debug.Assert(state.Value.Length is 2 or 3); 394Debug.Assert(state.Value.Length is 2 or 3); 424return Ordinal.EqualsIgnoreCase_Scalar(ref matchStart, ref state.Value.GetRawStringData(), state.Value.Length);
src\libraries\System.Private.CoreLib\src\System\SearchValues\Strings\SingleStringSearchValuesThreeChars.cs (4)
49Debug.Assert(value.Length > 1); 56_minusValueTailLength = -(value.Length - 1); 338ValidateReadPosition(ref searchSpaceStart, searchSpaceLength, ref matchRef, _valueState.Value.Length); 366ValidateReadPosition(ref searchSpaceStart, searchSpaceLength, ref matchRef, _valueState.Value.Length);
src\libraries\System.Private.CoreLib\src\System\SearchValues\Strings\StringSearchValues.cs (11)
67normalizedValues.Sort(static (a, b) => a.Length.CompareTo(b.Length)); 89string upperCase = string.FastAllocateString(value.Length); 90int charsWritten = Ordinal.ToUpperOrdinal(value, new Span<char>(ref upperCase.GetRawStringData(), upperCase.Length)); 91Debug.Assert(charsWritten == upperCase.Length); 387if (Vector128.IsHardwareAccelerated && value.Length > 1 && value.Length <= maxLength) 389SearchValues<string>? searchValues = value.Length switch 459minLength = Math.Min(minLength, value.Length); 493for (; (uint)i < (uint)value.Length; i++) 497if ((uint)(i + 1) >= (uint)value.Length || !char.IsLowSurrogate(value[i + 1]))
src\libraries\System.Private.CoreLib\src\System\Security\SecurityElement.cs (4)
343int maxCompareLength = str.Length - index; 353int length = strEscValue.Length; 357newIndex = index + strEscValue.Length; 373int strLen = str.Length;
src\libraries\System.Private.CoreLib\src\System\SR.cs (1)
24if (key.Length == 0)
src\libraries\System.Private.CoreLib\src\System\String.Comparison.cs (67)
27Debug.Assert(strA.Length == strB.Length); 32((uint)strA.Length) * sizeof(char)); 42Debug.Assert(indexA + countA <= strA.Length && indexB + countB <= strB.Length); 61if (strA.Length != strB.Length) 71Debug.Assert(strA.Length == strB.Length); 73return Ordinal.EqualsIgnoreCase(ref strA.GetRawStringData(), ref strB.GetRawStringData(), strB.Length); 87int length = Math.Min(strA.Length, strB.Length); 162return strA.Length - strB.Length; 258return Ordinal.CompareStringIgnoreCase(ref strA.GetRawStringData(), strA.Length, ref strB.GetRawStringData(), strB.Length); 323lengthA = Math.Min(lengthA, strA.Length - indexA); 328lengthB = Math.Min(lengthB, strB.Length - indexB); 358lengthA = Math.Min(lengthA, strA.Length - indexA); 363lengthB = Math.Min(lengthB, strB.Length - indexB); 392if (strA.Length - indexA < 0 || strB.Length - indexB < 0) 394string paramName = strA.Length - indexA < 0 ? nameof(indexA) : nameof(indexB); 403int lengthA = Math.Min(length, strA.Length - indexA); 404int lengthB = Math.Min(length, strB.Length - indexB); 484int lengthA = Math.Min(length, strA.Length - indexA); 485int lengthB = Math.Min(length, strB.Length - indexB); 548if (value.Length == 0) 565int offset = this.Length - value.Length; 566return (uint)offset <= (uint)this.Length && this.AsSpan(offset).SequenceEqual(value); 569return Length >= value.Length && 570Ordinal.EqualsIgnoreCase(ref Unsafe.Add(ref GetRawStringData(), Length - value.Length), 572value.Length); 604nuint localLength = (uint)Length; 608int lastPos = Length - 1; 609return ((uint)lastPos < (uint)Length) && this[lastPos] == value; 621if (this.Length != str.Length) 641if (this.Length != value.Length) 673if (this.Length != value.Length) 678if (this.Length != value.Length) 697if (a is null || b is null || a.Length != b.Length) 731if (a.Length != b.Length) 736if (a.Length != b.Length) 834Debug.Assert(src[Length] == '\0', "src[Length] == '\\0'"); 841int length = Length; 928int length = Length; 931Debug.Assert(src[Length] == '\0', "src[this.Length] == '\\0'"); 966return GetNonRandomizedHashCodeOrdinalIgnoreCaseSlow(hash1, hash2, this.AsSpan(Length - length)); 1117if (value.Length == 0) 1134if (this.Length < value.Length || _firstChar != value._firstChar) 1138return (value.Length == 1) ? 1143((nuint)value.Length) * 2); 1146if (this.Length < value.Length) 1150return Ordinal.EqualsIgnoreCase(ref this.GetRawStringData(), ref value.GetRawStringData(), value.Length); 1182return Length != 0 && _firstChar == value;
src\libraries\System.Private.CoreLib\src\System\String.cs (20)
84elementCount: (uint)result.Length, // derefing Length now allows JIT to prove 'result' not null below 110elementCount: (uint)result.Length, // derefing Length now allows JIT to prove 'result' not null below 136elementCount: (uint)result.Length, // derefing Length now allows JIT to prove 'result' not null below 170elementCount: (uint)result.Length, // derefing Length now allows JIT to prove 'result' not null below 366value != null ? new ReadOnlySpan<char>(ref value.GetRawStringData(), value.Length) : default; 373if ((ulong)(uint)startIndex + (ulong)(uint)count > (ulong)(uint)Length) 401string result = FastAllocateString(str.Length); 404elementCount: (uint)result.Length, // derefing Length now allows JIT to prove 'result' not null below 422ArgumentOutOfRangeException.ThrowIfGreaterThan(count, Length - sourceIndex, nameof(sourceIndex)); 438if ((uint)Length <= (uint)destination.Length) 440Buffer.Memmove(ref destination._reference, ref _firstChar, (uint)Length); 455if ((uint)Length <= (uint)destination.Length) 457Buffer.Memmove(ref destination._reference, ref _firstChar, (uint)Length); 466if (Length == 0) 469char[] chars = new char[Length]; 474elementCount: (uint)Length); 484ArgumentOutOfRangeException.ThrowIfGreaterThan((uint)startIndex, (uint)Length, nameof(startIndex)); 485ArgumentOutOfRangeException.ThrowIfGreaterThan(startIndex, Length - length); 505return value == null || value.Length == 0; 512for (int i = 0; i < value.Length; i++)
src\libraries\System.Private.CoreLib\src\System\String.Manipulation.cs (85)
60Debug.Assert(src.Length <= dest.Length - destPos); 65elementCount: (uint)src.Length); 117totalLength += toString.Length; 139Debug.Assert(position <= totalLength - s.Length, "We didn't allocate enough space for the result string!"); 142position += s.Length; 197int str0Length = str0.Length; 199int totalLength = str0Length + str1.Length; 233long totalLength = (long)str0.Length + (long)str1.Length + (long)str2.Length; 242CopyStringContent(result, str0.Length, str1); 243CopyStringContent(result, str0.Length + str1.Length, str2); 271long totalLength = (long)str0.Length + (long)str1.Length + (long)str2.Length + (long)str3.Length; 280CopyStringContent(result, str0.Length, str1); 281CopyStringContent(result, str0.Length + str1.Length, str2); 282CopyStringContent(result, str0.Length + str1.Length + str2.Length, str3); 296Span<char> resultSpan = new Span<char>(ref result._firstChar, result.Length); 313Span<char> resultSpan = new Span<char>(ref result._firstChar, result.Length); 335Span<char> resultSpan = new Span<char>(ref result._firstChar, result.Length); 360Span<char> resultSpan = new Span<char>(ref result._firstChar, result.Length); 413totalLengthLong += value.Length; 436int valueLen = value.Length; 542sb.EnsureCapacity(format.Length + args.Length * 8); 698ArgumentOutOfRangeException.ThrowIfGreaterThan((uint)startIndex, (uint)Length, nameof(startIndex)); 700int oldLength = Length; 701int insertLength = value.Length; 1056totalLength += value.Length; 1083int valueLen = value.Length; 1130int oldLength = Length; 1148int oldLength = Length; 1165int oldLength = this.Length; 1185if ((uint)startIndex > Length) 1281nuint remainingLength = (uint)(Length - firstIndex); 1282string result = FastAllocateString(Length); 1299nuint length = (uint)Length; 1337if (oldValue.Length == 1) 1343if (newValue.Length == 1) 1357int pos = PackedSpanHelpers.IndexOf(ref Unsafe.Add(ref _firstChar, i), c, Length - i); 1370int pos = SpanHelpers.NonPackedIndexOfChar(ref Unsafe.Add(ref _firstChar, i), c, Length - i); 1386int pos = SpanHelpers.IndexOf(ref Unsafe.Add(ref _firstChar, i), Length - i, ref oldValue._firstChar, oldValue.Length); 1392i += pos + oldValue.Length; 1404string dst = ReplaceHelper(oldValue.Length, newValue, replacementIndices.AsSpan()); 1415long dstLength = this.Length + ((long)(newValue.Length - oldValueLength)) * indices.Length; 1420Span<char> dstSpan = new Span<char>(ref dst._firstChar, dst.Length); 1440dstIdx += newValue.Length; 1444Debug.Assert(this.Length - thisIdx == dstSpan.Length - dstIdx); 1593else if (replacementText.Length != 1 || replacementText[0] != text[idx]) 1608if ((uint)idxOfFirstNewlineChar >= (uint)Length) 1614(uint)(idxOfFirstNewlineChar + 1) < (uint)Length && 1703if (count <= 1 || Length == 0) 1710if (separators.IsEmpty && count > Length) 1773if (count <= 1 || Length == 0) 1782if (separator!.Length == 0) 1829if ((options & StringSplitOptions.RemoveEmptyEntries) == 0 || candidate.Length != 0) 1851? SplitWithPostProcessing(sepList, default, separator.Length, count, options) 1852: SplitWithoutPostProcessing(sepList, default, separator.Length, count); 1874for (int i = 0; i < numActualReplaces && currIndex < Length; i++) 1881if (currIndex < Length && numActualReplaces >= 0) 2189int currentSepLength = separator.Length; 2224int length = Length - startIndex; 2230if ((uint)startIndex > (uint)Length) 2242if ((ulong)(uint)startIndex + (ulong)(uint)length > (ulong)(uint)Length) 2255if (length == Length) 2269if (startIndex > Length) 2281Debug.Assert(startIndex >= 0 && startIndex <= this.Length, "StartIndex is out of range!"); 2282Debug.Assert(length >= 0 && startIndex <= this.Length - length, "length is out of range!"); 2330if (Length == 0 || (!char.IsWhiteSpace(_firstChar) && !char.IsWhiteSpace(this[^1]))) 2340if (Length == 0 || (_firstChar != trimChar && this[^1] != trimChar)) 2468int end = Length - 1; 2474for (start = 0; start < Length; start++) 2485for (end = Length - 1; end >= start; end--) 2504int end = Length - 1; 2510for (start = 0; start < Length; start++) 2531for (end = Length - 1; end >= start; end--) 2557len == Length ? this :
src\libraries\System.Private.CoreLib\src\System\String.Searching.cs (27)
16if (RuntimeHelpers.IsKnownConstant(value) && value.Length == 1) 24Length, 26value.Length) >= 0; 37=> SpanHelpers.ContainsValueType(ref Unsafe.As<char, short>(ref _firstChar), (short)value, Length); 48public int IndexOf(char value) => SpanHelpers.IndexOfChar(ref _firstChar, value, Length); 52return IndexOf(value, startIndex, Length - startIndex); 79? PackedSpanHelpers.IndexOfAnyIgnoreCase(ref _firstChar, valueLc, Length) 80: SpanHelpers.IndexOfAnyChar(ref _firstChar, valueLc, valueUc, Length); 83return SpanHelpers.IndexOfChar(ref _firstChar, value, Length); 88if ((uint)startIndex > (uint)Length) 93if ((uint)count > (uint)(Length - startIndex)) 113return new ReadOnlySpan<char>(ref _firstChar, Length).IndexOfAny(anyOf); 118return IndexOfAny(anyOf, startIndex, Length - startIndex); 128if ((uint)startIndex > (uint)Length) 133if ((uint)count > (uint)(Length - startIndex)) 245return IndexOf(value, 0, Length, comparisonType); 250return IndexOf(value, startIndex, Length - startIndex, comparisonType); 270=> SpanHelpers.LastIndexOfValueType(ref Unsafe.As<char, short>(ref _firstChar), (short)value, Length); 279if (Length == 0) 284if ((uint)startIndex >= (uint)Length) 312return new ReadOnlySpan<char>(ref _firstChar, Length).LastIndexOfAny(anyOf); 327if (Length == 0) 332if ((uint)startIndex >= (uint)Length) 355return LastIndexOf(value, Length - 1, Length, StringComparison.CurrentCulture); 370return LastIndexOf(value, Length - 1, Length, comparisonType);
src\libraries\System.Private.CoreLib\src\System\StringComparer.cs (10)
343return Globalization.Ordinal.CompareStringIgnoreCase(ref x.GetRawStringData(), x.Length, ref y.GetRawStringData(), y.Length); 358if (x.Length != y.Length) 362return Globalization.Ordinal.EqualsIgnoreCase(ref x.GetRawStringData(), ref y.GetRawStringData(), x.Length); 506return Globalization.Ordinal.CompareStringIgnoreCase(ref x.GetRawStringData(), x.Length, ref y.GetRawStringData(), y.Length); 521if (x.Length != y.Length) 526return Globalization.Ordinal.EqualsIgnoreCase(ref x.GetRawStringData(), ref y.GetRawStringData(), x.Length);
src\libraries\System.Private.CoreLib\src\System\Text\ASCIIEncoding.cs (2)
116return GetByteCountCommon(pChars, chars!.Length); 225if (chars!.Length - charIndex < charCount)
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\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\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\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\libraries\System.Private.CoreLib\src\System\Text\EncodingTable.cs (1)
58Debug.Assert(EncodingNameIndices[^1] == EncodingNames.Length);
src\libraries\System.Private.CoreLib\src\System\Text\Latin1Encoding.cs (3)
98return GetByteCountCommon(pChars, s.Length); 271if (s!.Length - charIndex < charCount) 560GetCharsCommon(pBytes, bytes.Length, pChars, result.Length);
src\libraries\System.Private.CoreLib\src\System\Text\Rune.cs (2)
865if ((uint)index >= (uint)input.Length) 888if ((uint)index >= (uint)input.Length)
src\libraries\System.Private.CoreLib\src\System\Text\StringBuilder.cs (23)
106: this(value, 0, value?.Length ?? 0, capacity) 125if (startIndex > value.Length - length) 199if (persistedMaxCapacity < 1 || persistedString.Length > persistedMaxCapacity) 207persistedCapacity = Math.Min(Math.Max(DefaultCapacity, persistedString.Length), persistedMaxCapacity); 210if (persistedCapacity < 0 || persistedCapacity < persistedString.Length || persistedCapacity > persistedMaxCapacity) 218persistedString.CopyTo(0, m_ChunkChars, 0, persistedString.Length); 219m_ChunkLength = persistedString.Length; 334if ((uint)(chunkLength + chunkOffset) > (uint)result.Length || (uint)chunkLength > (uint)sourceArray.Length) 372CopyTo(startIndex, new Span<char>(ref result.GetRawStringData(), result.Length), result.Length); 754Append(ref value.GetRawStringData(), value.Length); 782if (startIndex > value.Length - count) 1134return AppendJoinCore(ref separator.GetRawStringData(), separator.Length, values); 1147return AppendJoinCore(ref separator.GetRawStringData(), separator.Length, values); 1158return AppendJoinCore(ref separator.GetRawStringData(), separator.Length, values); 1169return AppendJoinCore(ref separator.GetRawStringData(), separator.Length, values); 1182return AppendJoinCore(ref separator.GetRawStringData(), separator.Length, values); 1301Insert(index, ref value.GetRawStringData(), value.Length); 1541if ((uint)pos >= (uint)format.Length) 1761if (width <= s.Length) 1768Append(' ', width - s.Length); 1772Append(' ', width - s.Length); 1783if ((uint)pos >= (uint)format.Length)
src\libraries\System.Private.CoreLib\src\System\Text\StringRuneEnumerator.cs (1)
29if ((uint)_nextIndex >= _string.Length)
src\libraries\System.Private.CoreLib\src\System\Text\Unicode\Utf8.cs (1)
407ref value.GetRawStringData(), value.Length,
src\libraries\System.Private.CoreLib\src\System\Text\UnicodeEncoding.cs (2)
117return GetByteCount(pChars, s.Length, null); 149if (s.Length - charIndex < charCount)
src\libraries\System.Private.CoreLib\src\System\Text\UTF32Encoding.cs (2)
125return GetByteCount(pChars, s.Length, null); 157if (s.Length - charIndex < charCount)
src\libraries\System.Private.CoreLib\src\System\Text\UTF7Encoding.cs (2)
161return GetByteCount(pChars, s.Length, null); 193if (s.Length - charIndex < charCount)
src\libraries\System.Private.CoreLib\src\System\Text\UTF8Encoding.cs (2)
166return GetByteCountCommon(pChars, chars.Length); 272if (s.Length - charIndex < charCount)
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\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\libraries\System.Private.CoreLib\src\System\Threading\Tasks\TplEventSource.cs (1)
447eventPayload[1].Size = ((OperationName.Length + 1) * 2);
src\libraries\System.Private.CoreLib\src\System\TimeOnly.cs (2)
742if (format.Length == 1) 922if (format.Length == 1)
src\libraries\System.Private.CoreLib\src\System\TimeZoneInfo.cs (3)
662if (id.Length == 0 || id.Length > MaxKeyLength || id.Contains('\0')) 868if (source.Length == 0)
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\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\libraries\System.Private.CoreLib\src\System\TimeZoneInfo.StringSerializer.cs (16)
194if (_currentTokenStartIndex < 0 || _currentTokenStartIndex >= _serializedText.Length) 201for (int i = _currentTokenStartIndex; i < _serializedText.Length; i++) 224if (_currentTokenStartIndex >= _serializedText.Length) 262if (_currentTokenStartIndex < 0 || _currentTokenStartIndex >= _serializedText.Length) 270for (int i = _currentTokenStartIndex; i < _serializedText.Length; i++) 296if (_currentTokenStartIndex >= _serializedText.Length) 393if (_currentTokenStartIndex < 0 || _currentTokenStartIndex >= _serializedText.Length) 412if (_currentTokenStartIndex < 0 || _currentTokenStartIndex >= _serializedText.Length) 440if (_state == State.EndOfLine || _currentTokenStartIndex >= _serializedText.Length) 457if (_state == State.EndOfLine || _currentTokenStartIndex >= _serializedText.Length) 489if (_currentTokenStartIndex >= _serializedText.Length) 508(_currentTokenStartIndex < _serializedText.Length && _serializedText[_currentTokenStartIndex] == Rhs)) 516if (_currentTokenStartIndex < 0 || _currentTokenStartIndex >= _serializedText.Length) 572if (_state == State.EndOfLine || _currentTokenStartIndex >= _serializedText.Length) 593if (_currentTokenStartIndex < _serializedText.Length && 608if (_currentTokenStartIndex >= _serializedText.Length)
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\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\libraries\System.Reflection.Metadata\src\System\Reflection\Metadata\TypeNameParserHelpers.cs (3)
113sb.EnsureCapacity(name.Length); 116for (int i = indexOfEscapeCharacter; i < name.Length;) 120if (c != EscapeCharacter || i == name.Length)
src\System\Exception.CoreCLR.cs (1)
273for (digitEnd = poundPos + 1; digitEnd < helpFile.Length; digitEnd++)
src\System\Reflection\Assembly.CoreCLR.cs (1)
31if ((partialName.Length == 0) || (partialName[0] == '\0'))
src\System\Reflection\Emit\RuntimeModuleBuilder.cs (3)
18int i = typeName.Length - 1; 585while (startIndex <= className.Length) 1254return GetStringConstant(new QCallModule(ref thisModule), stringConstant, stringConstant.Length);
src\System\Reflection\Emit\RuntimeTypeBuilder.cs (1)
386if (name.Length > 1023)
src\System\Reflection\RuntimeAssembly.cs (3)
107if (codeBase.Length == 0) 433if (Location.Length == 0) 451if (Location.Length == 0)
src\System\Reflection\TypeNameResolver.CoreCLR.cs (2)
56if (typeName.Length == 0) 250if (escapedTypeName.Length == 1)
src\System\RuntimeType.CoreCLR.cs (1)
357if (name.Length != 0)
src\System\String.CoreCLR.cs (1)
71return encoding.GetBytes(pwzChar, Length, pbNativeBuffer, cbNativeBuffer);
src\System\StubHelpers.cs (10)
23byte[] buffer = new byte[checked((str.Length + 1) * Marshal.SystemMaxDBCSCharSize)]; 69nb = checked((strManaged.Length + 1) * Marshal.SystemMaxDBCSCharSize + 1); 94if (strManaged.Length == 0) 139int numChars = strManaged.Length; 242uint lengthInBytes = (uint)strManaged.Length * 2; 274Buffer.Memmove(ref *(char*)ptrToFirstChar, ref strManaged.GetRawStringData(), (nuint)strManaged.Length + 1); 348cch = strManaged.Length; 409if (strManaged.Length > 0) 1001int allocSize = (pManagedHome.Length + 1) * 2; 1005Buffer.Memmove(ref *(char*)pNativeHome, ref pManagedHome.GetRawStringData(), (nuint)pManagedHome.Length + 1);
src\System\Threading\Thread.CoreCLR.cs (1)
182InformThreadNameChange(GetNativeHandle(), value, value?.Length ?? 0);
System.Private.CoreLib.Generators (1)
EventSourceGenerator.Emitter.cs (1)
86Encoding.UTF8.GetBytes(name, 0, name.Length, metadata, 2);
System.Private.DataContractSerialization (148)
src\libraries\Common\src\System\CodeDom\CodeTypeReference.cs (3)
135int end = typeName.Length - 1; 367int end = typeName.Length - 1; 371while (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)
1181if (localName.Length == 0) 1185for (int i = 1; i < localName.Length; i++) 1470int nsLen = (type.Namespace == null) ? 0 : type.Namespace.Length; 1646if (dataContractNs.Length > 0) 1650if (trimmedNs.Length == 0 || trimmedNs.Contains("##", StringComparison.Ordinal)) 1659Span<char> formatted = stackalloc char[Globals.SerializationNamespace.Length]; 1661charsWritten == Globals.SerializationNamespace.Length && 1698return uriString.StartsWith(Globals.DataContractXsdBaseNamespace, StringComparison.Ordinal) ? uriString.Substring(Globals.DataContractXsdBaseNamespace.Length) : uriString; 1884for (int i = 0; i < format.Length; i++) 1891for (; i < format.Length; i++) 1894if (i == format.Length) 1981if (methodName.Length == 0)
System\Runtime\Serialization\EnumDataContract.cs (7)
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); 381if (memberName.Length == count && string.CompareOrdinal(value, index, memberName, 0, count) == 0)
System\Runtime\Serialization\ExtensionDataReader.cs (1)
802prefix = (ns.Length == 0) ? string.Empty : "p" + s_nsToPrefixTable.Count;
System\Runtime\Serialization\Json\DataContractJsonSerializer.cs (1)
352for (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)
1102else 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)
108if (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)
556if (xmlReader.NamespaceURI.Length != 0) 880if (xmlReader.NamespaceURI.Length != 0) 971couldBeISerializableData = (ns.Length == 0);
System\Runtime\Serialization\XmlObjectSerializerWriteContext.cs (1)
356if (ns != null && ns.Value != null && ns.Value.Length > 0)
System\Runtime\Serialization\XmlObjectSerializerWriteContextComplex.cs (1)
129if (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.Uri (137)
src\libraries\Common\src\System\Text\ValueStringBuilder.cs (5)
154int count = s.Length; 196if (s.Length == 1 && (uint)pos < (uint)_chars.Length) // very common case, e.g. appending strings from NumberFormatInfo like separators, percent symbols, etc. 210if (pos > _chars.Length - s.Length) 212Grow(s.Length); 220_pos += s.Length;
System\DomainNameHelper.cs (1)
227for (int i = 0; i < hostname.Length; i++)
System\Uri.cs (96)
459if (uriString!.Length != 0) 595for (int i = 0; i < relativeStr.Length; ++i) 618if (i + 1 < relativeStr.Length) 639if (relativeStr.Length == 0) 900if (path.Length == 0) 908while (current < path.Length) 913next = path.Length - 1; 1000result = new char[host.Length + 3 + _info.Offset.Fragment - _info.Offset.Path]; 1008UriHelper.UnescapeString(host, 0, host.Length, result, ref count, c_DummyChar, c_DummyChar, 1188string.Concat(host.AsSpan(1, host.Length - 2), scopeId) : 1189host.Substring(1, host.Length - 2); 1199UriHelper.UnescapeString(host, 0, host.Length, ref dest, 1266if (string.IsNullOrEmpty(name) || name.Length > short.MaxValue) 1271int end = name.Length; 1279if (IPv6AddressHelper.IsValid(fixedName, 1, ref end) && end == name.Length) 1285end = name.Length; 1286if (IPv4AddressHelper.IsValid(fixedName, 0, ref end, false, false, false) && end == name.Length) 1292if (DomainNameHelper.IsValid(name, iri: false, notImplicitFile: false, out int length) && length == name.Length) 1297if (DomainNameHelper.IsValid(name, iri: true, notImplicitFile: false, out length) && length == name.Length) 1303end = name.Length + 2; 1308if (IPv6AddressHelper.IsValid(newFixedName, 1, ref end) && end == name.Length) 1420ArgumentOutOfRangeException.ThrowIfGreaterThanOrEqual(index, pattern.Length); 1423&& (pattern.Length - index >= 3)) 1460(pattern.Length - index) >= 3 && 1895return (uint)index < (uint)uriString.Length && uriString[index] == ':'; 1910int length = uriString.Length; 1982int length = _string.Length; 2216info.Offset.End = (ushort)_string.Length; 2250idx = _syntax.SchemeName.Length; 2349info.Offset.End = (ushort)_originalUnicodeString.Length; 2441if (host.Length != 0) 2450result = CheckCanonical(pHost, ref idx, host.Length, c_DummyChar); 2493for (int i = 0; i < host.Length; ++i) 2549if (host.Length == 0) 2586if (host.Length >= c_MaxUriBufferSize) 2595if (CheckAuthorityHelper(pHost, 0, host.Length, ref err, ref flags, _syntax, ref newHost) != 2596host.Length) 2611host = CreateHostStringHelper(host, 0, host.Length, ref flags, _info); 2613for (int i = 0; i < host.Length; ++i) 2638for (int idx = 0; idx < portStr.Length; ++idx) 2747var dest = str.Length <= StackallocThreshold 2749: new ValueStringBuilder(str.Length); 2764var dest = str.Length <= StackallocThreshold 2766: new ValueStringBuilder(str.Length); 2851if (host.Length != 0) 3046if (_info.Offset.Scheme == 0 && _info.Offset.End == _string.Length) 3059if (_info.Offset.Scheme == 0 && _info.Offset.Fragment == _string.Length) 3070if (_info.Offset.Scheme == 0 && _info.Offset.Fragment == _string.Length) 3155if (_info.Offset.Scheme == 0 && _info.Offset.End == _string.Length) 3217int length = _string.Length; 3235for (i = 0; i < schemeName.Length; ++i) 3308_info.Offset.User = (ushort)_string.Length; 3309_info.Offset.Host = (ushort)_string.Length; 3312_info.Offset.Path = (ushort)_string.Length; 3329idx = str.Length; 3336idx = str.Length; 3341_info.Offset.Fragment = (ushort)str.Length; // There is no fragment in DisablePathAndQueryCanonicalization mode 3342_info.Offset.End = (ushort)str.Length; 3357origIdx = _originalUnicodeString.Length; 3379origIdx = index == -1 ? _originalUnicodeString.Length : (index + origIdx); 3384if (_string.Length > ushort.MaxValue) 3390length = _string.Length; 3505if (origIdx < _originalUnicodeString.Length && _originalUnicodeString[origIdx] == '?') 3511origIdx = index == -1 ? _originalUnicodeString.Length : (index + origIdx); 3515origIdx = _originalUnicodeString.Length; 3520if (_string.Length > ushort.MaxValue) 3526length = _string.Length; 3571if (origIdx < _originalUnicodeString.Length && _originalUnicodeString[origIdx] == '#') 3573origIdx = _originalUnicodeString.Length; 3577if (_string.Length > ushort.MaxValue) 3583length = _string.Length; 3634while ((uint)i < (uint)uriString.Length && UriHelper.IsLWS(uriString[i])) 3642(uint)i < (uint)uriString.Length && uriString[i] == '/' && 3643((uint)(i + 1) >= (uint)uriString.Length || uriString[i + 1] is not ('/' or '\\'))) 3655if ((uint)(i + 2) >= (uint)uriString.Length || 3658(uint)i >= (uint)uriString.Length || 3659(uint)(i + 1) >= (uint)uriString.Length) 3696while ((uint)i < (uint)uriString.Length && uriString[i] is '/' or '\\') 3854if (newHost.Length > ushort.MaxValue) 4717(relativePart.Length == 1 || (relativePart[1] != '/' && relativePart[1] != '\\'))) 4736if (relativePart.Length >= 2 && (relativePart[1] == '\\' || relativePart[1] == '/')) 4777if (relativePart.Length >= 2 && relativePart[1] == '/') 4804int length = left.Length; 4805char[] path = new char[length + relativePart.Length]; 4821relativePart.CopyTo(0, path, length, relativePart.Length); 4835for (; i < relativePart.Length; ++i) 4846else if (i < relativePart.Length) 4854length += relativePart.Length; 4927for (i = 0; (i < path1.Length) && (i < path2.Length); ++i) 4946if ((i == path1.Length) && (i == path2.Length)) 4953for (; i < path1.Length; ++i) 4961if (relPath.Length == 0 && path2.Length - 1 == si) 5042char[] dest = new char[path.Length]; 5044dest = UriHelper.UnescapeString(path, 0, path.Length, dest, ref count, c_DummyChar, c_DummyChar,
System\UriBuilder.cs (14)
95if (_query.Length == 1) 100if (_fragment.Length == 1) 115if (value.Length != 0) 290if (userInfo.Length > 0) 308if (UserName.Length == 0 && Password.Length != 0) 318if (scheme.Length != 0) 324schemeDelimiter = host.Length == 0 ? ":" : Uri.SchemeDelimiter; 329|| (host.Length != 0 && syntax.NotAny(UriSyntaxFlags.MailToLikeUri) && syntax.InFact(UriSyntaxFlags.OptionalAuthority)) 339if (username.Length != 0) 344if (password.Length != 0) 353if (host.Length != 0) 369if (path.Length != 0) 371if (!path.StartsWith('/') && host.Length != 0)
System\UriExt.cs (17)
60((uriKind == UriKind.Relative || (_string.Length >= 2 && (_string[0] != '\\' || _string[1] != '\\'))) 205_string = EscapeUnescapeIri(_originalUnicodeString, 0, _originalUnicodeString.Length, 207if (_string.Length > ushort.MaxValue) 239for ( ; i < data.Length; i++) 244if ((uint)(i + 2) < (uint)data.Length) 460return (CheckCanonical(str, ref idx, _string.Length, c_EOL) 509idx = _info.Offset.Scheme + _syntax.SchemeName.Length + 2; 562idx = _syntax.SchemeName.Length; 564if (idx + 1 >= _string.Length || str[idx] != '/' || str[idx + 1] != '/') 595Debug.Assert(backingString is null || backingString.Length == charsToUnescape.Length); 833if (relativeStr.Length > 0 && (UriHelper.IsLWS(relativeStr[0]) || UriHelper.IsLWS(relativeStr[relativeStr.Length - 1]))) 836if (relativeStr.Length == 0) 860if (relativeStr.Length >= 3 906if (_string.Length == 0) 1041return UriHelper.TestForSubPath(selfPtr, self.Length, otherPtr, other.Length,
System\UriHelper.cs (2)
208Debug.Assert(backingString is null || backingString.Length == charsToEscape.Length); 612Debug.Assert(backingString is null || strToClean.Length == backingString.Length);
System\UriScheme.cs (1)
171ArgumentOutOfRangeException.ThrowIfEqual(schemeName.Length, 1);
System\UriSyntax.cs (1)
162if (syntax.SchemeName.Length != 0)
System.Private.Windows.Core (14)
System\Private\Windows\Ole\Composition.ManagedToNativeAdapter.cs (7)
328sizeInBytes += (uint)(file.Length + 1) * sizeof(char); 358fileBuffer[file.Length] = '\0'; 359fileBuffer = fileBuffer[(file.Length + 1)..]; 369int byteCount = PInvokeCore.WideCharToMultiByte(PInvokeCore.CP_ACP, 0, value, value.Length, null, 0, null, null); 377PInvokeCore.WideCharToMultiByte(PInvokeCore.CP_ACP, 0, value, value.Length, (PSTR)buffer.Pointer, byteCount, null, null); 387uint byteCount = (uint)value.Length * sizeof(char) + sizeof(char); 399span[value.Length] = '\0';
System\Private\Windows\Ole\DragDropHelper.cs (2)
338if (message.Length >= (int)PInvokeCore.MAX_PATH) 343if (messageReplacementToken.Length >= (int)PInvokeCore.MAX_PATH)
System\Text\ValueStringBuilder.cs (5)
175int count = s.Length; 218if (s.Length == 1 && (uint)pos < (uint)_chars.Length) 233if (pos > _chars.Length - s.Length) 235Grow(s.Length); 239_pos += s.Length;
System.Private.Xml (1058)
src\libraries\Common\src\System\CSharpHelpers.cs (2)
131if (value.Length < 3) 152for (int i = 0; i < value.Length; i++)
src\libraries\Common\src\System\Text\ValueStringBuilder.cs (5)
154int count = s.Length; 196if (s.Length == 1 && (uint)pos < (uint)_chars.Length) // very common case, e.g. appending strings from NumberFormatInfo like separators, percent symbols, etc. 210if (pos > _chars.Length - s.Length) 212Grow(s.Length); 220_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)
140for (int i = 0; i < _localName.Length; i++) 327if (_localName.Length != 0) 334if (_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); 1140RawText(pSrcBegin, pSrcBegin + s.Length); 1316if (text.Length == 0) 1331char* pSrcEnd = pSrcBegin + text.Length; 1465if (text.Length == 0) 1482char* pSrcEnd = pSrcBegin + text.Length; 1858for (int i = 0; i < chars.Length; i++) 1876if (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); 896int leftCount = text.Length; 1115int leftCount = text.Length; 1251int writeLen = RawTextNoFlush(text, 0, text.Length); 1253_RawTextAsync(text, writeLen, text.Length - writeLen) : 1266writeLen = RawTextNoFlush(text1, 0, text1.Length); 1271return _RawTextAsync(text1, writeLen, text1.Length - writeLen, text2, text3, text4); 1277writeLen = RawTextNoFlush(text2, 0, text2.Length); 1282return _RawTextAsync(text2, writeLen, text2.Length - writeLen, text3, text4); 1290writeLen = RawTextNoFlush(text3, 0, text3.Length); 1295return _RawTextAsync(text3, writeLen, text3.Length - writeLen, text4); 1302writeLen = RawTextNoFlush(text4, 0, text4.Length); 1305return _RawTextAsync(text4, writeLen, text4.Length - writeLen); 1513int leftCount = text.Length; 1689if (text.Length == 0) 1700int leftCount = text.Length; 1873if (text.Length == 0) 1884int 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)
336if (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); 4373if (prefixLen == _lastPrefix.Length && chars.AsSpan(startPos).StartsWith(_lastPrefix)) 4513string qname = (prefix.Length == 0) ? defaultAttributeInfo.LocalName : (prefix + ':' + defaultAttributeInfo.LocalName); 4533int prefLen = startTagNode.prefix.Length; 4534int locLen = startTagNode.localName.Length; 4547if (startTagNode.prefix.Length == 0) 4902if (attr.prefix.Length == 0) 4963if (_curNode.prefix.Length == 0) 4978if (at.type == XmlNodeType.Attribute && at.prefix.Length > 0) 5050if (ns.Length == 0) 6185_curNode.lineInfo.linePos += _curNode.localName.Length; 7674if (prefixLen == _lastPrefix.Length && _ps.chars.AsSpan(_ps.charPos).StartsWith(_lastPrefix)) 7795if (uri.Length == 0 && prefix.Length > 0) 7811if (prefix.Length == 0) 8048RegisterConsumedCharacters(entity.Text!.Length, true); 8379if ((endPos - _ps.charPos - 2) == checkName.Length && chars.AsSpan(_ps.charPos + 2).StartsWith(checkName) && 8418if (endPos - _ps.charPos - 1 == _curNode.localName.Length && _ps.chars.AsSpan(_ps.charPos + 1).StartsWith(_curNode.localName) && 8825if (Ref.Equal(_nodes[i].localName, atomizedName) && _nodes[i].prefix.Length == 0) 9192if (defAttrInfo.Prefix.Length > 0) 9243if (prefix.Length == 0 && ns.Length > 0) 9277NodeData attr = AddAttribute(localName, prefix, prefix.Length > 0 ? null : localName); 9289if (attr.prefix.Length == 0) 9299if (_nodes[_index].prefix.Length == 0) 9572Debug.Assert(endPos < str.Length); 9614int len = value.Length;
System\Xml\Core\XmlTextReaderImpl.Unix.cs (1)
14if (url != null && url.Length > 0 && url[0] == '/')
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)
538Debug.Assert(localName.Length > 0); 590sb.Append(_value, valueOffset, _value.Length - valueOffset); 611int copyCount = _value.Length - valueOffset; 631return decoder.Decode(_value, valueOffset, _value.Length - valueOffset); 669if (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)
442else if (prefix.Length > 0) 446if (ns == null || (ns != null && ns.Length == 0)) 456Debug.Assert(prefix.Length == 0); 635if (prefix.Length > 0) 642if (prefix.Length == 0) 646if (namespaceName.Length > 0 && namespaceName != XmlReservedNs.NsXmlNs) 654else if (namespaceName.Length > 0) 669if (namespaceName.Length > 0 && namespaceName != XmlReservedNs.NsXmlNs) 679if (namespaceName.Length > 0 && namespaceName != XmlReservedNs.NsXml) 697if (namespaceName.Length == 0) 712if (prefix.Length != 0) 776if (value.Length == 0) 896if (name.Length == 3 && string.Equals(name, "xml", StringComparison.OrdinalIgnoreCase)) 1305if (prefix.Length != 0) 1687throw DupAttrException((prefix.Length == 0) ? string.Empty : "xmlns", (prefix.Length == 0) ? "xmlns" : prefix); 1836string attr = prefix.Length > 0 ? $"{prefix}:{localName}" : localName; 2031Debug.Assert(ncname != null && ncname.Length > 0); 2034int 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)
208if (endPos < name.Length) 217Debug.Assert((prefix == null) ? (n.Prefix.Length == 0) : (prefix == n.Prefix)); 219Debug.Assert((namespaceURI == null) ? (n.NamespaceURI.Length == 0) : (n.NamespaceURI == namespaceURI)); 226Debug.Assert(n == null || ((prefix == null) ? (n.Prefix.Length == 0) : (prefix == n.Prefix))); 228Debug.Assert(n == null || ((namespaceURI == null) ? (n.NamespaceURI.Length == 0) : (n.NamespaceURI == namespaceURI))); 235Debug.Assert((prefix == null) ? (xmlName.Prefix.Length == 0) : (prefix == xmlName.Prefix)); 237Debug.Assert((namespaceURI == null) ? (xmlName.NamespaceURI.Length == 0) : (xmlName.NamespaceURI == namespaceURI)); 245if ((oPrefix == (object)strXmlns || (xmlName.Prefix.Length == 0 && oLocalName == (object)strXmlns)) ^ (oNamespaceURI == (object)strReservedXmlns)) 615if (prefix == strXmlns || (prefix.Length == 0 && localName == strXmlns)) 1357if (value.Length > 0) 1442if (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)
708else if (!bHasDefXmlnsAttr && attr.Prefix.Length == 0 && attr.LocalName == _doc.strXmlns) 831else 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)) 550if ((xPath == null) || (xPath.Length == 0)) 695if (axis.Prefix.Length != 0) 704else 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)
298if (tns.Length == 0) 333else if (schema.TargetNamespace == null && targetNamespace != null && targetNamespace.Length == 0) 409if (ns.Length == 0) 1744if (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 (10)
460if (prefixValue.Length != 0) 523Uri ruri = _xmlResolver.ResolveUri(_baseUri, uri.Substring(x_schema.Length)); 551return uri.Length >= x_schema.Length && 5520 == string.Compare(uri, 0, x_schema, 0, x_schema.Length, StringComparison.Ordinal) && 676if (gname.Namespace.Length == 0) 764if (s.Length == 0) 1287if (prefix.Length == 0) 1295else if (prefix.Length != 0) 1522ns.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)
845if (schemaUri == null || schemaUri.OriginalString.Length == 0) 875else if (tns.Length == 0) 1115if (_schemas.ContainsKey(currentSchema.SchemaId) || (baseUri != null && baseUri.OriginalString.Length != 0 && _schemaLocations[baseUri] != null)) 1121if (baseUri != null && baseUri.OriginalString.Length != 0) 1243if (_schemas.ContainsKey(schema.SchemaId) && (targetNamespace.Length == 0 || targetNamespace == schema.TargetNamespace)) 1259else if (targetNamespace.Length != 0 && targetNamespace != schema.TargetNamespace) 1280if (schemaUri == null || schemaUri.OriginalString.Length == 0) 1315if (reprocessList[i].BaseUri != null && reprocessList[i].BaseUri!.OriginalString.Length != 0) 1383if (qname.Name.Length == 0)
System\Xml\Schema\XmlSchemaValidator.cs (11)
538&& attQName.Namespace.Length != 0 1037if (attributeNS.Length > 0) 1424if (stringValue.Length == 0 && currentElementDecl.DefaultValueTyped != null) 1507if (typeName.Length == 0) 1823if (elementValue.Length == 0) 2146if (defaultPrefix.Length != 0) 2362if (typedValue != null && stringValue.Length != 0) 2683if (name.Namespace.Length != 0) 2723if (name.Namespace.Length != 0) 2758return (ns.Length != 0) ? $"{ns}:{localName}" : localName; 2768if (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; 718_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)
199else if (assemblyAttribute.CodeBase != null && assemblyAttribute.CodeBase.Length > 0) 565if (encodingStyle != null && encodingStyle.Length > 0)
System\Xml\Serialization\Mappings.cs (3)
119if (colon == 0 || colon == name.Length - 1) 244Name = Name.Substring("xml:".Length); 1140if (s.TargetNamespace != null && s.TargetNamespace.Length > 0)
System\Xml\Serialization\ReflectionXmlSerializationReader.cs (3)
203if (mapping.Elements[j].Any && mapping.Elements[j].Name.Length == 0) 828if (element.Any && element.Name.Length == 0) 1935xmlnsMember.XmlnsSource(Reader.Name.Length == 5 ? string.Empty : Reader.LocalName, Reader.Value);
System\Xml\Serialization\ReflectionXmlSerializationWriter.cs (5)
212if (element.Name != null && element.Name.Length > 0) 308if (element.Any && element.Name.Length == 0) 339if (element.Any && element.Name.Length == 0) 394string? ns = element.Any && element.Name.Length == 0 ? null : (element.Form == XmlSchemaForm.Qualified ? (writeAccessor ? element.Namespace : element.Mapping!.Namespace) : string.Empty); 1130if (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)
442if (value.Length == 0) 463else 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) 965if (typeDesc.IsPrimitive && typeDesc.DataType != null && typeDesc.DataType.Name != null && typeDesc.DataType.Name.Length > 0) 974if (a.XmlType != null && a.XmlType.TypeName.Length > 0) 1167if (dataType.Length > 0) 1356if (structAttrs.XmlRoot.ElementName.Length > 0) 1371if (xmlElement.ElementName.Length == 0) 1521arrayItemElement.Name = xmlArrayItem.ElementName.Length == 0 ? arrayItemElement.Mapping.DefaultElementName : XmlConvert.EncodeLocalName(xmlArrayItem.ElementName); 1604attribute.Name = Accessor.EscapeQName(a.XmlAttribute.AttributeName.Length == 0 ? accessorName : a.XmlAttribute.AttributeName); 1655element.Name = XmlConvert.EncodeLocalName(xmlElement.ElementName.Length == 0 ? accessorName : xmlElement.ElementName); 1660element.Name = xmlElement.ElementName.Length == 0 ? element.Mapping.DefaultElementName : XmlConvert.EncodeLocalName(xmlElement.ElementName); 1691string anyName = xmlAnyElement.Name.Length == 0 ? xmlAnyElement.Name : XmlConvert.EncodeLocalName(xmlAnyElement.Name); 1710if (element.Name.Length > 0) 1746arrayElement.Name = XmlConvert.EncodeLocalName(a.XmlArray.ElementName.Length == 0 ? accessorName : a.XmlArray.ElementName); 1783attribute.Name = Accessor.EscapeQName(a.XmlAttribute.AttributeName.Length == 0 ? accessorName : a.XmlAttribute.AttributeName); 1827element.Name = XmlConvert.EncodeLocalName(xmlElement.ElementName.Length == 0 ? accessorName : xmlElement.ElementName); 1897element.Name = XmlConvert.EncodeLocalName(xmlElement.ElementName.Length == 0 ? accessorName : xmlElement.ElementName); 1901element.Name = xmlElement.ElementName.Length == 0 ? element.Mapping.DefaultElementName : XmlConvert.EncodeLocalName(xmlElement.ElementName); 1933string anyName = xmlAnyElement.Name.Length == 0 ? xmlAnyElement.Name : XmlConvert.EncodeLocalName(xmlAnyElement.Name); 1953if (element.Name.Length > 0) 2001if (element.Any && element.Name.Length == 0) 2004if (xmlName.Substring(0, xmlName.Length - 1) == anyNs) 2028if (element.Any && element.Name.Length == 0) 2035string id = element.Namespace != null && element.Namespace.Length > 0 ? $"{element.Namespace}:{element.Name}" : element.Name; 2310if (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) 449if (serializableMapping.NamespaceList.Length > 0) 803if (accessor.Any && accessor.Name.Length == 0) 808if (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)
784if (name.Length == 5) return true; 970if (value.Length == 0) 975int charsLength = value.Length; 1040if (itemType != null && itemType.Length > 0) 1046if (arraySize != null && arraySize.Length > 0) 1055if (dimensions[i].Length > 0) 1589if (arrayInfo.qname.Length > 0) 1691if (_r.NamespaceURI.Length != 0) 2545if (mapping.Elements[j].Any && mapping.Elements[j].Name.Length == 0) 3540if (member.Mapping.CheckSpecified == SpecifiedAccessor.ReadWrite && member.CheckSpecifiedSource != null && member.CheckSpecifiedSource.Length > 0) 3646if (name != null && name.Length > 0) 3850if (member.Mapping.CheckSpecified == SpecifiedAccessor.ReadWrite && member.CheckSpecifiedSource != null && member.CheckSpecifiedSource.Length > 0) 4008bool checkType = (checkTypeHrefsSource != null && checkTypeHrefsSource.Length > 0); 4159if (element.Any && element.Name.Length == 0) 4183bool checkType = checkTypeSource != null && checkTypeSource.Length > 0; 4620if (checkSpecified != null && checkSpecified.Length > 0)
System\Xml\Serialization\XmlSerializationReaderILGen.cs (4)
472if (mapping.Elements[j].Any && mapping.Elements[j].Name.Length == 0) 2111if (member.Mapping.CheckSpecified == SpecifiedAccessor.ReadWrite && member.CheckSpecifiedSource != null && member.CheckSpecifiedSource.Length > 0) 2427if (element.Any && element.Name.Length == 0) 2965if (checkSpecified != null && checkSpecified.Length > 0)
System\Xml\Serialization\XmlSerializationWriter.cs (20)
452else if (prefix.Length == 0) 520if (writePrefixed && prefix == null && ns != null && ns.Length > 0) 541if (alias.Length == 0 && string.IsNullOrEmpty(aliasNs)) 545if (alias.Length > 0) 554if (prefix == null && alias.Length == 0) 567int prefixLength = prefix.Length; 571if (qname.Name.Length > prefixLength) 574if (name.Length > prefixLength && name.Length <= prefixLength + MaxInt32.Length && name.StartsWith(prefix, StringComparison.Ordinal)) 577for (int j = prefixLength; j < name.Length; j++) 795if (node is XmlElement && name != null && name.Length > 0) 1255if (_soap12 && name != null && name.Length > 0) 1396WriteStartElement(name.Length == 0 ? entry.typeName! : name!, ns ?? entry.typeNs, null, true); 2008if (cast != null && cast.Length > 0) 3675if (element.Name != null && element.Name.Length > 0) 3913string? ns = element.Any && element.Name.Length == 0 ? null : (element.Form == XmlSchemaForm.Qualified ? (writeAccessor ? element.Namespace : element.Mapping!.Namespace) : ""); 4199if (value is string && ((string)value).Length == 0) 4453if (element.Any && element.Name.Length == 0) 4483if (element.Any && element.Name.Length == 0)
System\Xml\Serialization\XmlSerializationWriterILGen.cs (8)
1597if (element.Name != null && element.Name.Length > 0) 1899string? ns = element.Any && element.Name.Length == 0 ? null : (element.Form == XmlSchemaForm.Qualified ? (writeAccessor ? element.Namespace : element.Mapping!.Namespace) : ""); 2082if (value is string && ((string)value).Length == 0) 2248if (element.Any && element.Name.Length == 0) 2274if (element.Any && element.Name.Length == 0) 2588for (i = 0; i < value.Length; i++) 2597if (i == value.Length) 2608for (; i < value.Length; i++)
System\Xml\Serialization\XmlSerializer.cs (2)
391if (encodingStyle != null && encodingStyle.Length > 0) 491if (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 (11)
134return s1.Length >= s2.Length && string.CompareOrdinal(s1, 0, s2, 0, s2.Length) == 0; 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)
1067if (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)
223if (prefix.Length == 5 && prefix == "xmlns") 237if (ns.Length != 0 && _depth != 0) 542Debug.Assert(prefix.Length == 0 || ns.Length != 0); 554if (ns.Length == 0 && prefix.Length == 0) 726throw new XslTransformException(SR.XmlIl_NmspConflict, new string[] { prefix.Length == 0 ? "" : ":", prefix, ns, nsExisting }); 1222if (navigator.NamespaceURI.Length == 0) 1224Debug.Assert(navigator.LocalName.Length != 0, "xmlns:foo='' isn't allowed"); 1351Debug.Assert(prefix.Length != 0 && ns.Length != 0); 1414if (isElemPrefix || genPrefix.Length != 0) 1423if (isElemPrefix || genPrefix.Length != 0) 1505Debug.Assert(ValidateNames.ParseNCName(name.Name, 0) == name.Name.Length); 1508prefix = (name.Namespace.Length != 0) ? RemapPrefix(string.Empty, name.Namespace, nodeType == XPathNodeType.Element) : string.Empty; 1527prefix = (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 (8)
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); 339char separator = (groupSeparator.Length > 0) ? groupSeparator[0] : ' ';
System\Xml\Xsl\Runtime\XsltConvert.cs (1)
39return item.Value.Length != 0;
System\Xml\Xsl\Runtime\XsltFunctions.cs (27)
31return s1.Length >= s2.Length && string.CompareOrdinal(s1, 0, s2, 0, s2.Length) == 0; 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] == '-'); 379return dt.ToString(format.Length != 0 ? format : null, new CultureInfo(locale)); 392for (int idx = 0; idx < options.Length; idx++) 484if (len != name.Length) 503if (len != name.Length) 532if (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)
919if (prefix.Length != 0) 953if (name == "xmlns" || local == "xmlns" && nsUri.Length == 0) 983Debug.Assert(pos < source.Length); 987for (i = pos; i < source.Length; i++) 993if (i + 1 < source.Length && source[i + 1] == ch) 1008pos = source.Length; 1019Debug.Assert(i == source.Length || source[i] == '{'); 1036while (pos < source.Length) 1043if (pos < source.Length) 2042if (value.Length != 1) 2334XPathCompileException e = new XPathCompileException(expr, 0, expr.Length, SR.XPath_NodeSetExpected, null); 2364pos = expr.Length; 2499if (ignoreDefaultNs && recPrefix.Length == 0) 2683string attMode = (mode.LocalName.Length == 0) ? string.Empty : $" mode=\"{mode.QualifiedName}\""; 2762if (ignoreDefaultNs && prefix.Length == 0) 2771if (prefix.Length == 0)
System\Xml\Xsl\Xslt\QilGeneratorEnv.cs (5)
104if (prefix.Length == 0) 260if (ignoreDefaultNs && prefix.Length == 0) 269if (prefix.Length != 0) 322if (nsUri.Length == 0) 708if (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) 1279for (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) 2754if (ignoreDefaultNs && prefix.Length == 0) 2865else if (prefix.Length == 0) 2936if (_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 (57)
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) 911e.AppendAttributeSkipNotify(new XAttribute(_aCache.Get(r.Prefix.Length == 0 ? string.Empty : r.NamespaceURI).GetName(r.LocalName), r.Value)); 966_aCache.Get(r.Prefix.Length == 0 ? string.Empty : r.NamespaceURI).GetName(r.LocalName), 1033XAttribute a = new XAttribute(_aCache.Get(r.Prefix.Length == 0 ? string.Empty : r.NamespaceURI).GetName(r.LocalName), r.Value); 1148_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 (3)
280hashCode = ComputeHashCode(key, 0, key.Length); 299while (!FindEntry(hashCode, key, 0, key.Length, ref entryIndex)) 374if (count == keyCompare.Length && string.CompareOrdinal(key, index, keyCompare, 0, count) == 0)
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 (8)
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"); 254if (count == xmlPrefixNamespace.Length && string.CompareOrdinal(namespaceName, index, xmlPrefixNamespace, 0, count) == 0) return Xml; 255if (count == xmlnsPrefixNamespace.Length && string.CompareOrdinal(namespaceName, index, xmlnsPrefixNamespace, 0, count) == 0) return Xmlns;
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)
204if (name.Length > 4)
System\Reflection\Context\Virtual\VirtualPropertyBase.cs (1)
22if (name.Length == 0)
System.Reflection.Emit (2)
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 (59)
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\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\libraries\Common\src\System\Text\ValueStringBuilder.cs (5)
154int count = s.Length; 196if (s.Length == 1 && (uint)pos < (uint)_chars.Length) // very common case, e.g. appending strings from NumberFormatInfo like separators, percent symbols, etc. 210if (pos > _chars.Length - s.Length) 212Grow(s.Length); 220_pos += s.Length;
System\Reflection\Internal\Utilities\BlobUtilities.cs (1)
203return GetUTF8ByteCount(ptr, str.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)
1030WriteUTF8(value, 0, value.Length, allowUnpairedSurrogates: true, prependSize: true); 1051WriteCompressedInteger(BlobUtilities.GetUserStringByteLength(value.Length)); 1072WriteUTF8(value, 0, value.Length, allowUnpairedSurrogates, prependSize: false); 1079Debug.Assert(start + length <= str.Length);
System\Reflection\Metadata\BlobWriter.cs (3)
427WriteUTF8(str, 0, str.Length, allowUnpairedSurrogates: true, prependSize: true); 448WriteCompressedInteger(BlobUtilities.GetUserStringByteLength(value.Length)); 464WriteUTF8(value, 0, value.Length, allowUnpairedSurrogates, prependSize: false);
System\Reflection\Metadata\Ecma335\Encoding\BlobEncoders.cs (3)
617if (serializedTypeName != null && serializedTypeName.Length == 0) 683if (name.Length == 0) Throw.ArgumentEmptyString(nameof(name)); 881if (enumTypeName.Length == 0) Throw.ArgumentEmptyString(nameof(enumTypeName));
System\Reflection\Metadata\Ecma335\MetadataBuilder.cs (1)
112for (uint i = 8 + (uint)streamName.Length; i < sizeOfStreamHeader; i++)
System\Reflection\Metadata\Ecma335\MetadataBuilder.Heaps.cs (7)
337partBuilder.WriteUTF8(value, i, (next >= 0 ? next : value.Length) - i, allowUnpairedSurrogates: true, prependSize: false); 345if (next == value.Length - 1) 449if (value.Length == 0) 589for (int i = x.Length - 1, j = y.Length - 1; i >= 0 & j >= 0; i--, j--) 602return y.Length.CompareTo(x.Length);
System\Reflection\Metadata\Ecma335\MetadataRootBuilder.cs (2)
61Debug.Assert(BlobUtilities.GetUTF8ByteCount(DefaultMetadataVersionString) == DefaultMetadataVersionString.Length); 62int metadataVersionByteCount = metadataVersion != null ? BlobUtilities.GetUTF8ByteCount(metadataVersion) : DefaultMetadataVersionString.Length;
System\Reflection\Metadata\Ecma335\MetadataSizes.cs (1)
392BitArithmetic.Align(streamName.Length + 1, 4); // zero-terminated name, padding
System\Reflection\Metadata\Ecma335\PortablePdbBuilder.cs (2)
63Debug.Assert(BlobUtilities.GetUTF8ByteCount(MetadataVersion) == MetadataVersion.Length); 64_serializedMetadata = tablesAndHeaps.GetSerializedMetadata(typeSystemRowCounts, MetadataVersion.Length, isStandaloneDebugMetadata: true);
System\Reflection\Metadata\Internal\BlobHeap.cs (2)
233if (otherIndex == other.Length || !StringUtils.IsEqualAscii(other[otherIndex], separator, ignoreCaseMask)) 260return otherIndex == other.Length;
System\Reflection\Metadata\Internal\NamespaceCache.cs (1)
261if (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)
113sb.EnsureCapacity(name.Length); 116for (int i = indexOfEscapeCharacter; i < name.Length;) 120if (c != EscapeCharacter || i == name.Length)
System\Reflection\Metadata\TypeSystem\TypeDefinition.cs (1)
271TypeDefTreatment.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)
360for (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) 64if (name.Length == 0)
System\Reflection\TypeLoading\General\Helpers.cs (4)
108StringBuilder sbEscapedName = new StringBuilder(identifier.Length); 143StringBuilder sbUnescapedName = new StringBuilder(identifier.Length); 144for (int i = 0; i < identifier.Length; i++) 235return 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\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 (7)
System\Runtime\Caching\FileChangeNotificationSystem.cs (3)
48if (s2.Length != s1.Length) 52return 0 == string.Compare(s1, 0, s2, 0, s2.Length, StringComparison.OrdinalIgnoreCase);
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.Numerics (9)
src\libraries\Common\src\System\Number.Formatting.Common.cs (1)
473if (info.NumberGroupSeparator.Length > 0)
src\libraries\Common\src\System\Text\ValueStringBuilder.cs (5)
154int count = s.Length; 196if (s.Length == 1 && (uint)pos < (uint)_chars.Length) // very common case, e.g. appending strings from NumberFormatInfo like separators, percent symbols, etc. 210if (pos > _chars.Length - s.Length) 212Grow(s.Length); 220_pos += s.Length;
System\Number.BigInteger.cs (2)
749Debug.Assert(formatString == null || formatString.Length == formatSpan.Length); 831int strLength = strDigits + (sNegative?.Length ?? 0);
System\Number.Polyfill.cs (1)
66return 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) 451contractCodeDomInfo.TypeReference = new CodeTypeReference((clrNamespace == null || clrNamespace.Length == 0) ? typeName : clrNamespace + "." + typeName); 1120string expectedName = (nestedTypeIndex <= 0 || nestedTypeIndex == dataContractName.Length - 1) ? dataContractName : dataContractName.Substring(nestedTypeIndex + 1); 1412if (identifier.Length <= MaxIdentifierLength && CodeGenerator.IsValidLanguageIndependentIdentifier(identifier)) 1417for (int i = 0; i < identifier.Length && builder.Length < MaxIdentifierLength; i++) 1441int availableLength = MaxIdentifierLength - identifier.Length; 1442int requiredLength = appendString.Length; 1469uniqueNamespace = ((clrNamespace.Length == 0) ? ImportGlobals.DefaultClrNamespace : clrNamespace) + i.ToString(NumberFormatInfo.InvariantInfo); 1526AddToNamespace(builder, uriString.Substring(ImportGlobals.DataContractXsdBaseNamespace.Length), fragments); 1558for (int i = 0; i < fragment.Length && builder.Length < MaxIdentifierLength; i++)
System\Runtime\Serialization\Schema\SchemaImportHelper.cs (3)
73return uriString.StartsWith(ImportGlobals.DataContractXsdBaseNamespace, StringComparison.Ordinal) ? uriString.Substring(ImportGlobals.DataContractXsdBaseNamespace.Length) : uriString; 100if (localName.Length == 0) 104for (int i = 1; i < localName.Length; i++)
System.Security.Cryptography.Pkcs (5)
Internal\Cryptography\PkcsHelpers.cs (2)
286Debug.Assert((normalizedString.Length & 0x1) == 0); 288byte[] ba = new byte[normalizedString.Length / 2];
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\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)
203if (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)
819if (string.IsNullOrEmpty(reference.Uri) || (reference.Uri.Length > 0 && reference.Uri[0] != '#')) 824if (reference.Uri.Length > 0 && reference.Uri[0] == '#')
System\Security\Cryptography\Xml\Transform.cs (1)
214string 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; 402else if (prefix.Length > 0) 464string name = ((attrib.Prefix.Length > 0) ? attrib.Prefix + ":" + attrib.LocalName : attrib.LocalName); 466if (elem.HasAttribute(name) || (name.Equals("xmlns") && elem.Prefix.Length == 0)) continue; 511string name = ((ancestorElement.Prefix.Length > 0) ? "xmlns:" + ancestorElement.Prefix : "xmlns"); 537if (attrib.NamespaceURI.Length > 0) 544string name = ((attrib.Prefix.Length > 0) ? "xmlns:" + attrib.Prefix : "xmlns"); 726uint 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.ServiceModel.Federation (1)
System\ServiceModel\Security\SecurityUtils.cs (1)
45return addressingVersionString.Substring(pos + 1, addressingVersionString.Length - pos - 2);
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.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)
486if (prefix.Length == 0)
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)
112Debug.Assert(encodingNameIndices[encodingNameIndices.Length - 1] == EncodingNames.Length); 157int count = s1.Length; 168return s1.Length - length; 186Debug.Assert(indices[indices.Length - 1] == names.Length);
System.Text.Encodings.Web (11)
src\libraries\Common\src\System\Text\ValueStringBuilder.cs (5)
154int count = s.Length; 196if (s.Length == 1 && (uint)pos < (uint)_chars.Length) // very common case, e.g. appending strings from NumberFormatInfo like separators, percent symbols, etc. 210if (pos > _chars.Length - s.Length) 212Grow(s.Length); 220_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 (12)
src\libraries\Common\src\System\Text\ValueStringBuilder.cs (5)
154int count = s.Length; 196if (s.Length == 1 && (uint)pos < (uint)_chars.Length) // very common case, e.g. appending strings from NumberFormatInfo like separators, percent symbols, etc. 210if (pos > _chars.Length - s.Length) 212Grow(s.Length); 220_pos += s.Length;
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\Serialization\Converters\Value\EnumConverter.cs (1)
568if (string.IsNullOrEmpty(name) || char.IsWhiteSpace(name[0]) || char.IsWhiteSpace(name[name.Length - 1]) ||
System\Text\Json\ThrowHelper.Serialization.cs (2)
619if (message.Length > 0) 647if (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 (3)
JsonSourceGenerator.Parser.cs (1)
1652capacity: EncodedPropName.Length + utf8Json.Length * 2);
src\libraries\Common\src\Roslyn\GetBestTypeByMetadataName.cs (2)
157return name.Length > AttributeSuffix.Length && name.EndsWith(AttributeSuffix, comparison);
System.Text.RegularExpressions (173)
src\libraries\Common\src\System\Text\ValueStringBuilder.cs (5)
154int count = s.Length; 196if (s.Length == 1 && (uint)pos < (uint)_chars.Length) // very common case, e.g. appending strings from NumberFormatInfo like separators, percent symbols, etc. 210if (pos > _chars.Length - s.Length) 212Grow(s.Length); 220_pos += s.Length;
System\Text\RegularExpressions\Capture.cs (1)
43internal ReadOnlyMemory<char> GetRightSubstring() => Text is string text ? text.AsMemory(Index + Length, Text.Length - Index - Length) : ReadOnlyMemory<char>.Empty;
System\Text\RegularExpressions\MatchCollection.cs (2)
27if ((uint)startat > (uint)input.Length) 92match = _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)
249string fullname = regexinfos[i].Namespace.Length == 0 ? 415if ((uint)startat > (uint)input.Length) 419if ((uint)length > (uint)input.Length)
System\Text\RegularExpressions\Regex.Match.cs (7)
80return RunSingleMatch(RegexRunnerMode.ExistenceRequired, -1, input, 0, input.Length, RightToLeft ? input.Length : 0) is null; 94return RunSingleMatch(RegexRunnerMode.ExistenceRequired, -1, input, 0, input.Length, startat) is null; 145return RunSingleMatch(RegexRunnerMode.FullMatchRequired, -1, input, 0, input.Length, RightToLeft ? input.Length : 0)!; 159return RunSingleMatch(RegexRunnerMode.FullMatchRequired, -1, input, 0, input.Length, startat)!; 200return new MatchCollection(this, input, RightToLeft ? input.Length : 0);
System\Text\RegularExpressions\Regex.Replace.cs (7)
45return Replace(input, replacement, -1, RightToLeft ? input.Length : 0); 60return Replace(input, replacement, count, RightToLeft ? input.Length : 0); 114return Replace(evaluator, this, input, -1, RightToLeft ? input.Length : 0); 128return Replace(evaluator, this, input, count, RightToLeft ? input.Length : 0); 165if ((uint)startat > (uint)input.Length) 192state.segments.Add(input.AsMemory(state.prevat, input.Length - state.prevat)); 196state.prevat = input.Length;
System\Text\RegularExpressions\Regex.Split.cs (4)
38return Split(this, input, 0, RightToLeft ? input.Length : 0); 52return Split(this, input, count, RightToLeft ? input.Length : 0); 78if ((uint)startat > (uint)input.Length) 119state.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)
452for (int i = 0; i < category.Length; i++) 558bool startsWithNulls = set.Length >= 2 && set[0] == '\0' && set[1] == '\0'; 559int strLength = SetStartIndex + set.Length + category.Length; 578span[SetLengthIndex] = (char)(state.set.Length - 2); 579span[CategoryLengthIndex] = (char)state.category.Length; 581index = SetStartIndex + state.set.Length - 2; 586span[SetLengthIndex] = (char)state.set.Length; 587span[CategoryLengthIndex] = (char)state.category.Length; 589index = SetStartIndex + state.set.Length; 764set.Length == SetStartIndex + set[SetLengthIndex]) // and no subtraction 795set.Length == SetStartIndex + set[SetLengthIndex]) // and no subtraction 1087set.Length > SetStartIndex && 1177charClass.Length > SetStartIndex + 1341if (inClass && set.Length > endPosition) 1495if (charClass.Length > endPosition) 1879temp.RemoveAll(kvp => kvp.Value.Length != 1); 1898endPosition >= set.Length && // no subtraction 1946endPosition >= set.Length && // no subtraction 2020if (set.Length > endPosition)
System\Text\RegularExpressions\RegexCompiler.cs (10)
833Ldc(prefix.Length); 1448int length = node.Kind == RegexNodeKind.Multi ? node.Str!.Length : 1; 2927sliceStaticPos += caseInsensitiveString.Length; 3225Debug.Assert(str.Length >= 2); 3234Ldc(str.Length); 3240for (int i = str.Length - 1; i >= 0; i--) 3265sliceStaticPos += str.Length; 3625switch ((overlap, literal.SetChars.Length)) 5130literalLength = node.Str!.Length; 5372Ldc((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)
293Debug.Assert(node.Str.Length >= 2, $"Expected {node.Str} to be at least two characters"); 1281Debug.Assert(startingNode.Str!.Length > 0); 1283int minLength = Math.Min(startingSpan.Length, startingNode.Str.Length); 1336if (node.Str!.Length == startingSpan.Length) 1341else if (node.Str.Length - 1 == startingSpan.Length) 1344node.Ch = node.Str[node.Str.Length - 1]; 1717while (matchingCharsInMulti < nextNode.Str.Length && currentNode.Ch == nextNode.Str[matchingCharsInMulti]) 1732if (nextNode.Str.Length == matchingCharsInMulti) 1740Debug.Assert(matchingCharsInMulti < nextNode.Str.Length); 1741if (nextNode.Str.Length - matchingCharsInMulti == 1) 1744nextNode.Ch = nextNode.Str[nextNode.Str.Length - 1]; 2274return Str!.Length; 2387return Str!.Length;
System\Text\RegularExpressions\RegexParser.cs (76)
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) 427if (_pos == _pattern.Length || !(isQuantifier = IsTrueQuantifier())) 461if (_pos < _pattern.Length && _pattern[_pos] == ',') 464max = _pos == _pattern.Length || _pattern[_pos] == '}' ? int.MaxValue : ScanDecimal(); 468if (startpos == _pos || _pos == _pattern.Length || _pattern[_pos++] != '}') 486if (_pos < _pattern.Length && _pattern[_pos] == '?') 523while (_pos < _pattern.Length) 530_pos = _pattern.Length; 535if (_pos < _pattern.Length) 557if (_pos < _pattern.Length && _pattern[_pos] == '^') 570for (; _pos < _pattern.Length; firstChar = false) 582else if (ch == '\\' && _pos < _pattern.Length) 682if (_pos < _pattern.Length && _pattern[_pos] != ']') 698else if (_pos + 1 < _pattern.Length && _pattern[_pos] == '-' && _pattern[_pos + 1] != ']') 705else if (_pos < _pattern.Length && ch == '-' && !translatedChar && _pattern[_pos] == '[' && !firstChar) 715if (_pos < _pattern.Length && _pattern[_pos] != ']') 754if (_pos == _pattern.Length || _pattern[_pos] != '?' || (_pos + 1 < _pattern.Length && _pattern[_pos + 1] == ')')) 771if (_pos == _pattern.Length) 808if (_pos == _pattern.Length) 855if (_pos < _pattern.Length && !(_pattern[_pos] == close || _pattern[_pos] == '-')) 875if (_pos < _pattern.Length && !(_pattern[_pos] == close || _pattern[_pos] == '-')) 892if ((capnum != -1 || proceed) && _pos + 1 < _pattern.Length && _pattern[_pos] == '-') 907if (_pos < _pattern.Length && _pattern[_pos] != close) 921if (_pos < _pattern.Length && _pattern[_pos] != close) 935if ((capnum != -1 || uncapnum != -1) && _pos < _pattern.Length && _pattern[_pos++] == close) 947if (_pos < _pattern.Length) 955if (_pos < _pattern.Length && _pattern[_pos++] == ')') 971if (_capnames?[capname] is int tmpCapnum && _pos < _pattern.Length && _pattern[_pos++] == ')') 982if (_pos + 2 < _pattern.Length && _pattern[_pos + 1] == '?') 991if (_pattern[_pos + 2] == '\'' || (_pos + 3 < _pattern.Length && _pattern[_pos + 2] == '<' && _pattern[_pos + 3] != '!' && _pattern[_pos + 3] != '=')) 1009if (_pos == _pattern.Length) 1043while (_pos < _pattern.Length && IsSpace(_pattern[_pos])) 1049if ((_options & RegexOptions.IgnorePatternWhitespace) != 0 && _pos < _pattern.Length && _pattern[_pos] == '#') 1054_pos = _pattern.Length; 1057else if (_pos + 2 < _pattern.Length && _pattern[_pos + 2] == '#' && _pattern[_pos + 1] == '?' && _pattern[_pos] == '(') 1062_pos = _pattern.Length; 1078Debug.Assert(_pos < _pattern.Length, "The current reading position must not be at the end of the pattern"); 1153Debug.Assert(_pos < _pattern.Length, "The current reading position must not be at the end of the pattern"); 1164if (_pos + 1 < _pattern.Length) 1175if (!angled || _pos == _pattern.Length) 1185else if ((ch == '<' || ch == '\'') && _pos + 1 < _pattern.Length) 1199if (_pos < _pattern.Length && _pattern[_pos++] == close) 1225if (_pos == _pattern.Length || (ch = _pattern[_pos]) < '0' || ch > '9') 1265if (_pos < _pattern.Length && _pattern[_pos++] == close) 1287if (_pos == _pattern.Length) 1299if (ch == '{' && _pos + 1 < _pattern.Length) 1325while (_pos < _pattern.Length && (ch = _pattern[_pos]) >= '0' && ch <= '9') 1351if (!angled || _pos < _pattern.Length && _pattern[_pos++] == '}') 1363if (_pos < _pattern.Length && _pattern[_pos++] == '}') 1420while (_pos < _pattern.Length) 1436int c = Math.Min(3, _pattern.Length - _pos); 1462while (_pos < _pattern.Length && (uint)(d = (char)(_pattern[_pos] - '0')) <= 9) 1482if (_pos + c <= _pattern.Length) 1508if (_pos == _pattern.Length) 1533for (bool off = false; _pos < _pattern.Length; _pos++) 1620if (_pos + 2 >= _pattern.Length) 1632while (_pos < _pattern.Length) 1644if (_pos == _pattern.Length || _pattern[_pos++] != '}') 1674while (_pos < _pattern.Length) 1681if (_pos < _pattern.Length) 1707if (_pos + 1 < _pattern.Length && _pattern[_pos + 1] == '#' && _pattern[_pos] == '?') 1716if (_pos < _pattern.Length && _pattern[_pos] == '?') 1721if (_pos + 1 < _pattern.Length && (_pattern[_pos] == '<' || _pattern[_pos] == '\'')) 1748if (_pos < _pattern.Length) 1976Debug.Assert(_pos < _pattern.Length, "The current reading position must not be at the end of the pattern"); 1986int nChars = _pattern.Length - _pos;
System\Text\RegularExpressions\RegexPrefixAnalyzer.cs (6)
625for (; i < s.Length && results.Count < MaxFixedResults; i++) 630return i == s.Length; 995cc.AddChar(node.Str![(node.Options & RegexOptions.RightToLeft) != 0 ? node.Str.Length - 1 : 0]); 1154if (FindPrefix(nextChild) is { Length: >= 1 } prefix) 1161prefix.Length == 1 ? (firstChild, (prefix[0], null, StringComparison.Ordinal, null)) : 1168if (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 (141)
RegexGenerator.Emitter.cs (11)
659writer.WriteLine($"int end = base.runtextpos = start {(!rtl ? "+" : "-")} {(root.Kind == RegexNodeKind.Multi ? root.Str!.Length : 1)};"); 1129writer.WriteLine($"base.runtextpos = pos + {prefix.Length};"); 1890return multi.Str!.Length == 2 ? 3047sliceStaticPos += caseInsensitiveString.Length; 3276Debug.Assert(str.Length >= 2); 3282using (EmitBlock(writer, $"if ((uint)(pos - {str.Length}) >= inputSpan.Length)")) 3288using (EmitBlock(writer, $"for (int i = 0; i < {str.Length}; i++)")) 3290using (EmitBlock(writer, $"if (inputSpan[--pos] != {Literal(str)}[{str.Length - 1} - i])")) 3313sliceStaticPos += str.Length; 3583writer.WriteLine((overlap, literal.SetChars.Length) switch 4943literalLength = node.Str!.Length;
src\libraries\Common\src\Roslyn\GetBestTypeByMetadataName.cs (2)
157return name.Length > AttributeSuffix.Length && name.EndsWith(AttributeSuffix, comparison);
src\libraries\Common\src\System\Text\ValueStringBuilder.cs (5)
154int count = s.Length; 196if (s.Length == 1 && (uint)pos < (uint)_chars.Length) // very common case, e.g. appending strings from NumberFormatInfo like separators, percent symbols, etc. 210if (pos > _chars.Length - s.Length) 212Grow(s.Length); 220_pos += s.Length;
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\libraries\System.Text.RegularExpressions\src\System\Text\RegularExpressions\RegexCharClass.cs (20)
452for (int i = 0; i < category.Length; i++) 558bool startsWithNulls = set.Length >= 2 && set[0] == '\0' && set[1] == '\0'; 559int strLength = SetStartIndex + set.Length + category.Length; 578span[SetLengthIndex] = (char)(state.set.Length - 2); 579span[CategoryLengthIndex] = (char)state.category.Length; 581index = SetStartIndex + state.set.Length - 2; 586span[SetLengthIndex] = (char)state.set.Length; 587span[CategoryLengthIndex] = (char)state.category.Length; 589index = SetStartIndex + state.set.Length; 764set.Length == SetStartIndex + set[SetLengthIndex]) // and no subtraction 795set.Length == SetStartIndex + set[SetLengthIndex]) // and no subtraction 1087set.Length > SetStartIndex && 1177charClass.Length > SetStartIndex + 1341if (inClass && set.Length > endPosition) 1495if (charClass.Length > endPosition) 1879temp.RemoveAll(kvp => kvp.Value.Length != 1); 1898endPosition >= set.Length && // no subtraction 1946endPosition >= set.Length && // no subtraction 2020if (set.Length > endPosition)
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\libraries\System.Text.RegularExpressions\src\System\Text\RegularExpressions\RegexNode.cs (13)
293Debug.Assert(node.Str.Length >= 2, $"Expected {node.Str} to be at least two characters"); 1281Debug.Assert(startingNode.Str!.Length > 0); 1283int minLength = Math.Min(startingSpan.Length, startingNode.Str.Length); 1336if (node.Str!.Length == startingSpan.Length) 1341else if (node.Str.Length - 1 == startingSpan.Length) 1344node.Ch = node.Str[node.Str.Length - 1]; 1717while (matchingCharsInMulti < nextNode.Str.Length && currentNode.Ch == nextNode.Str[matchingCharsInMulti]) 1732if (nextNode.Str.Length == matchingCharsInMulti) 1740Debug.Assert(matchingCharsInMulti < nextNode.Str.Length); 1741if (nextNode.Str.Length - matchingCharsInMulti == 1) 1744nextNode.Ch = nextNode.Str[nextNode.Str.Length - 1]; 2274return Str!.Length; 2387return Str!.Length;
src\libraries\System.Text.RegularExpressions\src\System\Text\RegularExpressions\RegexParser.cs (76)
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) 427if (_pos == _pattern.Length || !(isQuantifier = IsTrueQuantifier())) 461if (_pos < _pattern.Length && _pattern[_pos] == ',') 464max = _pos == _pattern.Length || _pattern[_pos] == '}' ? int.MaxValue : ScanDecimal(); 468if (startpos == _pos || _pos == _pattern.Length || _pattern[_pos++] != '}') 486if (_pos < _pattern.Length && _pattern[_pos] == '?') 523while (_pos < _pattern.Length) 530_pos = _pattern.Length; 535if (_pos < _pattern.Length) 557if (_pos < _pattern.Length && _pattern[_pos] == '^') 570for (; _pos < _pattern.Length; firstChar = false) 582else if (ch == '\\' && _pos < _pattern.Length) 682if (_pos < _pattern.Length && _pattern[_pos] != ']') 698else if (_pos + 1 < _pattern.Length && _pattern[_pos] == '-' && _pattern[_pos + 1] != ']') 705else if (_pos < _pattern.Length && ch == '-' && !translatedChar && _pattern[_pos] == '[' && !firstChar) 715if (_pos < _pattern.Length && _pattern[_pos] != ']') 754if (_pos == _pattern.Length || _pattern[_pos] != '?' || (_pos + 1 < _pattern.Length && _pattern[_pos + 1] == ')')) 771if (_pos == _pattern.Length) 808if (_pos == _pattern.Length) 855if (_pos < _pattern.Length && !(_pattern[_pos] == close || _pattern[_pos] == '-')) 875if (_pos < _pattern.Length && !(_pattern[_pos] == close || _pattern[_pos] == '-')) 892if ((capnum != -1 || proceed) && _pos + 1 < _pattern.Length && _pattern[_pos] == '-') 907if (_pos < _pattern.Length && _pattern[_pos] != close) 921if (_pos < _pattern.Length && _pattern[_pos] != close) 935if ((capnum != -1 || uncapnum != -1) && _pos < _pattern.Length && _pattern[_pos++] == close) 947if (_pos < _pattern.Length) 955if (_pos < _pattern.Length && _pattern[_pos++] == ')') 971if (_capnames?[capname] is int tmpCapnum && _pos < _pattern.Length && _pattern[_pos++] == ')') 982if (_pos + 2 < _pattern.Length && _pattern[_pos + 1] == '?') 991if (_pattern[_pos + 2] == '\'' || (_pos + 3 < _pattern.Length && _pattern[_pos + 2] == '<' && _pattern[_pos + 3] != '!' && _pattern[_pos + 3] != '=')) 1009if (_pos == _pattern.Length) 1043while (_pos < _pattern.Length && IsSpace(_pattern[_pos])) 1049if ((_options & RegexOptions.IgnorePatternWhitespace) != 0 && _pos < _pattern.Length && _pattern[_pos] == '#') 1054_pos = _pattern.Length; 1057else if (_pos + 2 < _pattern.Length && _pattern[_pos + 2] == '#' && _pattern[_pos + 1] == '?' && _pattern[_pos] == '(') 1062_pos = _pattern.Length; 1078Debug.Assert(_pos < _pattern.Length, "The current reading position must not be at the end of the pattern"); 1153Debug.Assert(_pos < _pattern.Length, "The current reading position must not be at the end of the pattern"); 1164if (_pos + 1 < _pattern.Length) 1175if (!angled || _pos == _pattern.Length) 1185else if ((ch == '<' || ch == '\'') && _pos + 1 < _pattern.Length) 1199if (_pos < _pattern.Length && _pattern[_pos++] == close) 1225if (_pos == _pattern.Length || (ch = _pattern[_pos]) < '0' || ch > '9') 1265if (_pos < _pattern.Length && _pattern[_pos++] == close) 1287if (_pos == _pattern.Length) 1299if (ch == '{' && _pos + 1 < _pattern.Length) 1325while (_pos < _pattern.Length && (ch = _pattern[_pos]) >= '0' && ch <= '9') 1351if (!angled || _pos < _pattern.Length && _pattern[_pos++] == '}') 1363if (_pos < _pattern.Length && _pattern[_pos++] == '}') 1420while (_pos < _pattern.Length) 1436int c = Math.Min(3, _pattern.Length - _pos); 1462while (_pos < _pattern.Length && (uint)(d = (char)(_pattern[_pos] - '0')) <= 9) 1482if (_pos + c <= _pattern.Length) 1508if (_pos == _pattern.Length) 1533for (bool off = false; _pos < _pattern.Length; _pos++) 1620if (_pos + 2 >= _pattern.Length) 1632while (_pos < _pattern.Length) 1644if (_pos == _pattern.Length || _pattern[_pos++] != '}') 1674while (_pos < _pattern.Length) 1681if (_pos < _pattern.Length) 1707if (_pos + 1 < _pattern.Length && _pattern[_pos + 1] == '#' && _pattern[_pos] == '?') 1716if (_pos < _pattern.Length && _pattern[_pos] == '?') 1721if (_pos + 1 < _pattern.Length && (_pattern[_pos] == '<' || _pattern[_pos] == '\'')) 1748if (_pos < _pattern.Length) 1976Debug.Assert(_pos < _pattern.Length, "The current reading position must not be at the end of the pattern"); 1986int nChars = _pattern.Length - _pos;
src\libraries\System.Text.RegularExpressions\src\System\Text\RegularExpressions\RegexPrefixAnalyzer.cs (6)
625for (; i < s.Length && results.Count < MaxFixedResults; i++) 630return i == s.Length; 995cc.AddChar(node.Str![(node.Options & RegexOptions.RightToLeft) != 0 ? node.Str.Length - 1 : 0]); 1154if (FindPrefix(nextChild) is { Length: >= 1 } prefix) 1161prefix.Length == 1 ? (firstChild, (prefix[0], null, StringComparison.Ordinal, null)) : 1168if (FindPrefixOrdinalCaseInsensitive(nextChild) is { Length: >= 2 } ordinalCaseInsensitivePrefix)
UpgradeToGeneratedRegexCodeFixer.cs (1)
140nodeToFix = root.FindNode(new TextSpan(nodeToFix.Span.Start + (typesModified * "partial".Length), nodeToFix.Span.Length), getInnermostNodeForTie: true);
System.Transactions.Local (2)
System\Transactions\TransactionsEtwProvider.cs (2)
1416if (str.Length >= 36) 1423if (str.Length >= 32)
System.Web.HttpUtility (11)
src\libraries\Common\src\System\Text\ValueStringBuilder.cs (5)
154int count = s.Length; 196if (s.Length == 1 && (uint)pos < (uint)_chars.Length) // very common case, e.g. appending strings from NumberFormatInfo like separators, percent symbols, etc. 210if (pos > _chars.Length - s.Length) 212Grow(s.Length); 220_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)
461if (e.GetMaxByteCount(str.Length) <= StackallocThreshold) 484int 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)
688if (selectionStart == newText.Length && 836EditableTextBoxSite.SelectionStart = newText.Length; 837EditableTextBoxSite.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 (243)
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)
1973return 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)
183if (s_companyName is null || s_companyName.Length == 0) 194if (s_companyName is null || s_companyName.Length == 0) 488s_productName = lastDot != -1 && lastDot < ns.Length - 1 ? ns[(lastDot + 1)..] : ns; 525if (s_productVersion is null || s_productVersion.Length == 0) 535if (s_productVersion is null || s_productVersion.Length == 0) 1095s_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\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)
3672_text = value.Length == 0 ? null : value; 6378if (pos + 1 >= text.Length) 6384if (pos <= 0 || pos >= text.Length) 6560m.ResultInternal = (LRESULT)((value.Length + 1) * sizeof(char)); 6564if ((int)m.WParamInternal < value.Length + 1) 7370if (_text is not null && _text.Length != 0) 7540if (_text is not null && _text.Length == 0) 10759return Text.Length != 0;
System\Windows\Forms\Controls\Buttons\ButtonInternal\ButtonBaseAdapter.LayoutOptions.cs (1)
490if (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)
1182SelectionLength = text.Length; 2043MatchingText.Length <= 1) 2931Select(0, Text.Length); 2934SelectionLength = 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)
2887if (cellStyle is not null && cellStyle.Format.Length != 0) 2891else if (columnHeadersStyle.Format.Length != 0) 10451Debug.Assert(dataGridViewColumn.DataPropertyName.Length != 0, "this method should be called only for columns which have DataPropertyName set"); 13258if (dataGridViewColumn.DataPropertyName.Length != 0) 13267if (Columns[i].DataPropertyName.Length != 0) 13327if (DataSource is not null && e.Column.DataPropertyName.Length != 0 && !_dataGridViewOper[OperationInRefreshColumns]) 13331else if (DataSource is not null && e.Column.DataPropertyName.Length == 0) 25445if (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)
1170int cb = s.Length; 1228int cb = s.Length; 2115if (cellStyle is not null && cellStyle.Format.Length != 0) 2119else if (rowStyle is not null && rowStyle.Format.Length != 0) 2123else if (DataGridView.RowsDefaultCellStyle.Format.Length != 0 && 2124(rowIndex % 2 == 0 || DataGridView.AlternatingRowsDefaultCellStyle.Format.Length == 0)) 2128else if (rowIndex % 2 == 1 && DataGridView.AlternatingRowsDefaultCellStyle.Format.Length != 0) 2132else if (columnStyle is not null && columnStyle.Format.Length != 0) 3974if (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)
829if (value is null || value.Length == 0)
System\Windows\Forms\Controls\ImageList\ImageList.ImageCollection.cs (1)
42if ((_imageInfoCollection[i] is ImageInfo image) && (image.Name is not null) && (image.Name.Length != 0))
System\Windows\Forms\Controls\Labels\LinkLabel.cs (6)
498return index - numTextElements + text.Length; 503return sub.Length; 520if (text.Length == 0) 642ranges.Add(new CharacterRange(0, text.Length)); 730private bool LinkInText(int start, int length) => start >= 0 && start < Text.Length && length > 0; 978Debug.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)
309if (DisplayMember.Length == 0) 469private protected bool BindingFieldEmpty => _displayMember.BindingField.Length == 0; 502found = 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); 5183backgroundImage.cchImageMax = (uint)(_backgroundImageFileName.Length + 1); 5621ReadOnlySpan<char> txt = (z.Length > 40) ? z.AsSpan(0, 40) : z; 5631ReadOnlySpan<char> txt = (z.Length > 40) ? z.AsSpan(0, 40) : z; 5769cchHeader = header.Length, 5774if (subtitle.Length != 0) 5779if (task.Length != 0) 5784if (footer.Length != 0) 5821if (footer.Length != 0) 5823lvgroup.cchFooter = footer.Length; 5839if (subtitle.Length != 0) 5841lvgroup.cchSubtitle = (uint)subtitle.Length; 5845if (task.Length != 0) 5847lvgroup.cchTask = (uint)task.Length;
System\Windows\Forms\Controls\PictureBox\PictureBox.cs (1)
1212if (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)
1868if (text.Length > MaximumLengthOfPropertyString) 1928text = 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)
1523if (text is not null && text.Length > 0 && string.Equals(text[..1], letter, StringComparison.InvariantCultureIgnoreCase)) 3722PInvoke.GetTextExtentPoint32W(hdc.HDC, value, value.Length, textSize); 4933while (exMessage is null || exMessage.Length == 0) 5006while (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 (11)
1062return SelectedText.Length; 1815int startIndex = FindInternal(kashidaString, position, position + str.Length, options); 1819chrg.cpMax = position + str.Length; 1826for (searchingCursor = startIndex, foundCursor = position + startIndex; searchingCursor < str.Length; 2225if (index >= t.Length) 2227index = Math.Max(t.Length - 1, 0); 2268if (index < 0 || index > Text.Length) 2522if (_textRtf!.Length == 0) 2799if (str.Length == 0) 2861byte[] bytes = new byte[SZ_RTF_TAG.Length]; 2867_editStream.ReadExactly(bytes, (int)streamStart, SZ_RTF_TAG.Length);
System\Windows\Forms\Controls\TabControl\TabControl.cs (3)
2152tcitem.cchTextMax = text.Length; 2187for (int i = firstAmpersand; i < value.Length; ++i) 2191if (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 (19)
581while (lineStart < text.Length) 584for (; lineEnd < text.Length; lineEnd++) 597if (lineEnd < text.Length && text[lineEnd] == '\r') 602if (lineEnd < text.Length && text[lineEnd] == '\n') 611if (text.Length > 0 && (text[^1] == '\r' || text[^1] == '\n')) 912len = t.Length; 1105=> IsHandleCreated ? PInvokeCore.GetWindowTextLength(this) : Text.Length; 1150Text = value.Length == 0 ? null : value; 1565return (index < 0 || index >= t.Length) ? (char)0 : t[index]; 1586if (index >= t.Length) 1588index = Math.Max(t.Length - 1, 0); 1610if (index < 0 || index >= Text.Length) 1677textDocument.Value->Range(WindowText.Length - 1, WindowText.Length - 1, windowTextRange).ThrowOnFailure(); 1943if (start > str.Length) 1945start = str.Length; 1953if (end > str.Length) 1955end = str.Length; 1980if (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)
259if (text.Length < 1)
System\Windows\Forms\Controls\UpDown\NumericUpDown.cs (2)
533!(Text.Length == 1 && Text == "-")) 734!(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\ErrorProvider\ErrorProvider.ControlItem.cs (3)
121bool adding = _error.Length == 0; 123if (value.Length == 0) 272_error.Length > 0)
System\Windows\Forms\Form.cs (1)
4689int 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; 135StringBuilder str = new(text.Length); 137for (; index < text.Length; ++index) 204int len = text.Length; 257StringBuilder str = new(text.Length); 259for (; index < text.Length; ++index) 267if (index < text.Length) 310if (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.Analyzers.CSharp.Tests (7)
Analyzers\WFO1001\ImplementITypedDataObjectTests.cs (7)
25.WithSpan(8, 16, 8, 16 + nameof(UntypedInterface).Length) 39.WithSpan(8, 23, 8, 23 + nameof(DerivedFromUntyped).Length) 42.WithSpan(13, 16, 13, 16 + nameof(UntypedInterface).Length) 56.WithSpan(8, 16, 8, 16 + nameof(UntypedWithAlias).Length) 70.WithSpan(8, 16, 8, 16 + nameof(UntypedWithNamespace).Length) 83.WithSpan(8, 16, 8, 16 + nameof(UntypedUnimplemented).Length) 86.WithSpan(8, 39, 8, 39 + "IDataObject".Length)
System.Windows.Forms.Analyzers.VisualBasic.Tests (6)
Analyzers\WFO1001\ImplementITypedDataObjectTests.vb (6)
20DiagnosticResult.CompilerWarning(DiagnosticId).WithSpan(8, 18, 8, 18 + NameOf(UntypedInterface).Length) _ 30DiagnosticResult.CompilerWarning(DiagnosticId).WithSpan(8, 33, 8, 33 + NameOf(DerivedFromUntyped).Length) _ 32DiagnosticResult.CompilerWarning(DiagnosticId).WithSpan(15, 18, 15, 18 + NameOf(UntypedInterface).Length) _ 42DiagnosticResult.CompilerWarning(DiagnosticId).WithSpan(8, 18, 8, 18 + NameOf(UntypedWithAlias).Length) _ 52DiagnosticResult.CompilerWarning(DiagnosticId).WithSpan(8, 18, 8, 18 + NameOf(UntypedWithNamespace).Length) _ 63.WithSpan(9, 18, 9, 18 + NameOf(UntypedUnimplemented).Length) _
System.Windows.Forms.Design (64)
System\ComponentModel\Design\BinaryEditor.cs (1)
60int size = stringValue.Length * 2;
System\ComponentModel\Design\DesignerActionPanel.cs (3)
756StringBuilder result = new(s.Length); 757for (int i = 0; i < s.Length; i++) 763if (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)
567&& className.Length > oldName.Length && className[className.Length - oldName.Length - 1] == '.') 570_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)
1017string baseName = string.Create(dataType.Name.Length, dataType.Name, static (span, baseName) => 1019for (int i = 0; i < baseName.Length; i++) 1021if (char.IsUpper(baseName[i]) && (i == 0 || i == baseName.Length - 1 || char.IsUpper(baseName[i + 1]))) 1108if (name.Length == 0) 1180if (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)
841if (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)
463Text.StringBuilder name = new(text.Length + nameSuffix.Length); 465for (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)
1721Debug.Assert(defaultName is not null && defaultName.Length > 0, "Couldn't create default name for item"); 1723if (text is null || text.Length == 0 || text == "-") 1730Text.StringBuilder name = new(text.Length + nameSuffix.Length); 1732for (int i = 0; i < text.Length; i++) 1886if (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)
689if (current is null || current.Length == 0)
System\Windows\Forms\Design\ToolStripMenuItemDesigner.cs (1)
2697if (name is null || name.Length == 0)
System.Windows.Forms.Design.Tests (2)
CodeDomHelpers.cs (1)
109else if (s.Length == 0)
System\Windows\Forms\Design\LinkAreaEditor.LinkAreaUITests.cs (1)
100sampleText.Length.Should().BeGreaterThanOrEqualTo(selectionStart + selectionLength);
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.Forms.Primitives.Tests (20)
Interop\ComCtl32\LVITEMWTests.cs (7)
38Assert.Equal(maxLength - 1, text.Length); 39Assert.Equal(text.Length + 1, lvi.cchTextMax); 47yield return new object[] { "abcdefg", "abcdefg".Length, "0123456", "012345" }; 48yield return new object[] { "abcdefg", "abcdefg".Length, "0123456789", "012345" }; 59cchTextMax = originalText.Length, 69Assert.Equal(lvi.cchTextMax, text.Length + 1); 81cchTextMax = originalText.Length,
System\Windows\Forms\Automation\UiaTextRangeTests.cs (13)
290providerMock.Setup(m => m.TextLength).Returns("words, words, words".Length); 308providerMock.Setup(m => m.TextLength).Returns(testText.Length); 329providerMock.Setup(m => m.TextLength).Returns(testText.Length); 360providerMock.Setup(m => m.TextLength).Returns(testText.Length); 385providerMock.Setup(m => m.TextLength).Returns(testText.Length); 427providerMock.Setup(m => m.TextLength).Returns(testText.Length); 655providerMock.Setup(m => m.TextLength).Returns(testText.Length); 705providerMock.Setup(m => m.TextLength).Returns(testText.Length); 787providerMock.Setup(m => m.TextLength).Returns(testText.Length); 873providerMock.Setup(m => m.TextLength).Returns(testText.Length); 904providerMock.Setup(m => m.TextLength).Returns(testText.Length); 938providerMock.Setup(m => m.TextLength).Returns(testText.Length); 1314providerMock.Setup(m => m.TextLength).Returns(testText.Length);
System.Windows.Forms.Primitives.TestUtilities.Tests (2)
PathLengthTests.cs (2)
20int currentRootLength = currentPath.Length - "src".Length;
System.Windows.Forms.Tests (71)
MaskedTextBoxTests.cs (1)
652control.SelectionLength = value.Length;
SpanHelpersTests.cs (1)
40Span<char> copy = stackalloc char[source.Length];
System\Windows\Forms\AccessibleObjects\LinkLabel.Link.LinkAccessibleObjectTests.cs (2)
218linkLabel.Links.Add(new(start, name.Length)); 219start += name.Length + 1;
System\Windows\Forms\AccessibleObjects\MaskedTextBox.MaskedTextBoxAccessibleObjectTests.cs (2)
127Assert.Equal(useMask, maskedTextBox.Mask?.Length == actual.Length);
System\Windows\Forms\AxHostTests.cs (1)
3032PropertyDescriptor descriptor = TypeDescriptor.GetProperties(typeof(string))[nameof(string.Length)];
System\Windows\Forms\ComboBox.ComboBoxUiaTextProviderTests.cs (3)
668Assert.Equal(comboBox.Text.Length, provider.TextLength); 790Assert.True(providerVisibleStart < comboBox.Text.Length); 792Assert.True(providerVisibleEnd <= comboBox.Text.Length);
System\Windows\Forms\ComboBoxTests.cs (3)
2704control.SelectionLength.Should().Be(control.Text.Length); 2715control.SelectionLength.Should().Be(control.Text.Length); 2888SelectionStart = Text.Length + cursorRelativeToEnd;
System\Windows\Forms\DataGridViewTextBoxEditingControlTests.cs (10)
213Assert.Equal(expected.Length, control.TextLength); 221Assert.Equal(expected.Length, control.TextLength); 243Assert.Equal(expected.Length, control.TextLength); 252Assert.Equal(expected.Length, control.TextLength); 345Assert.Equal(expected.Length, control.TextLength); 353Assert.Equal(expected.Length, control.TextLength); 375Assert.Equal(expected.Length, control.TextLength); 384Assert.Equal(expected.Length, control.TextLength); 434Assert.Equal(expected.Length, control.TextLength); 445Assert.Equal(expected.Length, control.TextLength);
System\Windows\Forms\DataObjectTests.cs (2)
2612new string(text, 0, "Path1".Length + 1 + "Path2".Length + 1 + 1).Should().Be("Path1\0Path2\0\0");
System\Windows\Forms\PropertyGridInternal\GridToolTipTests.cs (2)
62_toolTip.ToolTip.Length.Should().Be(MaximumToolTipLength + 3); 67_toolTip.ToolTip.Length.Should().Be(MaximumToolTipLength);
System\Windows\Forms\RichTextBoxTests.cs (17)
7065Assert.Equal(expected.Length, control.TextLength); 7078Assert.Equal(expected.Length, control.TextLength); 7180Assert.Equal(expected.Length, control.TextLength); 7191Assert.Equal(expected.Length, control.TextLength); 7212Assert.Equal(expected.Length, control.TextLength); 7223Assert.Equal(expected.Length, control.TextLength); 7252Assert.Equal(expected.Length, control.TextLength); 7266Assert.Equal(expected.Length, control.TextLength); 7298Assert.Equal(expected.Length, control.TextLength); 7314Assert.Equal(expected.Length, control.TextLength); 7407Assert.Equal(expected.Length, control.TextLength); 7420Assert.Equal(expected.Length, control.TextLength); 7472Assert.Equal(expected.Length, control.TextLength); 7486Assert.Equal(expected.Length, control.TextLength); 10587Assert.Equal(richTextBox.Text.Length, richTextBox.TextLength); 10590int endOfHidden = riched20.Text.IndexOf("hidden", StringComparison.Ordinal) + "hidden".Length; 10689int endOfText = richTextBox2.Text.IndexOf("text", StringComparison.Ordinal) + "text".Length;
System\Windows\Forms\ScreenTests.cs (1)
213Assert.InRange(screen.DeviceName.Length, 1, 32);
System\Windows\Forms\SystemInformationTests.cs (2)
110Assert.InRange(name.Length, 1, 256); 743Assert.InRange(name.Length, 1, 256);
System\Windows\Forms\TextBoxBase.TextBoxBaseUiaTextProviderTests.cs (5)
563Assert.Equal(textBoxBase.Text.Length, provider.TextLength); 636Assert.True(providerVisibleStart < textBoxBase.Text.Length); 638Assert.True(providerVisibleEnd <= textBoxBase.Text.Length); 685Assert.True(providerVisibleStart < textBoxBase.Text.Length); 687Assert.True(providerVisibleEnd <= textBoxBase.Text.Length);
System\Windows\Forms\ToolStripComboBoxTests.cs (1)
353_toolStripComboBox.SelectionLength.Should().Be(_toolStripComboBox.Text.Length);
System\Windows\Forms\ToolStripTextBoxTests.cs (1)
789_toolStripTextBox.SelectionStart = _toolStripTextBox.Text.Length;
TestAccessorTests.cs (1)
219private int ToStringLength(string value) => value.Length;
TextBoxBaseTests.cs (16)
3223Assert.Equal(expected.Length, control.TextLength); 3234Assert.Equal(expected.Length, control.TextLength); 3277Assert.Equal(expected.Length, control.TextLength); 3288Assert.Equal(expected.Length, control.TextLength); 3307Assert.Equal(expected.Length, control.TextLength); 3318Assert.Equal(expected.Length, control.TextLength); 3342Assert.Equal(expected.Length, control.TextLength); 3355Assert.Equal(expected.Length, control.TextLength); 3386Assert.Equal(expected.Length, control.TextLength); 3399Assert.Equal(expected.Length, control.TextLength); 3451Assert.Equal(expected.Length, control.TextLength); 3465Assert.Equal(expected.Length, control.TextLength); 3867Assert.Equal(expected.Length, control.SelectionStart); 3971Assert.Equal(expected.Length, control.SelectionStart); 5969SelectionStart = text.Length + cursorRelativeToEnd 5984SelectionStart = text.Length,
System.Windows.Forms.UI.IntegrationTests (13)
Infra\DataCollectionService.cs (4)
212if (path.Length > MaxPath) 214testName = testName[..Math.Max(0, testName.Length - (path.Length - MaxPath))]; 241if (Environment.GetEnvironmentVariable("XUNIT_LOGS") is { Length: > 0 } baseLogDirectory)
Infra\SendInput.cs (2)
30while (index < text.Length) 42nextIndex = text.Length;
Input\KeyboardSimulator.cs (3)
68if (text.Length == 0) 73Span<INPUT> inputs = stackalloc INPUT[text.Length * 2]; 74for (int i = 0; i < text.Length; i++)
RichTextBoxTests.cs (4)
54Assert.True(result!.LinkStart + result.LinkLength <= richTextBox.Text.Length); 114Assert.True(result!.LinkStart + result.LinkLength <= richTextBox.Text.Length); 175Assert.True(result!.LinkStart + result.LinkLength <= richTextBox.Text.Length); 197control.Select(control.Text.IndexOf(text, StringComparison.Ordinal), text.Length);
System.Windows.Input.Manipulations (1)
System\Windows\Input\Manipulations\Exceptions.cs (1)
219Debug.Assert(paramName.Length > 0);
System.Xaml (61)
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\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);
SystemdTestApp (1)
Startup.cs (1)
33context.Response.ContentLength = response.Length;
Templates.Blazor.Tests (11)
src\ProjectTemplates\Shared\AspNetProcess.cs (1)
202ListeningMessagePrefix, StringComparison.Ordinal) + ListeningMessagePrefix.Length);
src\ProjectTemplates\Shared\ProjectFactoryFixture.cs (1)
61private static char GetRandomLetter() => LetterChars[Random.Shared.Next(LetterChars.Length - 1)];
src\Shared\CertificateGeneration\CertificateManager.cs (1)
205if ((byteArray.Length == AspNetHttpsOidFriendlyName.Length && byteArray[0] == (byte)'A') || byteArray.Length == 0)
src\Shared\CertificateGeneration\UnixCertificateManager.cs (1)
341? Path.Combine("$HOME", certDir[homeDirectoryWithSlash.Length..])
src\Shared\CommandLineUtils\CommandLine\AnsiConsole.cs (2)
77while (endIndex != message.Length && 86if (endIndex == message.Length)
src\Shared\CommandLineUtils\CommandLine\CommandLineApplication.cs (3)
480var maxArgLen = arguments.Max(a => a.Name.Length); 496var maxOptLen = options.Max(o => o.Template.Length); 512var maxCmdLen = commands.Max(c => c.Name.Length);
src\Shared\CommandLineUtils\CommandLine\CommandOption.cs (2)
29if (optName.Length == 1 && !IsEnglishLetter(optName[0])) 40ValueName = part.Substring(1, part.Length - 2);
Templates.Blazor.WebAssembly.Auth.Tests (12)
src\ProjectTemplates\Shared\AspNetProcess.cs (1)
202ListeningMessagePrefix, StringComparison.Ordinal) + ListeningMessagePrefix.Length);
src\ProjectTemplates\Shared\ProjectFactoryFixture.cs (1)
61private static char GetRandomLetter() => LetterChars[Random.Shared.Next(LetterChars.Length - 1)];
src\Shared\CertificateGeneration\CertificateManager.cs (1)
205if ((byteArray.Length == AspNetHttpsOidFriendlyName.Length && byteArray[0] == (byte)'A') || byteArray.Length == 0)
src\Shared\CertificateGeneration\UnixCertificateManager.cs (1)
341? Path.Combine("$HOME", certDir[homeDirectoryWithSlash.Length..])
src\Shared\CommandLineUtils\CommandLine\AnsiConsole.cs (2)
77while (endIndex != message.Length && 86if (endIndex == message.Length)
src\Shared\CommandLineUtils\CommandLine\CommandLineApplication.cs (3)
480var maxArgLen = arguments.Max(a => a.Name.Length); 496var maxOptLen = options.Max(o => o.Template.Length); 512var maxCmdLen = commands.Max(c => c.Name.Length);
src\Shared\CommandLineUtils\CommandLine\CommandOption.cs (2)
29if (optName.Length == 1 && !IsEnglishLetter(optName[0])) 40ValueName = part.Substring(1, part.Length - 2);
src\Shared\E2ETesting\E2ETestOptions.cs (1)
27.ToDictionary(kvp => kvp.Key.Substring(TestingOptionsPrefix.Length + 1), kvp => kvp.Value);
Templates.Blazor.WebAssembly.Tests (12)
src\ProjectTemplates\Shared\AspNetProcess.cs (1)
202ListeningMessagePrefix, StringComparison.Ordinal) + ListeningMessagePrefix.Length);
src\ProjectTemplates\Shared\ProjectFactoryFixture.cs (1)
61private static char GetRandomLetter() => LetterChars[Random.Shared.Next(LetterChars.Length - 1)];
src\Shared\CertificateGeneration\CertificateManager.cs (1)
205if ((byteArray.Length == AspNetHttpsOidFriendlyName.Length && byteArray[0] == (byte)'A') || byteArray.Length == 0)
src\Shared\CertificateGeneration\UnixCertificateManager.cs (1)
341? Path.Combine("$HOME", certDir[homeDirectoryWithSlash.Length..])
src\Shared\CommandLineUtils\CommandLine\AnsiConsole.cs (2)
77while (endIndex != message.Length && 86if (endIndex == message.Length)
src\Shared\CommandLineUtils\CommandLine\CommandLineApplication.cs (3)
480var maxArgLen = arguments.Max(a => a.Name.Length); 496var maxOptLen = options.Max(o => o.Template.Length); 512var maxCmdLen = commands.Max(c => c.Name.Length);
src\Shared\CommandLineUtils\CommandLine\CommandOption.cs (2)
29if (optName.Length == 1 && !IsEnglishLetter(optName[0])) 40ValueName = part.Substring(1, part.Length - 2);
src\Shared\E2ETesting\E2ETestOptions.cs (1)
27.ToDictionary(kvp => kvp.Key.Substring(TestingOptionsPrefix.Length + 1), kvp => kvp.Value);
Templates.Mvc.Tests (12)
src\ProjectTemplates\Shared\AspNetProcess.cs (1)
202ListeningMessagePrefix, StringComparison.Ordinal) + ListeningMessagePrefix.Length);
src\ProjectTemplates\Shared\ProjectFactoryFixture.cs (1)
61private static char GetRandomLetter() => LetterChars[Random.Shared.Next(LetterChars.Length - 1)];
src\Shared\CertificateGeneration\CertificateManager.cs (1)
205if ((byteArray.Length == AspNetHttpsOidFriendlyName.Length && byteArray[0] == (byte)'A') || byteArray.Length == 0)
src\Shared\CertificateGeneration\UnixCertificateManager.cs (1)
341? Path.Combine("$HOME", certDir[homeDirectoryWithSlash.Length..])
src\Shared\CommandLineUtils\CommandLine\AnsiConsole.cs (2)
77while (endIndex != message.Length && 86if (endIndex == message.Length)
src\Shared\CommandLineUtils\CommandLine\CommandLineApplication.cs (3)
480var maxArgLen = arguments.Max(a => a.Name.Length); 496var maxOptLen = options.Max(o => o.Template.Length); 512var maxCmdLen = commands.Max(c => c.Name.Length);
src\Shared\CommandLineUtils\CommandLine\CommandOption.cs (2)
29if (optName.Length == 1 && !IsEnglishLetter(optName[0])) 40ValueName = part.Substring(1, part.Length - 2);
src\Shared\E2ETesting\E2ETestOptions.cs (1)
27.ToDictionary(kvp => kvp.Key.Substring(TestingOptionsPrefix.Length + 1), kvp => kvp.Value);
Templates.Tests (13)
BaselineTest.cs (1)
110?.Substring(namespaceDeclarationPrefix.Length);
src\ProjectTemplates\Shared\AspNetProcess.cs (1)
202ListeningMessagePrefix, StringComparison.Ordinal) + ListeningMessagePrefix.Length);
src\ProjectTemplates\Shared\ProjectFactoryFixture.cs (1)
61private static char GetRandomLetter() => LetterChars[Random.Shared.Next(LetterChars.Length - 1)];
src\Shared\CertificateGeneration\CertificateManager.cs (1)
205if ((byteArray.Length == AspNetHttpsOidFriendlyName.Length && byteArray[0] == (byte)'A') || byteArray.Length == 0)
src\Shared\CertificateGeneration\UnixCertificateManager.cs (1)
341? Path.Combine("$HOME", certDir[homeDirectoryWithSlash.Length..])
src\Shared\CommandLineUtils\CommandLine\AnsiConsole.cs (2)
77while (endIndex != message.Length && 86if (endIndex == message.Length)
src\Shared\CommandLineUtils\CommandLine\CommandLineApplication.cs (3)
480var maxArgLen = arguments.Max(a => a.Name.Length); 496var maxOptLen = options.Max(o => o.Template.Length); 512var maxCmdLen = commands.Max(c => c.Name.Length);
src\Shared\CommandLineUtils\CommandLine\CommandOption.cs (2)
29if (optName.Length == 1 && !IsEnglishLetter(optName[0])) 40ValueName = part.Substring(1, part.Length - 2);
src\Shared\E2ETesting\E2ETestOptions.cs (1)
27.ToDictionary(kvp => kvp.Key.Substring(TestingOptionsPrefix.Length + 1), kvp => kvp.Value);
Test.Utilities (193)
src\Compilers\Core\Portable\FileSystem\FileUtilities.cs (2)
133if (path!.Length == 1) 175Debug.Assert(path.Length == 1 || !PathUtilities.IsDirectorySeparator(path[1]));
src\Compilers\Core\Portable\FileSystem\PathUtilities.cs (36)
52int lastSeparator = s.Length; 58if (lastSeparator != s.Length) 71if (s.Length == 0 || IsAnyDirectorySeparator(s[s.Length - 1])) 138var rootLength = GetPathRoot(path, isUnixLike).Length; 139if (path.Length > rootLength) 141var i = path.Length; 212int length = path.Length; 287return path.Length > 0 && IsDirectorySeparator(path[0]) 314if (path.Length > 0 && path[0] == '.') 316if (path.Length == 1 || IsDirectorySeparator(path[1])) 323if (path.Length == 2 || IsDirectorySeparator(path[2])) 334if (path.Length >= 1 && IsDirectorySeparator(path[0])) 341if (path.Length >= 2 && path[1] == VolumeSeparatorChar && (path.Length <= 2 || !IsDirectorySeparator(path[2]))) 375return path.Length >= 2 && 386return path.Length >= 3 && path[1] == VolumeSeparatorChar && IsDirectorySeparator(path[2]); 440char c = root[root.Length - 1]; 479if (path.Length > 0 && IsDirectorySeparator(path[path.Length - 1])) 481return path.Substring(0, path.Length - 1); 608return parentPath.Length > 0 609&& childPath.Length > parentPath.Length 610&& PathsEqual(childPath, parentPath, parentPath.Length) 611&& (IsDirectorySeparator(parentPath[parentPath.Length - 1]) || IsDirectorySeparator(childPath[parentPath.Length])); 616var relativePath = childPath.Substring(parentPath.Length); 619int start = ConsumeDirectorySeparators(relativePath, relativePath.Length, 0); 648return PathsEqual(path1, path2, Math.Max(path1.Length, path2.Length)); 656if (path1.Length < length || path2.Length < length) 714if (!(oldPrefix?.Length > 0)) continue; 723var replacement = replacementPrefix + filePath.Substring(oldPrefix.Length); 841if (!isDriveRooted && !(p.Length > 1 && p[0] == AltDirectorySeparatorChar))
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\Compilers\Core\Portable\InternalUtilities\StringExtensions.cs (15)
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.Substring(0, name.Length - AttributeSuffix.Length); 165return name.Length > AttributeSuffix.Length && name.EndsWith(AttributeSuffix, comparison); 171while (i < str.Length) 178if (i < str.Length && char.IsLowSurrogate(str[i])) 208if (arg.Length > 1 && arg[0] == '"' && arg[arg.Length - 1] == '"') 211return arg.Substring(1, arg.Length - 2); 223while (x < string1.Length && x < string2.Length && 235while (x < string1.Length && x < string2.Length &&
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\Compilers\Core\Portable\InternalUtilities\UnicodeCharacterUtilities.cs (1)
103int nameLength = name.Length;
src\Compilers\Core\Portable\Syntax\SyntaxTreeExtensions.cs (2)
95var n1 = s1.Length; 96var n2 = s2.Length;
src\Compilers\Core\Portable\Text\TextChangeRangeExtensions.cs (1)
105return new TextChangeRange(textChange.Span, textChange.NewText?.Length ?? 0);
src\Dependencies\Collections\Extensions\IEnumerableExtensions.cs (2)
213return str.Length == 0; 236return source.Length == 0;
src\RoslynAnalyzers\Utilities\Compiler\Extensions\StringExtensions.cs (1)
15return Encoding.UTF8.GetByteCount(value) == value.Length;
src\RoslynAnalyzers\Utilities\Compiler\Options\AnalyzerOptionsExtensions.cs (2)
359if (trimmedSuffix.Length >= 2 && 363for (int i = 1; i < trimmedSuffix.Length - 2; i++)
src\RoslynAnalyzers\Utilities\Compiler\Options\SymbolNamesWithValueOption.cs (2)
109parts.SymbolName.Length == 1)) 145Debug.Assert(parts.SymbolName.Length >= 2);
src\RoslynAnalyzers\Utilities\Compiler\RulesetToEditorconfigConverter.cs (2)
208if (comment.Length > 0) 213if (trimmedCommentPart.Length > 0)
src\RoslynAnalyzers\Utilities\Compiler\WellKnownTypeProvider.cs (1)
220for (int i = 0; i < fullTypeName.Length; i++)
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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\CodeGeneration\ParameterName.cs (1)
42BestNameForParameter = trimmed.Length > 0 ? tryMakeCamelCase ? trimmed.ToCamelCase() : trimmed : nameBasedOnArgument;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EditorConfig\Parsing\Sections\SectionMatcher.Lexer.cs (5)
15public readonly bool IsDone => Position >= headerText.Length; 54if (position < headerText.Length) 85if (position < headerText.Length && 113if (position >= headerText.Length) 171return str.Length == 0 || str == "-"
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\VirtualChars\AbstractVirtualCharService.cs (8)
31if (index + 1 < tokenText.Length) 117Debug.Assert(lastVC.Span.End == token.Span.End - "\"".Length, "Last span has to end right before the end of the string token."); 121Debug.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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\VirtualChars\AbstractVirtualCharService.ITextInfo.cs (1)
30public readonly int Length(string text) => text.Length;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\VirtualChars\VirtualCharSequence.Chunks.cs (3)
84public override int Length => data.Length; 89if (stringIndex < 0 || stringIndex >= data.Length) 104Debug.Assert(index + 1 >= data.Length ||
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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\TokenStream.cs (2)
337length = text.ConvertTabToSpace(_options.TabSize, initialColumn, text.Length); 341length = text.Length;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\TreeData.Node.cs (1)
30return lineText.GetColumnFromLineOffset(lineText.Length, tabSize);
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\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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\Naming\IdentifierNameParts.cs (2)
47? newBaseName[prefix.Length..] 53? newBaseName[..^suffix.Length]
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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\NamingStyle.WordSpanEnumerator.cs (1)
52Current = new TextSpan(Current.End + _wordSeparator.Length, 0);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Serialization\ObjectWriter.cs (2)
504var bytes = new byte[(uint)value.Length * sizeof(char)]; 510WriteCompressedUInt((uint)value.Length);
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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\SyntaxFacts\ISyntaxFactsExtensions.cs (2)
251if (name.Length == 0) 261for (var i = 1; i < name.Length; i++)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.cs (1)
198Debug.Assert(reader.Position == symbolKey.Length);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.SymbolKeyReader.cs (1)
259while (Position < Data.Length)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\Base64Utilities.cs (2)
329decodedLength = (encodedString.Length * 3) / 4 - padding; 336var index = attributeData.Length - 1;
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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\BKTree.cs (4)
74Span<char> lowerCaseCharacters = value.Length < 512 75? stackalloc char[value.Length] 76: new char[value.Length]; 78for (var i = 0; i < value.Length; i++)
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++) 89Span<char> 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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\PathMetadataUtilities.cs (2)
31if (rootNamespace is { Length: > 0 } && 69@namespace = @namespace[(rootNamespace.Length + 1)..];
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\StringBreaker.cs (2)
24for (var start = 0; start < text.Length;) 42var length = identifier.Length;
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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\WordSimilarityChecker.cs (6)
80=> value.Length <= 4 ? 1 : 2; 87if (_source.Length < 3) 113if (Math.Abs(_source.Length - candidateText.Length) <= _threshold) 142var lengthDifference = Math.Abs(originalText.Length - candidateText.Length);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\ISymbolExtensions.cs (1)
795(symbol.Name.Length == 1 || uint.TryParse(symbol.Name[1..], out _) || symbol.Name.All(n => n.Equals('_')));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\ITypeSymbolExtensions.cs (1)
363return shortName.Length == 0
TestTasks (1)
InjectRequestHandler.cs (1)
60var bitnessString = rid.Substring(rid.Length - 3, 3);
Text.Analyzers (204)
CodeAnalysisDictionary.cs (1)
92if (trimmedWord.Length > 0)
IdentifiersShouldBeSpelledCorrectly.cs (2)
376if (checkForUnmeaningful && symbolName.Length == 1) 483=> name.Length > 0 && name[0] == prefix ? name[1..] : name;
src\Compilers\Core\Portable\FileSystem\FileUtilities.cs (2)
133if (path!.Length == 1) 175Debug.Assert(path.Length == 1 || !PathUtilities.IsDirectorySeparator(path[1]));
src\Compilers\Core\Portable\FileSystem\PathUtilities.cs (36)
52int lastSeparator = s.Length; 58if (lastSeparator != s.Length) 71if (s.Length == 0 || IsAnyDirectorySeparator(s[s.Length - 1])) 138var rootLength = GetPathRoot(path, isUnixLike).Length; 139if (path.Length > rootLength) 141var i = path.Length; 212int length = path.Length; 287return path.Length > 0 && IsDirectorySeparator(path[0]) 314if (path.Length > 0 && path[0] == '.') 316if (path.Length == 1 || IsDirectorySeparator(path[1])) 323if (path.Length == 2 || IsDirectorySeparator(path[2])) 334if (path.Length >= 1 && IsDirectorySeparator(path[0])) 341if (path.Length >= 2 && path[1] == VolumeSeparatorChar && (path.Length <= 2 || !IsDirectorySeparator(path[2]))) 375return path.Length >= 2 && 386return path.Length >= 3 && path[1] == VolumeSeparatorChar && IsDirectorySeparator(path[2]); 440char c = root[root.Length - 1]; 479if (path.Length > 0 && IsDirectorySeparator(path[path.Length - 1])) 481return path.Substring(0, path.Length - 1); 608return parentPath.Length > 0 609&& childPath.Length > parentPath.Length 610&& PathsEqual(childPath, parentPath, parentPath.Length) 611&& (IsDirectorySeparator(parentPath[parentPath.Length - 1]) || IsDirectorySeparator(childPath[parentPath.Length])); 616var relativePath = childPath.Substring(parentPath.Length); 619int start = ConsumeDirectorySeparators(relativePath, relativePath.Length, 0); 648return PathsEqual(path1, path2, Math.Max(path1.Length, path2.Length)); 656if (path1.Length < length || path2.Length < length) 714if (!(oldPrefix?.Length > 0)) continue; 723var replacement = replacementPrefix + filePath.Substring(oldPrefix.Length); 841if (!isDriveRooted && !(p.Length > 1 && p[0] == AltDirectorySeparatorChar))
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\Compilers\Core\Portable\InternalUtilities\StringExtensions.cs (15)
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.Substring(0, name.Length - AttributeSuffix.Length); 165return name.Length > AttributeSuffix.Length && name.EndsWith(AttributeSuffix, comparison); 171while (i < str.Length) 178if (i < str.Length && char.IsLowSurrogate(str[i])) 208if (arg.Length > 1 && arg[0] == '"' && arg[arg.Length - 1] == '"') 211return arg.Substring(1, arg.Length - 2); 223while (x < string1.Length && x < string2.Length && 235while (x < string1.Length && x < string2.Length &&
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\Compilers\Core\Portable\InternalUtilities\UnicodeCharacterUtilities.cs (1)
103int nameLength = name.Length;
src\Compilers\Core\Portable\Syntax\SyntaxTreeExtensions.cs (2)
95var n1 = s1.Length; 96var n2 = s2.Length;
src\Compilers\Core\Portable\Text\TextChangeRangeExtensions.cs (1)
105return new TextChangeRange(textChange.Span, textChange.NewText?.Length ?? 0);
src\Dependencies\Collections\Extensions\IEnumerableExtensions.cs (2)
213return str.Length == 0; 236return source.Length == 0;
src\RoslynAnalyzers\Utilities\Compiler\CodeMetrics\CodeAnalysisMetricData.cs (1)
141if (index >= 0 && index < symbolName.Length)
src\RoslynAnalyzers\Utilities\Compiler\Extensions\StringExtensions.cs (1)
15return Encoding.UTF8.GetByteCount(value) == value.Length;
src\RoslynAnalyzers\Utilities\Compiler\Options\AnalyzerOptionsExtensions.cs (2)
359if (trimmedSuffix.Length >= 2 && 363for (int i = 1; i < trimmedSuffix.Length - 2; i++)
src\RoslynAnalyzers\Utilities\Compiler\Options\SymbolNamesWithValueOption.cs (2)
109parts.SymbolName.Length == 1)) 145Debug.Assert(parts.SymbolName.Length >= 2);
src\RoslynAnalyzers\Utilities\Compiler\RulesetToEditorconfigConverter.cs (2)
208if (comment.Length > 0) 213if (trimmedCommentPart.Length > 0)
src\RoslynAnalyzers\Utilities\Compiler\WellKnownTypeProvider.cs (1)
220for (int i = 0; i < fullTypeName.Length; i++)
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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\CodeGeneration\ParameterName.cs (1)
42BestNameForParameter = trimmed.Length > 0 ? tryMakeCamelCase ? trimmed.ToCamelCase() : trimmed : nameBasedOnArgument;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EditorConfig\Parsing\Sections\SectionMatcher.Lexer.cs (5)
15public readonly bool IsDone => Position >= headerText.Length; 54if (position < headerText.Length) 85if (position < headerText.Length && 113if (position >= headerText.Length) 171return str.Length == 0 || str == "-"
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\VirtualChars\AbstractVirtualCharService.cs (8)
31if (index + 1 < tokenText.Length) 117Debug.Assert(lastVC.Span.End == token.Span.End - "\"".Length, "Last span has to end right before the end of the string token."); 121Debug.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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\VirtualChars\AbstractVirtualCharService.ITextInfo.cs (1)
30public readonly int Length(string text) => text.Length;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\VirtualChars\VirtualCharSequence.Chunks.cs (3)
84public override int Length => data.Length; 89if (stringIndex < 0 || stringIndex >= data.Length) 104Debug.Assert(index + 1 >= data.Length ||
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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\TokenStream.cs (2)
337length = text.ConvertTabToSpace(_options.TabSize, initialColumn, text.Length); 341length = text.Length;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\TreeData.Node.cs (1)
30return lineText.GetColumnFromLineOffset(lineText.Length, tabSize);
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\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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\Naming\IdentifierNameParts.cs (2)
47? newBaseName[prefix.Length..] 53? newBaseName[..^suffix.Length]
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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\NamingStyle.WordSpanEnumerator.cs (1)
52Current = new TextSpan(Current.End + _wordSeparator.Length, 0);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Serialization\ObjectWriter.cs (2)
504var bytes = new byte[(uint)value.Length * sizeof(char)]; 510WriteCompressedUInt((uint)value.Length);
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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\SyntaxFacts\ISyntaxFactsExtensions.cs (2)
251if (name.Length == 0) 261for (var i = 1; i < name.Length; i++)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.cs (1)
198Debug.Assert(reader.Position == symbolKey.Length);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.SymbolKeyReader.cs (1)
259while (Position < Data.Length)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\Base64Utilities.cs (2)
329decodedLength = (encodedString.Length * 3) / 4 - padding; 336var index = attributeData.Length - 1;
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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\BKTree.cs (4)
74Span<char> lowerCaseCharacters = value.Length < 512 75? stackalloc char[value.Length] 76: new char[value.Length]; 78for (var i = 0; i < value.Length; i++)
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++) 89Span<char> 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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\PathMetadataUtilities.cs (2)
31if (rootNamespace is { Length: > 0 } && 69@namespace = @namespace[(rootNamespace.Length + 1)..];
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\StringBreaker.cs (2)
24for (var start = 0; start < text.Length;) 42var length = identifier.Length;
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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\WordSimilarityChecker.cs (6)
80=> value.Length <= 4 ? 1 : 2; 87if (_source.Length < 3) 113if (Math.Abs(_source.Length - candidateText.Length) <= _threshold) 142var lengthDifference = Math.Abs(originalText.Length - candidateText.Length);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\ISymbolExtensions.cs (1)
795(symbol.Name.Length == 1 || uint.TryParse(symbol.Name[1..], out _) || symbol.Name.All(n => n.Equals('_')));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\ITypeSymbolExtensions.cs (1)
363return shortName.Length == 0
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Extensions\ProjectExtensions.cs (2)
75analyzerConfigDirectory.Length > bestPath.Length)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Extensions\SyntaxGeneratorExtensions_CreateEqualsMethod.cs (1)
366if (name.Length > 0)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\LanguageServices\TypeInferenceService\AbstractTypeInferenceService.cs (3)
67if (name.Length == prefix.Length) 72var nextChar = name[prefix.Length];
TlsFeaturesObserve (1)
HttpSys\HttpSysConfigurator.cs (1)
76var length = thumbprint.Length;
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\Microsoft.DotNet.Wpf\src\Shared\MS\Win32\NativeMethodsCLR.cs (1)
2423int count = Math.Min(s.Length, buffer.Length - offset);
vbc (3)
src\Compilers\Shared\BuildProtocol.cs (1)
581writer.Write(value.Length);
src\Compilers\Shared\RuntimeHostInfo.cs (2)
44if (Environment.GetEnvironmentVariable(DotNetHostPathEnvironmentName) is { Length: > 0 } pathToDotNet) 49if (Environment.GetEnvironmentVariable(DotNetExperimentalHostPathEnvironmentName) is { Length: > 0 } pathToDotNetExperimental)
VBCSCompiler (4)
src\Compilers\Server\VBCSCompiler\BuildServerController.cs (1)
178pipeName = arg.Substring(pipeArgPrefix.Length);
src\Compilers\Shared\BuildProtocol.cs (1)
581writer.Write(value.Length);
src\Compilers\Shared\RuntimeHostInfo.cs (2)
44if (Environment.GetEnvironmentVariable(DotNetHostPathEnvironmentName) is { Length: > 0 } pathToDotNet) 49if (Environment.GetEnvironmentVariable(DotNetExperimentalHostPathEnvironmentName) is { Length: > 0 } pathToDotNetExperimental)
VBCSCompiler.UnitTests (2)
BuildClientTests.cs (1)
345Assert.Equal(43, name.Length);
CompilerServerTests.cs (1)
290var newTempDir = _tempDirectory.CreateDirectory(new string('a', 100 - _tempDirectory.Path.Length));
VersioningWebSite (1)
src\Mvc\test\WebSites\Common\TestResponseGenerator.cs (1)
32.ToDictionary(kvp => kvp.Key.Substring("link_".Length), kvp => (object)kvp.Value[0]);
VisualBasicSyntaxGenerator (13)
Grammar\GrammarGenerator.vb (2)
333Dim trimmed = If(name.EndsWith("Syntax"), name.Substring(0, name.Length - "Syntax".Length), name)
Util\WriteUtils.vb (6)
57Return nodeStructure.Name.Substring(0, nodeStructure.Name.Length - 6) 452If nodeName.EndsWith("Syntax", StringComparison.Ordinal) Then nodeName = nodeName.Substring(0, nodeName.Length - 6) 532If s Is Nothing OrElse s.Length = 0 Then 541If s Is Nothing OrElse s.Length = 0 Then 563While text.Length >= LineLength 573If text.Length > 0 Then
Util\XmlRenamer.vb (5)
59s = s.Substring(1, s.Length - 2) 62s = s.Substring("Optional".Length) 132Dim endIndex = index + kind.Length 133If (endIndex < attrValue.Length AndAlso attrValue(endIndex) <> "|"c) Then 161Dim newValue = attrValue.Substring(0, startIndex) + newKind + attrValue.Substring(startIndex + oldKind.Length)
Wasm.Performance.ConsoleHost (7)
src\Shared\CommandLineUtils\CommandLine\AnsiConsole.cs (2)
77while (endIndex != message.Length && 86if (endIndex == message.Length)
src\Shared\CommandLineUtils\CommandLine\CommandLineApplication.cs (3)
480var maxArgLen = arguments.Max(a => a.Name.Length); 496var maxOptLen = options.Max(o => o.Template.Length); 512var maxCmdLen = commands.Max(c => c.Name.Length);
src\Shared\CommandLineUtils\CommandLine\CommandOption.cs (2)
29if (optName.Length == 1 && !IsEnglishLetter(optName[0])) 40ValueName = part.Substring(1, part.Length - 2);
WinFormsControlsTest (4)
Dialogs.ClientGuidConverter.cs (1)
25if ((value is null) || (value is string str && str.Length == 0))
DragDrop.cs (2)
215textBox.Text += textBox.Text.Length > 0 220textBox.SelectionStart = textBox.Text.Length;
RichTextBoxes.cs (1)
41control.Select(control.Text.IndexOf(text, StringComparison.Ordinal), text.Length);
XmlFileLogger (7)
ItemGroupParser.cs (6)
30line = line.Substring(prefix.Length); 37if (lines[0].Length > prefix.Length) 40var nameValue = ParseNameValue(lines[0].Substring(prefix.Length)); 60name = line.Substring(4, line.Length - 5); 101while (result < line.Length && line[result] == ' ')
ObjectModel\Build.cs (1)
115string message = buildMessageEventArgs.Message.Substring(prefix.Length);
xunit.assert (22)
EqualityAsserts.cs (4)
280 var typeNameIndent = Math.Max(expectedTypeName.Length, actualTypeName.Length); 794 var typeNameIndent = Math.Max(expectedTypeName.Length, actualTypeName.Length);
Sdk\ArgumentFormatter.cs (3)
156 var builder = new StringBuilder(s.Length); 157 for (var i = 0; i < s.Length; i++) 440 if (value.Length > MAX_STRING_LENGTH)
Sdk\AssertHelper.cs (5)
219 var end = Math.Min(start + 41, value.Length); 247 paddingLength = encoding.Length; 258 if (end < value.Length) 283 return ShortenAndEncodeString(value, (value?.Length - 1) ?? 0, out pointerIndent); 704 var prefixDot = prefix.Length == 0 ? string.Empty : prefix + ".";
Sdk\Exceptions\AllException.cs (1)
46 var maxItemIndexLength = errors.Max(x => x.Item1).ToString(CultureInfo.CurrentCulture).Length + 4; // "[#]: "
Sdk\Exceptions\CollectionException.cs (1)
48 if (text.Length != 0)
Sdk\Exceptions\EqualException.cs (2)
161 if (expected != null && expectedIndex > -1 && expectedIndex < expected.Length) 166 if (actual != null && expectedIndex > -1 && actualIndex < actual.Length)
Sdk\Exceptions\EquivalentException.cs (4)
161 Assert.GuardArgumentNotNull(nameof(memberName), memberName).Length == 0 ? string.Empty : string.Format(CultureInfo.CurrentCulture, ": Mismatched value on member '{0}'", memberName), 191 Assert.GuardArgumentNotNull(nameof(memberName), memberName).Length == 0 ? string.Empty : string.Format(CultureInfo.CurrentCulture, " in member '{0}'", memberName), 226 Assert.GuardArgumentNotNull(nameof(memberName), memberName).Length == 0 ? string.Empty : string.Format(CultureInfo.CurrentCulture, " in member '{0}'", memberName), 254 Assert.GuardArgumentNotNull(nameof(memberName), memberName).Length == 0 ? string.Empty : string.Format(CultureInfo.CurrentCulture, " in member '{0}'", memberName),
Sdk\Exceptions\XunitException.cs (1)
65 message == null || message.Length <= 0
StringAsserts.cs (1)
591 if (value.Length != 0)
xunit.console (5)
CommandLine.cs (3)
123if (line.Length == 0) continue; 130for (var j = 0; j < line.Length; j++) 136if (j >= line.Length)
common\AssemblyResolution\Microsoft.Extensions.DependencyModel\DependencyContextJsonReader.cs (1)
77if (seperatorIndex > -1 && seperatorIndex < runtimeTargetName.Length)
common\Json.cs (1)
224for (int i = 1; i < literal.Length; ++i)