637 references to FirstOrDefault
Aspire.Components.Common.Tests (1)
ConformanceTests.cs (1)
342var detail = results.Details.FirstOrDefault(x => x.HasErrors);
Aspire.Dashboard (1)
DashboardWebApplication.cs (1)
180var browserHttpsPort = dashboardOptions.Frontend.GetEndpointAddresses().FirstOrDefault(IsHttpsOrNull)?.Port;
Aspire.Dashboard.Tests (1)
Integration\ServerRetryHelper.cs (1)
87var match = unavailableEndpoints.FirstOrDefault(ep => ep.Port == i);
Aspire.EndToEnd.Tests (1)
tests\Shared\WorkloadTesting\BuildEnvironment.cs (1)
100.FirstOrDefault(File.Exists);
Aspire.Hosting (3)
Dcp\DcpOptions.cs (1)
183return assemblyMetadata?.FirstOrDefault(m => string.Equals(m.Key, key, StringComparison.OrdinalIgnoreCase))?.Value;
DistributedApplicationBuilder.cs (1)
432if (Resources.FirstOrDefault(r => string.Equals(r.Name, resource.Name, StringComparisons.ResourceName)) is { } existingResource)
DistributedApplicationOptions.cs (1)
118return assemblyMetadata?.FirstOrDefault(m => string.Equals(m.Key, key, StringComparison.OrdinalIgnoreCase))?.Value;
Aspire.Hosting.Azure (1)
AzureProvisioningResourceExtensions.cs (1)
162var parameter = infrastructure.GetParameters().FirstOrDefault(p => p.BicepIdentifier == parameterName);
Aspire.Hosting.Azure.Functions (2)
AzureFunctionsProjectResourceExtensions.cs (2)
44.FirstOrDefault(r => r.Name == storageResourceName); 57var storageAccount = infrastructure.GetProvisionableResources().OfType<StorageAccount>().FirstOrDefault(r => r.BicepIdentifier == storageResourceName)
Aspire.Hosting.Milvus.Tests (2)
AddMilvusTests.cs (2)
38.FirstOrDefault(e => e.Name == "grpc"); 69.FirstOrDefault(e => e.Name == "grpc");
Aspire.Hosting.Qdrant.Tests (3)
AddQdrantTests.cs (3)
57.FirstOrDefault(e => e.Name == "grpc"); 96.FirstOrDefault(e => e.Name == "http"); 130.FirstOrDefault(e => e.Name == "grpc");
Aspire.Hosting.Testing (1)
DistributedApplicationFactory.cs (1)
191return assemblyMetadata?.FirstOrDefault(m => string.Equals(m.Key, key, StringComparison.OrdinalIgnoreCase))?.Value;
Aspire.Hosting.Testing.Tests (1)
TestingBuilderTests.cs (1)
50var appHostType = appHostAssembly.GetTypes().FirstOrDefault(t => t.Name.EndsWith("_AppHost"))
Aspire.Microsoft.Data.SqlClient (1)
src\Vendoring\OpenTelemetry.Instrumentation.SqlClient\Shared\DiagnosticSourceInstrumentation\PropertyFetcher.cs (1)
97var property = type.DeclaredProperties.FirstOrDefault(p => string.Equals(p.Name, propertyName, StringComparison.OrdinalIgnoreCase)) ?? type.GetProperty(propertyName);
Aspire.Microsoft.EntityFrameworkCore.Cosmos (2)
src\Components\Common\EntityFrameworkUtils.cs (2)
41var oldDbContextOptionsDescriptor = builder.Services.FirstOrDefault(sd => sd.ServiceType == typeof(DbContextOptions<TContext>)); 97var oldDbContextOptionsDescriptor = builder.Services.FirstOrDefault(sd => sd.ServiceType == typeof(DbContextOptions<TContext>));
Aspire.Microsoft.EntityFrameworkCore.Cosmos.Tests (1)
EnrichCosmosDbTests.cs (1)
113var optionsDescriptor = builder.Services.FirstOrDefault(sd => sd.ServiceType == typeof(DbContextOptions<TestDbContext>));
Aspire.Microsoft.EntityFrameworkCore.SqlServer (3)
src\Components\Common\EntityFrameworkUtils.cs (2)
41var oldDbContextOptionsDescriptor = builder.Services.FirstOrDefault(sd => sd.ServiceType == typeof(DbContextOptions<TContext>)); 97var oldDbContextOptionsDescriptor = builder.Services.FirstOrDefault(sd => sd.ServiceType == typeof(DbContextOptions<TContext>));
src\Vendoring\OpenTelemetry.Instrumentation.SqlClient\Shared\DiagnosticSourceInstrumentation\PropertyFetcher.cs (1)
97var property = type.DeclaredProperties.FirstOrDefault(p => string.Equals(p.Name, propertyName, StringComparison.OrdinalIgnoreCase)) ?? type.GetProperty(propertyName);
Aspire.Microsoft.EntityFrameworkCore.SqlServer.Tests (5)
EnrichSqlServerTests.cs (5)
123var oldOptionsDescriptor = builder.Services.FirstOrDefault(sd => sd.ServiceType == typeof(DbContextOptions<TestDbContext>)); 161var oldOptionsDescriptor = builder.Services.FirstOrDefault(sd => sd.ServiceType == typeof(DbContextOptions<TestDbContext>)); 167var optionsDescriptor = builder.Services.FirstOrDefault(sd => sd.ServiceType == typeof(DbContextOptions<TestDbContext>)); 204var oldOptionsDescriptor = builder.Services.FirstOrDefault(sd => sd.ServiceType == typeof(DbContextOptions<TestDbContext>)); 254var optionsDescriptor = builder.Services.FirstOrDefault(sd => sd.ServiceType == typeof(DbContextOptions<TestDbContext>));
Aspire.Npgsql.EntityFrameworkCore.PostgreSQL (2)
src\Components\Common\EntityFrameworkUtils.cs (2)
41var oldDbContextOptionsDescriptor = builder.Services.FirstOrDefault(sd => sd.ServiceType == typeof(DbContextOptions<TContext>)); 97var oldDbContextOptionsDescriptor = builder.Services.FirstOrDefault(sd => sd.ServiceType == typeof(DbContextOptions<TContext>));
Aspire.Npgsql.EntityFrameworkCore.PostgreSQL.Tests (5)
EnrichNpgsqlTests.cs (5)
127var oldOptionsDescriptor = builder.Services.FirstOrDefault(sd => sd.ServiceType == typeof(DbContextOptions<TestDbContext>)); 166var oldOptionsDescriptor = builder.Services.FirstOrDefault(sd => sd.ServiceType == typeof(DbContextOptions<TestDbContext>)); 172var optionsDescriptor = builder.Services.FirstOrDefault(sd => sd.ServiceType == typeof(DbContextOptions<TestDbContext>)); 210var oldOptionsDescriptor = builder.Services.FirstOrDefault(sd => sd.ServiceType == typeof(DbContextOptions<TestDbContext>)); 263var optionsDescriptor = builder.Services.FirstOrDefault(sd => sd.ServiceType == typeof(DbContextOptions<TestDbContext>));
Aspire.Oracle.EntityFrameworkCore (2)
src\Components\Common\EntityFrameworkUtils.cs (2)
41var oldDbContextOptionsDescriptor = builder.Services.FirstOrDefault(sd => sd.ServiceType == typeof(DbContextOptions<TContext>)); 97var oldDbContextOptionsDescriptor = builder.Services.FirstOrDefault(sd => sd.ServiceType == typeof(DbContextOptions<TContext>));
Aspire.Oracle.EntityFrameworkCore.Tests (5)
EnrichOracleDatabaseTests.cs (5)
124var oldOptionsDescriptor = builder.Services.FirstOrDefault(sd => sd.ServiceType == typeof(DbContextOptions<TestDbContext>)); 162var oldOptionsDescriptor = builder.Services.FirstOrDefault(sd => sd.ServiceType == typeof(DbContextOptions<TestDbContext>)); 168var optionsDescriptor = builder.Services.FirstOrDefault(sd => sd.ServiceType == typeof(DbContextOptions<TestDbContext>)); 205var oldOptionsDescriptor = builder.Services.FirstOrDefault(sd => sd.ServiceType == typeof(DbContextOptions<TestDbContext>)); 255var optionsDescriptor = builder.Services.FirstOrDefault(sd => sd.ServiceType == typeof(DbContextOptions<TestDbContext>));
Aspire.Playground.Tests (1)
Infrastructure\DistributedApplicationTestFactory.cs (1)
25var appHostType = appHostAssembly.GetTypes().FirstOrDefault(t => t.Name.EndsWith("_AppHost"))
Aspire.Pomelo.EntityFrameworkCore.MySql (2)
src\Components\Common\EntityFrameworkUtils.cs (2)
41var oldDbContextOptionsDescriptor = builder.Services.FirstOrDefault(sd => sd.ServiceType == typeof(DbContextOptions<TContext>)); 97var oldDbContextOptionsDescriptor = builder.Services.FirstOrDefault(sd => sd.ServiceType == typeof(DbContextOptions<TContext>));
Aspire.Pomelo.EntityFrameworkCore.MySql.Tests (5)
EnrichMySqlTests.cs (5)
137var oldOptionsDescriptor = builder.Services.FirstOrDefault(sd => sd.ServiceType == typeof(DbContextOptions<TestDbContext>)); 175var oldOptionsDescriptor = builder.Services.FirstOrDefault(sd => sd.ServiceType == typeof(DbContextOptions<TestDbContext>)); 181var optionsDescriptor = builder.Services.FirstOrDefault(sd => sd.ServiceType == typeof(DbContextOptions<TestDbContext>)); 218var oldOptionsDescriptor = builder.Services.FirstOrDefault(sd => sd.ServiceType == typeof(DbContextOptions<TestDbContext>)); 268var optionsDescriptor = builder.Services.FirstOrDefault(sd => sd.ServiceType == typeof(DbContextOptions<TestDbContext>));
Aspire.StackExchange.Redis (1)
src\Vendoring\OpenTelemetry.Instrumentation.StackExchangeRedis\Shared\PropertyFetcher.AOT.cs (1)
103var property = type.DeclaredProperties.FirstOrDefault(p => string.Equals(p.Name, propertyName, StringComparison.OrdinalIgnoreCase)) ?? type.GetProperty(propertyName);
Aspire.Workload.Tests (1)
tests\Shared\WorkloadTesting\BuildEnvironment.cs (1)
100.FirstOrDefault(File.Exists);
BasicWebSite (1)
ContactsRepository.cs (1)
14return _contacts.FirstOrDefault(f => f.ContactId == id);
Contract.Data.IntegrationTests (1)
DataContractTests.4.1.1.cs (1)
32operation.OperationBehaviors.FirstOrDefault(
CSharpSyntaxGenerator (1)
SourceWriter.cs (1)
1164var field = fields.FirstOrDefault(f => f.Name == name);
dotnet-svcutil-lib (18)
CommandLineParser.cs (1)
66return CommandSwitch.All.FirstOrDefault(s => s.Equals(name));
FrameworkFork\System.Runtime.Serialization\System\Runtime\Serialization\DataContract.cs (3)
1551var isReferenceProperty = universalDataContractAttribute.NamedArguments?.FirstOrDefault(a => a.MemberName == "IsReference"); 1554var namespaceProperty = universalDataContractAttribute.NamedArguments?.FirstOrDefault(a => a.MemberName == "Namespace"); 1557var nameProperty = universalDataContractAttribute.NamedArguments?.FirstOrDefault(a => a.MemberName == "Name");
ImportModule.cs (1)
348importOptions.ClrNamespace = options.NamespaceMappings.FirstOrDefault(m => m.Key == "*").Value;
Metadata\MetadataDocumentLoader.cs (1)
586var chameleonSchema = chameleonSchemas.FirstOrDefault(c =>
Metadata\MetadataDocumentSaver.cs (1)
71var fileInfo = this.MetadataFiles.FirstOrDefault(fi => File.Exists(fi.FilePath));
Metadata\ServiceDescriptor.cs (1)
197ServiceEndpoint endpoint = this.Endpoints.FirstOrDefault(ep =>
Shared\MSBuildProj.cs (5)
469var itemAttribue = reference.Attributes().FirstOrDefault(item => item.Name == itemName); 476itemNameElement = reference.Elements().FirstOrDefault(item => item.Name == itemName); 491var itemAttribute = itemName.Attributes().FirstOrDefault(item => item.Name == "Include"); 505var itemAttribute = itemName.Attributes().FirstOrDefault(item => item.Name == "Include"); 803LockFileTarget target = lockFile.Targets.Count == 1 ? lockFile.Targets[0] : lockFile.Targets.FirstOrDefault(t =>
Shared\Options\ApplicationOptions.cs (1)
201this.PropertyBag.Values.FirstOrDefault(v => v.HasSameId(optionId));
Shared\Options\WCFCSUpdateOptions.cs (2)
119var item1 = properties.FirstOrDefault(p => p.Name == "Item1")?.Value.Value<string>(); 124var item2 = properties.FirstOrDefault(p => p.Name == "Item2")?.Value.Value<string>();
Shared\TargetFrameworkHelper.cs (2)
92targetFramework = targetFrameworks.FirstOrDefault((framework) => IsSupportedFramework(framework, out fxInfo) && fxInfo.IsDnx); 95targetFramework = targetFrameworks.FirstOrDefault((framework) => IsSupportedFramework(framework, out fxInfo));
dotnet-user-jwts (2)
src\Tools\Shared\SecretsHelpers\ProjectIdResolver.cs (1)
144var targetPath = searchPaths.Select(p => Path.Combine(p, "SecretManager.targets")).FirstOrDefault(File.Exists);
src\Tools\Shared\SecretsHelpers\UserSecretsCreator.cs (1)
49.FirstOrDefault(node => node is XElement el
dotnet-user-secrets (2)
src\Tools\Shared\SecretsHelpers\ProjectIdResolver.cs (1)
144var targetPath = searchPaths.Select(p => Path.Combine(p, "SecretManager.targets")).FirstOrDefault(File.Exists);
src\Tools\Shared\SecretsHelpers\UserSecretsCreator.cs (1)
49.FirstOrDefault(node => node is XElement el
FormatterWebSite (1)
ValidateBodyParameterAttribute.cs (1)
19.FirstOrDefault(parameter => IsBodyBindingSource(
Identity.DefaultUI.WebSite (1)
src\Identity\test\InMemory.Test\InMemoryUserStore.cs (1)
64user.Claims.FirstOrDefault(
IIS.FunctionalTests (1)
src\Servers\IIS\IIS\test\Common.FunctionalTests\Infrastructure\Helpers.cs (1)
187var appPool = serverManager.ApplicationPools.FirstOrDefault(ap => ap.Name == appPoolName);
IIS.LongTests (2)
src\Servers\IIS\IIS\test\Common.FunctionalTests\Infrastructure\Helpers.cs (1)
187var appPool = serverManager.ApplicationPools.FirstOrDefault(ap => ap.Name == appPoolName);
src\Servers\IIS\IIS\test\Common.LongTests\StartupTests.cs (1)
321.FirstOrDefault(e => e.Attribute("name").Value == "AspNetCoreModuleV2");
IIS.NewHandler.FunctionalTests (2)
src\Servers\IIS\IIS\test\Common.FunctionalTests\Infrastructure\Helpers.cs (1)
187var appPool = serverManager.ApplicationPools.FirstOrDefault(ap => ap.Name == appPoolName);
src\Servers\IIS\IIS\test\Common.LongTests\StartupTests.cs (1)
321.FirstOrDefault(e => e.Attribute("name").Value == "AspNetCoreModuleV2");
IIS.NewShim.FunctionalTests (2)
src\Servers\IIS\IIS\test\Common.FunctionalTests\Infrastructure\Helpers.cs (1)
187var appPool = serverManager.ApplicationPools.FirstOrDefault(ap => ap.Name == appPoolName);
src\Servers\IIS\IIS\test\Common.LongTests\StartupTests.cs (1)
321.FirstOrDefault(e => e.Attribute("name").Value == "AspNetCoreModuleV2");
IIS.ShadowCopy.Tests (1)
src\Servers\IIS\IIS\test\Common.FunctionalTests\Infrastructure\Helpers.cs (1)
187var appPool = serverManager.ApplicationPools.FirstOrDefault(ap => ap.Name == appPoolName);
IIS.Tests (1)
StrictTestServerTests.cs (1)
20if (TestSink.Writes.FirstOrDefault(w => w.LogLevel > LogLevel.Information) is WriteContext writeContext)
IISExpress.FunctionalTests (2)
src\Servers\IIS\IIS\test\Common.FunctionalTests\Infrastructure\Helpers.cs (1)
187var appPool = serverManager.ApplicationPools.FirstOrDefault(ap => ap.Name == appPoolName);
src\Servers\IIS\IIS\test\Common.LongTests\StartupTests.cs (1)
321.FirstOrDefault(e => e.Attribute("name").Value == "AspNetCoreModuleV2");
illink (6)
InMemory.FunctionalTests (1)
src\Servers\Kestrel\shared\test\ServerRetryHelper.cs (1)
72var match = unavailableEndpoints.FirstOrDefault(ep => ep.Port == i);
Interop.FunctionalTests (4)
Http3\Http3RequestTests.cs (3)
1054var badLogWrite = TestSink.Writes.FirstOrDefault(w => w.LogLevel == LogLevel.Critical); 1140var badLogWrite = TestSink.Writes.FirstOrDefault(w => w.LogLevel >= LogLevel.Critical); 1815var connectionAbortLog = logs.FirstOrDefault(
src\Servers\Kestrel\shared\test\ServerRetryHelper.cs (1)
72var match = unavailableEndpoints.FirstOrDefault(ep => ep.Port == i);
InteropTests (1)
src\Shared\Process\ProcessEx.cs (1)
231.FirstOrDefault(attribute => attribute.Key == "TestPackageRestorePath")
Microsoft.Analyzers.Extra (2)
Utilities\SyntaxNodeExtensions.cs (2)
112.FirstOrDefault(n => n.NodeHasSpecifiedMethod(semanticModel, expectedFullMethodNames)); 124.FirstOrDefault(n => n.NodeHasSpecifiedMethod(semanticModel, expectedFullMethodNames));
Microsoft.Analyzers.Local (4)
ApiLifecycle\AssemblyAnalysis.cs (4)
133var typeDef = Assembly.Types.FirstOrDefault(x => x.ModifiersAndName == typeModifiersAndName); 221var method = typeDef.Methods.FirstOrDefault(x => x.Member == methodSignature); 236var prop = typeDef.Properties.FirstOrDefault(x => x.Member == propSignature); 258var field = typeDef.Fields.FirstOrDefault(x => x.Member == fieldSignature);
Microsoft.Arcade.Common (2)
ZipArchiveManager.cs (2)
38zip.Entries.FirstOrDefault(e => e.FullName == entryName)?.Delete(); 53archive.Entries.FirstOrDefault(e => e.FullName == targetFilename)?.Delete();
Microsoft.AspNetCore.App.Analyzers (5)
Authorization\AddAuthorizationBuilderAnalyzer.cs (1)
46.FirstOrDefault(member => member is { Name: "AddAuthorization", Parameters.Length: 2 });
Authorization\AuthorizationOptionsTypes.cs (4)
25.FirstOrDefault(member => member.Name == "DefaultPolicy"); 27.FirstOrDefault(member => member.Name == "FallbackPolicy"); 29.FirstOrDefault(member => member.Name == "InvokeHandlersAfterFailure"); 32.FirstOrDefault(member => member.Name == "GetPolicy");
Microsoft.AspNetCore.App.Analyzers.Test (1)
RouteEmbeddedLanguage\FrameworkParametersCompletionProviderTests.cs (1)
845var item = result.Completions.ItemsList.FirstOrDefault(i => i.DisplayText == "id");
Microsoft.AspNetCore.Authentication.Cookies (1)
CookieAuthenticationHandler.cs (1)
166var claim = ticket.Principal.Claims.FirstOrDefault(c => c.Type.Equals(SessionIdClaim));
Microsoft.AspNetCore.Authorization.Test (3)
AuthorizationMiddlewareTests.cs (3)
829var res = AuthenticateResult.Success(new AuthenticationTicket(new ClaimsPrincipal(c.User.Identities.FirstOrDefault(i => i.AuthenticationType == scheme)), scheme)); 836var res = AuthenticateResult.Success(new AuthenticationTicket(new ClaimsPrincipal(c.User.Identities.FirstOrDefault(i => i.AuthenticationType == scheme)), scheme)); 925var res = AuthenticateResult.Success(new AuthenticationTicket(new ClaimsPrincipal(c.User.Identities.FirstOrDefault(i => i.AuthenticationType == scheme)), scheme));
Microsoft.AspNetCore.Components.Tests (1)
RendererTest.cs (1)
5788entry = entries.FirstOrDefault(e => e.Event == eventType);
Microsoft.AspNetCore.Components.WebAssembly (3)
HotReload\HotReloadAgent.cs (2)
233var assembly = AppDomain.CurrentDomain.GetAssemblies().FirstOrDefault(assembly => TryGetModuleId(assembly) is Guid moduleId && moduleId == delta.ModuleId); 243var type = assemblyTypes.FirstOrDefault(t => t.MetadataToken == updatedType);
Services\LazyAssemblyLoader.cs (1)
89var assembly = AssemblyLoadContext.Default.Assemblies.FirstOrDefault(a => a.GetName().Name == assemblyName);
Microsoft.AspNetCore.Components.WebView.Maui (1)
iOS\IOSWebViewManager.cs (1)
185 GetTopViewController(UIApplication.SharedApplication.Windows.FirstOrDefault(m => m.IsKeyWindow)?.RootViewController)?
Microsoft.AspNetCore.DataProtection (1)
XmlEncryption\XmlEncryptionExtensions.cs (1)
121var elementWhichRequiresEncryption = doc.Descendants().FirstOrDefault(DoesSingleElementRequireEncryption);
Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore (1)
MigrationsEndPointMiddleware.cs (1)
113var contextType = registeredContexts.FirstOrDefault(c => string.Equals(contextTypeName, c.AssemblyQualifiedName, StringComparison.Ordinal));
Microsoft.AspNetCore.Grpc.JsonTranscoding (1)
Internal\Json\FieldMaskConverter.cs (1)
44var firstInvalid = paths.FirstOrDefault(p => !Legacy.IsPathValid(p));
Microsoft.AspNetCore.Hosting.Tests (2)
WebHostBuilderTests.cs (2)
1301var filter = (MyStartupFilter)host.Services.GetServices<IStartupFilter>().FirstOrDefault(s => s is MyStartupFilter); 1653ServiceADescriptor = services.FirstOrDefault(s => s.ServiceType == typeof(ServiceA));
Microsoft.AspNetCore.Http.Extensions (2)
HeaderDictionaryTypeExtensions.cs (1)
303.FirstOrDefault(methodInfo =>
src\Shared\ParameterBindingMethodCache.cs (1)
484.FirstOrDefault(methodInfo => methodInfo.Name == name);
Microsoft.AspNetCore.Identity (1)
SignInManager.cs (1)
711var providerDisplayName = (await GetExternalAuthenticationSchemesAsync()).FirstOrDefault(p => p.Name == provider)?.DisplayName
Microsoft.AspNetCore.Identity.InMemory.Test (2)
InMemoryStore.cs (1)
141role.Claims.FirstOrDefault(
InMemoryUserStore.cs (1)
64user.Claims.FirstOrDefault(
Microsoft.AspNetCore.Identity.Test (1)
IdentityUIScriptsTest.cs (1)
138.FirstOrDefault(attr => string.Equals("asp-fallback-src", attr.Name, StringComparison.OrdinalIgnoreCase));
Microsoft.AspNetCore.JsonPatch (1)
Internal\PocoAdapter.cs (1)
213.FirstOrDefault(p => string.Equals(p.PropertyName, segment, StringComparison.OrdinalIgnoreCase));
Microsoft.AspNetCore.Localization (1)
RequestLocalizationMiddleware.cs (1)
191var culture = supportedCultures.FirstOrDefault(
Microsoft.AspNetCore.Mvc.Abstractions (2)
ModelBinding\ModelMetadata.cs (1)
672var property = Properties.FirstOrDefault(p =>
src\Shared\ParameterBindingMethodCache.cs (1)
484.FirstOrDefault(methodInfo => methodInfo.Name == name);
Microsoft.AspNetCore.Mvc.Core (1)
ModelBinding\Metadata\DefaultBindingMetadataProvider.cs (1)
127var mappedProperty = properties.FirstOrDefault(property =>
Microsoft.AspNetCore.Mvc.Core.Test (8)
Infrastructure\ActionSelectorTest.cs (1)
917.FirstOrDefault(x => x.ControllerName == "NonAction" && x.ActionName == actionName);
ModelBinding\Metadata\ModelAttributesTest.cs (7)
16var property = modelType.GetRuntimeProperties().FirstOrDefault(p => p.Name == nameof(BaseModel.BaseProperty)); 34var property = modelType.GetRuntimeProperties().FirstOrDefault(p => p.Name == nameof(BaseModel.TestProperty)); 64var property = modelType.GetRuntimeProperties().FirstOrDefault(p => p.Name == nameof(BaseModel.BaseProperty)); 82var property = modelType.GetRuntimeProperties().FirstOrDefault(p => p.Name == nameof(BaseModel.TestProperty)); 102var property = modelType.GetRuntimeProperties().FirstOrDefault(p => p.Name == nameof(BaseModel.VirtualProperty)); 120var property = modelType.GetRuntimeProperties().FirstOrDefault(p => p.Name == nameof(BaseModel.RouteValue)); 295var property = modelType.GetRuntimeProperties().FirstOrDefault(p => p.Name == nameof(BaseModel.RouteValue));
Microsoft.AspNetCore.Mvc.FunctionalTests (4)
TempDataInCookiesTest.cs (4)
98.FirstOrDefault(setCookieHeader => setCookieHeader.Name == CookieTempDataProvider.CookieName); 131.FirstOrDefault(setCookieHeaderValue => setCookieHeaderValue.Name == CookieTempDataProvider.CookieName); 154.FirstOrDefault(setCookieHeaderValue => setCookieHeaderValue.Name == CookieTempDataProvider.CookieName); 184.FirstOrDefault(setCookieHeaderValue => setCookieHeaderValue.Name == CookieTempDataProvider.CookieName);
Microsoft.AspNetCore.Mvc.Localization.Test (16)
MvcLocalizationMvcBuilderExtensionsTest.cs (8)
46var service = services.FirstOrDefault( 52service = services.FirstOrDefault( 59service = services.FirstOrDefault( 64service = services.FirstOrDefault( 69service = services.FirstOrDefault(sd => sd.ServiceType == typeof(IHtmlLocalizerFactory)); 74service = services.FirstOrDefault(sd => sd.ServiceType == typeof(IHtmlLocalizer<>)); 79service = services.FirstOrDefault(sd => sd.ServiceType == typeof(IViewLocalizer)); 127return services.FirstOrDefault(sd => sd.ServiceType == serviceType);
MvcLocalizationMvcCoreBuilderExtensionsTest.cs (8)
46var service = services.FirstOrDefault( 52service = services.FirstOrDefault( 59service = services.FirstOrDefault( 64service = services.FirstOrDefault( 69service = services.FirstOrDefault(sd => sd.ServiceType == typeof(IHtmlLocalizerFactory)); 74service = services.FirstOrDefault(sd => sd.ServiceType == typeof(IHtmlLocalizer<>)); 79service = services.FirstOrDefault(sd => sd.ServiceType == typeof(IViewLocalizer)); 127return services.FirstOrDefault(sd => sd.ServiceType == serviceType);
Microsoft.AspNetCore.Mvc.NewtonsoftJson (3)
DependencyInjection\NewtonsoftJsonMvcCoreBuilderExtensions.cs (3)
64var jsonResultExecutor = services.FirstOrDefault(f => 75var tempDataSerializer = services.FirstOrDefault(f => 89var jsonHelper = services.FirstOrDefault(
Microsoft.AspNetCore.Mvc.Razor (2)
ApplicationParts\RazorCompiledItemFeatureProvider.cs (2)
24.FirstOrDefault(g => g.Count() > 1); 63.FirstOrDefault(a => a.Key == "Identifier");
Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation (4)
ChecksumValidator.cs (1)
44.FirstOrDefault(c => string.Equals(item.Identifier, c.Identifier, StringComparison.OrdinalIgnoreCase));
CompilationFailedExceptionFactory.cs (1)
104sourceDocument = codeDocument.Imports.FirstOrDefault(f => string.Equals(f.FilePath, filePath, StringComparison.Ordinal));
DependencyInjection\RazorRuntimeCompilationMvcCoreBuilderExtensions.cs (2)
60var compilerProvider = services.FirstOrDefault(f => 73var actionDescriptorProvider = services.FirstOrDefault(f =>
Microsoft.AspNetCore.Mvc.RazorPages (2)
ApplicationModels\CompiledPageRouteModelProvider.cs (1)
126.FirstOrDefault(f => f.Key == RouteTemplateKey)
DependencyInjection\MvcRazorPagesMvcCoreBuilderExtensions.cs (1)
94var actionDescriptorProvider = services.FirstOrDefault(f =>
Microsoft.AspNetCore.Mvc.ViewFeatures (1)
DefaultHtmlGenerator.cs (1)
746modelError = modelErrors.FirstOrDefault(m => !string.IsNullOrEmpty(m.ErrorMessage)) ?? modelErrors[0];
Microsoft.AspNetCore.OpenApi (1)
src\Shared\ParameterBindingMethodCache.cs (1)
484.FirstOrDefault(methodInfo => methodInfo.Name == name);
Microsoft.AspNetCore.Server.IntegrationTesting (1)
src\Shared\Process\ProcessEx.cs (1)
231.FirstOrDefault(attribute => attribute.Key == "TestPackageRestorePath")
Microsoft.AspNetCore.Server.IntegrationTesting.IIS (1)
XElementExtensions.cs (1)
35var existing = element.Elements(name).FirstOrDefault(e => e.Attribute(attribute)?.Value == attributeValue);
Microsoft.AspNetCore.Server.Kestrel.Core.Tests (1)
src\Servers\Kestrel\shared\test\ServerRetryHelper.cs (1)
72var match = unavailableEndpoints.FirstOrDefault(ep => ep.Port == i);
Microsoft.AspNetCore.Server.Kestrel.Transport.Quic.Tests (1)
src\Servers\Kestrel\shared\test\ServerRetryHelper.cs (1)
72var match = unavailableEndpoints.FirstOrDefault(ep => ep.Port == i);
Microsoft.AspNetCore.SignalR.Client.SourceGenerator (1)
HubClientProxyGenerator.Parser.cs (1)
255&& memberAccess.Parent.ChildNodes().FirstOrDefault(x => x is ArgumentListSyntax) is
Microsoft.AspNetCore.SignalR.Tests (1)
HttpHeaderConnectionHandler.cs (1)
26var headerValues = headers.FirstOrDefault(h => string.Equals(h.Key, headerName, StringComparison.OrdinalIgnoreCase)).Value.ToArray();
Microsoft.AspNetCore.SignalR.Tests.Utils (1)
src\Shared\SignalR\WrappingLoggerFactory.cs (1)
107if (logScope.FirstOrDefault(kv => kv.Key == "TransportConnectionId" || kv.Key == "ClientConnectionId").Value is string id)
Microsoft.AspNetCore.StaticAssets.Tests (2)
StaticAssetsIntegrationTests.cs (2)
212var integrity = descriptors[0].Properties.FirstOrDefault(p => p.Name == "integrity"); 269var integrity = descriptors[0].Properties.FirstOrDefault(p => p.Name == "integrity");
Microsoft.AspNetCore.Testing (1)
ServiceFakesHostExtensions.cs (1)
40var uri = GetListenUris(host.Services.GetRequiredService<IServer>()).FirstOrDefault(addressFilter)
Microsoft.AspNetCore.WebSockets.ConformanceTests (1)
Autobahn\AutobahnTester.cs (1)
112var serverExpectation = _expectations.FirstOrDefault(e => e.Server == serverResult.Server && e.Ssl == serverResult.Ssl);
Microsoft.Build (15)
BackEnd\BuildManager\BuildManager.cs (1)
3025ForwardingLoggerRecord? configurableLogger = result.FirstOrDefault(l =>
BackEnd\Components\Scheduler\Scheduler.cs (2)
2033SchedulableRequest parentRequest = _schedulingData.BlockedRequests.FirstOrDefault(r => r.BuildRequest.GlobalRequestId == request.ParentGlobalRequestId) 2034?? _schedulingData.ExecutingRequests.FirstOrDefault(r => r.BuildRequest.GlobalRequestId == request.ParentGlobalRequestId);
BuildCheck\Checks\PropertiesUsageCheck.cs (3)
49var config = configurationContext.CheckConfig.FirstOrDefault(c => c.RuleId == _usedBeforeInitializedRule.Id) 55config = configurationContext.CheckConfig.FirstOrDefault(c => c.RuleId == _unusedPropertyRule.Id) 61config = configurationContext.CheckConfig.FirstOrDefault(c => c.RuleId == _usedBeforeInitializedRule.Id)
BuildCheck\Infrastructure\CheckWrapper.cs (1)
123_ruleTelemetryData.FirstOrDefault(td => td.RuleId.Equals(configurationEffective.RuleId));
BuildEnvironmentHelper.cs (1)
337.FirstOrDefault(env => env != null);
Construction\ProjectRootElement.cs (1)
933ImportGroupsReversed.FirstOrDefault(importGroup => importGroup.Condition.Length <= 0);
Construction\Solution\SolutionFile.cs (1)
429SolutionPropertyBag websiteProperties = projectModel?.Properties.FirstOrDefault(p => p.Id == "WebsiteProperties");
Definition\ProjectCollection.cs (2)
1390Project conflictingProject = GetLoadedProjects(false, null).FirstOrDefault(project => project.UsesProjectRootElement(projectRootElement)); 1542Project conflictingProject = GetLoadedProjects(false, null).FirstOrDefault(project => project.UsesProjectRootElement(projectRootElement));
Definition\Toolset.cs (1)
810subToolsetVersion = SubToolsets.Keys.FirstOrDefault(version => visualStudioVersionFromSolutionAsVersion.Equals(VersionUtilities.ConvertToVersion(version)));
Graph\GraphBuilder.cs (1)
402var partiallyMarchedConfig = projectConfigs.FirstOrDefault(pc => pc.Value.ConfigurationName.Equals(solutionConfig.ConfigurationName, StringComparison.OrdinalIgnoreCase)).Value;
Instance\TaskRegistry.cs (1)
770taskRecords.FirstOrDefault(r =>
Microsoft.Build.BuildCheck.UnitTests (1)
EndToEndTests.cs (1)
139KeyValuePair<string, JsonNode?> resource = output.DepsJsonResources.FirstOrDefault(
Microsoft.Build.Engine.OM.UnitTests (24)
BuildEnvironmentHelper.cs (1)
337.FirstOrDefault(env => env != null);
Construction\ProjectItemElement_Tests.cs (2)
359ProjectItemGroupElement itemGroup = (ProjectItemGroupElement)projectElement.AllChildren.FirstOrDefault(c => c is ProjectItemGroupElement); 412ProjectItemGroupElement itemGroup = (ProjectItemGroupElement)projectElement.AllChildren.FirstOrDefault(c => c is ProjectItemGroupElement);
Construction\ProjectMetadataElement_Tests.cs (18)
301ProjectItemGroupElement itemGroup = (ProjectItemGroupElement)projectElement.AllChildren.FirstOrDefault(c => c is ProjectItemGroupElement); 328ProjectItemDefinitionGroupElement itemDefinitionGroup = (ProjectItemDefinitionGroupElement)projectElement.AllChildren.FirstOrDefault(c => c is ProjectItemDefinitionGroupElement); 429ProjectItemGroupElement itemGroup = (ProjectItemGroupElement)projectElement.AllChildren.FirstOrDefault(c => c is ProjectItemGroupElement); 454ProjectItemDefinitionGroupElement itemDefinitionGroup = (ProjectItemDefinitionGroupElement)projectElement.AllChildren.FirstOrDefault(c => c is ProjectItemDefinitionGroupElement); 488ProjectItemGroupElement itemGroup = (ProjectItemGroupElement)projectElement.AllChildren.FirstOrDefault(c => c is ProjectItemGroupElement); 513ProjectItemDefinitionGroupElement itemDefinitionGroup = (ProjectItemDefinitionGroupElement)projectElement.AllChildren.FirstOrDefault(c => c is ProjectItemDefinitionGroupElement); 563ProjectItemGroupElement itemGroup = (ProjectItemGroupElement)projectElement.AllChildren.FirstOrDefault(c => c is ProjectItemGroupElement); 606ProjectItemDefinitionGroupElement itemDefinitionGroup = (ProjectItemDefinitionGroupElement)projectElement.AllChildren.FirstOrDefault(c => c is ProjectItemDefinitionGroupElement); 680ProjectItemGroupElement itemGroup = (ProjectItemGroupElement)projectElement.AllChildren.FirstOrDefault(c => c is ProjectItemGroupElement); 723ProjectItemDefinitionGroupElement itemDefinitionGroup = (ProjectItemDefinitionGroupElement)projectElement.AllChildren.FirstOrDefault(c => c is ProjectItemDefinitionGroupElement); 809ProjectItemGroupElement itemGroup = (ProjectItemGroupElement)projectElement.AllChildren.FirstOrDefault(c => c is ProjectItemGroupElement); 872ProjectItemDefinitionGroupElement itemDefinitionGroup = (ProjectItemDefinitionGroupElement)projectElement.AllChildren.FirstOrDefault(c => c is ProjectItemDefinitionGroupElement); 941ProjectItemGroupElement itemGroup = (ProjectItemGroupElement)projectElement.AllChildren.FirstOrDefault(c => c is ProjectItemGroupElement); 984ProjectItemDefinitionGroupElement itemDefinitionGroup = (ProjectItemDefinitionGroupElement)projectElement.AllChildren.FirstOrDefault(c => c is ProjectItemDefinitionGroupElement); 1056ProjectItemGroupElement itemGroup = (ProjectItemGroupElement)projectElement.AllChildren.FirstOrDefault(c => c is ProjectItemGroupElement); 1096ProjectItemDefinitionGroupElement itemDefinitionGroup = (ProjectItemDefinitionGroupElement)projectElement.AllChildren.FirstOrDefault(c => c is ProjectItemDefinitionGroupElement); 1167ProjectItemGroupElement itemGroup = (ProjectItemGroupElement)projectElement.AllChildren.FirstOrDefault(c => c is ProjectItemGroupElement); 1214ProjectItemDefinitionGroupElement itemDefinitionGroup = (ProjectItemDefinitionGroupElement)projectElement.AllChildren.FirstOrDefault(c => c is ProjectItemDefinitionGroupElement);
Construction\SolutionFile_Tests.cs (3)
274.FirstOrDefault(p => p.RelativePath == ConvertToUnixPathIfNeeded("ClassLibrary1\\ClassLibrary1.csproj")); 280.FirstOrDefault(p => p.RelativePath == ConvertToUnixPathIfNeeded("MyPhysicalFolder\\ClassLibrary1\\ClassLibrary1.csproj")); 285.FirstOrDefault(p => p.RelativePath == ConvertToUnixPathIfNeeded("ClassLibrary2\\ClassLibrary2.csproj"));
Microsoft.Build.Engine.UnitTests (3)
Graph\GraphTestingUtilities.cs (1)
143return GetNodesWithProjectNumber(graph, projectNumber).FirstOrDefault(i => i.ProjectType == ProjectInterpretation.ProjectType.OuterBuild);
Graph\ProjectGraph_Tests.cs (1)
2220var innerBuild1WithReferenceToInnerBuild2 = outerBuild1.ProjectReferences.FirstOrDefault(n => n.ProjectType == ProjectInterpretation.ProjectType.InnerBuild && n.ProjectInstance.GlobalProperties[InnerBuildPropertyName] == "a");
WarningsAsMessagesAndErrors_Tests.cs (1)
247BuildMessageEventArgs actualEvent = logger.BuildMessageEvents.FirstOrDefault(i => i.Message.Equals(ExpectedEventMessage));
Microsoft.Build.Tasks.CodeAnalysis.UnitTests (1)
TestUtilities\DotNetSdkTestBase.cs (1)
78dotnetInstallDir = Environment.GetEnvironmentVariable("PATH")?.Split(Path.PathSeparator).FirstOrDefault(isMatchingDotNetInstance);
Microsoft.Build.Tasks.Core (11)
AssemblyDependency\GenerateBindingRedirects.cs (3)
76.FirstOrDefault(e => e.Name.LocalName == "runtime"); 213.FirstOrDefault(e => e.Name.LocalName == "assemblyIdentity"); 226.FirstOrDefault(e => e.Name.LocalName == "bindingRedirect");
BuildEnvironmentHelper.cs (1)
337.FirstOrDefault(env => env != null);
RoslynCodeTaskFactory\RoslynCodeTaskFactory.cs (5)
175TaskType = exportedTypes.FirstOrDefault(type => type.Name.Equals(taskName, StringComparison.OrdinalIgnoreCase)) 176?? exportedTypes.Where(i => i.FullName != null).FirstOrDefault(type => type.FullName.Equals(taskName, StringComparison.OrdinalIgnoreCase) || type.FullName.EndsWith(taskName, StringComparison.OrdinalIgnoreCase)); 348XAttribute includeAttribute = child.Attributes().FirstOrDefault(i => i.Name.LocalName.Equals("Include")); 362XAttribute namespaceAttribute = child.Attributes().FirstOrDefault(i => i.Name.LocalName.Equals("Namespace")); 570.FirstOrDefault(p => File.Exists(Path.Combine(p, assemblyFileName)));
RoslynCodeTaskFactory\RoslynCodeTaskFactoryCompilers.cs (1)
43return possibleLocations.Select(possibleLocation => possibleLocation()).FirstOrDefault(File.Exists);
WriteCodeFragment.cs (1)
496var allStringParameters = candidates.FirstOrDefault(c => c.All(t => t == typeof(string)));
Microsoft.Build.UnitTests.Shared (1)
EnvironmentProvider.cs (1)
67.FirstOrDefault(File.Exists);
Microsoft.Build.Utilities.Core (4)
BuildEnvironmentHelper.cs (1)
337.FirstOrDefault(env => env != null);
ToolLocationHelper.cs (2)
1591.FirstOrDefault<TargetPlatformSDK>(platform => 1601matchingSdk = targetPlatforms.FirstOrDefault<TargetPlatformSDK>(platform => platform.ContainsPlatform(targetPlatformIdentifier, versionString));
ToolTask.cs (1)
1332.FirstOrDefault(fullPath => !string.IsNullOrEmpty(fullPath) && FileSystems.Default.FileExists(fullPath));
Microsoft.Cci.Extensions (6)
Extensions\CSharp\CSharpCciExtensions.cs (1)
790return attributes.FirstOrDefault(a => a.Type.AreEquivalent(attributeName));
HostEnvironment.cs (3)
258.FirstOrDefault(ai => !consideredIdentities.Contains(ai)); 482var coreAssemblyFile = contractSet.FirstOrDefault(c => Path.GetFileNameWithoutExtension(c).EndsWith(coreAssemblySimpleName, StringComparison.OrdinalIgnoreCase) == true); 668var coreIdentity = identities.FirstOrDefault(ai => StringComparer.OrdinalIgnoreCase.Equals(ai.Name.Value, coreAssemblySimpleName));
Writers\CSharp\CSharpWriter.cs (2)
150WriteMemberGroupHeader(types.FirstOrDefault(Filter.Include) as ITypeDefinitionMember); 187WriteMemberGroupHeader(members.FirstOrDefault(Filter.Include));
Microsoft.CodeAnalysis (1)
TreeDumper.cs (1)
253return Children.FirstOrDefault(c => c.Text == child);
Microsoft.CodeAnalysis.CodeStyle (9)
src\Analyzers\Core\Analyzers\RemoveUnnecessaryImports\AbstractRemoveUnnecessaryImportsDiagnosticAnalyzer.cs (1)
127var tree = compilation.SyntaxTrees.FirstOrDefault(tree => !GeneratedCodeUtilities.IsGeneratedCode(tree, IsRegularCommentOrDocComment, context.CancellationToken));
src\Analyzers\Core\Analyzers\UseIsNullCheck\AbstractUseIsNullForReferenceEqualsDiagnosticAnalyzer.cs (1)
39.FirstOrDefault(m => m.DeclaredAccessibility == Accessibility.Public &&
src\Analyzers\Core\Analyzers\UseNullPropagation\AbstractUseNullPropagationDiagnosticAnalyzer.cs (1)
98.FirstOrDefault(m => m is { DeclaredAccessibility: Accessibility.Public, Parameters.Length: 2 });
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\INamedTypeSymbolExtensions.cs (1)
72.FirstOrDefault(s => symbol.Equals(s.GetOverriddenMember()));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\IPropertySymbolExtensions.cs (1)
14.FirstOrDefault(f => property.Equals(f.AssociatedSymbol));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\FlowAnalysis\SymbolUsageAnalysis\SymbolUsageAnalysis.cs (1)
46.FirstOrDefault(o => Equals((o as ILocalFunctionOperation)?.Symbol, localFunction));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\BottomUpBaseIndentationFinder.cs (1)
266var match = list.FirstOrDefault(o => o != null && o.Tokens.Contains(token));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\ChainedFormattingRules.cs (1)
106key => key.type.GetRuntimeMethods().FirstOrDefault(method => method.Name == key.name)?.DeclaringType);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\SyntaxFacts\AbstractDocumentationCommentService.cs (1)
67.FirstOrDefault(e => GetName(e).ToString() == "summary");
Microsoft.CodeAnalysis.CodeStyle.Fixes (5)
src\Analyzers\Core\CodeFixes\MakeMethodSynchronous\AbstractMakeMethodSynchronousCodeFixProvider.cs (1)
142var referencedSymbol = references.FirstOrDefault(r => Equals(r.Definition, methodSymbol));
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\CodeGenerationHelpers.cs (1)
221var beforeMember = declarationList.FirstOrDefault(m => m.Span.End >= info.Context.BeforeThisLocation.SourceSpan.End);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Extensions\ProjectExtensions.cs (1)
107return project.AnalyzerConfigDocuments.FirstOrDefault(d => d.FilePath == analyzerConfigPath);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\LanguageServices\MoveDeclarationNearReference\AbstractMoveDeclarationNearReferenceService.State.cs (1)
128FirstStatementAffectedInInnermostBlock = InnermostBlockStatements.Cast<TStatementSyntax>().FirstOrDefault(allAffectedStatements.Contains);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\LanguageServices\SemanticsFactsService\AbstractSemanticFactsService.cs (1)
77var container = containerOpt ?? location.AncestorsAndSelf().FirstOrDefault(
Microsoft.CodeAnalysis.CSharp.CodeStyle (7)
src\Analyzers\CSharp\Analyzers\UseIndexOrRangeOperator\CSharpUseRangeOperatorDiagnosticAnalyzer.InfoCache.cs (4)
48.FirstOrDefault(IsTwoArgumentSliceLikeMethod); 58.FirstOrDefault(IsTwoArgumentSliceLikeMethod); 113.FirstOrDefault(IsTwoArgumentSliceLikeMethod); 163.FirstOrDefault(s => IsTwoArgumentSliceLikeMethod(s));
src\Analyzers\CSharp\Analyzers\UsePatternMatching\CSharpAsAndNullCheckDiagnosticAnalyzer.cs (1)
201var comparisonEnclosingBlock = comparison.AncestorsAndSelf().FirstOrDefault(n => n is BlockSyntax);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\ILocalSymbolExtensions.cs (1)
17.FirstOrDefault(node => node.Kind() is SyntaxKind.LocalFunctionStatement or SyntaxKind.MethodDeclaration);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Rules\ElasticTriviaFormattingRule.cs (1)
255var firstNonWhitespaceTrivia = triviaList.FirstOrDefault(trivia => !IsWhitespace(trivia));
Microsoft.CodeAnalysis.CSharp.CodeStyle.Fixes (12)
src\Analyzers\CSharp\CodeFixes\ConvertToAsync\CSharpConvertToAsyncMethodCodeFixProvider.cs (1)
65var invocationExpression = node.ChildNodes().FirstOrDefault(n => n.IsKind(SyntaxKind.InvocationExpression));
src\Analyzers\CSharp\CodeFixes\ConvertToRecord\ConvertToRecordEngine.cs (3)
200var equalsOp = (OperatorDeclarationSyntax?)typeDeclaration.Members.FirstOrDefault(member 202var notEqualsOp = (OperatorDeclarationSyntax?)typeDeclaration.Members.FirstOrDefault(member 285var iEquatableItem = typeList.FirstOrDefault(baseItem
src\Analyzers\CSharp\CodeFixes\DocumentationComments\CSharpAddDocCommentNodesCodeFixProvider.cs (1)
63.FirstOrDefault(f => f is ParameterListSyntax);
src\Analyzers\CSharp\CodeFixes\GenerateVariable\CSharpGenerateVariableCodeFixProvider.cs (1)
44var nameNode = node.ChildNodes().FirstOrDefault(n => n.IsKind(SyntaxKind.IdentifierName));
src\Analyzers\CSharp\CodeFixes\UsePrimaryConstructor\CSharpUsePrimaryConstructorCodeFixProvider.cs (1)
267var inKeyword = current.Modifiers.FirstOrDefault(t => t.Kind() == SyntaxKind.InKeyword);
src\Analyzers\CSharp\CodeFixes\UsePrimaryConstructor\CSharpUsePrimaryConstructorCodeFixProvider_DocComments.cs (1)
179var (removedMember, (memberDeclaration, _)) = removedMembers.FirstOrDefault(kvp => kvp.Key.Name == memberName);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\CSharpCodeGenerationHelpers.cs (1)
155=> members.FirstOrDefault(m => m is MethodDeclarationSyntax);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\ContextQuery\SyntaxTreeExtensions.cs (1)
881var firstConstructorConstraint = constraintClause.Constraints.FirstOrDefault(t => t is ConstructorConstraintSyntax);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\LanguageServices\CSharpTypeInferenceService.TypeInferrer.cs (2)
2133.FirstOrDefault(label => label.Kind() == SyntaxKind.CaseSwitchLabel) is CaseSwitchLabelSyntax firstCase) 2211var container = afterNode.AncestorsAndSelf().FirstOrDefault(a => a is BlockSyntax or SwitchSectionSyntax);
Microsoft.CodeAnalysis.CSharp.CommandLine.UnitTests (1)
CommandLineTests.cs (1)
68.FirstOrDefault(assembly => !assembly.IsDynamic && assembly.Location.EndsWith("netstandard.dll")).Location;
Microsoft.CodeAnalysis.CSharp.Emit3.UnitTests (2)
Attributes\AttributeTests_NativeInteger.cs (1)
1609return reader.GetCustomAttribute(handles.FirstOrDefault(h => GetAttributeConstructorName(reader, h) == name));
Attributes\AttributeTests_Nullable.cs (1)
5418return reader.GetCustomAttribute(handles.FirstOrDefault(h => GetAttributeConstructorName(reader, h) == name));
Microsoft.CodeAnalysis.CSharp.Features (24)
ChangeSignature\CSharpChangeSignatureService.cs (2)
247var matchingNode = node.AncestorsAndSelf().FirstOrDefault(n => _updatableAncestorKinds.Contains(n.Kind())); 813var nameAttribute = paramNode.StartTag.Attributes.FirstOrDefault(a => a.Name.ToString().Equals("name", StringComparison.OrdinalIgnoreCase));
ConvertAutoPropertyToFullProperty\CSharpConvertAutoPropertyToFullPropertyCodeRefactoringProvider.cs (2)
72=> (accessorListSyntax.Accessors.FirstOrDefault(a => a.IsKind(SyntaxKind.GetAccessorDeclaration)), 73accessorListSyntax.Accessors.FirstOrDefault(a => a.Kind() is SyntaxKind.SetAccessorDeclaration or SyntaxKind.InitAccessorDeclaration));
ConvertProgram\ConvertProgramTransform_ProgramMain.cs (1)
39var oldClassDeclaration = root.Members.OfType<ClassDeclarationSyntax>().FirstOrDefault(IsProgramClass);
Debugging\CSharpProximityExpressionsService.Worker.cs (1)
220var statementAncestor = _parentStatement.Ancestors().OfType<StatementSyntax>().FirstOrDefault(node => !node.IsKind(SyntaxKind.Block));
EditAndContinue\BreakpointSpans.cs (1)
201var baseInitializer = (PrimaryConstructorBaseTypeSyntax?)typeDeclaration.BaseList?.Types.FirstOrDefault(t => t.IsKind(SyntaxKind.PrimaryConstructorBaseType));
GenerateConstructors\CSharpGenerateConstructorsCodeRefactoringProvider.cs (1)
65var getAccessor = propertyDeclaration.AccessorList?.Accessors.FirstOrDefault(a => a.Kind() == SyntaxKind.GetAccessorDeclaration);
GenerateType\CSharpGenerateTypeService.cs (1)
392var firstVarDeclWithInitializer = variableDeclaration.Variables.FirstOrDefault(var => var.Initializer != null && var.Initializer.Value != null);
IntroduceVariable\CSharpIntroduceVariableService_IntroduceLocal.cs (1)
40: expression.Ancestors().FirstOrDefault(s => s is BlockSyntax or ArrowExpressionClauseSyntax or LambdaExpressionSyntax);
QuickInfo\CSharpSyntacticQuickInfoProvider.cs (1)
68var openBrace = parent.ChildNodesAndTokens().FirstOrDefault(n => n.Kind() == SyntaxKind.OpenBraceToken).AsToken();
src\Analyzers\CSharp\Analyzers\UseIndexOrRangeOperator\CSharpUseRangeOperatorDiagnosticAnalyzer.InfoCache.cs (4)
48.FirstOrDefault(IsTwoArgumentSliceLikeMethod); 58.FirstOrDefault(IsTwoArgumentSliceLikeMethod); 113.FirstOrDefault(IsTwoArgumentSliceLikeMethod); 163.FirstOrDefault(s => IsTwoArgumentSliceLikeMethod(s));
src\Analyzers\CSharp\Analyzers\UsePatternMatching\CSharpAsAndNullCheckDiagnosticAnalyzer.cs (1)
201var comparisonEnclosingBlock = comparison.AncestorsAndSelf().FirstOrDefault(n => n is BlockSyntax);
src\Analyzers\CSharp\CodeFixes\ConvertToAsync\CSharpConvertToAsyncMethodCodeFixProvider.cs (1)
65var invocationExpression = node.ChildNodes().FirstOrDefault(n => n.IsKind(SyntaxKind.InvocationExpression));
src\Analyzers\CSharp\CodeFixes\ConvertToRecord\ConvertToRecordEngine.cs (3)
200var equalsOp = (OperatorDeclarationSyntax?)typeDeclaration.Members.FirstOrDefault(member 202var notEqualsOp = (OperatorDeclarationSyntax?)typeDeclaration.Members.FirstOrDefault(member 285var iEquatableItem = typeList.FirstOrDefault(baseItem
src\Analyzers\CSharp\CodeFixes\DocumentationComments\CSharpAddDocCommentNodesCodeFixProvider.cs (1)
63.FirstOrDefault(f => f is ParameterListSyntax);
src\Analyzers\CSharp\CodeFixes\GenerateVariable\CSharpGenerateVariableCodeFixProvider.cs (1)
44var nameNode = node.ChildNodes().FirstOrDefault(n => n.IsKind(SyntaxKind.IdentifierName));
src\Analyzers\CSharp\CodeFixes\UsePrimaryConstructor\CSharpUsePrimaryConstructorCodeFixProvider.cs (1)
267var inKeyword = current.Modifiers.FirstOrDefault(t => t.Kind() == SyntaxKind.InKeyword);
src\Analyzers\CSharp\CodeFixes\UsePrimaryConstructor\CSharpUsePrimaryConstructorCodeFixProvider_DocComments.cs (1)
179var (removedMember, (memberDeclaration, _)) = removedMembers.FirstOrDefault(kvp => kvp.Key.Name == memberName);
Microsoft.CodeAnalysis.CSharp.Workspaces (9)
CodeGeneration\CSharpSyntaxGenerator.cs (3)
1851var clause = clauses.FirstOrDefault(c => c.Name.Identifier.ToString() == typeParameterName); 2582return accessorList?.Accessors.FirstOrDefault(a => a.IsKind(kind)); 2592var acc = accessorList.Accessors.FirstOrDefault(a => a.IsKind(kind));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\ILocalSymbolExtensions.cs (1)
17.FirstOrDefault(node => node.Kind() is SyntaxKind.LocalFunctionStatement or SyntaxKind.MethodDeclaration);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Rules\ElasticTriviaFormattingRule.cs (1)
255var firstNonWhitespaceTrivia = triviaList.FirstOrDefault(trivia => !IsWhitespace(trivia));
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\CSharpCodeGenerationHelpers.cs (1)
155=> members.FirstOrDefault(m => m is MethodDeclarationSyntax);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\ContextQuery\SyntaxTreeExtensions.cs (1)
881var firstConstructorConstraint = constraintClause.Constraints.FirstOrDefault(t => t is ConstructorConstraintSyntax);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\LanguageServices\CSharpTypeInferenceService.TypeInferrer.cs (2)
2133.FirstOrDefault(label => label.Kind() == SyntaxKind.CaseSwitchLabel) is CaseSwitchLabelSyntax firstCase) 2211var container = afterNode.AncestorsAndSelf().FirstOrDefault(a => a is BlockSyntax or SwitchSectionSyntax);
Microsoft.CodeAnalysis.EditorFeatures (3)
EditAndContinue\EditAndContinueLanguageService.cs (1)
289var projectId = solution.Projects.FirstOrDefault(project => project.FilePath == path)?.Id;
EditorConfigSettings\Updater\SettingsUpdaterBase.cs (1)
77.FirstOrDefault(d => d.FilePath == EditorconfigPath);
InlineRename\InlineRenameSession.cs (1)
178_triggerView = textBufferAssociatedViewService.GetAssociatedTextViews(triggerSpan.Snapshot.TextBuffer).FirstOrDefault(v => v.HasAggregateFocus) ??
Microsoft.CodeAnalysis.EditorFeatures.Test.Utilities (4)
Completion\AbstractCompletionProviderTests.cs (1)
1022var item = completionList.ItemsList.FirstOrDefault(i => i.DisplayText == expectedItem);
Diagnostics\GenerateType\GenerateTypeTestState.cs (2)
46ProjectToBeModified = Workspace.CurrentSolution.Projects.FirstOrDefault(proj => proj.Name.Equals(projectToBeModified)); 57ExistingDocument = ProjectToBeModified.Documents.FirstOrDefault(doc => doc.Name.Equals(existingFileName));
Workspaces\EditorTestWorkspace.cs (1)
360var documentWithSpan = baseDocuments.FirstOrDefault(d => d.AnnotatedSpans.ContainsKey(spanName));
Microsoft.CodeAnalysis.EditorFeatures.UnitTests (2)
CodeActions\CodeChangeProviderMetadataTests.cs (1)
167.FirstOrDefault(exportedType => exportedTypeName.Equals(exportedType.ContractName));
CodeGeneration\CodeGenerationTests.cs (1)
920return token.Parent.AncestorsAndSelf().OfType<T>().FirstOrDefault(t => !fullSpanCoverage || t.Span.End >= destSpan.End);
Microsoft.CodeAnalysis.EditorFeatures.Wpf (1)
SignatureHelp\Controller.Session_UpdateModel.cs (1)
93var result = filteredItems.FirstOrDefault(i => IsApplicable(i, syntacticArgumentCount, name, isCaseSensitive));
Microsoft.CodeAnalysis.ExpressionEvaluator.ExpressionCompiler (1)
PDB\MethodDebugInfo.Native.cs (1)
454var localSlot0 = scopes.SelectMany(scope => scope.GetLocals()).FirstOrDefault(variable => variable.GetSlot() == 0);
Microsoft.CodeAnalysis.ExpressionEvaluator.ResultProvider.Utilities (4)
Debugger\Engine\DkmClrRuntimeInstance.cs (2)
69var module = this.Modules.FirstOrDefault(m => m.Assembly == assembly) ?? DefaultModule; 127return this.Modules.FirstOrDefault(m => m.Mvid == mvid) ?? DefaultModule;
Debugger\Engine\DkmClrType.cs (1)
267var attributeData = type.GetCustomAttributesData().FirstOrDefault(data => data.AttributeType == typeof(DebuggerDisplayAttribute));
ReflectionUtilities.cs (1)
76return _assemblies.FirstOrDefault(a => a.FullName == name);
Microsoft.CodeAnalysis.ExternalAccess.FSharp (1)
LanguageServices\FSharpVisualStudioWorkspaceExtensions.cs (1)
44return workspace.CurrentSolution.Projects.FirstOrDefault(p => p.FilePath == filePath)?.Id ?? ProjectId.CreateNewId("ProjectNotFound");
Microsoft.CodeAnalysis.Features (8)
Completion\Providers\ImportCompletionProvider\AbstractExtensionMethodImportCompletionProvider.cs (1)
92receiverTypeSymbol = errorTypeSymbol.CandidateSymbols.Select(GetSymbolType).FirstOrDefault(s => s != null);
ConvertAutoPropertyToFullProperty\AbstractConvertAutoPropertyToFullPropertyCodeRefactoringProvider.cs (1)
59var field = fields.FirstOrDefault(f => propertySymbol.Equals(f.AssociatedSymbol));
ConvertForToForEach\AbstractConvertForToForEachCodeRefactoringProvider.cs (1)
468var containingFunction = node.AncestorsAndSelf().FirstOrDefault(
EditAndContinue\AbstractEditAndContinueAnalyzer.cs (1)
571var syntaxError = syntaxDiagnostics.FirstOrDefault(d => d.Severity == DiagnosticSeverity.Error);
IntroduceVariable\AbstractIntroduceVariableService.State.cs (1)
220var declaration = equalsValue.AncestorsAndSelf().FirstOrDefault(n => syntaxFacts.IsLocalDeclarationStatement(n) || syntaxFacts.IsFieldDeclaration(n));
src\Analyzers\Core\Analyzers\UseIsNullCheck\AbstractUseIsNullForReferenceEqualsDiagnosticAnalyzer.cs (1)
39.FirstOrDefault(m => m.DeclaredAccessibility == Accessibility.Public &&
src\Analyzers\Core\Analyzers\UseNullPropagation\AbstractUseNullPropagationDiagnosticAnalyzer.cs (1)
98.FirstOrDefault(m => m is { DeclaredAccessibility: Accessibility.Public, Parameters.Length: 2 });
StackTraceExplorer\AbstractStackTraceSymbolResolver.cs (1)
114.FirstOrDefault(m => MatchParameters(m.Parameters, methodArguments));
Microsoft.CodeAnalysis.LanguageServer.Protocol (4)
Handler\Completion\CompletionResolveHandler.cs (1)
93.FirstOrDefault(cachedCompletionItem => MatchesLSPCompletionItem(completionItem, cachedCompletionItem));
Handler\InlineCompletions\XmlSnippetParser.CodeSnippet.cs (3)
98return element?.Elements().FirstOrDefault(e => e.Name.LocalName.Equals(localName, StringComparison.OrdinalIgnoreCase)); 144var delimiterAttribute = code.Attributes().FirstOrDefault(a => a.Name.LocalName.Equals("Delimiter", StringComparison.OrdinalIgnoreCase)); 283return _tokens.FirstOrDefault(t => string.Equals(t.ID, fieldName, StringComparison.Ordinal));
Microsoft.CodeAnalysis.Test.Utilities (1)
DotNetCoreSdk.cs (1)
36.FirstOrDefault(DotNetExeExists);
Microsoft.CodeAnalysis.Workspaces (20)
CodeFixes\CodeFix.cs (1)
72var document = Project.Documents.FirstOrDefault(d => d.FilePath == diagnostic.Location.GetLineSpan().Path);
Editing\SymbolEditor.cs (2)
374var decl = this.GetDeclarations(currentSymbol).FirstOrDefault(d => 411var declaration = this.GetDeclarations(currentSymbol).FirstOrDefault(d => memberDecls.Any(md => md.SyntaxTree == d.SyntaxTree && d.FullSpan.IntersectsWith(md.FullSpan)));
Editing\SymbolEditorExtensions.cs (1)
44var typeRef = gen.GetBaseAndInterfaceTypes(decl).FirstOrDefault(r => model.GetTypeInfo(r, cancellationToken).Type.Equals(baseOrInterfaceType));
Editing\SyntaxGenerator.cs (1)
1321=> this.GetAccessors(declaration).FirstOrDefault(a => GetDeclarationKind(a) == kind);
Rename\Renamer.RenameDocumentActionSet.cs (1)
141return project.Documents.FirstOrDefault(d => d.Name == _documentName && d.Folders.SequenceEqual(_documentFolders))
Rename\Renamer.RenameSymbolDocumentAction.cs (1)
75return typeDeclarations.FirstOrDefault(d => WorkspacePathUtilities.TypeNameMatchesDocumentName(document, d, syntaxFacts));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\INamedTypeSymbolExtensions.cs (1)
72.FirstOrDefault(s => symbol.Equals(s.GetOverriddenMember()));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\IPropertySymbolExtensions.cs (1)
14.FirstOrDefault(f => property.Equals(f.AssociatedSymbol));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\FlowAnalysis\SymbolUsageAnalysis\SymbolUsageAnalysis.cs (1)
46.FirstOrDefault(o => Equals((o as ILocalFunctionOperation)?.Symbol, localFunction));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\BottomUpBaseIndentationFinder.cs (1)
266var match = list.FirstOrDefault(o => o != null && o.Tokens.Contains(token));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\ChainedFormattingRules.cs (1)
106key => key.type.GetRuntimeMethods().FirstOrDefault(method => method.Name == key.name)?.DeclaringType);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\SyntaxFacts\AbstractDocumentationCommentService.cs (1)
67.FirstOrDefault(e => GetName(e).ToString() == "summary");
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\CodeGenerationHelpers.cs (1)
221var beforeMember = declarationList.FirstOrDefault(m => m.Span.End >= info.Context.BeforeThisLocation.SourceSpan.End);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Extensions\ProjectExtensions.cs (1)
107return project.AnalyzerConfigDocuments.FirstOrDefault(d => d.FilePath == analyzerConfigPath);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\LanguageServices\MoveDeclarationNearReference\AbstractMoveDeclarationNearReferenceService.State.cs (1)
128FirstStatementAffectedInInnermostBlock = InnermostBlockStatements.Cast<TStatementSyntax>().FirstOrDefault(allAffectedStatements.Contains);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\LanguageServices\SemanticsFactsService\AbstractSemanticFactsService.cs (2)
77var container = containerOpt ?? location.AncestorsAndSelf().FirstOrDefault( 165return (disposableType, disposableType?.GetMembers().OfType<IMethodSymbol>().FirstOrDefault(m => m.Parameters.Length == 0 && m.Name == methodName));
Workspace\CommandLineProject.cs (2)
66var unresolvedMetadataReferences = boundMetadataReferences.FirstOrDefault(r => r is UnresolvedMetadataReference); 79var unresolvedAnalyzerReferences = boundAnalyzerReferences.FirstOrDefault(r => r is UnresolvedAnalyzerReference);
Microsoft.CodeAnalysis.Workspaces.MSBuild (1)
src\Workspaces\Core\MSBuild.BuildHost\Rpc\Contracts\MonoMSBuildDiscovery.cs (1)
77.FirstOrDefault(File.Exists);
Microsoft.CodeAnalysis.Workspaces.MSBuild.BuildHost (7)
MSBuild\ProjectFile\ProjectFile.cs (6)
392var item = items.FirstOrDefault(it => PathUtilities.PathsEqual(it.EvaluatedInclude, relativePath) 441item = references.FirstOrDefault(it => string.Compare(it.EvaluatedInclude, shortAssemblyName, StringComparison.OrdinalIgnoreCase) == 0); 446item = references.FirstOrDefault(it => string.Compare(it.EvaluatedInclude, fullAssemblyName, StringComparison.OrdinalIgnoreCase) == 0); 453item = references.FirstOrDefault(it => PathUtilities.PathsEqual(it.EvaluatedInclude, filePath) 472=> item.Metadata.FirstOrDefault(m => string.Equals(m.Name, MetadataNames.HintPath, StringComparison.OrdinalIgnoreCase))?.EvaluatedValue ?? string.Empty; 552var item = analyzers.FirstOrDefault(it => PathUtilities.PathsEqual(it.EvaluatedInclude, relativePath)
Rpc\Contracts\MonoMSBuildDiscovery.cs (1)
77.FirstOrDefault(File.Exists);
Microsoft.CodeAnalysis.Workspaces.MSBuild.UnitTests (9)
VisualStudioMSBuildWorkspaceTests.cs (9)
322var pref = c2.References.OfType<PortableExecutableReference>().FirstOrDefault(r => r.Display == "CSharpProject"); 349var pref = c2.References.OfType<PortableExecutableReference>().FirstOrDefault(r => r.Display == "EmittedCSharpProject"); 790var csharpLib = refs.OfType<PortableExecutableReference>().FirstOrDefault(r => r.FilePath.Contains("Microsoft.CSharp")); 2209var xaml = workspace.CurrentSolution.GetProject(csProjectId).AdditionalDocuments.FirstOrDefault(d => d.Name == "XamlFile.xaml"); 2728var testProject = solution.Projects.FirstOrDefault(p => p.Name == "ReferenceTest"); 2732var libraryProject = solution.Projects.FirstOrDefault(p => p.Name == "Library1"); 2754var testProject = solution.Projects.FirstOrDefault(p => p.Name == "ReferenceTest"); 2758var library1Project = solution.Projects.FirstOrDefault(p => p.Name == "Library1"); 2762var library2Project = solution.Projects.FirstOrDefault(p => p.Name == "Library2");
Microsoft.CodeAnalysis.Workspaces.Test.Utilities (7)
MEF\TestComposition.cs (1)
190var testAssembly = assemblies.FirstOrDefault(IsTestAssembly);
Workspaces\TestWorkspace_XmlConsumption.cs (2)
566var originalProject = workspaceElement.Elements(ProjectElementName).FirstOrDefault(p => 597documentElement = originalProject.Elements(DocumentElementName).FirstOrDefault(d =>
Workspaces\TestWorkspace`1.cs (4)
320=> this.Documents.FirstOrDefault(d => d.Id == documentId); 323=> this.AdditionalDocuments.FirstOrDefault(d => d.Id == documentId); 326=> this.AnalyzerConfigDocuments.FirstOrDefault(d => d.Id == documentId); 332=> this.Projects.FirstOrDefault(p => p.Id == projectId);
Microsoft.Data.Analysis.Interactive (1)
TabularDataResourceExtensions.cs (1)
35return row.FirstOrDefault(kvp => kvp.Key == fieldName).Value;
Microsoft.DotNet.Arcade.Sdk (5)
src\InstallDotNetCore.cs (1)
82if (runtimeItems.SelectMany(r => r.Value).Select(r => r.Key).FirstOrDefault(f => !SemanticVersion.TryParse(f, out SemanticVersion version)) != null)
src\LocateDotNet.cs (1)
71var dotNetDir = paths.Split(new[] { ';' }, StringSplitOptions.RemoveEmptyEntries).FirstOrDefault(p => File.Exists(Path.Combine(p, fileName)));
src\SourceBuild\AddSourceMappingToNugetConfig.cs (2)
28XElement pkgSrcMappingElement = document.Root.Descendants().FirstOrDefault(e => e.Name == "packageSourceMapping"); 55XElement pkgSrcMappingClearElement = pkgSrcMappingElement.Descendants().FirstOrDefault(e => e.Name == "clear");
src\SourceBuild\AddSourceToNuGetConfig.cs (1)
50.FirstOrDefault(e => e.Attribute("key").Value == SourceName);
Microsoft.DotNet.AsmDiff (2)
DiffCSharpWriter.cs (2)
159TypeMapping mapping = types.FirstOrDefault(DiffFilter.Include); 186MemberMapping mapping = members.FirstOrDefault(m => DiffFilter.Include(m) && !IsPropertyOrEventAccessor(m.Representative));
Microsoft.DotNet.Build.Tasks.Packaging (5)
ApplyBaseLine.cs (1)
88dependencyBaseLineVersions.FirstOrDefault(v => v >= requestedVersion);
GeneratePackageReport.cs (2)
155var refAssm = compileAssets.FirstOrDefault(r => !NuGetAssetResolver.IsPlaceholder(r))?.Substring(PackageId.Length + 1); 162refAssm = compileAssets.FirstOrDefault(r => !NuGetAssetResolver.IsPlaceholder(r));
HarvestPackage.cs (2)
239var refAssm = compileAssets.FirstOrDefault(r => !NuGetAssetResolver.IsPlaceholder(r))?.Substring(PackageId.Length + 1); 246refAssm = compileAssets.FirstOrDefault(r => !NuGetAssetResolver.IsPlaceholder(r));
Microsoft.DotNet.Build.Tasks.Packaging.Tests (2)
HarvestPackageTests.cs (2)
106var ns10asset = task.HarvestedFiles.FirstOrDefault(f => f.GetMetadata("TargetFramework") == "netstandard1.0"); 133var net46asset = task.HarvestedFiles.FirstOrDefault(f => f.GetMetadata("TargetFramework") == "net46");
Microsoft.DotNet.Build.Tasks.Workloads.Tests (4)
CreateVisualStudioWorkloadSetTests.cs (1)
63DirectoryRow versionDir = MsiUtils.GetAllDirectories(msi.ItemSpec).FirstOrDefault(d => string.Equals(d.Directory, "WorkloadSetVersionDir"));
CreateVisualStudioWorkloadTests.cs (3)
96createWorkloadTask.SwixProjects.FirstOrDefault( 101createWorkloadTask.SwixProjects.FirstOrDefault( 231createWorkloadTask.SwixProjects.FirstOrDefault(
Microsoft.DotNet.CodeAnalysis (1)
Analyzers\AppContextDefaultsAnalyzer.cs (1)
80var containingIfStatement = call.Ancestors().FirstOrDefault(n => n.IsKind(SyntaxKind.IfStatement)) as IfStatementSyntax;
Microsoft.DotNet.Helix.Client (4)
generated-code\PagedResponse.cs (4)
68var first = links.FirstOrDefault(t => t.rel == "first").href; 69var prev = links.FirstOrDefault(t => t.rel == "prev").href; 70var next = links.FirstOrDefault(t => t.rel == "next").href; 71var last = links.FirstOrDefault(t => t.rel == "last").href;
Microsoft.DotNet.Helix.JobSender (1)
Payloads\AdhocPayload.cs (1)
55duplicateName = files.FirstOrDefault(file => !filesSeen.Add(Path.GetFileName(file).ToLowerInvariant()));
Microsoft.DotNet.Helix.Sdk (2)
CheckAzurePipelinesTestResults.cs (2)
78.FirstOrDefault(stat => stat["outcome"]?.ToString() == "Failed"); 144workItem = WorkItems.FirstOrDefault(t =>
Microsoft.DotNet.Internal.DependencyInjection.Testing (1)
DependencyInjectionValidation.cs (1)
145ServiceDescriptor parameterService = services.FirstOrDefault(s => IsMatchingServiceRegistration(s.ServiceType, p.ParameterType));
Microsoft.DotNet.NuGetRepack.Tasks (1)
src\ReplacePackageParts.cs (1)
234archive.Entries.FirstOrDefault(e => e.FullName == NuGetUtils.SignaturePartUri)?.Delete();
Microsoft.DotNet.PackageTesting (1)
VerifyClosure.cs (1)
307var suspectAssembly = cycle.FirstOrDefault(a => a != root) ?? root;
Microsoft.DotNet.SharedFramework.Sdk (1)
src\Microsoft.DotNet.PackageTesting\VerifyClosure.cs (1)
307var suspectAssembly = cycle.FirstOrDefault(a => a != root) ?? root;
Microsoft.DotNet.SignCheckLibrary (3)
Verification\Jar\JarIndividualEntry.cs (1)
74string digestAttributeKey = Attributes.Keys.FirstOrDefault(key => key.EndsWith("-Digest", StringComparison.OrdinalIgnoreCase));
Verification\Jar\JarSignatureFile.cs (2)
126string digestAttributeKey = MainAttributes.Keys.FirstOrDefault(key => key.EndsWith("-Digest-Manifest-Main-Attributes", StringComparison.OrdinalIgnoreCase)); 147JarIndividualEntry manifestFileEntry = manifestFile.IndividualSection.FirstOrDefault(
Microsoft.DotNet.SignTool (1)
src\Configuration.cs (1)
302extension = _fileExtensionSignInfo.OrderByDescending(o => o.Key.Length).FirstOrDefault(f => file.FileName.EndsWith(f.Key, StringComparison.OrdinalIgnoreCase)).Key ?? extension;
Microsoft.DotNet.SourceBuild.Tasks (2)
src\UsageReport\WritePackageUsageData.cs (1)
212directDependencies?.FirstOrDefault(
src\UsageReport\WriteUsageReports.cs (1)
144?.FirstOrDefault(p => usage.AssetsFile?.StartsWith(p) ?? false),
Microsoft.DotNet.SwaggerGenerator.CodeGenerator (2)
HelperFactory.cs (1)
255var providedParameter = providedParameters.FirstOrDefault(
Modeler\ServiceClientModelFactory.cs (1)
206var schema = response.Content.Values.Select(t => t.Schema).FirstOrDefault(s => s != null);
Microsoft.DotNet.VersionTools (9)
Automation\VersionsRepoUpdater.cs (1)
97.FirstOrDefault(prerelease => !string.IsNullOrEmpty(prerelease))
BuildInfo.cs (1)
215versions.FirstOrDefault(v => v.IsPrerelease)?.Release ??
Dependencies\BuildOutput\FileRegexPackageUpdater.cs (1)
20.FirstOrDefault(d => d.RawPackages.ContainsKey(PackageId));
Dependencies\BuildOutput\OrchestratedBuild\OrchestratedBuildUpdateHelpers.cs (4)
57.FirstOrDefault(r => r != null); 67.FirstOrDefault(p => p.Id.Equals(packageId, StringComparison.OrdinalIgnoreCase)); 77.FirstOrDefault(r => r != null); 83.FirstOrDefault(e => e.IsOrchestratedBlobFeed);
Dependencies\FileUpdater.cs (1)
61.FirstOrDefault(i => i.HasValue)
Dependencies\Submodule\IndicatorPackageSubmoduleUpdater.cs (1)
49.FirstOrDefault(p => p.Id == IndicatorPackageId);
Microsoft.Extensions.AI (1)
ChatCompletion\FunctionInvokingChatClient.cs (1)
530AIFunction? function = options.Tools!.OfType<AIFunction>().FirstOrDefault(t => t.Metadata.Name == functionCallContent.Name);
Microsoft.Extensions.AI.OpenAI (1)
OpenAIRealtimeExtensions.cs (1)
115&& tools.FirstOrDefault(t => t.Metadata.Name == update.FunctionName) is AIFunction aiFunction)
Microsoft.Extensions.ApiDescription.Client.Tests (1)
src\Shared\Process\ProcessEx.cs (1)
231.FirstOrDefault(attribute => attribute.Key == "TestPackageRestorePath")
Microsoft.Extensions.Caching.SqlServer.Tests (1)
SqlServerCacheServicesExtensionsTest.cs (1)
48var distributedCache = services.FirstOrDefault(desc => desc.ServiceType == typeof(IDistributedCache));
Microsoft.Extensions.Caching.StackExchangeRedis.Tests (3)
CacheServiceExtensionsTests.cs (3)
26var distributedCache = services.FirstOrDefault(desc => desc.ServiceType == typeof(IDistributedCache)); 45var distributedCache = services.FirstOrDefault(desc => desc.ServiceType == typeof(IDistributedCache)); 116var distributedCache = services.FirstOrDefault(desc => desc.ServiceType == typeof(IDistributedCache));
Microsoft.Extensions.DependencyModel (8)
CollectionExtensions.cs (1)
24return groups.FirstOrDefault(g => g.Runtime == runtime);
DependencyContextExtensions.cs (4)
131RuntimeFallbacks? fallbacks = context.RuntimeGraph.FirstOrDefault(f => f.Runtime == runtimeIdentifier); 141RuntimeFallbacks? fallbacks = context.RuntimeGraph.FirstOrDefault(f => f.Runtime == runtimeIdentifier); 150RuntimeAssetGroup? group = groups.FirstOrDefault(g => g.Runtime == rid); 165RuntimeAssetGroup? group = groups.FirstOrDefault(g => g.Runtime == rid);
DependencyContextJsonReader.cs (3)
190Target? ridlessTarget = targets.FirstOrDefault(t => !IsRuntimeTarget(t.Name)); 225target = targets.FirstOrDefault(t => t.Name == runtimeTargetName); 233target = targets.FirstOrDefault(t => IsRuntimeTarget(t.Name));
Microsoft.Interop.LibraryImportGenerator (2)
Analyzers\AddDisableRuntimeMarshallingAttributeFixer.cs (1)
55project.Documents.FirstOrDefault(IsPropertiesAssemblyInfo) ??
Analyzers\CustomMarshallerAttributeAnalyzer.cs (1)
985if (marshallerType.GetMembers(ShapeMemberNames.BufferSize).OfType<IPropertySymbol>().FirstOrDefault(prop => prop is { ReturnsByRef: false, ReturnsByRefReadonly: false, GetMethod: not null }) is null)
Microsoft.Interop.SourceGeneration (24)
MarshallerShape.cs (24)
209.FirstOrDefault(m => m is { IsStatic: true, Parameters.Length: 1, ReturnsVoid: true }); 219.FirstOrDefault(m => m is { IsStatic: true, Parameters.Length: 1 } and 262.FirstOrDefault(m => m is { IsStatic: true, Parameters.Length: 1, ReturnsVoid: false } 293.FirstOrDefault(m => m is { IsStatic: true, Parameters.Length: 1, ReturnsVoid: false } 302.FirstOrDefault(m => m is { IsStatic: true, Parameters.Length: 1, ReturnsVoid: false } 314.FirstOrDefault(m => m is { IsStatic: true, Parameters.Length: 2, ReturnsVoid: false } 346.FirstOrDefault(m => m is { IsStatic: true, Parameters.Length: 1, ReturnsVoid: false, ReturnType: INamedTypeSymbol returnType } 356.FirstOrDefault(m => m is { IsStatic: true, Parameters.Length: 2, ReturnsVoid: false, ReturnType: INamedTypeSymbol returnType } 366.FirstOrDefault(m => m is { IsStatic: true, Parameters.Length: 2, ReturnsVoid: false } 376.FirstOrDefault(m => m is { IsStatic: true, Parameters.Length: 2, ReturnsVoid: false } 386.FirstOrDefault(m => m is { IsStatic: true, Parameters.Length: 1, ReturnsVoid: false, ReturnType: INamedTypeSymbol returnType } 396.FirstOrDefault(m => m is { IsStatic: true, Parameters.Length: 2, ReturnsVoid: false, ReturnType: INamedTypeSymbol returnType } 565.FirstOrDefault(m => m is { IsStatic: false, Parameters.Length: 1, ReturnsVoid: true } 594.FirstOrDefault(m => m is { IsStatic: false, Parameters.Length: 0, ReturnsVoid: false, ReturnsByRef: false, ReturnsByRefReadonly: false } 602.FirstOrDefault(m => m is { IsStatic: false, Parameters.Length: 0, ReturnsVoid: false, ReturnsByRef: false, ReturnsByRefReadonly: false } 610.FirstOrDefault(m => m is { IsStatic: false, Parameters.Length: 0, ReturnsVoid: false, ReturnsByRef: false, ReturnsByRefReadonly: false }); 656.FirstOrDefault(m => m is { IsStatic: false, Parameters.Length: 0, ReturnsVoid: true }); 663.FirstOrDefault(m => m is { IsStatic: false, Parameters.Length: 0, ReturnsVoid: true }); 670.FirstOrDefault(m => m is { IsStatic: true, Parameters.Length: 1 } and 679.FirstOrDefault(m => m is { IsStatic: false, Parameters.Length: 0 } and 690.FirstOrDefault(m => m is { IsStatic: false, Parameters.Length: 0, ReturnsVoid: false, ReturnType: INamedTypeSymbol returnType } 699.FirstOrDefault(m => m is { IsStatic: false, Parameters.Length: 0, ReturnsVoid: false, ReturnType: INamedTypeSymbol returnType } 708.FirstOrDefault(m => m is { IsStatic: false, Parameters.Length: 1, ReturnsVoid: false, ReturnType: INamedTypeSymbol returnType } 718.FirstOrDefault(m => m is { IsStatic: false, Parameters.Length: 1, ReturnsVoid: false, ReturnType: INamedTypeSymbol returnType }
Microsoft.Maui (3)
Converters\KeyboardTypeConverter.cs (2)
31 FieldInfo? field = kbType.GetFields()?.FirstOrDefault(fi => fi.IsStatic && fi.Name == keyboard); 35 PropertyInfo? property = kbType.GetProperties()?.FirstOrDefault(pi => pi != null && pi.Name == keyboard && pi.CanRead && (pi.GetMethod?.IsStatic ?? false));
HotReload\HotReloadHelper.cs (1)
165 var t = assemblies.Select(x => x.GetType(oldViewType)).FirstOrDefault(x => x != null);
Microsoft.Maui.Controls (3)
DependencyService.cs (1)
99 DependencyTypes.FirstOrDefault(t => target.IsAssignableFrom(t.Type)).Type;
LayoutOptionsConverter.cs (1)
51 FieldInfo field = typeof(LayoutOptions).GetFields().FirstOrDefault(fi => fi.IsStatic && fi.Name == strValue);
MergedStyle.cs (1)
130 ClassStyles = _classStyleProperties.Select(p => (Target.GetValue(p) as IList<Style>)?.FirstOrDefault(s => s.CanBeAppliedTo(TargetType))).ToList();
Microsoft.Maui.Controls.Build.Tasks (35)
BindablePropertyReferenceExtensions.cs (1)
55 if (attributes.FirstOrDefault(cad => cad.AttributeType.FullName == "System.ComponentModel.TypeConverterAttribute")?.ConstructorArguments[0].Value is TypeReference typeConverter)
CompiledConverters\RDSourceTypeConverter.cs (1)
37 var ar = currentModule.AssemblyReferences.FirstOrDefault(ar => ar.Name == asmName);
CreateObjectVisitor.cs (6)
134 factoryCtorInfo = typedef.AllMethods(Context.Cache).FirstOrDefault(md => md.methodDef.IsConstructor && 145 factoryMethodInfo = typedef.AllMethods(Context.Cache).FirstOrDefault(md => !md.methodDef.IsConstructor && 156 parameterizedCtorInfo = typedef.Methods.FirstOrDefault(md => md.IsConstructor && 173 ctorInfo = ctorInfo ?? typedef.Methods.FirstOrDefault(md => md.IsConstructor && !md.HasParameters && !md.IsStatic); 179 var implicitOperatorref = typedef.Methods.FirstOrDefault(md => 460 .Methods.FirstOrDefault(md => md.IsConstructor && !md.HasParameters);
DebugXamlCTask.cs (4)
59 var initComp = typeDef.Methods.FirstOrDefault(md => md.Name == "InitializeComponent"); 65 var initCompRuntime = typeDef.Methods.FirstOrDefault(md => md.Name == "__InitComponentRuntime"); 98 var altCtor = typeDef.Methods.FirstOrDefault(md => md.IsConstructor 122 if (typeDef.BaseType.Resolve().GetConstructors().FirstOrDefault(c => c.HasParameters && c.Parameters.Count == 1 && c.Parameters[0].Name == "useCompiledXaml") is MethodDefinition baseCtorDef)
ModuleDefinitionExtensions.cs (6)
27 var ctor = module.ImportReference(type).ResolveCached(cache).Methods.FirstOrDefault(md => !md.IsPrivate && !md.IsStatic && md.IsConstructor && (predicate?.Invoke(md) ?? true)); 109 .FirstOrDefault(pd => 129 .FirstOrDefault(pd => 149 .FirstOrDefault(md => 241 .FirstOrDefault(fd => 265 var exportedType = asm.MainModule.ExportedTypes.FirstOrDefault(
NodeILExtensions.cs (5)
26 attributeProvider.CustomAttributes.FirstOrDefault( 109 attributeProvider.CustomAttributes.FirstOrDefault( 163 var converter = typeof(ICompiledTypeConverter).GetMethods().FirstOrDefault(md => md.Name == "ConvertFromString"); 193 .Methods.FirstOrDefault(md => md.Name == "ConvertFromInvariantString" && md.Parameters.Count == 2) 196 .FirstOrDefault(md => md.methodDef.Name == "ConvertFromInvariantString" && md.methodDef.Parameters.Count == 1).methodDef;
SetPropertiesVisitor.cs (5)
245 attributes.FirstOrDefault(cad => ContentPropertyAttribute.ContentPropertyTypes.Contains(cad.AttributeType.FullName)); 358 var cProvideValue = typeof(ICompiledValueProvider).GetMethods().FirstOrDefault(md => md.Name == "ProvideValue"); 398 var cProvideValue = typeof(ICompiledValueProvider).GetMethods().FirstOrDefault(md => md.Name == "ProvideValue"); 545 var ctorInfo = module.ImportReference(typedBindingRef.ResolveCached(context.Cache).Methods.FirstOrDefault(md => 1210 var handler = declaringType.AllMethods(context.Cache).FirstOrDefault(md =>
TypeReferenceExtensions.cs (1)
156 if ((iface = typeDef.Interfaces.FirstOrDefault(tr =>
XamlCTask.cs (6)
207 assemblyDefinition.CustomAttributes.FirstOrDefault( 222 module.CustomAttributes.FirstOrDefault( 252 typeDef.CustomAttributes.FirstOrDefault( 271 var initComp = typeDef.Methods.FirstOrDefault(md => md.Name == "InitializeComponent"); 279 var xamlFilePath = typeDef.HasCustomAttributes && (xamlFilePathAttr = typeDef.CustomAttributes.FirstOrDefault(ca => ca.AttributeType.FullName == "Microsoft.Maui.Controls.Xaml.XamlFilePathAttribute")) != null ? 339 var suppressMessageAttribute = initComp.CustomAttributes.FirstOrDefault(ca => ca.AttributeType.FullName == "System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessageAttribute");
Microsoft.Maui.Controls.Xaml (12)
ApplyPropertiesVisitor.cs (6)
291 attributes.FirstOrDefault(cad => ContentPropertyAttribute.ContentPropertyTypes.Contains(cad.AttributeType.FullName)); 342 var propertyInfo = elementType.GetRuntimeProperties().FirstOrDefault(p => p.Name == localName); 463 var eventInfo = elementType.GetRuntimeEvent(localName) ?? elementType.GetRuntimeEvents().FirstOrDefault(ei => ei.Name == localName && !(ei.AddMethod.IsPrivate)); 601 minforetriever = () => property.DeclaringType.GetRuntimeProperties().FirstOrDefault(pi => pi.Name == property.PropertyName); 660 var propertyInfo = elementType.GetRuntimeProperties().FirstOrDefault(p => p.Name == localName); 813 var addMethod = GetAllRuntimeMethods(property.ReturnType).FirstOrDefault(mi => mi.Name == "Add" && mi.GetParameters().Length == 1);
CreateValuesVisitor.cs (3)
207 .DeclaredConstructors.FirstOrDefault( 233 .DeclaredConstructors.FirstOrDefault( 278 var mi = nodeType.GetRuntimeMethods().FirstOrDefault(isMatch);
MarkupExtensions\StaticExtension.cs (2)
32 var pinfo = type.GetRuntimeProperties().FirstOrDefault(pi => pi.Name == membername && pi.GetMethod.IsStatic); 36 var finfo = type.GetRuntimeFields().FirstOrDefault(fi => fi.Name == membername && fi.IsStatic);
XamlServiceProvider.cs (1)
334 && parentType.GetRuntimeProperties().FirstOrDefault(p => p.Name == name.LocalName) is PropertyInfo propertyInfo
Microsoft.Maui.Essentials (3)
AppActions\AppActions.uwp.cs (1)
67 var appAction = actions.FirstOrDefault(a => a.Id == id);
Flashlight\Flashlight.uwp.cs (1)
34 var lampInfo = allLamps.FirstOrDefault(di => di.EnclosureLocation?.Panel == Panel.Back);
TextToSpeech\TextToSpeech.uwp.cs (1)
34 var voiceInfo = SpeechSynthesizer.AllVoices.FirstOrDefault(v => v.Id == options.Locale.Id) ?? SpeechSynthesizer.DefaultVoice;
Microsoft.ML.AutoML (5)
ColumnInference\ColumnTypeInference.cs (1)
394labelColumn = cols.FirstOrDefault(c => c.Name == args.Label);
Experiment\SuggestedPipelineRunDetails\SuggestedPipelineCrossValRunDetail.cs (1)
45Exception = Results.Select(r => r.Exception).FirstOrDefault(e => e != null);
TransformInference\TransformInference.cs (2)
445var labelColumnName = intermediateCols.FirstOrDefault(c => c.Purpose == ColumnPurpose.Label)?.ColumnName; 449var groupColumnName = intermediateCols.FirstOrDefault(c => c.Purpose == ColumnPurpose.GroupId)?.ColumnName;
Utils\UserInputValidationUtil.cs (1)
304return groups.FirstOrDefault(g => g.Count() > 1)?.Key;
Microsoft.ML.Core (9)
CommandLine\CmdParser.cs (1)
1207arg = Args.FirstOrDefault(a => a.Index == argument.Index);
ComponentModel\ComponentCatalog.cs (4)
854component = _components.FirstOrDefault(x => x.ArgumentType == argumentType); 865component = _components.FirstOrDefault(x => x.InterfaceType == interfaceType && x.ArgumentType == argumentType); 875component = _components.FirstOrDefault(x => x.InterfaceType == interfaceType && (x.Name == alias || (x.Aliases != null && x.Aliases.Contains(alias)))); 892component = _components.FirstOrDefault(x => x.InterfaceType == interfaceType && (x.Name.ToLowerInvariant() == alias || AnyMatch(alias, x.Aliases)));
Data\IEstimator.cs (1)
210column = _columns.FirstOrDefault(x => x.Name == name);
Data\ProgressReporter.cs (1)
404info = _infos.FirstOrDefault(x => x.Channel == source);
Data\Repository.cs (1)
426var assemblyInternationalVersionAttribute = assembly.CustomAttributes.FirstOrDefault(a =>
Utilities\ResourceManagerUtils.cs (1)
338var errorResult = result.FirstOrDefault(res => !string.IsNullOrEmpty(res.ErrorMessage));
Microsoft.ML.Data (3)
Data\SchemaDefinition.cs (1)
304get => this.FirstOrDefault(x => x.ColumnName == columnName);
DataView\DataViewConstructionUtils.cs (1)
71var schemaDefinitionCol = schemaDefinition.FirstOrDefault(c => c.ColumnName == name);
EntryPoints\EntryPointNode.cs (1)
999public bool HasRunnableNodes => _nodes.FirstOrDefault(x => x.CanStart()) != null;
Microsoft.ML.FastTree (1)
Utils\BufferPoolManager.cs (1)
53List<Array> buffers = availableBuffers.FirstOrDefault(x => x.Value.Count > 0 && x.Key >= size && (x.Key - size) < (size * 0.2)).Value as List<Array>;
Microsoft.ML.GenAI.Mistral (1)
Mistral_7B_0_3ChatTemplateBuilder.cs (1)
35var systemMessage = messages.FirstOrDefault(m => m.GetRole() == Role.System)?.GetContent();
Microsoft.ML.OnnxTransformer (2)
OnnxTransform.cs (2)
589var slotsNode = nodes.FirstOrDefault(node => node.Name == slotNamesNodeName); 590var slotsAttr = slotsNode?.Attribute.FirstOrDefault(attr => attr.Name == "keys_strings");
Microsoft.VisualStudio.LanguageServices (13)
CallHierarchy\CallHierarchyItem.cs (3)
120var finder = _finders.FirstOrDefault(s => s.SearchCategory == categoryName); 148var finder = _finders.FirstOrDefault(s => s.SearchCategory == categoryName); 166var finder = _finders.FirstOrDefault(s => s.SearchCategory == categoryName);
DocumentOutline\DocumentOutlineViewModel.cs (1)
427var filePath = _textBuffer.GetRelatedDocuments().FirstOrDefault(static d => d.FilePath is not null)?.FilePath;
ErrorReporting\VisualStudioInfoBar.cs (1)
193var item = _items.FirstOrDefault(i => i.Title == actionItem.Text);
Implementation\HierarchyItemToProjectIdMap.cs (1)
67var matchingProject = candidateProjects.FirstOrDefault(p => _workspace.TryGetDependencyNodeTargetIdentifier(p.Id) == targetFrameworkMoniker);
Interactive\VsResetInteractive.cs (1)
165=> _workspace.CurrentSolution.Projects.FirstOrDefault(proj => _workspace.GetHierarchy(proj.Id) == hierarchy);
ProjectSystem\Extensions\ProjectItemsExtensions.cs (1)
17=> items.OfType<ProjectItem>().FirstOrDefault(p => comparer.Compare(p.Name, itemName) == 0);
ProjectSystem\VisualStudioWorkspaceImpl.AddMetadataReferenceUndoUnit.cs (1)
36.FirstOrDefault(p => StringComparer.OrdinalIgnoreCase.Equals(p.FilePath, _filePath));
ProjectSystem\VisualStudioWorkspaceImpl.cs (1)
826var folderItem = items.FirstOrDefault(p => StringComparer.OrdinalIgnoreCase.Compare(p.Name, folder) == 0);
ProjectSystem\VisualStudioWorkspaceImpl.OpenFileTracker.cs (1)
246var matchingProjectId = projectIds.FirstOrDefault(id => projectToHierarchyMap.GetValueOrDefault(id, null) == hierarchy);
ProjectSystem\VisualStudioWorkspaceImpl.RemoveMetadataReferenceUndoUnit.cs (1)
35.FirstOrDefault(p => StringComparer.OrdinalIgnoreCase.Equals(p.FilePath!, _filePath));
Workspace\VisualStudioActiveDocumentTracker.cs (1)
146var existingFrame = _visibleFrames.FirstOrDefault(f => f.Frame == frame);
Microsoft.VisualStudio.LanguageServices.CSharp.UnitTests (2)
Interactive\Commands\ResetInteractiveTests.cs (2)
51var project = workspace.CurrentSolution.Projects.FirstOrDefault(p => p.AssemblyName == "ResetInteractiveTestsAssembly"); 52var document = project.Documents.FirstOrDefault(d => d.FilePath == "ResetInteractiveTestsDocument");
Microsoft.VisualStudio.LanguageServices.LiveShare (1)
Client\RemoteLanguageServiceWorkspace.cs (1)
317var project = CurrentSolution.Projects.FirstOrDefault(p => p.Name == projectName && p.Language == language);
MSBuild (3)
BuildEnvironmentHelper.cs (1)
337.FirstOrDefault(env => env != null);
XMake.cs (2)
1110ILogger logger = loggers.FirstOrDefault(l => l is SimpleErrorLogger); 3156? commandLineSwitches[CommandLineSwitches.ParameterizedSwitch.OutputResultsCache].FirstOrDefault(p => p != null) ?? string.Empty
MSBuildTaskHost (1)
BuildEnvironmentHelper.cs (1)
337.FirstOrDefault(env => env != null);
Mvc.Api.Analyzers.Test (2)
TestFiles\AddResponseTypeAttributeCodeFixProviderIntegrationTest\CodeFixWorksWhenMultipleIdenticalStatusCodesAreInError.Input.cs (1)
23var model = Values.FirstOrDefault(m => m.Id == id);
TestFiles\AddResponseTypeAttributeCodeFixProviderIntegrationTest\CodeFixWorksWhenMultipleIdenticalStatusCodesAreInError.Output.cs (1)
27var model = Values.FirstOrDefault(m => m.Id == id);
Roslyn.Test.PdbUtilities (1)
Reader\PdbValidation.cs (1)
504element.Attributes().FirstOrDefault(a => a.Name.LocalName == "format")?.Remove();
Stress.AppHost (1)
ResourceBuilderExtensions.cs (1)
44var endpoint = endpoints.FirstOrDefault(e => string.Equals(e.EndpointName, endpointName, StringComparison.OrdinalIgnoreCase))
System.Composition.TypedParts (1)
System\Composition\TypedParts\Discovery\DiscoveredPart.cs (1)
106_constructor ??= _partType.DeclaredConstructors.FirstOrDefault(ci => ci.IsPublic && !(ci.IsStatic || ci.GetParameters().Length != 0));
System.Linq.Parallel (1)
System\Linq\ParallelEnumerable.cs (1)
5540.FirstOrDefault(ExceptionAggregator.WrapFunc<TSource, bool>(predicate, settings.CancellationState));
System.ServiceModel.Http.Tests (1)
ServiceModel\SecurityBindingElementTest.cs (1)
24var securityBindingElement = bindingElements.FirstOrDefault(x => x is SecurityBindingElement) as SecurityBindingElement;
System.ServiceModel.NetFramingBase (1)
System\ServiceModel\Channels\ConnectionPool.cs (1)
344var toe = ae.InnerExceptions.FirstOrDefault(e => e is TimeoutException);
System.ServiceModel.Syndication (5)
System\ServiceModel\Syndication\SyndicationFeed.cs (5)
247.FirstOrDefault(e => e.OuterName == Rss20Constants.DocumentationTag && e.OuterNamespace == Rss20Constants.Rss20Namespace); 262.FirstOrDefault(e => e.OuterName == Rss20Constants.TimeToLiveTag && e.OuterNamespace == Rss20Constants.Rss20Namespace); 291.FirstOrDefault(e => e.OuterName == Rss20Constants.SkipHoursTag && e.OuterNamespace == Rss20Constants.Rss20Namespace); 325.FirstOrDefault(e => e.OuterName == Rss20Constants.SkipDaysTag && e.OuterNamespace == Rss20Constants.Rss20Namespace); 361.FirstOrDefault(e => e.OuterName == Rss20Constants.TextInputTag && e.OuterNamespace == Rss20Constants.Rss20Namespace);
System.Text.Json.SourceGeneration (2)
Helpers\RoslynExtensions.cs (1)
112constructorInfo = namedType.GetExplicitlyDeclaredInstanceConstructors().FirstOrDefault(ctor => ctor.DeclaredAccessibility is Accessibility.Public && ctor.Parameters.Length == 0);
JsonSourceGenerator.Parser.cs (1)
1551return paramGenSpecs?.FirstOrDefault(MatchesConstructorParameter);
System.Windows.Forms.Analyzers.CSharp (2)
System\Windows\Forms\CSharp\Analyzers\MissingPropertySerializationConfiguration\MissingPropertySerializationConfigurationAnalyzer.cs (1)
64.FirstOrDefault(m => m.Name == $"ShouldSerialize{propertySymbol.Name}");
System\Windows\Forms\CSharp\Generators\ApplicationConfiguration\ApplicationConfigurationGenerator.cs (1)
64.FirstOrDefault(a => a is NamespaceDeclarationSyntax) is NamespaceDeclarationSyntax namespaceSyntax)
System.Windows.Forms.Design (1)
System\Windows\Forms\Design\EventHandlerService.cs (1)
57object? handler = _handlers.FirstOrDefault(handlerType.IsInstanceOfType);
System.Windows.Forms.Design.Tests (2)
System\Windows\Forms\Design\TextBoxBaseDesignerTests.cs (1)
57SnapLine? baselineSnapLine = snapLines.Cast<SnapLine>().FirstOrDefault(sl => sl.SnapLineType == SnapLineType.Baseline);
System\Windows\Forms\Design\UpDownBaseDesignerTests.cs (1)
57SnapLine? baselineSnapLine = snapLines.FirstOrDefault(sl => sl.SnapLineType == SnapLineType.Baseline);
Templates.Blazor.Tests (2)
src\ProjectTemplates\Shared\Project.cs (1)
539.FirstOrDefault(a => a.Key == key);
src\Shared\Process\ProcessEx.cs (1)
231.FirstOrDefault(attribute => attribute.Key == "TestPackageRestorePath")
Templates.Blazor.WebAssembly.Auth.Tests (2)
src\ProjectTemplates\Shared\Project.cs (1)
539.FirstOrDefault(a => a.Key == key);
src\Shared\Process\ProcessEx.cs (1)
231.FirstOrDefault(attribute => attribute.Key == "TestPackageRestorePath")
Templates.Blazor.WebAssembly.Tests (2)
src\ProjectTemplates\Shared\Project.cs (1)
539.FirstOrDefault(a => a.Key == key);
src\Shared\Process\ProcessEx.cs (1)
231.FirstOrDefault(attribute => attribute.Key == "TestPackageRestorePath")
Templates.Mvc.Tests (2)
src\ProjectTemplates\Shared\Project.cs (1)
539.FirstOrDefault(a => a.Key == key);
src\Shared\Process\ProcessEx.cs (1)
231.FirstOrDefault(attribute => attribute.Key == "TestPackageRestorePath")
Templates.Tests (2)
src\ProjectTemplates\Shared\Project.cs (1)
539.FirstOrDefault(a => a.Key == key);
src\Shared\Process\ProcessEx.cs (1)
231.FirstOrDefault(attribute => attribute.Key == "TestPackageRestorePath")
TestTasks (2)
InjectRequestHandler.cs (2)
38var targetLibrary = target.Properties().FirstOrDefault(p => p.Name == libraryName); 70var library = libraries.Properties().FirstOrDefault(p => p.Name == libraryName);
UnitTests.Common (1)
TestHelpers.cs (1)
175MessageDescription messageDesc = messages.FirstOrDefault(m => m.Action.Equals(messageData.Action));
Wasm.Performance.Driver (1)
Program.cs (1)
215.FirstOrDefault(f => f.Key == "CommitHash")
xunit.assert (1)
Sdk\CollectionTrackerExtensions.cs (1)
42 static readonly MethodInfo? asTrackerOpenGeneric = typeof(CollectionTrackerExtensions).GetRuntimeMethods().FirstOrDefault(m => m.Name == nameof(AsTracker) && m.IsGenericMethod);
xunit.console (13)
CommandLine.cs (2)
67var reporter = reporters.FirstOrDefault(r => r.RunnerSwitch == unknownOption) ?? throw new ArgumentException($"unknown option: -{unknownOption}"); 76result = reporters.FirstOrDefault(r => r.IsEnvironmentallyEnabled) ?? result;
common\AssemblyResolution\DependencyContextAssemblyCache.cs (8)
68.Select(lib => compatibleRuntimes.Select(runtime => Tuple.Create(lib, lib.RuntimeAssemblyGroups.FirstOrDefault(libGroup => string.Equals(libGroup.Runtime, runtime)))) 69.FirstOrDefault(tuple => tuple.Item2?.AssetPaths != null)) 82.Select(lib => compatibleRuntimes.Select(runtime => Tuple.Create(lib, lib.NativeLibraryGroups.FirstOrDefault(libGroup => string.Equals(libGroup.Runtime, runtime)))) 83.FirstOrDefault(tuple => tuple.Item2?.AssetPaths != null)) 102=> runtimeGraph.FirstOrDefault(x => string.Equals(x.Runtime, currentRuntimeIdentifier, StringComparison.OrdinalIgnoreCase)) 103?? runtimeGraph.FirstOrDefault(x => string.Equals(x.Runtime, fallbackRuntimeIdentifier.Value, StringComparison.OrdinalIgnoreCase)) 238var resolvedAssemblyPath = assemblies.FirstOrDefault(a => string.Equals(assemblyName, Path.GetFileNameWithoutExtension(a), StringComparison.OrdinalIgnoreCase)); 281var resolvedAssemblyPath = assemblies.FirstOrDefault(a => string.Equals(formattedUnmanagedDllName, Path.GetFileName(a), StringComparison.OrdinalIgnoreCase));
common\AssemblyResolution\Microsoft.Extensions.DependencyModel\DependencyContextJsonReader.cs (3)
91var ridlessTarget = targets.FirstOrDefault(t => !IsRuntimeTarget(t.Name)); 122target = targets.FirstOrDefault(t => t.Name == runtimeTargetName); 128target = targets.FirstOrDefault(t => IsRuntimeTarget(t.Name));