741 references to FirstOrDefault
ApplicationModelWebSite (2)
Conventions\CloneActionConvention.cs (1)
15var actionName = action.Attributes.OfType<CloneActionAttribute>()?.FirstOrDefault()?.ActionName;
Conventions\MultipleAreasControllerConvention.cs (1)
16var areaNames = controller.ControllerType.GetCustomAttributes<MultipleAreasAttribute>()?.FirstOrDefault()?.AreaNames;
Aspire.Azure.Data.Tables.Tests (2)
ConformanceTests.cs (2)
110service.Query(t => t.Name == tableName).FirstOrDefault(); 130_ = tableClient.GetTableClient("test").Query<TableEntity>(filter: "false").FirstOrDefault();
Aspire.Azure.Storage.Blobs.Tests (1)
ConformanceTests.cs (1)
130tableClient.GetBlobContainers().AsPages(pageSizeHint: 1).FirstOrDefault();
Aspire.Azure.Storage.Queues.Tests (1)
ConformanceTests.cs (1)
132tableClient.GetQueues().AsPages(pageSizeHint: 1).FirstOrDefault();
Aspire.Dashboard.Components.Tests (2)
Controls\StructuredLogDetailsTests.cs (1)
69var duplicate = properties.GroupBy(p => p.Key).Where(g => g.Count() >= 2).FirstOrDefault();
tests\Shared\Logging\XunitLoggerProvider.cs (1)
76messageBuilder.AppendLine(firstLinePrefix + lines.FirstOrDefault() ?? string.Empty);
Aspire.Dashboard.Tests (1)
tests\Shared\Logging\XunitLoggerProvider.cs (1)
76messageBuilder.AppendLine(firstLinePrefix + lines.FirstOrDefault() ?? string.Empty);
Aspire.Hosting (1)
Dcp\Model\Executable.cs (1)
224launchConfiguration = launchConfigurations?.FirstOrDefault();
Aspire.Hosting.AWS (3)
CDK\CDKExtensions.cs (1)
231var stackResource = builder.Resources.OfType<IStackResource>().FirstOrDefault();
CDK\ConstructOutputAnnotation.cs (1)
21stack = construct.Node.Scopes.OfType<Stack>().FirstOrDefault() ?? throw new InvalidOperationException("Construct is not part of a Stack");
CDK\Utils\ConstructExtensions.cs (1)
26=> construct.Node.Scopes.OfType<Stack>().FirstOrDefault();
Aspire.Hosting.Azure.Tests (3)
AzureEventHubsExtensionsTests.cs (1)
201var containerImageAnnotation = eventHubs.Resource.Annotations.OfType<ContainerImageAnnotation>().FirstOrDefault();
AzureResourceExtensionsTests.cs (2)
151var endpointAnnotation = cosmos.Resource.Annotations.OfType<EndpointAnnotation>().FirstOrDefault(); 172var containerImageAnnotation = cosmos.Resource.Annotations.OfType<ContainerImageAnnotation>().FirstOrDefault();
Aspire.Hosting.Testing.Tests (3)
TestingBuilderTests.cs (2)
36SearchOption.AllDirectories).FirstOrDefault(); 88var containerImageAnnotation = resource.Annotations.OfType<ContainerImageAnnotation>().FirstOrDefault();
tests\Shared\Logging\XunitLoggerProvider.cs (1)
76messageBuilder.AppendLine(firstLinePrefix + lines.FirstOrDefault() ?? string.Empty);
Aspire.Hosting.Tests (1)
tests\Shared\Logging\XunitLoggerProvider.cs (1)
76messageBuilder.AppendLine(firstLinePrefix + lines.FirstOrDefault() ?? string.Empty);
Aspire.Playground.Tests (1)
tests\Shared\Logging\XunitLoggerProvider.cs (1)
76messageBuilder.AppendLine(firstLinePrefix + lines.FirstOrDefault() ?? string.Empty);
Aspire.Workload.Tests (1)
BuildAndRunTemplateTests.cs (1)
78var projectName = Directory.GetFiles(project.AppHostProjectDirectory, "*.csproj").FirstOrDefault();
BasicTestApp (1)
FormsTest\CustomFieldCssClassProvider.cs (1)
23.FirstOrDefault();
BuildBoss (3)
ProjectUtil.cs (3)
47internal XElement GetTargetFramework() => Document.XPathSelectElements("//mb:TargetFramework", Manager).FirstOrDefault(); 49internal XElement GetTargetFrameworks() => Document.XPathSelectElements("//mb:TargetFrameworks", Manager).FirstOrDefault(); 60var hasProjectWithSdkAttribute = Document.XPathSelectElements("//mb:Project", Manager).FirstOrDefault()?.Attribute("Sdk") != null;
ClientSample (1)
src\Shared\CommandLineUtils\CommandLine\CommandArgument.cs (1)
25return Values.FirstOrDefault();
CodeGenerator (2)
FeatureCollectionGenerator.cs (1)
35internal protected {feature}? _current{feature};")}{(allFeatures.Where(f => !implementedFeatures.Contains(f)).FirstOrDefault() is not null ? @"
src\Servers\Kestrel\shared\KnownHeaders.cs (1)
404var firstTermVarExpression = values.Select(h => h.FirstNameIgnoreCaseSegment()).FirstOrDefault();
ConfigurationSchemaGenerator (2)
RuntimeSource\Configuration.Binder\Parser\ConfigurationBinder.cs (2)
172ITypeOfOperation? typeOfOperation = GetArgumentForParameterAtIndex(operation.Arguments, 1).ChildOperations.FirstOrDefault() as ITypeOfOperation; 227ITypeOfOperation? typeOfOperation = GetArgumentForParameterAtIndex(operation.Arguments, 1).ChildOperations.FirstOrDefault() as ITypeOfOperation;
Crossgen2Tasks (1)
ResolveReadyToRunCompilers.cs (1)
60_crossgen2Pack = Crossgen2Packs?.FirstOrDefault();
dotnet-dev-certs (1)
src\Shared\CommandLineUtils\CommandLine\CommandArgument.cs (1)
25return Values.FirstOrDefault();
dotnet-getdocument (1)
src\Shared\CommandLineUtils\CommandLine\CommandArgument.cs (1)
25return Values.FirstOrDefault();
dotnet-openapi (1)
src\Shared\CommandLineUtils\CommandLine\CommandArgument.cs (1)
25return Values.FirstOrDefault();
dotnet-sql-cache (1)
src\Shared\CommandLineUtils\CommandLine\CommandArgument.cs (1)
25return Values.FirstOrDefault();
dotnet-svcutil-lib (18)
CommandProcessorOptions.cs (1)
824FileInfo assemblyFile = directoryInfo.GetFiles(reference.AssemblyName + ".*", SearchOption.AllDirectories).FirstOrDefault();
FrameworkFork\System.Runtime.Serialization\System\Runtime\Serialization\CollectionDataContract.cs (3)
982Type t = type.GetInterfaces().Where(it => it.Equals(interfaceType)).FirstOrDefault(); 1220Type t = type.GetInterfaces().Where(it => it.Equals(interfaceType)).FirstOrDefault(); 1268Type ienumerableInterface = interfaceType.GetInterfaces().Where(t => t.FullName.StartsWith("System.Collections.Generic.IEnumerable")).FirstOrDefault();
FrameworkFork\System.Runtime.Serialization\System\Runtime\Serialization\DataContract.cs (1)
1546var universalDataContractAttribute = attributes.FirstOrDefault();
FrameworkFork\System.Runtime.Serialization\System\Runtime\Serialization\Globals.cs (1)
1026return matchedMethods.FirstOrDefault();
Metadata\MetadataDocumentSaver.cs (2)
290var mainWsdlFile = wsdlFiles.Where(w => !importedWsdl.Any(i => MetadataFileNameManager.UriEqual(i, w.FilePath))).FirstOrDefault(); 294mainWsdlFile = wsdlFiles.FirstOrDefault();
Shared\MSBuildProj.cs (7)
87_projectReferenceGroup = refItems.FirstOrDefault().Parent; 110_referenceGroup = refItems.FirstOrDefault().Parent; 134_packageReferenceGroup = refItems.FirstOrDefault().Parent; 432var ele = doc.Root?.Descendants(elementStr).FirstOrDefault(); 547if (this.TargetFrameworks.Count() > 1 && dependency.Name.Equals(TargetFrameworkHelper.FullFrameworkReferences.FirstOrDefault().Name) 979this.GlobalProperties["TargetFramework"] = this.TargetFrameworks.FirstOrDefault(); 1027depsFile = depsFiles.FirstOrDefault()?.FullName;
Shared\TargetFrameworkHelper.cs (1)
166targetFramework = targetFrameworks.FirstOrDefault() ?? string.Empty;
Shared\Utilities\PathHelper.cs (1)
253fullPath = EnumerateItems(workingDir).Where(item => Path.GetFileName(item).Equals(itemName, RuntimeEnvironmentHelper.FileStringComparison)).FirstOrDefault();
Tool.cs (1)
295needSave |= project.AddDependency(TargetFrameworkHelper.FullFrameworkReferences.FirstOrDefault());
dotnet-svcutil-lib.Tests (1)
TestInit.cs (1)
563FileInfo nugetFile = binDirectory.GetFiles("dotnet-svcutil-lib.*.nupkg", SearchOption.AllDirectories).Where(f => !f.Name.Contains("symbols")).OrderByDescending(f => f.LastWriteTime).FirstOrDefault();
dotnet-user-jwts (2)
src\Shared\CommandLineUtils\CommandLine\CommandArgument.cs (1)
25return Values.FirstOrDefault();
src\Tools\Shared\SecretsHelpers\UserSecretsCreator.cs (1)
31var existingUserSecretsId = projectDocument.XPathSelectElements("//UserSecretsId").FirstOrDefault();
dotnet-user-secrets (2)
src\Shared\CommandLineUtils\CommandLine\CommandArgument.cs (1)
25return Values.FirstOrDefault();
src\Tools\Shared\SecretsHelpers\UserSecretsCreator.cs (1)
31var existingUserSecretsId = projectDocument.XPathSelectElements("//UserSecretsId").FirstOrDefault();
GetDocument.Insider (1)
src\Shared\CommandLineUtils\CommandLine\CommandArgument.cs (1)
25return Values.FirstOrDefault();
IdeCoreBenchmarks (1)
ProjectOperationBenchmarks.cs (1)
108var documentId = Project.DocumentIds.FirstOrDefault();
Identity.DefaultUI.WebSite (1)
src\Identity\test\InMemory.Test\InMemoryUserStore.cs (1)
339where user.Claims.Where(x => x.ClaimType == claim.Type && x.ClaimValue == claim.Value).FirstOrDefault() != null
illink (5)
ILLink.RoslynAnalyzer (3)
RequiresAssemblyFilesAnalyzer.cs (1)
72 var isDynamicCodeSupportedProperty = runtimeFeaturesType.GetMembers ("IsAssemblyFilesSupported").OfType<IPropertySymbol> ().FirstOrDefault ();
RequiresDynamicCodeAnalyzer.cs (1)
132 var isDynamicCodeSupportedProperty = runtimeFeaturesType.GetMembers ("IsDynamicCodeSupported").OfType<IPropertySymbol> ().FirstOrDefault ();
RequiresUnreferencedCodeAnalyzer.cs (1)
75 var isDynamicCodeSupportedProperty = runtimeFeaturesType.GetMembers ("IsUnreferencedCodeSupported").OfType<IPropertySymbol> ().FirstOrDefault ();
InProcessWebSite (1)
src\Servers\IIS\IIS\test\testassets\InProcessWebSite\Program.cs (1)
23var mode = args.FirstOrDefault();
Microsoft.Analyzers.Extra.Tests (4)
SyntaxNodeExtensionsTests.cs (4)
54var methodInvocSyntax = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().FirstOrDefault(); 86var methodInvocSyntax = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().FirstOrDefault(); 149var methodInvocSyntax = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().FirstOrDefault(); 179var methodInvocSyntax = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().FirstOrDefault();
Microsoft.Analyzers.Local (3)
InternalReferencedInPublicDocAnalyzer.cs (3)
26var documentationComment = crefNode.Ancestors(ascendOutOfTrivia: false).OfType<DocumentationCommentTriviaSyntax>().FirstOrDefault(); 34var symbolNode = crefNode.Ancestors().OfType<MemberDeclarationSyntax>().FirstOrDefault(); 45.FirstOrDefault();
Microsoft.AspNetCore.App.Analyzers (8)
Mvc\DetectAmbiguousActionRoutes.cs (1)
122var actionNameAttribute = actionSymbol.GetAttributes(wellKnownTypes.Get(WellKnownType.Microsoft_AspNetCore_Mvc_ActionNameAttribute), inherit: true).FirstOrDefault();
Mvc\DetectOverriddenAuthorizeAttribute.cs (1)
118var attributeUsage = attribute.GetAttributes(attributeUsageAttributeType, inherit: true).FirstOrDefault();
Mvc\MvcAnalyzer.cs (1)
71var controllerRouteAttribute = namedTypeSymbol.GetAttributes(wellKnownTypes.Get(WellKnownType.Microsoft_AspNetCore_Mvc_RouteAttribute), inherit: true).FirstOrDefault();
RouteHandlers\DetectMisplacedLambdaAttribute.cs (1)
28if (lambda.ChildOperations.Count != 1 || lambda.ChildOperations.FirstOrDefault() is not IBlockOperation blockOperation)
RouteHandlers\DisallowMvcBindArgumentsOnParameters.cs (2)
24var modelBindingAttribute = parameter.GetAttributes(wellKnownTypes.Get(WellKnownType.Microsoft_AspNetCore_Mvc_ModelBinding_IBinderTypeProviderMetadata)).FirstOrDefault() ?? 25parameter.GetAttributes(wellKnownTypes.Get(WellKnownType.Microsoft_AspNetCore_Mvc_BindAttribute)).FirstOrDefault();
RouteHandlers\RouteHandlerAnalyzer.cs (1)
82delegateCreation = argument.Descendants().OfType<IDelegateCreationOperation>().FirstOrDefault();
WebApplicationBuilder\WebApplicationBuilderAnalyzer.cs (1)
285.FirstOrDefault();
Microsoft.AspNetCore.App.UnitTests (1)
SharedFxTests.cs (1)
327var sharedFxPath = Directory.GetFiles(packageFolder, "Microsoft.AspNetCore.App.Runtime.*-*." + TestData.GetSharedFxVersion() + ".nupkg").FirstOrDefault();
Microsoft.AspNetCore.Authentication.Test (2)
CookieTests.cs (1)
1727var cookie = (await server.SendAsync("http://www.example.com/signin")).SetCookie.FirstOrDefault();
JwtBearerTests_Handler.cs (1)
1042Assert.Equal(firstKey, Convert.ToBase64String(jwtBearerOptions.TokenValidationParameters.IssuerSigningKeys.OfType<SymmetricSecurityKey>().FirstOrDefault()?.Key));
Microsoft.AspNetCore.Components.Endpoints (1)
Builder\RazorComponentsEndpointRouteBuilderExtensions.cs (1)
45var dataSource = endpoints.DataSources.OfType<RazorComponentEndpointDataSource<TRootComponent>>().FirstOrDefault();
Microsoft.AspNetCore.Components.WebAssembly (1)
HotReload\HotReloadAgent.cs (1)
281return loadedAssembly.Modules.FirstOrDefault()?.ModuleVersionId;
Microsoft.AspNetCore.Components.WebAssembly.Server (1)
AuthenticationStateSerializationOptions.cs (1)
44if (authenticationState.User.Identities.FirstOrDefault() is { } identity)
Microsoft.AspNetCore.Cors.Test (4)
CorsMiddlewareTests.cs (4)
59Assert.Equal(OriginUrl, response.Headers.GetValues(CorsConstants.AccessControlAllowOrigin).FirstOrDefault()); 101Assert.Equal(OriginUrl, response.Headers.GetValues(CorsConstants.AccessControlAllowOrigin).FirstOrDefault()); 102Assert.Equal("AllowedHeader", response.Headers.GetValues(CorsConstants.AccessControlExposeHeaders).FirstOrDefault()); 151Assert.Equal(OriginUrl, response.Headers.GetValues(CorsConstants.AccessControlAllowOrigin).FirstOrDefault());
Microsoft.AspNetCore.DataProtection (3)
KeyManagement\DefaultKeyResolver.cs (2)
163select key).FirstOrDefault(); 205select key).FirstOrDefault();
XmlEncryption\XmlEncryptionExtensions.cs (1)
39var elementWhichRequiresDecryption = doc.Descendants(XmlConstants.EncryptedSecretElementName).FirstOrDefault();
Microsoft.AspNetCore.Diagnostics (2)
DeveloperExceptionPage\Views\CompilationErrorPage.Designer.cs (1)
349var fileName = errorDetail.StackFrames.FirstOrDefault()?.File;
DeveloperExceptionPage\Views\ErrorPage.Designer.cs (1)
370var firstFrame = errorDetail.StackFrames.FirstOrDefault();
Microsoft.AspNetCore.Diagnostics.Middleware.Tests (1)
Latency\ChecpointAcceptanceTests.cs (1)
112.FirstOrDefault();
Microsoft.AspNetCore.Grpc.JsonTranscoding (2)
src\Grpc\JsonTranscoding\src\Shared\Legacy.cs (2)
400.FirstOrDefault()?.PreferredAlias ?? true) 403.FirstOrDefault()
Microsoft.AspNetCore.Grpc.Swagger (3)
Internal\XmlComments\GrpcXmlCommentsOperationFilter.cs (1)
24var grpcMetadata = context.ApiDescription.ActionDescriptor.EndpointMetadata.OfType<GrpcMethodMetadata>().FirstOrDefault();
src\Grpc\JsonTranscoding\src\Shared\Legacy.cs (2)
400.FirstOrDefault()?.PreferredAlias ?? true) 403.FirstOrDefault()
Microsoft.AspNetCore.Hosting (3)
Internal\StartupLoader.cs (2)
274var typeInfo = startupType1.Concat(startupType2).FirstOrDefault(); 338var methodInfo = selectedMethods.FirstOrDefault();
src\Shared\ErrorPage\ErrorPage.Designer.cs (1)
316var firstFrame = errorDetail.StackFrames.FirstOrDefault();
Microsoft.AspNetCore.Http.Connections.Client (1)
Internal\Constants.cs (1)
22.FirstOrDefault();
Microsoft.AspNetCore.Http.Connections.Tests (1)
HttpConnectionDispatcherTests.cs (1)
824Assert.Equal("claimValue", connectionHttpContext.User.Claims.FirstOrDefault().Value);
Microsoft.AspNetCore.Http.Extensions (7)
RequestDelegateFactory.cs (7)
719if (parameterCustomAttributes.OfType<IFromRouteMetadata>().FirstOrDefault() is { } routeAttribute) 730else if (parameterCustomAttributes.OfType<IFromQueryMetadata>().FirstOrDefault() is { } queryAttribute) 735else if (parameterCustomAttributes.OfType<IFromHeaderMetadata>().FirstOrDefault() is { } headerAttribute) 740else if (parameterCustomAttributes.OfType<IFromBodyMetadata>().FirstOrDefault() is { } bodyAttribute) 755else if (parameterCustomAttributes.OfType<IFromFormMetadata>().FirstOrDefault() is { } formAttribute) 798if (parameterCustomAttributes.OfType<FromKeyedServicesAttribute>().FirstOrDefault() is not null) 806else if (parameterCustomAttributes.OfType<FromKeyedServicesAttribute>().FirstOrDefault() is { } keyedServicesAttribute)
Microsoft.AspNetCore.Http.Extensions.Tests (1)
RequestDelegateGenerator\CompileTimeCreationTests.cs (1)
562var log1 = logs.FirstOrDefault();
Microsoft.AspNetCore.Http.Tests (10)
Features\QueryFeatureTests.cs (10)
37Assert.Equal("value1", queryCollection["key1"].FirstOrDefault()); 38Assert.Equal("value2", queryCollection["key2"].FirstOrDefault()); 102Assert.Equal("valueB", queryCollection["key2"].FirstOrDefault()); 117Assert.Equal("valueB", queryCollection["key2"].FirstOrDefault()); 131Assert.Equal(string.Empty, queryCollection["key1"].FirstOrDefault()); 132Assert.Equal(string.Empty, queryCollection["key2"].FirstOrDefault()); 162Assert.Equal("", queryCollection["fields [todoItems]"].FirstOrDefault()); 176Assert.Equal("fields [todoItems]", queryCollection[""].FirstOrDefault()); 190Assert.Equal("", queryCollection["fields [todoItems]"].FirstOrDefault()); 204Assert.Equal("[ 1 ]", queryCollection["fields [todoItems]"].FirstOrDefault());
Microsoft.AspNetCore.HttpLogging.Tests (2)
FileLoggerProcessorTests.cs (2)
239await WaitForCondition(() => testSink.Writes.FirstOrDefault()?.EventId.Name == "MaxFilesReached").DefaultTimeout(); 255await WaitForCondition(() => testSink2.Writes.FirstOrDefault()?.EventId.Name == "MaxFilesReached").DefaultTimeout();
Microsoft.AspNetCore.HttpsPolicy.Tests (4)
HstsMiddlewareTests.cs (3)
71Assert.Equal("max-age=2592000", response.Headers.GetValues(HeaderNames.StrictTransportSecurity).FirstOrDefault()); 117Assert.Equal(expected, response.Headers.GetValues(HeaderNames.StrictTransportSecurity).FirstOrDefault()); 163Assert.Equal(expected, response.Headers.GetValues(HeaderNames.StrictTransportSecurity).FirstOrDefault());
HttpsPolicyTests.cs (1)
77Assert.Equal(expectedHstsHeader, response.Headers.GetValues(HeaderNames.StrictTransportSecurity).FirstOrDefault());
Microsoft.AspNetCore.Identity.EntityFrameworkCore (1)
IdentityUserContext.cs (1)
105.FirstOrDefault()?.ApplicationServiceProvider
Microsoft.AspNetCore.Identity.EntityFrameworkCore.Test (2)
UserStoreWithGenericsTest.cs (2)
163Claim oldClaim = userClaims.FirstOrDefault(); 167Claim newClaim = newUserClaims.FirstOrDefault();
Microsoft.AspNetCore.Identity.InMemory.Test (2)
FunctionalTest.cs (1)
446transaction.SetCookie = transaction.Response.Headers.GetValues("Set-Cookie").FirstOrDefault();
InMemoryUserStore.cs (1)
339where user.Claims.Where(x => x.ClaimType == claim.Type && x.ClaimValue == claim.Value).FirstOrDefault() != null
Microsoft.AspNetCore.Identity.Specification.Tests (2)
IdentityResultAssert.cs (2)
53Assert.Equal(error.Description, result.Errors.FirstOrDefault()?.Description); 54Assert.Equal(error.Code, result.Errors.FirstOrDefault()?.Code);
Microsoft.AspNetCore.Identity.Test (1)
IdentityUIScriptsTest.cs (1)
175var solutionPath = Directory.EnumerateFiles(directoryInfo.FullName, "*.sln").FirstOrDefault();
Microsoft.AspNetCore.InternalTesting (4)
Logging\XunitLoggerProvider.cs (1)
78messageBuilder.AppendLine(firstLinePrefix + lines.FirstOrDefault() ?? string.Empty);
TestFileOutputContext.cs (3)
78var attribute = assembly.GetCustomAttributes().OfType<TestOutputDirectoryAttribute>().FirstOrDefault(); 84var attribute = assembly.GetCustomAttributes().OfType<TestOutputDirectoryAttribute>().FirstOrDefault(); 96var attribute = assembly.GetCustomAttributes().OfType<TestOutputDirectoryAttribute>().FirstOrDefault();
Microsoft.AspNetCore.InternalTesting.Tests (1)
TestableAssembly.cs (1)
43ThisAssembly.GetCustomAttributes().OfType<TestOutputDirectoryAttribute>().FirstOrDefault();
Microsoft.AspNetCore.Mvc.Abstractions (1)
ModelBinding\BindingInfo.cs (1)
180if (attributes.OfType<FromKeyedServicesAttribute>().FirstOrDefault() is { } fromKeyedServicesAttribute)
Microsoft.AspNetCore.Mvc.Api.Analyzers (10)
ActualApiResponseMetadataFactory.cs (2)
89?.FirstOrDefault(); 97.FirstOrDefault();
AddResponseTypeAttributeCodeFixAction.cs (1)
95var apiConventionMethodAttribute = context.Method.GetAttributes(context.SymbolCache.ApiConventionMethodAttribute).FirstOrDefault();
SymbolApiConventionMatcher.cs (2)
63var attribute = symbol.GetAttributes(symbolCache.ApiConventionNameMatchAttribute).FirstOrDefault(); 85var attribute = symbol.GetAttributes(symbolCache.ApiConventionTypeMatchAttribute).FirstOrDefault();
SymbolApiResponseMetadataProvider.cs (5)
48method.GetAttributes(symbolCache.ProducesErrorResponseTypeAttribute).FirstOrDefault() ?? 49method.ContainingType.GetAttributes(symbolCache.ProducesErrorResponseTypeAttribute).FirstOrDefault() ?? 50method.ContainingAssembly.GetAttributes(symbolCache.ProducesErrorResponseTypeAttribute).FirstOrDefault(); 86.FirstOrDefault(); 152var producesDefaultResponse = methodSymbol.GetAttributes(symbolCache.ProducesDefaultResponseTypeAttribute, inherit: true).FirstOrDefault();
Microsoft.AspNetCore.Mvc.ApiExplorer (5)
EndpointMetadataApiDescriptionProvider.cs (5)
255if (attributes.OfType<IFromRouteMetadata>().FirstOrDefault() is { } routeAttribute) 261else if (attributes.OfType<IFromQueryMetadata>().FirstOrDefault() is { } queryAttribute) 265else if (attributes.OfType<IFromHeaderMetadata>().FirstOrDefault() is { } headerAttribute) 269else if (attributes.OfType<IFromBodyMetadata>().FirstOrDefault() is { } fromBodyAttribute) 273else if (attributes.OfType<IFromFormMetadata>().FirstOrDefault() is { } fromFormAttribute)
Microsoft.AspNetCore.Mvc.ApiExplorer.Test (1)
EndpointMetadataApiDescriptionProviderTest.cs (1)
775.FirstOrDefault();
Microsoft.AspNetCore.Mvc.Core (17)
ApplicationModels\ApiConventionApplicationModelConvention.cs (2)
79action.Attributes.OfType<ProducesErrorResponseTypeAttribute>().FirstOrDefault() ?? 80action.Controller.Attributes.OfType<ProducesErrorResponseTypeAttribute>().FirstOrDefault() ??
ApplicationModels\ApplicationModelFactory.cs (1)
303var verbs = selector.ActionConstraints?.OfType<HttpMethodActionConstraint>().FirstOrDefault()?.HttpMethods;
ApplicationModels\DefaultApplicationModelProvider.cs (5)
175var apiVisibility = attributes.OfType<IApiDescriptionVisibilityProvider>().FirstOrDefault(); 181var apiGroupName = attributes.OfType<IApiDescriptionGroupNameProvider>().FirstOrDefault(); 273var actionName = attributes.OfType<ActionNameAttribute>().FirstOrDefault(); 283var apiVisibility = attributes.OfType<IApiDescriptionVisibilityProvider>().FirstOrDefault(); 289var apiGroupName = attributes.OfType<IApiDescriptionGroupNameProvider>().FirstOrDefault();
Builder\ControllerEndpointRouteBuilderExtensions.cs (1)
530var dataSource = endpoints.DataSources.OfType<ControllerActionEndpointDataSource>().FirstOrDefault();
Filters\MiddlewareFilterConfigurationProvider.cs (1)
51var methodInfo = selectedMethods.FirstOrDefault();
ModelBinding\Metadata\DefaultBindingMetadataProvider.cs (3)
156return matchingAttributes.FirstOrDefault() 160.FirstOrDefault(); 162return context.ParameterAttributes!.OfType<BindingBehaviorAttribute>().FirstOrDefault();
ModelBinding\Metadata\DefaultValidationMetadataProvider.cs (3)
40var validationFilter = context.PropertyAttributes!.OfType<IPropertyValidationFilter>().FirstOrDefault(); 48.FirstOrDefault(); 55var validationFilter = context.ParameterAttributes!.OfType<IPropertyValidationFilter>().FirstOrDefault();
ModelBinding\Metadata\SystemTextJsonValidationMetadataProvider.cs (1)
69=> attributes?.OfType<JsonPropertyNameAttribute>().FirstOrDefault()?.Name;
Microsoft.AspNetCore.Mvc.Cors (4)
CorsApplicationModelProvider.cs (4)
47var enableCors = controllerModel.Attributes.OfType<IEnableCorsAttribute>().FirstOrDefault(); 53var disableCors = controllerModel.Attributes.OfType<IDisableCorsAttribute>().FirstOrDefault(); 63enableCors = actionModel.Attributes.OfType<IEnableCorsAttribute>().FirstOrDefault(); 69disableCors = actionModel.Attributes.OfType<IDisableCorsAttribute>().FirstOrDefault();
Microsoft.AspNetCore.Mvc.DataAnnotations (10)
DataAnnotationsMetadataProvider.cs (10)
46var editableAttribute = context.Attributes.OfType<EditableAttribute>().FirstOrDefault(); 59var dataTypeAttribute = attributes.OfType<DataTypeAttribute>().FirstOrDefault(); 60var displayAttribute = attributes.OfType<DisplayAttribute>().FirstOrDefault(); 61var displayColumnAttribute = attributes.OfType<DisplayColumnAttribute>().FirstOrDefault(); 62var displayFormatAttribute = attributes.OfType<DisplayFormatAttribute>().FirstOrDefault(); 63var displayNameAttribute = attributes.OfType<DisplayNameAttribute>().FirstOrDefault(); 64var hiddenInputAttribute = attributes.OfType<HiddenInputAttribute>().FirstOrDefault(); 65var scaffoldColumnAttribute = attributes.OfType<ScaffoldColumnAttribute>().FirstOrDefault(); 66var uiHintAttribute = attributes.OfType<UIHintAttribute>().FirstOrDefault(); 322var requiredAttribute = attributes.OfType<RequiredAttribute>().FirstOrDefault();
Microsoft.AspNetCore.Mvc.Formatters.Xml (1)
ModelBinding\DataMemberRequiredBindingMetadataProvider.cs (1)
35.FirstOrDefault();
Microsoft.AspNetCore.Mvc.FunctionalTests (3)
AuthMiddlewareAndFilterTestBase.cs (1)
283return response.Headers.GetValues("Set-Cookie").FirstOrDefault();
AuthMiddlewareUsingRequireAuthTest.cs (1)
85return response.Headers.GetValues("Set-Cookie").FirstOrDefault();
TestingInfrastructureTests.cs (1)
23Factory = fixture.Factories.FirstOrDefault() ?? fixture.WithWebHostBuilder(ConfigureWebHostBuilder);
Microsoft.AspNetCore.Mvc.NewtonsoftJson (1)
NewtonsoftJsonValidationMetadataProvider.cs (1)
66=> attributes?.OfType<JsonPropertyAttribute>().FirstOrDefault()?.PropertyName;
Microsoft.AspNetCore.Mvc.Razor (1)
RazorHotReload.cs (1)
29_razorCompiledItemFeatureProvider = applicationPartManager.FeatureProviders.OfType<RazorCompiledItemFeatureProvider>().FirstOrDefault();
Microsoft.AspNetCore.Mvc.RazorPages (1)
Builder\RazorPagesEndpointRouteBuilderExtensions.cs (1)
376var dataSource = endpoints.DataSources.OfType<PageActionEndpointDataSource>().FirstOrDefault();
Microsoft.AspNetCore.Mvc.RazorPages.Test (1)
Infrastructure\PageActionInvokerTest.cs (1)
1562.Returns<PageContext>(c => c.ActionDescriptor.HandlerMethods.FirstOrDefault());
Microsoft.AspNetCore.Mvc.ViewFeatures (1)
Filters\AntiforgeryApplicationModelProvider.cs (1)
55var antiforgeryAttribute = filters.OfType<ValidateAntiForgeryTokenAttribute>().FirstOrDefault();
Microsoft.AspNetCore.Mvc.ViewFeatures.Test (12)
ExpressionHelperTest.cs (12)
100(Expression<Func<IList<TestModel>, string>>)(model => model.FirstOrDefault().Name), 104(Expression<Func<IList<LowerModel>, string>>)(model => model.FirstOrDefault().name), 108(Expression<Func<IList<TestModel>, string>>)(model => model.FirstOrDefault().Model), 112(Expression<Func<IList<TestModel>, int>>)(model => model.FirstOrDefault().SelectedCategory.CategoryId), 116(Expression<Func<IList<TestModel>, string>>)(model => model.FirstOrDefault().SelectedCategory.CategoryName.MainCategory), 120(Expression<Func<IList<TestModel>, int>>)(model => model.FirstOrDefault().PreferredCategories.Count), 124(Expression<Func<IList<TestModel>, int>>)(model => model.FirstOrDefault().PreferredCategories.FirstOrDefault().CategoryId), 235(Expression<Func<IList<TestModel>, string>>)(model => model.FirstOrDefault().Name), 236(Expression<Func<IList<TestModel>, string>>)(model => model.FirstOrDefault().SelectedCategory.CategoryName.MainCategory), 237(Expression<Func<IList<TestModel>, int>>)(model => model.FirstOrDefault().PreferredCategories.FirstOrDefault().CategoryId),
Microsoft.AspNetCore.OpenApi (6)
Services\OpenApiGenerator.cs (6)
297var hasFormAttribute = requestBodyParameter.GetCustomAttributes().OfType<IFromFormMetadata>().FirstOrDefault() != null; 403if (attributes.OfType<IFromRouteMetadata>().FirstOrDefault() is { } routeAttribute) 407else if (attributes.OfType<IFromQueryMetadata>().FirstOrDefault() is { } queryAttribute) 411else if (attributes.OfType<IFromHeaderMetadata>().FirstOrDefault() is { } headerAttribute) 415else if (attributes.OfType<IFromBodyMetadata>().FirstOrDefault() is { } fromBodyAttribute) 419else if (attributes.OfType<IFromFormMetadata>().FirstOrDefault() is { } fromFormAttribute)
Microsoft.AspNetCore.OpenApi.Tests (1)
Services\OpenApiGeneratorTests.cs (1)
87var content = operation.RequestBody.Content.Keys.FirstOrDefault();
Microsoft.AspNetCore.ResponseCompression (1)
ResponseCompressionProvider.cs (1)
141selectedProvider = candidates.FirstOrDefault().Provider;
Microsoft.AspNetCore.Rewrite (3)
IISUrlRewrite\UrlRewriteFileParser.cs (3)
24var xmlRoot = xmlDoc.Descendants(RewriteTags.Rewrite).FirstOrDefault(); 34ParseRules(xmlRoot.Descendants(RewriteTags.GlobalRules).FirstOrDefault(), result, global: true); 35ParseRules(xmlRoot.Descendants(RewriteTags.Rules).FirstOrDefault(), result, global: false);
Microsoft.AspNetCore.Rewrite.Tests (1)
IISUrlRewrite\RewriteMapParserTests.cs (1)
28var xmlRoot = xmlDoc.Descendants(RewriteTags.Rewrite).FirstOrDefault();
Microsoft.AspNetCore.Server.HttpSys.FunctionalTests (2)
ResponseCachingTests.cs (2)
480return response.Headers.GetValues("x-request-count").FirstOrDefault(); 491return response.Headers.GetValues("x-request-count").FirstOrDefault();
Microsoft.AspNetCore.Server.IIS (1)
src\Shared\ErrorPage\ErrorPage.Designer.cs (1)
316var firstFrame = errorDetail.StackFrames.FirstOrDefault();
Microsoft.AspNetCore.Server.IntegrationTesting (1)
Deployers\RemoteWindowsDeployer\RemoteWindowsDeployer.cs (1)
166var environmentVariablesSection = aspNetCoreSection.Elements("environmentVariables").FirstOrDefault();
Microsoft.AspNetCore.Server.IntegrationTesting.IIS (2)
IISDeployer.cs (2)
297var app = site.Applications.FirstOrDefault(); 298if (app != null && app.VirtualDirectories.FirstOrDefault()?.PhysicalPath == contentRoot)
Microsoft.AspNetCore.Server.Kestrel.Core (1)
Internal\Http\HttpProtocol.cs (1)
944(expect.FirstOrDefault() ?? "").Equals("100-continue", StringComparison.OrdinalIgnoreCase))
Microsoft.AspNetCore.Server.Kestrel.Core.Tests (1)
src\Servers\Kestrel\shared\KnownHeaders.cs (1)
404var firstTermVarExpression = values.Select(h => h.FirstNameIgnoreCaseSegment()).FirstOrDefault();
Microsoft.AspNetCore.Shared.Tests (1)
src\Shared\CommandLineUtils\CommandLine\CommandArgument.cs (1)
25return Values.FirstOrDefault();
Microsoft.AspNetCore.StaticFiles.Tests (2)
DefaultFilesMiddlewareTests.cs (1)
267var actualURL = response.Headers.GetValues("Location").FirstOrDefault();
DirectoryBrowserMiddlewareTests.cs (1)
272Assert.Equal("http://localhost" + requestUrl + "/" + queryString, response.Headers.GetValues("Location").FirstOrDefault());
Microsoft.AspNetCore.TestHost (1)
WebHostBuilderExtensions.cs (1)
155var solutionPath = Directory.EnumerateFiles(directoryInfo.FullName, solutionName).FirstOrDefault();
Microsoft.AspNetCore.WebUtilities.Tests (11)
QueryHelpersTests.cs (11)
15Assert.Equal("value1", collection["key1"].FirstOrDefault()); 16Assert.Equal("value2", collection["key2"].FirstOrDefault()); 24Assert.Equal("value1", collection["key1"].FirstOrDefault()); 25Assert.Equal("value2", collection["key2"].FirstOrDefault()); 34Assert.Equal("valueB", collection["key2"].FirstOrDefault()); 42Assert.Equal(string.Empty, collection["key1"].FirstOrDefault()); 43Assert.Equal(string.Empty, collection["key2"].FirstOrDefault()); 59Assert.Equal("", collection["fields [todoItems]"].FirstOrDefault()); 67Assert.Equal("fields [todoItems]", collection[""].FirstOrDefault()); 75Assert.Equal("", collection["fields [todoItems]"].FirstOrDefault()); 83Assert.Equal("[ 1 ]", collection["fields [todoItems]"].FirstOrDefault());
Microsoft.Build (9)
BackEnd\BuildManager\BuildManager.cs (1)
903_buildTelemetry.Project ??= requestData.EntryProjectsFullPath.FirstOrDefault();
BackEnd\Components\ProjectCache\ProjectCacheService.cs (1)
355var type = GetTypes<ProjectCachePluginBase>(assembly).FirstOrDefault();
BackEnd\Components\SdkResolution\SdkResult.cs (1)
56var firstPath = paths.FirstOrDefault();
BuildCheck\Infrastructure\BuildCheckManagerProvider.cs (2)
500projectFullPath = _projectsByInstanceId.FirstOrDefault().Value; 510projectFullPath = _projectsByEvaluationId.FirstOrDefault().Value;
Construction\ProjectRootElement.cs (2)
705=> GetChildrenReversedOfType<ProjectExtensionsElement>().FirstOrDefault(); 1033ProjectElement reference = ItemGroupsReversed.FirstOrDefault();
Graph\GraphBuildRequestData.cs (2)
218ProjectGraphNode? node = ProjectGraph?.EntryPointNodes.FirstOrDefault(); 224ProjectGraphEntryPoint? entryPoint = ProjectGraphEntryPoints?.FirstOrDefault();
Microsoft.Build.BuildCheck.UnitTests (1)
TestAssemblyInfo.cs (1)
121var cliVersionElement = doc.Root.Elements(ns + "PropertyGroup").Elements(ns + "DotNetCliVersion").FirstOrDefault();
Microsoft.Build.CommandLine.UnitTests (1)
TestAssemblyInfo.cs (1)
121var cliVersionElement = doc.Root.Elements(ns + "PropertyGroup").Elements(ns + "DotNetCliVersion").FirstOrDefault();
Microsoft.Build.Engine.OM.UnitTests (31)
Definition\Project_Tests.cs (3)
2293List<ProjectItem> list = new List<ProjectItem>() { project.GetItems("i").FirstOrDefault(), project.GetItems("j").FirstOrDefault() }; 2404ProjectItem item = project.GetItems("i").FirstOrDefault();
Definition\ProjectItem_Tests.cs (3)
2159var metadata = project.GetItems("I").FirstOrDefault().SetMetadataValue("M", "$(P);@(Foo)", true); 2185var item = project.GetItems("I").FirstOrDefault(); 2193ProjectMetadataElement metadataElement = item.Xml.Metadata.FirstOrDefault();
ObjectModelRemoting\Helpers\ViewValidation.construction.cs (2)
197return result.FirstOrDefault(); 204return result.FirstOrDefault();
ObjectModelRemoting\LinkedConstructionModify_Tests.cs (4)
45var newView = this.StdGroup.Local.GetLoadedProjects(tempPath).FirstOrDefault(); 85ViewValidation.VerifyMetadata(itemMetadata, (k) => itemWithMetadata1.View.Metadata.Where((md) => md.Name == k).FirstOrDefault().Value); 707ViewValidation.VerifyMetadata(itemMetadata, (k) => itemWithMetadata1.View.Metadata.Where((md) => md.Name == k).FirstOrDefault().Value); 708ViewValidation.VerifyMetadata(itemMetadata, (k) => itemWithMetadata2.View.Metadata.Where((md) => md.Name == k).FirstOrDefault().Value);
ObjectModelRemoting\LinkedConstructionReadOnly_Tests.cs (4)
35var projView = this.Local.GetLoadedProjects(this.BigFile).FirstOrDefault(); 47var projView = this.Local.GetLoadedProjects(this.BigFile).FirstOrDefault(); 99var realXml = realExtensionsList.FirstOrDefault(); 100var viewXml = viewExtensionsList.FirstOrDefault();
ObjectModelRemoting\LinkedEvaluationModify_Tests.cs (4)
40var viewProj = pcLocal.Collection.GetLoadedProjects(proj1Path).FirstOrDefault(); 114var viewProj = pcLocal.Collection.GetLoadedProjects(proj1Path).FirstOrDefault(); 310var viewProj = pcLocal.Collection.GetLoadedProjects(proj1Path).FirstOrDefault(); 346var viewProj = pcLocal.Collection.GetLoadedProjects(proj1Path).FirstOrDefault();
ObjectModelRemoting\LinkedEvaluationReadOnly_Tests.cs (2)
29var projView = this.Local.GetLoadedProjects(this.BigFile).FirstOrDefault(); 41var projView = this.Local.GetLoadedProjects(this.BigFile).FirstOrDefault();
ObjectModelRemoting\LinkedProjectCollection_Tests.cs (5)
46Assert.Same(proj1, loadedLocal.FirstOrDefault()); 47Assert.Same(proj2, loadedRemote.FirstOrDefault()); 55var localProj = pcLocal.Collection.GetLoadedProjects(proj1Path).FirstOrDefault(); 58var remoteProj = pcLocal.Collection.GetLoadedProjects(proj2Path).FirstOrDefault(); 118ViewValidation.VerifyLinkedNotNull(prj3Coll.FirstOrDefault());
ObjectModelRemoting\LinkedSpecialCasesScenarios.cs (3)
54var targetView = this.Local.GetLoadedProjects(this.TargetBigPath).FirstOrDefault(); 61var guestView = this.Local.GetLoadedProjects(this.GuestBigPath).FirstOrDefault(); 82var newView = this.StdGroup.Local.GetLoadedProjects(tempPath).FirstOrDefault();
TestAssemblyInfo.cs (1)
121var cliVersionElement = doc.Root.Elements(ns + "PropertyGroup").Elements(ns + "DotNetCliVersion").FirstOrDefault();
Microsoft.Build.Engine.UnitTests (9)
BackEnd\BuildManager_Tests.cs (1)
200graph.GraphRoots.FirstOrDefault()
Construction\SolutionProjectGenerator_Tests.cs (3)
2543ProjectInstance projectInstance = SolutionProjectGenerator.Generate(solutionFile, null, null, BuildEventContext.Invalid, CreateMockLoggingService(), new[] { "MyTarget" }).FirstOrDefault(); 2604ProjectInstance projectInstance = SolutionProjectGenerator.Generate(solutionFile, null, null, BuildEventContext.Invalid, CreateMockLoggingService(), targetsToBuild).FirstOrDefault(); 2721ProjectInstance projectInstance = SolutionProjectGenerator.Generate(solutionFile, globalProperties, null, BuildEventContext.Invalid, CreateMockLoggingService(), new[] { "Build" }).FirstOrDefault();
Graph\ProjectGraph_Tests.cs (1)
2226var innerBuild2 = GetInnerBuilds(graph, 2).FirstOrDefault();
Parser_Tests.cs (1)
579var projectItem = project.GetItems("A").FirstOrDefault();
TestAssemblyInfo.cs (1)
121var cliVersionElement = doc.Root.Elements(ns + "PropertyGroup").Elements(ns + "DotNetCliVersion").FirstOrDefault();
WarningsAsMessagesAndErrors_Tests.cs (2)
223BuildErrorEventArgs actualEvent = logger.Errors.FirstOrDefault(); 235BuildWarningEventArgs actualEvent = logger.Warnings.FirstOrDefault();
Microsoft.Build.Framework.UnitTests (1)
TestAssemblyInfo.cs (1)
121var cliVersionElement = doc.Root.Elements(ns + "PropertyGroup").Elements(ns + "DotNetCliVersion").FirstOrDefault();
Microsoft.Build.Tasks.Core (4)
BootstrapperUtil\BootstrapperBuilder.cs (1)
1860KeyValuePair<string, XmlNode> altCulturePair = _cultures.FirstOrDefault();
GetSDKReferenceFiles.cs (1)
927string cacheFile = Directory.EnumerateFiles(_cacheFileDirectory, GetCacheFileName(sdkIdentity, sdkRoot, "*")).FirstOrDefault();
ResolveSDKReference.cs (1)
531var resolvedReference = sdkReferenceItems.Where(y => String.Equals(y.SimpleName, simpleName, StringComparison.OrdinalIgnoreCase) && String.Equals(y.Version, sdkVersion, StringComparison.OrdinalIgnoreCase)).DefaultIfEmpty(null).FirstOrDefault();
WriteCodeFragment.cs (1)
260() => Type.GetType(attribute.Name, throwOnError: false) ?? NamespaceImports.Select(x => Type.GetType($"{x}.{attribute.Name}", throwOnError: false)).FirstOrDefault(),
Microsoft.Build.Tasks.UnitTests (4)
CodeTaskFactoryTests.cs (1)
1225BuildErrorEventArgs error = mockLogger.Errors.FirstOrDefault();
ProjectExtensionsImportTestBase.cs (2)
231logger.Errors.Select(i => i.Code).FirstOrDefault().ShouldBe("MSB3540"); 258logger.Warnings.Select(i => i.Code).FirstOrDefault().ShouldBe("MSB3539");
TestAssemblyInfo.cs (1)
121var cliVersionElement = doc.Root.Elements(ns + "PropertyGroup").Elements(ns + "DotNetCliVersion").FirstOrDefault();
Microsoft.Build.UnitTests.Shared (1)
EngineTestEnvironment.cs (1)
212var binaryLogger = expectedLoggers.OfType<BinaryLogger>().FirstOrDefault();
Microsoft.Build.Utilities.Core (4)
ToolLocationHelper.cs (4)
535.DefaultIfEmpty(null).FirstOrDefault<TargetPlatformSDK>(); 1390return availablePlatformVersions.OrderByDescending(x => x).FirstOrDefault().ToString(); 2505DirectoryInfo extensionSdksDirectory = rootInfo.GetDirectories("Extension SDKs", SearchOption.TopDirectoryOnly).FirstOrDefault(); 2511DirectoryInfo extensionSdksDirectory2 = rootInfo.GetDirectories("ExtensionSDKs", SearchOption.TopDirectoryOnly).FirstOrDefault();
Microsoft.Build.Utilities.UnitTests (1)
TestAssemblyInfo.cs (1)
121var cliVersionElement = doc.Root.Elements(ns + "PropertyGroup").Elements(ns + "DotNetCliVersion").FirstOrDefault();
Microsoft.Cci.Extensions (12)
Extensions\CSharp\CSharpCciExtensions.cs (3)
657return ((ITypeDefinition)method.ContainingType).ExplicitImplementationOverrides.Where(mi => mi.ImplementingMethod.Equals(method)).FirstOrDefault(); 665string location = methodImplementation.ContainingType.Locations.FirstOrDefault()?.Document?.Location; 747object argument = attribute.Arguments.FirstOrDefault();
Extensions\TypeExtensions.cs (3)
354ITypeReference baseTypeRef = type.BaseClasses.FirstOrDefault(); 427select a).FirstOrDefault(); 432var nameArgument = tfmAttribute.Arguments.FirstOrDefault() as IMetadataConstant;
Writers\CSharp\CSDeclarationWriter.Attributes.cs (1)
393var arg = c.Arguments.OfType<IMetadataConstant>().FirstOrDefault();
Writers\CSharp\CSDeclarationWriter.Generics.cs (1)
88var assemblyLocation = parameter.Locations.FirstOrDefault()?.Document?.Location;
Writers\CSharp\CSDeclarationWriter.Methods.cs (2)
437var baseType = type.BaseClasses.FirstOrDefault().GetDefinitionOrNull(); 453return constructors.FirstOrDefault();
Writers\CSharp\CSDeclarationWriter.Types.cs (2)
121string location = type.Locations.FirstOrDefault()?.Document?.Location; 175ITypeReference baseTypeRef = type.BaseClasses.FirstOrDefault();
Microsoft.CodeAnalysis (3)
InternalUtilities\EnumerableExtensions.cs (1)
214return source.Cast<T?>().FirstOrDefault();
MetadataReader\PEModule.cs (2)
709var fLeft = left.FirstOrDefault(); 710var fRight = right.FirstOrDefault();
Microsoft.CodeAnalysis.CodeStyle (10)
src\Analyzers\Core\Analyzers\SimplifyInterpolation\AbstractSimplifyInterpolationHelpers.cs (1)
160var interpolatedStringOperation = AncestorsAndSelf(operation).OfType<IInterpolatedStringOperation>().FirstOrDefault();
src\Analyzers\Core\Analyzers\UseExplicitTupleName\UseExplicitTupleNameDiagnosticAnalyzer.cs (1)
58var nameNode = memberAccessSyntax.ChildNodesAndTokens().Reverse().FirstOrDefault().AsNode();
src\Compilers\Core\Portable\InternalUtilities\EnumerableExtensions.cs (1)
214return source.Cast<T?>().FirstOrDefault();
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EditorConfig\Parsing\EditorConfigFile.cs (2)
49.FirstOrDefault(); 87.FirstOrDefault();
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\ISymbolExtensions.cs (1)
542var declarationSyntax = symbol.DeclaringSyntaxReferences.Select(r => r.GetSyntax()).FirstOrDefault();
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\ITypeParameterSymbolExtensions.cs (1)
13=> typeParameter.ConstraintTypes.Select(GetNamedTypeSymbol).WhereNotNull().FirstOrDefault();
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\SyntaxNodeExtensions.cs (1)
79return node?.GetAncestorsOrThis<TNode>().FirstOrDefault();
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\BottomUpBaseIndentationFinder.cs (1)
308return GetIndentBlockOperationsFromSmallestSpan(root, list, position).FirstOrDefault();
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\SelectedMembers\AbstractSelectedMembers.cs (1)
70.FirstOrDefault();
Microsoft.CodeAnalysis.CodeStyle.Fixes (9)
src\Analyzers\Core\CodeFixes\DocumentationComments\AbstractAddDocCommentNodesCodeFixProvider.cs (2)
83var summaryNode = GetElementNodes(newDocComment, "summary").FirstOrDefault(); 103var nodeAfterNewParamNode = paramNodes.FirstOrDefault() ?? newDocComment.ChildNodes().First();
src\Analyzers\Core\CodeFixes\GenerateParameterizedMember\TypeParameterSubstitution.cs (1)
122return similarTypes.FirstOrDefault() ?? symbol;
src\Analyzers\Core\CodeFixes\ImplementAbstractClass\ImplementAbstractClassData.cs (1)
321constraints.OfType<INamedTypeSymbol>().FirstOrDefault() ??
src\Analyzers\Core\CodeFixes\MakeMethodSynchronous\AbstractMakeMethodSynchronousCodeFixProvider.cs (1)
123var methodDeclaration = syntaxRoot.GetAnnotatedNodes(annotation).FirstOrDefault();
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\AbstractCodeGenerationService.cs (1)
376var field = members.OfType<IFieldSymbol>().FirstOrDefault();
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\Symbols\CodeGenerationNamedTypeSymbol.cs (1)
101? this.GetMembers(WellKnownMemberNames.DelegateInvokeName).OfType<IMethodSymbol>().FirstOrDefault()
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Simplification\SimplificationHelpers.cs (2)
67var annotation1 = expression.GetAnnotations(SymbolAnnotation.Kind).FirstOrDefault(); 75var annotation2 = expression.GetAnnotations(SpecialTypeAnnotation.Kind).FirstOrDefault();
Microsoft.CodeAnalysis.CSharp (8)
BoundTree\UnboundLambda.cs (1)
1256.FirstOrDefault()
CommandLine\CSharpCommandLineParser.cs (1)
1676simpleName = PathUtilities.RemoveExtension(PathUtilities.GetFileName(sourceFiles.FirstOrDefault().Path));
Compilation\CSharpSemanticModel.cs (2)
793var existingConstructorInitializer = this.Root.FindToken(position).Parent.AncestorsAndSelf().OfType<ConstructorInitializerSyntax>().FirstOrDefault(); 865var existingConstructorInitializer = this.Root.FindToken(position).Parent.AncestorsAndSelf().OfType<PrimaryConstructorBaseTypeSyntax>().FirstOrDefault();
Compilation\MethodBodySemanticModel.cs (2)
241Root.FindToken(position).Parent?.AncestorsAndSelf().OfType<ConstructorInitializerSyntax>().FirstOrDefault()?.Parent == Root) 263if (Root.FindToken(position).Parent?.AncestorsAndSelf().OfType<PrimaryConstructorBaseTypeSyntax>().FirstOrDefault() == typeDecl.PrimaryConstructorBaseTypeIfClass)
Compilation\SyntaxTreeSemanticModel.cs (2)
704var existingConstructorInitializer = this.Root.FindToken(position).Parent.AncestorsAndSelf().OfType<ConstructorInitializerSyntax>().FirstOrDefault(); 723var existingConstructorInitializer = this.Root.FindToken(position).Parent.AncestorsAndSelf().OfType<PrimaryConstructorBaseTypeSyntax>().FirstOrDefault();
Microsoft.CodeAnalysis.CSharp.CodeStyle (8)
src\Analyzers\CSharp\Analyzers\UseIndexOrRangeOperator\CSharpUseRangeOperatorDiagnosticAnalyzer.InfoCache.cs (1)
73.FirstOrDefault();
src\Analyzers\CSharp\Analyzers\UseIndexOrRangeOperator\Helpers.cs (3)
31.FirstOrDefault(); 135.FirstOrDefault(); 151.FirstOrDefault();
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\ParenthesizedExpressionSyntaxExtensions.cs (1)
49var nextChar = tokenAfterParen.Text.FirstOrDefault();
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\SyntaxTreeExtensions.cs (2)
44return syntaxTree.GetContainingTypeDeclarations(position, cancellationToken).FirstOrDefault(); 50return syntaxTree.GetContainingTypeOrEnumDeclarations(position, cancellationToken).FirstOrDefault();
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Services\SemanticFacts\CSharpSemanticFacts.cs (1)
95var enumDecl = namedTypeSymbol.DeclaringSyntaxReferences.Select(r => r.GetSyntax()).OfType<EnumDeclarationSyntax>().FirstOrDefault();
Microsoft.CodeAnalysis.CSharp.CodeStyle.Fixes (7)
src\Analyzers\CSharp\CodeFixes\ConvertToRecord\ConvertToRecordHelpers.cs (3)
702return operation.FirstOrDefault() is IReturnOperation 884=> statementsToCheck.FirstOrDefault() switch 1025if (TryGetAssignmentFromParameterWithExplicitCast(statementsToCheck.FirstOrDefault(), parameter, out otherC))
src\Analyzers\CSharp\CodeFixes\Nullable\CSharpDeclareAsNullableCodeFixProvider.cs (1)
225var parameter = method.Parameters.Where(p => p.Name == identifier.Text).FirstOrDefault();
src\Analyzers\CSharp\CodeFixes\UsePrimaryConstructor\CSharpUsePrimaryConstructorCodeFixProvider.cs (1)
545var xmlElement = identifier.AncestorsAndSelf().OfType<XmlEmptyElementSyntax>().FirstOrDefault();
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\CSharpCodeGenerationHelpers.cs (1)
212var implementation = implementations.FirstOrDefault();
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\LanguageServices\CSharpTypeInferenceService.TypeInferrer.cs (1)
1558var patternType = GetPatternTypes(subPattern.Pattern).FirstOrDefault();
Microsoft.CodeAnalysis.CSharp.EditorFeatures.UnitTests (4)
AddMissingImports\CSharpAddMissingImportsRefactoringProviderTests.cs (1)
32var pastedTextSpan = hostDocument.SelectedSpans.FirstOrDefault();
Interactive\BraceMatching\InteractiveBraceHighlightingTests.cs (1)
40buffer.CurrentSnapshot.GetRelatedDocumentsWithChanges().FirstOrDefault(),
SymbolKey\SymbolKeyCompilationsTests.cs (2)
98var symbol01 = comp1.SourceModule.GlobalNamespace.GetMembers().FirstOrDefault() as NamedTypeSymbol; 99var symbol02 = comp1.SourceModule.GlobalNamespace.GetMembers().FirstOrDefault() as NamedTypeSymbol;
Microsoft.CodeAnalysis.CSharp.Emit2.UnitTests (1)
PDB\CSharpDeterministicBuildCompilationTests.cs (1)
49var firstSyntaxTree = (CSharpSyntaxTree)compilation.SyntaxTrees.FirstOrDefault();
Microsoft.CodeAnalysis.CSharp.Emit3.UnitTests (7)
FlowAnalysis\FlowTestBase.cs (1)
218return GetSyntaxNodeList(tree).OfType<T>().Where(n => n.Span.Contains(offset)).FirstOrDefault();
FlowAnalysis\RegionAnalysisTests.cs (1)
6418var statement = tree.GetCompilationUnitRoot().DescendantNodes().OfType<BlockSyntax>().FirstOrDefault();
Semantics\OutVarTests.cs (4)
1078var typeofExpression = decl.Ancestors().OfType<TypeOfExpressionSyntax>().FirstOrDefault(); 1277if ((forStatement = decl.Ancestors().OfType<ForStatementSyntax>().FirstOrDefault()) != null && 1284var containingStatement = decl.Ancestors().OfType<StatementSyntax>().FirstOrDefault(); 32707var declarator = decl.Ancestors().OfType<VariableDeclaratorSyntax>().FirstOrDefault();
Semantics\PatternMatchingTestBase.cs (1)
291var declarator = designation.Ancestors().OfType<VariableDeclaratorSyntax>().FirstOrDefault();
Microsoft.CodeAnalysis.CSharp.Features (23)
AddImport\CSharpAddImportFeatureService.cs (1)
496.FirstOrDefault();
ChangeSignature\CSharpChangeSignatureService.cs (1)
820var identifier = nameAttribute.DescendantNodes(descendIntoTrivia: true).OfType<IdentifierNameSyntax>().FirstOrDefault();
CodeRefactorings\UseRecursivePatterns\UseRecursivePatternsCodeRefactoringProvider.cs (1)
315.FirstOrDefault();
Completion\CompletionProviders\DeclarationName\DeclarationNameRecommender.cs (2)
179var system = compilation.GlobalNamespace.GetMembers(nameof(System)).OfType<INamespaceSymbol>().FirstOrDefault(); 180var systemCollections = system?.GetMembers(nameof(System.Collections)).OfType<INamespaceSymbol>().FirstOrDefault();
Completion\CompletionProviders\EnumAndCompletionListTagCompletionProvider.cs (1)
337? DocumentationCommentId.GetSymbolsForDeclarationId(documentation.CompletionListCref, compilation).OfType<INamedTypeSymbol>().FirstOrDefault()
ConvertNamespace\ConvertNamespaceCodeRefactoringProvider.cs (1)
96var namespaceDecl = root.DescendantNodes().OfType<BaseNamespaceDeclarationSyntax>().FirstOrDefault();
ConvertProgram\ConvertProgramTransform_TopLevelStatements.cs (1)
63return root.Members.OfType<FileScopedNamespaceDeclarationSyntax>().FirstOrDefault() is { } fileScopedNamespace
DocumentationComments\CSharpDocumentationCommentSnippetService.cs (1)
347var firstTextToken = textTokens.FirstOrDefault();
EditAndContinue\CSharpEditAndContinueAnalyzer.cs (2)
1624(editKind == EditKind.Delete ? globalStatements.LastOrDefault() : globalStatements.FirstOrDefault()) ?? 1625unit.ChildNodes().FirstOrDefault();
EditAndContinue\SyntaxUtilities.cs (1)
161var firstGetter = accessorList?.Accessors.Where(a => a.IsKind(SyntaxKind.GetAccessorDeclaration)).FirstOrDefault();
EncapsulateField\CSharpEncapsulateFieldService.cs (1)
40var declarator = root.GetAnnotatedNodes<VariableDeclaratorSyntax>(declarationAnnotation).FirstOrDefault();
ExtractMethod\CSharpMethodExtractor.TriviaResult.cs (1)
66var token = node.GetAnnotatedNodesAndTokens(annotation).FirstOrDefault().AsToken();
src\Analyzers\CSharp\Analyzers\UseIndexOrRangeOperator\CSharpUseRangeOperatorDiagnosticAnalyzer.InfoCache.cs (1)
73.FirstOrDefault();
src\Analyzers\CSharp\Analyzers\UseIndexOrRangeOperator\Helpers.cs (3)
31.FirstOrDefault(); 135.FirstOrDefault(); 151.FirstOrDefault();
src\Analyzers\CSharp\CodeFixes\ConvertToRecord\ConvertToRecordHelpers.cs (3)
702return operation.FirstOrDefault() is IReturnOperation 884=> statementsToCheck.FirstOrDefault() switch 1025if (TryGetAssignmentFromParameterWithExplicitCast(statementsToCheck.FirstOrDefault(), parameter, out otherC))
src\Analyzers\CSharp\CodeFixes\Nullable\CSharpDeclareAsNullableCodeFixProvider.cs (1)
225var parameter = method.Parameters.Where(p => p.Name == identifier.Text).FirstOrDefault();
src\Analyzers\CSharp\CodeFixes\UsePrimaryConstructor\CSharpUsePrimaryConstructorCodeFixProvider.cs (1)
545var xmlElement = identifier.AncestorsAndSelf().OfType<XmlEmptyElementSyntax>().FirstOrDefault();
Microsoft.CodeAnalysis.CSharp.Scripting.UnitTests (1)
InteractiveSessionTests.cs (1)
1489Assert.Null(value.FirstOrDefault());
Microsoft.CodeAnalysis.CSharp.Semantic.UnitTests (2)
Semantics\InterpolationTests.cs (1)
4603.FirstOrDefault()
Semantics\RawInterpolationTests_Handler.cs (1)
2904.FirstOrDefault()
Microsoft.CodeAnalysis.CSharp.Symbol.UnitTests (4)
Compilation\SemanticModelAPITests.cs (2)
1962var lambdaExpression = speculatedStatement.DescendantNodes().OfType<ParenthesizedLambdaExpressionSyntax>().FirstOrDefault(); 2683var lambdaExpression = blockStatement.Statements[0].DescendantNodes().OfType<ParenthesizedLambdaExpressionSyntax>().FirstOrDefault();
Symbols\IndexerTests.cs (1)
2844ExpressionSyntax expr = tree.GetCompilationUnitRoot().DescendantNodes().OfType<ElementAccessExpressionSyntax>().FirstOrDefault();
Symbols\TypeTests.cs (1)
1455var errSymbol = comp.SourceModule.GlobalNamespace.GetMembers().FirstOrDefault() as NamedTypeSymbol;
Microsoft.CodeAnalysis.CSharp.Syntax.UnitTests (29)
Syntax\SyntaxAnnotationTests.cs (4)
100var toTrivia = GetAllTrivia(tree.GetCompilationUnitRoot()).FirstOrDefault(); 110var fromTrivia = GetAllTrivia(tree.GetCompilationUnitRoot()).FirstOrDefault(); 119var fromTrivia = GetAllTrivia(tree.GetCompilationUnitRoot()).FirstOrDefault(); 120var toTrivia = GetAllTrivia(tree.GetCompilationUnitRoot()).FirstOrDefault();
Syntax\SyntaxNodeTests.cs (25)
2456var b = expr.DescendantTokens().Where(t => t.Text == "b").Select(t => t.Parent.FirstAncestorOrSelf<ArgumentSyntax>()).FirstOrDefault(); 2471var b = expr.DescendantTokens().Where(t => t.Text == "b").Select(t => t.Parent.FirstAncestorOrSelf<ArgumentSyntax>()).FirstOrDefault(); 2487var b = expr.DescendantTokens().Where(t => t.Text == "b").Select(t => t.Parent.FirstAncestorOrSelf<ArgumentSyntax>()).FirstOrDefault(); 2504var b = expr.DescendantTokens().Where(t => t.Text == "b").Select(t => t.Parent.FirstAncestorOrSelf<ArgumentSyntax>()).FirstOrDefault(); 2525var b = expr.DescendantTokens().Where(t => t.Text == "b").Select(t => t.Parent.FirstAncestorOrSelf<ArgumentSyntax>()).FirstOrDefault(); 2544var b = expr.DescendantTokens().Where(t => t.Text == "b").Select(t => t.Parent.FirstAncestorOrSelf<ArgumentSyntax>()).FirstOrDefault(); 2560var b = expr.DescendantTokens().Where(t => t.Text == "b").Select(t => t.Parent.FirstAncestorOrSelf<ArgumentSyntax>()).FirstOrDefault(); 2576var b = expr.DescendantTokens().Where(t => t.Text == "b").Select(t => t.Parent.FirstAncestorOrSelf<ArgumentSyntax>()).FirstOrDefault(); 2592var b = expr.DescendantTokens().Where(t => t.Text == "b").Select(t => t.Parent.FirstAncestorOrSelf<ArgumentSyntax>()).FirstOrDefault(); 2612var b = expr.DescendantTokens().Where(t => t.Text == "b").Select(t => t.Parent.FirstAncestorOrSelf<ArgumentSyntax>()).FirstOrDefault(); 2629var n = expr.DescendantTokens().Where(t => t.Text == "a").Select(t => t.Parent.FirstAncestorOrSelf<ArgumentSyntax>()).FirstOrDefault(); 2643var n = expr.DescendantTokens().Where(t => t.Text == "a").Select(t => t.Parent.FirstAncestorOrSelf<ArgumentSyntax>()).FirstOrDefault(); 2657var n = expr.DescendantTokens().Where(t => t.Text == "c").Select(t => t.Parent.FirstAncestorOrSelf<ArgumentSyntax>()).FirstOrDefault(); 2671var b = expr.DescendantTokens().Where(t => t.Text == "b").Select(t => t.Parent.FirstAncestorOrSelf<StatementSyntax>()).FirstOrDefault(); 2685var b = expr.DescendantTokens().Where(t => t.Text == "b").Select(t => t.Parent.FirstAncestorOrSelf<StatementSyntax>()).FirstOrDefault(); 2702var m = cu.DescendantNodes().OfType<MethodDeclarationSyntax>().FirstOrDefault(); 2736var m = cu.DescendantNodes().OfType<MethodDeclarationSyntax>().FirstOrDefault(); 2771var m = cu.DescendantNodes().OfType<MethodDeclarationSyntax>().FirstOrDefault(); 2811var m = cu.DescendantNodes().OfType<MethodDeclarationSyntax>().FirstOrDefault(); 2843var m = cu.DescendantNodes().OfType<MethodDeclarationSyntax>().FirstOrDefault(); 2935var m = cu.DescendantNodes().OfType<ParameterSyntax>().FirstOrDefault(); 2976var m = cu.DescendantNodes().OfType<ParameterSyntax>().FirstOrDefault(); 3020var m = cu.DescendantNodes().OfType<ParameterSyntax>().FirstOrDefault(); 3062var m = cu.DescendantNodes().OfType<ParameterSyntax>().FirstOrDefault(); 3252var m = cu.DescendantNodes().OfType<TypeDeclarationSyntax>().FirstOrDefault();
Microsoft.CodeAnalysis.CSharp.Test.Utilities (2)
Extensions.cs (1)
400select a).ToList().FirstOrDefault() != null;
SemanticModelTestBase.cs (1)
111return (ConstructorInitializerSyntax)constructorInitializers.FirstOrDefault();
Microsoft.CodeAnalysis.CSharp.Workspaces (9)
Simplification\CSharpSimplificationService.Expander.cs (1)
789var invocationExpression = originalSimpleName.Ancestors().OfType<InvocationExpressionSyntax>().FirstOrDefault();
Simplification\Reducers\CSharpEscapingReducer.cs (2)
55var enclosingLambdaExpression = parent.GetAncestorsOrThis(n => (n is SimpleLambdaExpressionSyntax or ParenthesizedLambdaExpressionSyntax)).FirstOrDefault(); 75var enclosingMethodBlock = parent.GetAncestorsOrThis(n => n is MethodDeclarationSyntax).FirstOrDefault();
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\ParenthesizedExpressionSyntaxExtensions.cs (1)
49var nextChar = tokenAfterParen.Text.FirstOrDefault();
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\SyntaxTreeExtensions.cs (2)
44return syntaxTree.GetContainingTypeDeclarations(position, cancellationToken).FirstOrDefault(); 50return syntaxTree.GetContainingTypeOrEnumDeclarations(position, cancellationToken).FirstOrDefault();
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Services\SemanticFacts\CSharpSemanticFacts.cs (1)
95var enumDecl = namedTypeSymbol.DeclaringSyntaxReferences.Select(r => r.GetSyntax()).OfType<EnumDeclarationSyntax>().FirstOrDefault();
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\CSharpCodeGenerationHelpers.cs (1)
212var implementation = implementations.FirstOrDefault();
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\LanguageServices\CSharpTypeInferenceService.TypeInferrer.cs (1)
1558var patternType = GetPatternTypes(subPattern.Pattern).FirstOrDefault();
Microsoft.CodeAnalysis.EditorFeatures (6)
CodeActions\CodeActionEditHandlerService.cs (3)
180var updatedSolution = operations.OfType<ApplyChangesOperation>().FirstOrDefault()?.ChangedSolution ?? oldSolution; 296var navigationOperation = operations.OfType<DocumentNavigationOperation>().FirstOrDefault(); 305var renameOperation = operations.OfType<StartInlineRenameSessionOperation>().FirstOrDefault();
InlineRename\InlineRenameSession.OpenTextBufferManager.cs (2)
93return _textViews.FirstOrDefault(); 679var ss = textView.GetSpanInView(kvp.Value.TrackingSpan.GetSpan(snapshot)).FirstOrDefault();
Structure\AbstractStructureTaggerProvider.cs (1)
60var openDocument = subjectBuffer.AsTextContainer().GetRelatedDocuments().FirstOrDefault();
Microsoft.CodeAnalysis.EditorFeatures.Test.Utilities (1)
BraceHighlighting\AbstractBraceHighlightingTests.cs (1)
45var document = buffer.CurrentSnapshot.GetRelatedDocumentsWithChanges().FirstOrDefault();
Microsoft.CodeAnalysis.EditorFeatures.UnitTests (5)
CodeGeneration\CodeGenerationTests.cs (1)
911.Where(s => s != null).FirstOrDefault() as T;
Diagnostics\DiagnosticAnalyzerServiceTests.cs (1)
451var firstAdditionalDocument = project.AdditionalDocuments.FirstOrDefault();
MetadataAsSource\AbstractMetadataAsSourceTests.TestContext.cs (1)
214.FirstOrDefault();
TextEditor\TryGetDocumentTests.cs (1)
36var newDocument = buffer.CurrentSnapshot.GetRelatedDocumentsWithChanges().FirstOrDefault();
Utilities\SymbolEquivalenceComparerTests.cs (1)
1891var invocation = method_root.DescendantNodes().OfType<TInvocation>().FirstOrDefault();
Microsoft.CodeAnalysis.EditorFeatures.Wpf (2)
SignatureHelp\SignatureHelpControllerProvider.cs (1)
38private readonly IIntelliSensePresenter<ISignatureHelpPresenterSession, ISignatureHelpSession> _signatureHelpPresenter = ExtensionOrderer.Order(signatureHelpPresenters).Select(lazy => lazy.Value).FirstOrDefault();
Utilities\BrushToColorConverter.cs (1)
18GradientBrush gradientBrush => gradientBrush.GradientStops.FirstOrDefault()?.Color ?? Colors.Transparent,
Microsoft.CodeAnalysis.ExpressionEvaluator.ResultProvider.Utilities (2)
Debugger\Engine\DkmClrType.cs (2)
157var proxyAttribute = _lazyEvalAttributes.Value.OfType<DkmClrDebuggerTypeProxyAttribute>().FirstOrDefault(); 171var attribute = (DebuggerTypeProxyAttribute)type.GetCustomAttributes(typeof(DebuggerTypeProxyAttribute), inherit: false).FirstOrDefault();
Microsoft.CodeAnalysis.ExternalAccess.Xaml (1)
Internal\DescriptionService.cs (1)
54var codeDocument = project.Documents.FirstOrDefault();
Microsoft.CodeAnalysis.Features (18)
CodeFixes\Suppression\AbstractSuppressionCodeFixProvider.PragmaHelpers.cs (1)
139(trivia.HasStructure && fixer.IsEndOfLine(trivia.GetStructure().DescendantTrivia().FirstOrDefault()));
CodeRefactorings\AddAwait\AbstractAddAwaitCodeRefactoringProvider.cs (1)
95current = current.ChildNodesAndTokens().FirstOrDefault().AsNode() as TExpressionSyntax;
Completion\Providers\AbstractMemberInsertingCompletionProvider.cs (1)
48var caretTarget = newRoot.GetAnnotatedNodes(_annotation).FirstOrDefault();
Completion\Providers\ImportCompletionProvider\ExtensionMethodImportCompletionHelper.SymbolComputer.cs (2)
251var declaredReceiverTypeInOriginatingCompilation = SymbolFinder.FindSimilarSymbols(declaredReceiverType, _originatingSemanticModel.Compilation, cancellationToken).FirstOrDefault(); 275foreach (var methodInOriginatingCompilation in methodSymbols.Select(s => SymbolFinder.FindSimilarSymbols(s, _originatingSemanticModel.Compilation).FirstOrDefault()).WhereNotNull())
ConvertForToForEach\AbstractConvertForToForEachCodeRefactoringProvider.cs (1)
241return TryFindMembersInThisOrBaseTypes<TSymbol>(containingType, type, memberName).FirstOrDefault();
ExtractMethod\AbstractSyntaxTriviaService.Result.cs (1)
264return root.GetAnnotatedNodesAndTokens(annotation).FirstOrDefault().AsToken();
ExtractMethod\MethodExtractor.TriviaResult.cs (2)
111var trivia = list.FirstOrDefault(); 118trivia = listWithoutHead.FirstOrDefault();
GenerateConstructorFromMembers\AbstractGenerateConstructorFromMembersCodeRefactoringProvider.State.cs (1)
111return q.FirstOrDefault();
IntroduceVariable\AbstractIntroduceVariableService.cs (1)
149var block = blocks.FirstOrDefault();
src\Analyzers\Core\Analyzers\SimplifyInterpolation\AbstractSimplifyInterpolationHelpers.cs (1)
160var interpolatedStringOperation = AncestorsAndSelf(operation).OfType<IInterpolatedStringOperation>().FirstOrDefault();
src\Analyzers\Core\Analyzers\UseExplicitTupleName\UseExplicitTupleNameDiagnosticAnalyzer.cs (1)
58var nameNode = memberAccessSyntax.ChildNodesAndTokens().Reverse().FirstOrDefault().AsNode();
src\Analyzers\Core\CodeFixes\DocumentationComments\AbstractAddDocCommentNodesCodeFixProvider.cs (2)
83var summaryNode = GetElementNodes(newDocComment, "summary").FirstOrDefault(); 103var nodeAfterNewParamNode = paramNodes.FirstOrDefault() ?? newDocComment.ChildNodes().First();
src\Analyzers\Core\CodeFixes\GenerateParameterizedMember\TypeParameterSubstitution.cs (1)
122return similarTypes.FirstOrDefault() ?? symbol;
src\Analyzers\Core\CodeFixes\ImplementAbstractClass\ImplementAbstractClassData.cs (1)
321constraints.OfType<INamedTypeSymbol>().FirstOrDefault() ??
SyncNamespaces\AbstractSyncNamespacesService.cs (1)
106.FirstOrDefault();
Microsoft.CodeAnalysis.LanguageServer (1)
ExportProviderBuilder.cs (1)
88var erroredParts = configuration.CompositionErrors.FirstOrDefault()?.SelectMany(error => error.Parts).Select(part => part.Definition.Type.Name) ?? Enumerable.Empty<string>();
Microsoft.CodeAnalysis.LanguageServer.Protocol (2)
ExternalAccess\Razor\FormatNewFileHandler.cs (1)
72var hintDocument = project.Documents.FirstOrDefault();
Features\CodeFixes\CodeFixService.cs (1)
810var fixer = lazyConfigurationProviders.Value.OfType<AbstractSuppressionCodeFixProvider>().FirstOrDefault();
Microsoft.CodeAnalysis.Rebuild (1)
CompilationFactory.cs (1)
185return methodSymbols.FirstOrDefault();
Microsoft.CodeAnalysis.Scripting (3)
Hosting\ObjectFormatter\CommonObjectFormatter.Visitor.cs (1)
363var browsable = (DebuggerBrowsableAttribute)member.GetCustomAttributes(typeof(DebuggerBrowsableAttribute), false).FirstOrDefault();
Hosting\ObjectFormatter\ObjectFormatterHelpers.cs (2)
50var result = member.GetCustomAttributes<DebuggerDisplayAttribute>().FirstOrDefault(); 74var result = type.GetCustomAttributes<DebuggerTypeProxyAttribute>().FirstOrDefault();
Microsoft.CodeAnalysis.UnitTests (1)
Diagnostics\SuppressMessageTargetSymbolResolverTests.cs (1)
1406var symbol = q.FirstOrDefault();
Microsoft.CodeAnalysis.VisualBasic.Syntax.UnitTests (4)
Syntax\SyntaxAnnotationTests.vb (4)
90Dim toTrivia = GetAllTrivia(tree.GetRoot()).FirstOrDefault() 99Dim fromTrivia = GetAllTrivia(tree.GetRoot()).FirstOrDefault() 107Dim fromTrivia = GetAllTrivia(tree.GetRoot()).FirstOrDefault() 108Dim toTrivia = GetAllTrivia(tree.GetRoot()).FirstOrDefault()
Microsoft.CodeAnalysis.Workspaces (34)
CodeCleanup\AbstractCodeCleanerService.cs (2)
157var previousToken = previousTokens.FirstOrDefault(); 158var nextToken = nextTokens.FirstOrDefault();
Diagnostics\Extensions.cs (1)
381var suppressionAnalyzer = hostAnalyzers.OfType<IPragmaSuppressionsAnalyzer>().FirstOrDefault();
Editing\SymbolEditor.cs (1)
205declaration = GetDeclarations(symbol).FirstOrDefault();
FindSymbols\FindReferences\Finders\ParameterSymbolReferenceFinder.cs (2)
97var parameterNode = parameter.DeclaringSyntaxReferences.Select(r => r.GetSyntax(cancellationToken)).FirstOrDefault(); 218.FirstOrDefault();
FindSymbols\SymbolFinder_Callers.cs (1)
47r => SymbolEquivalenceComparer.Instance.Equals(symbol, r.Definition)).FirstOrDefault();
Log\RoslynEventSource.cs (1)
96command.Arguments.Keys.FirstOrDefault() == "SendFunctionDefinitions";
ReassignedVariable\AbstractReassignedVariableService.cs (1)
274.FirstOrDefault();
Recommendations\AbstractRecommendationServiceRunner.cs (1)
294.OfType<INamespaceSymbol>().FirstOrDefault();
Rename\ConflictEngine\ConflictResolver.cs (2)
101var renameSymbolDeclarationLocation = renameLocations.Symbol.Locations.Where(loc => loc.IsInSource).FirstOrDefault(); 415return orderedLocations.FirstOrDefault();
Shared\Extensions\ILanguageMetadataExtensions.cs (1)
20return services.Where(s => s.Metadata.Language == languageName).Select(s => s.Value).FirstOrDefault();
Shared\Extensions\ISymbolExtensions.cs (1)
479return baseType.Constructors.Where(c => IsSameSignature(methodSymbol, c)).FirstOrDefault();
Shared\Extensions\ITypeSymbolExtensions.cs (3)
161return explicitMatches.FirstOrDefault(); 172return explicitMatches.FirstOrDefault() ?? implicitMatches.FirstOrDefault();
src\Compilers\Core\Portable\InternalUtilities\EnumerableExtensions.cs (1)
214return source.Cast<T?>().FirstOrDefault();
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EditorConfig\Parsing\EditorConfigFile.cs (2)
49.FirstOrDefault(); 87.FirstOrDefault();
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\ISymbolExtensions.cs (1)
542var declarationSyntax = symbol.DeclaringSyntaxReferences.Select(r => r.GetSyntax()).FirstOrDefault();
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\ITypeParameterSymbolExtensions.cs (1)
13=> typeParameter.ConstraintTypes.Select(GetNamedTypeSymbol).WhereNotNull().FirstOrDefault();
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\SyntaxNodeExtensions.cs (1)
79return node?.GetAncestorsOrThis<TNode>().FirstOrDefault();
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\BottomUpBaseIndentationFinder.cs (1)
308return GetIndentBlockOperationsFromSmallestSpan(root, list, position).FirstOrDefault();
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\SelectedMembers\AbstractSelectedMembers.cs (1)
70.FirstOrDefault();
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\AbstractCodeGenerationService.cs (1)
376var field = members.OfType<IFieldSymbol>().FirstOrDefault();
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\Symbols\CodeGenerationNamedTypeSymbol.cs (1)
101? this.GetMembers(WellKnownMemberNames.DelegateInvokeName).OfType<IMethodSymbol>().FirstOrDefault()
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Extensions\ITypeInferenceServiceExtensions.cs (1)
50return delegateTypes.WhereNotNull().FirstOrDefault();
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Extensions\SyntaxGeneratorExtensions_CreateGetHashCodeMethod.cs (1)
214return existingMethods.FirstOrDefault();
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\LanguageServices\AddImports\AbstractAddImportsService.cs (1)
179fallbackNode = contextSpine.OfType<TNamespaceDeclarationSyntax>().FirstOrDefault();
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Simplification\SimplificationHelpers.cs (2)
67var annotation1 = expression.GetAnnotations(SymbolAnnotation.Kind).FirstOrDefault(); 75var annotation2 = expression.GetAnnotations(SpecialTypeAnnotation.Kind).FirstOrDefault();
Workspace\ProjectSystem\ProjectSystemProject.BatchingDocumentCollection.cs (1)
327var entry = _documentPathsToDocumentIds.Where(kv => kv.Value == documentId).FirstOrDefault();
Workspace\Workspace_Editor.cs (1)
282return _bufferToAssociatedDocumentsMap.Where(kvp => kvp.Value.Contains(documentId)).Select(kvp => kvp.Key).FirstOrDefault();
Microsoft.CodeAnalysis.Workspaces.MSBuild.BuildHost (3)
BuildHost.cs (1)
57instance = MSBuildLocator.QueryVisualStudioInstances().OrderByDescending(vs => vs.Version).FirstOrDefault();
MSBuild\ProjectFile\ProjectFile.cs (1)
139var intermediateOutputFilePath = project.GetItems(ItemNames.IntermediateAssembly).FirstOrDefault()?.EvaluatedInclude;
src\Compilers\Core\Portable\InternalUtilities\EnumerableExtensions.cs (1)
214return source.Cast<T?>().FirstOrDefault();
Microsoft.CodeAnalysis.Workspaces.MSBuild.UnitTests (20)
MSBuildWorkspaceTestBase.cs (2)
79var project = sol.GetProjectsByName("VisualBasicProject").FirstOrDefault(); 88var project = sol.GetProjectsByName("VisualBasicProject").FirstOrDefault();
SolutionGeneration.cs (1)
119var projectName = inputs.OfType<ProjectNameBuilder>().FirstOrDefault();
VisualStudioMSBuildWorkspaceTests.cs (17)
1836var project = solution.GetProjectsByName("VisualBasicProject").FirstOrDefault(); 1862var project = solution.GetProjectsByName("VisualBasicProject").FirstOrDefault(); 1896var project = sol.GetProjectsByName("VisualBasicProject").FirstOrDefault(); 1919var project = sol.GetProjectsByName("VisualBasicProject").FirstOrDefault(); 1943var project = sol.GetProjectsByName("CSharpProject").FirstOrDefault(); 1966var project = sol.GetProjectsByName("CSharpProject").FirstOrDefault(); 1991var project = solution.GetProjectsByName("CSharpProject").FirstOrDefault(); 2012var project = solution.GetProjectsByName("CSharpProject").FirstOrDefault(); 2019var project2 = solution2.GetProjectsByName("CSharpProject").FirstOrDefault(); 2038var projectB = workspaceB.CurrentSolution.GetProjectsByName("CSharpProject").FirstOrDefault(); 2053var project = solution.GetProjectsByName("CSharpProject").FirstOrDefault(); 2062var project2 = solution2.GetProjectsByName("CSharpProject").FirstOrDefault(); 2087var project = solution.GetProjectsByName("CSharpProject").FirstOrDefault(); 2095var project2 = solution2.GetProjectsByName("CSharpProject").FirstOrDefault(); 2114var documents = solution.GetProjectsByName("CSharpProject").FirstOrDefault().Documents.ToList(); 2141var documents = solution.GetProjectsByName("CSharpProject").FirstOrDefault().AdditionalDocuments.ToList(); 2168var project = solution.GetProjectsByName("CSharpProject").FirstOrDefault();
Microsoft.CodeAnalysis.Workspaces.UnitTests (6)
FindReferencesTests.cs (2)
183SyntaxNode declareMethod = tree.GetRoot().DescendantNodes().OfType<Microsoft.CodeAnalysis.VisualBasic.Syntax.DeclareStatementSyntax>().FirstOrDefault(); 222var propertyStatement = tree.GetRoot().DescendantNodes().OfType<Microsoft.CodeAnalysis.VisualBasic.Syntax.PropertyStatementSyntax>().FirstOrDefault();
SolutionTests\SolutionTests.cs (1)
2842Assert.Equal(project, solution.GetProjectsByName(project.Name).FirstOrDefault());
WorkspaceTests\AdhocWorkspaceTests.cs (3)
37Assert.Equal(project, ws.CurrentSolution.Projects.FirstOrDefault()); 49Assert.Same(project, ws.CurrentSolution.Projects.FirstOrDefault()); 98var project = solution.Projects.FirstOrDefault();
Microsoft.Data.Analysis.Tests (2)
DataFrameGroupByTests.cs (2)
29var oddGroup = grouping.Where(gr => gr.Key == "odd").FirstOrDefault(); 33var evenGroup = grouping.Where(gr => gr.Key == "even").FirstOrDefault();
Microsoft.DotNet.Arcade.Sdk (2)
src\GenerateResxSource.cs (1)
115string value = node.Elements("value").FirstOrDefault()?.Value.Trim();
src\InstallDotNetCore.cs (1)
115ProjectProperty property = properties[propertyName].FirstOrDefault();
Microsoft.DotNet.Arcade.Sdk.Tests (2)
SourceMappingToNugetConfigTest.cs (2)
57.FirstOrDefault(); 80.FirstOrDefault();
Microsoft.DotNet.Build.Tasks.Packaging (2)
GetMinimumNETStandard.cs (1)
34.FirstOrDefault();
NuGetUtility.cs (1)
86.FirstOrDefault();
Microsoft.DotNet.Build.Tasks.Workloads (1)
Swix\SwixComponent.cs (1)
158ITaskItem? resourceItem = componentResources?.Where(r => string.Equals(r.ItemSpec, workload.Id)).FirstOrDefault();
Microsoft.DotNet.Build.Tasks.Workloads.Tests (13)
CreateVisualStudioWorkloadSetTests.cs (1)
68ITaskItem workloadSetSwixItem = createWorkloadSetTask.SwixProjects.Where(s => s.ItemSpec.Contains(@"Microsoft.NET.Workloads.9.0.100.9.0.100-baseline.1.23464.1\x64")).FirstOrDefault();
CreateVisualStudioWorkloadTests.cs (3)
76ITaskItem manifestMsiItem = createWorkloadTask.Msis.Where(m => m.ItemSpec.ToLowerInvariant().Contains("d96ba8044ad35589f97716ecbf2732fb-x64.msi")).FirstOrDefault(); 143ITaskItem pythonPackSwixItem = createWorkloadTask.SwixProjects.Where(s => s.ItemSpec.Contains(@"Microsoft.Emscripten.Python.6.0.4\x64")).FirstOrDefault(); 212ITaskItem manifestMsiItem = createWorkloadTask.Msis.Where(m => m.ItemSpec.ToLowerInvariant().Contains("d96ba8044ad35589f97716ecbf2732fb-arm64.msi")).FirstOrDefault();
MsiTests.cs (1)
137FileRow fileRow = MsiUtils.GetAllFiles(msiPath).FirstOrDefault();
SwixComponentTests.cs (8)
25WorkloadDefinition workload = (WorkloadDefinition)manifest.Workloads.FirstOrDefault().Value; 53WorkloadDefinition workload = (WorkloadDefinition)manifest.Workloads.FirstOrDefault().Value; 82WorkloadDefinition workload = (WorkloadDefinition)manifest.Workloads.FirstOrDefault().Value; 109WorkloadDefinition workload = (WorkloadDefinition)manifest.Workloads.FirstOrDefault().Value; 123WorkloadDefinition workload = (WorkloadDefinition)manifest.Workloads.FirstOrDefault().Value; 143WorkloadDefinition workload = (WorkloadDefinition)manifest.Workloads.FirstOrDefault().Value; 169WorkloadDefinition workload = (WorkloadDefinition)manifest.Workloads.FirstOrDefault().Value; 183WorkloadDefinition workload = (WorkloadDefinition)manifest.Workloads.FirstOrDefault().Value;
Microsoft.DotNet.Helix.Sdk (1)
DownloadFromResultsContainer.cs (1)
91var fileAvailableForDownload = allAvailableFiles.Where(f => f.Name == file || f.Name.Replace('\\', '/') == file).FirstOrDefault();
Microsoft.DotNet.PackageTesting (1)
GetCompatiblePackageTargetFrameworks.cs (1)
37.FirstOrDefault()?
Microsoft.DotNet.RemoteExecutor (3)
RemoteExecutor.cs (2)
652.FirstOrDefault(); 657.FirstOrDefault();
RemoteInvokeHandle.cs (1)
186ClrRuntime runtime = dt.ClrVersions.FirstOrDefault()?.CreateRuntime();
Microsoft.DotNet.SignCheckLibrary (1)
Verification\VsixVerifier.cs (1)
54XmlNode encodedTimeNode = element.SelectNodes("//ds:TimeStamp/ds:EncodedTime", namespaceManager).OfType<XmlNode>().FirstOrDefault();
Microsoft.DotNet.SignTool (4)
src\Configuration.cs (4)
340signInfo = signInfos.Where(s => s.CollisionPriorityId == collisionPriorityId).FirstOrDefault(); 345signInfo = signInfos.FirstOrDefault(); 367pktBasedSignInfo = pktBasedSignInfos.Where(s => s.CollisionPriorityId == collisionPriorityId).FirstOrDefault(); 371pktBasedSignInfo = pktBasedSignInfos.FirstOrDefault();
Microsoft.DotNet.SourceBuild.Tasks (2)
src\UsageReport\Usage.cs (1)
63.FirstOrDefault()
src\UsageReport\WriteUsageReports.cs (1)
187.Elements().Skip(1).FirstOrDefault()
Microsoft.DotNet.SwaggerGenerator.CodeGenerator (4)
Modeler\ServiceClientModelFactory.cs (4)
126.ToLookup(t => t.operation.Tags.FirstOrDefault()?.Name) 132document.Servers?.FirstOrDefault()?.Url, 154string firstTag = operation.Tags.FirstOrDefault()?.Name; 179var selectedResponse = operation.Responses.Where(r => r.Key.StartsWith("2")).Select(p => p.Value).FirstOrDefault();
Microsoft.DotNet.VersionTools (2)
BuildInfo.cs (1)
217versions.FirstOrDefault()?.ToNormalizedString();
Dependencies\BuildManifest\OrchestratedBuildIdentityMatch.cs (1)
31return matches.FirstOrDefault();
Microsoft.DotNet.XliffTasks (5)
Model\XamlRuleDocument.cs (5)
30var descendentDisplayName = element.Elements(XName.Get($"{element.Name.LocalName}.DisplayName", element.Name.NamespaceName)).FirstOrDefault(); 31var descendentDescription = element.Elements(XName.Get($"{element.Name.LocalName}.Description", element.Name.NamespaceName)).FirstOrDefault(); 60if (element.Elements(XName.Get($"{element.Name.LocalName}.{localizableProperty}", element.Name.NamespaceName)).FirstOrDefault() is { } descendentValue) 82else if (AttributedName(element) == "SearchTerms" && (XmlName(attribute) == "Value" || element.Elements(XName.Get($"{element.Name.LocalName}.Value", element.Name.NamespaceName)).FirstOrDefault() is { })) 93else if (element.Elements(XName.Get($"{element.Name.LocalName}.Value", element.Name.NamespaceName)).FirstOrDefault() is { } descendentValue)
Microsoft.DotNet.XUnitExtensions (4)
Discoverers\ConditionalTestDiscoverer.cs (1)
55ITypeInfo type = testMethod.TestClass.Class.Assembly.GetTypes(false).Where(t => t.Name.Contains(symbols[0])).FirstOrDefault();
Discoverers\SkipOnPlatformDiscoverer.cs (1)
20if (traitAttribute.GetConstructorArguments().FirstOrDefault() is TestPlatforms tp)
SkippedTestMessageBus.cs (2)
37var exceptionType = testFailed.ExceptionTypes.FirstOrDefault(); 41return innerBus.QueueMessage(new TestSkipped(testFailed.Test, testFailed.Messages.FirstOrDefault()));
Microsoft.Extensions.AI (1)
Embeddings\OpenTelemetryEmbeddingGenerator.cs (1)
160responseModelId = embeddings.FirstOrDefault()?.ModelId;
Microsoft.Extensions.AI.Abstractions (5)
ChatCompletion\ChatMessage.cs (2)
63get => Contents.OfType<TextContent>().FirstOrDefault()?.Text; 66if (Contents.OfType<TextContent>().FirstOrDefault() is { } textContent)
ChatCompletion\StreamingChatCompletionUpdate.cs (2)
48get => Contents.OfType<TextContent>().FirstOrDefault()?.Text; 51if (Contents.OfType<TextContent>().FirstOrDefault() is { } textContent)
Utilities\AIJsonUtilities.Schema.cs (1)
428(TAttribute?)provider?.GetCustomAttributes(typeof(TAttribute), inherit: false).FirstOrDefault();
Microsoft.Extensions.AI.Abstractions.Tests (1)
test\Shared\JsonSchemaExporter\TestTypes.cs (1)
1289(TAttribute?)provider?.GetCustomAttributes(typeof(TAttribute), inherit: false).FirstOrDefault();
Microsoft.Gen.Logging (1)
Parsing\Parser.cs (1)
574: lm.GetTemplatesForParameter(paramName).FirstOrDefault() ?? paramName;
Microsoft.ML.AutoML (1)
PipelineSuggesters\PipelineSuggester.cs (1)
213var proposedParamSet = sweeper.ProposeSweeps(1, historyToUse.Select(h => h.ToRunResult(isMaximizingMetric))).FirstOrDefault();
Microsoft.ML.CodeGenerator (4)
CodeGenerator\CSharp\AzureCodeGenerator\AzureAttachConsoleAppCodeGenerator.cs (2)
51Separator = _columnInferenceResult.TextLoaderOptions.Separators.FirstOrDefault(), 95Separator = _columnInferenceResult.TextLoaderOptions.Separators.FirstOrDefault(),
CodeGenerator\CSharp\CodeGenerator.cs (2)
354Separator = _columnInferenceResult.TextLoaderOptions.Separators.FirstOrDefault(), 377Separator = _columnInferenceResult.TextLoaderOptions.Separators.FirstOrDefault(),
Microsoft.ML.Core (8)
ComponentModel\ComponentCatalog.cs (6)
372var kindAttr = type.GetTypeInfo().GetCustomAttributes(typeof(TlcModule.EntryPointKindAttribute), false).FirstOrDefault() 569var attr = methodInfo.GetCustomAttributes(typeof(TlcModule.EntryPointAttribute), false).FirstOrDefault() as TlcModule.EntryPointAttribute; 574methodInfo.GetCustomAttributes(typeof(ObsoleteAttribute), false).FirstOrDefault() as ObsoleteAttribute); 596var attr = nestedType.GetTypeInfo().GetCustomAttributes(typeof(TlcModule.ComponentAttribute), true).FirstOrDefault() 604var faceAttr = faceType.GetTypeInfo().GetCustomAttributes(typeof(TlcModule.ComponentKindAttribute), false).FirstOrDefault() 939var faceAttr = signatureType.GetTypeInfo().GetCustomAttributes(typeof(TlcModule.ComponentKindAttribute), false).FirstOrDefault()
EntryPoints\EntryPointUtils.cs (2)
58var attr = fieldInfo.GetCustomAttributes(typeof(ArgumentAttribute), false).FirstOrDefault() 84var rangeAttr = fieldInfo.GetCustomAttributes(typeof(TlcModule.RangeAttribute), false).FirstOrDefault()
Microsoft.ML.Data (4)
EntryPoints\InputBuilder.cs (4)
70var attr = (ArgumentAttribute)fieldInfo.GetCustomAttributes(typeof(ArgumentAttribute), false).FirstOrDefault(); 75var rangeAttr = fieldInfo.GetCustomAttributes(typeof(TlcModule.RangeAttribute), false).FirstOrDefault() 416value = value.Values().FirstOrDefault(); 678var attr = fieldInfo.GetCustomAttributes(typeof(TlcModule.OutputAttribute), false).FirstOrDefault()
Microsoft.ML.EntryPoints (8)
JsonUtils\JsonManifestUtils.cs (8)
160var inputAttr = fieldInfo.GetCustomAttributes(typeof(ArgumentAttribute), false).FirstOrDefault() as ArgumentAttribute; 198var rangeAttr = fieldInfo.GetCustomAttributes(typeof(TlcModule.RangeAttribute), false).FirstOrDefault() as TlcModule.RangeAttribute; 220if (fieldInfo.GetCustomAttributes(typeof(ObsoleteAttribute), false).FirstOrDefault() is ObsoleteAttribute obsAttr) 229if (fieldInfo.GetCustomAttributes(typeof(TlcModule.SweepableLongParamAttribute), false).FirstOrDefault() is TlcModule.SweepableLongParamAttribute slpAttr) 246if (fieldInfo.GetCustomAttributes(typeof(TlcModule.SweepableFloatParamAttribute), false).FirstOrDefault() is TlcModule.SweepableFloatParamAttribute sfpAttr) 263if (fieldInfo.GetCustomAttributes(typeof(TlcModule.SweepableDiscreteParamAttribute), false).FirstOrDefault() is TlcModule.SweepableDiscreteParamAttribute sdpAttr) 293.FirstOrDefault() as TlcModule.OutputAttribute; 492var attr = fieldInfo.GetCustomAttributes(typeof(ArgumentAttribute), false).FirstOrDefault()
Microsoft.ML.FastTree (1)
FastTree.cs (1)
3153double max = ordered.FirstOrDefault().Value;
Microsoft.ML.TestFramework (2)
TestCommandBase.cs (2)
250if (char.IsLetterOrDigit(suffix.FirstOrDefault())) 647if (char.IsLetterOrDigit(suffix.FirstOrDefault()))
Microsoft.ML.Tests (1)
OnnxSequenceTypeWithAttributesTest.cs (1)
64var onnxOut = output.Output.FirstOrDefault();
Microsoft.ML.TimeSeries (1)
RootCauseAnalyzer.cs (1)
33return AnalyzeOneLayer(_src).FirstOrDefault();
Microsoft.TestUtilities (2)
XUnit\SkippedTestMessageBus.cs (2)
33var exceptionType = testFailed.ExceptionTypes.FirstOrDefault(); 37return _innerBus.QueueMessage(new TestSkipped(testFailed.Test, testFailed.Messages.FirstOrDefault()));
Microsoft.VisualStudio.LanguageServices (12)
CallHierarchy\CallHierarchyCommandHandler.cs (1)
55_presenter = presenters.FirstOrDefault();
Diagnostics\VisualStudioDiagnosticAnalyzerService.cs (1)
108var project = projectsWithHierarchy.FirstOrDefault();
GenerateType\GenerateTypeDialogViewModel.cs (1)
530this.SelectedDocument = _selectedProject.Documents.FirstOrDefault();
LanguageService\AbstractLanguageService`2.cs (1)
156var openDocument = wpfTextView.TextBuffer.AsTextContainer().GetRelatedDocuments().FirstOrDefault();
LanguageService\AbstractLanguageService`2.VsCodeWindowManager.cs (1)
81var document = textBuffer?.AsTextContainer()?.GetRelatedDocuments().FirstOrDefault();
Progression\GraphBuilder.cs (1)
215preferredLocation = newSymbol.Locations.Where(loc => loc.IsInSource).FirstOrDefault();
ProjectSystem\VisualStudioWorkspaceImpl.cs (1)
777if (folders.FirstOrDefault() == project.Name)
TaskList\ProjectExternalErrorReporter.cs (1)
135.FirstOrDefault();
Utilities\AutomationDelegatingListView.cs (1)
107textBlockItem = this.GetChildren()?.OfType<TextBlockAutomationPeer>().FirstOrDefault();
Venus\ContainedLanguageCodeSupport.cs (1)
270var memberNode = member.DeclaringSyntaxReferences.Select(r => r.GetSyntax(cancellationToken)).FirstOrDefault();
Workspace\VisualStudioSymbolNavigationService.cs (2)
62var sourceLocation = visibleSourceLocations.FirstOrDefault() ?? sourceLocations.FirstOrDefault(); 159var openedDocument = textBuffer?.AsTextContainer().GetRelatedDocuments().FirstOrDefault();
Microsoft.VisualStudio.LanguageServices.CSharp (2)
CodeModel\CSharpCodeModelService.cs (1)
3043var tree = compilation.SyntaxTrees.FirstOrDefault();
Snippets\CSharpSnippetExpansionLanguageHelper.cs (1)
136var candidateUsing = SyntaxFactory.ParseCompilationUnit("using " + namespaceToImport + ";").DescendantNodes().OfType<UsingDirectiveSyntax>().FirstOrDefault();
Microsoft.VisualStudio.LanguageServices.Xaml (2)
Implementation\LanguageServer\Extensions\SymbolExtensions.cs (1)
42var codeDocument = codeProject.Documents.FirstOrDefault();
Implementation\LanguageServer\Handler\Completion\CompletionHandler.cs (1)
68var completionResult = await completionService.GetCompletionsAsync(new XamlCompletionContext(document, offset, request.Context?.TriggerCharacter?.FirstOrDefault() ?? '\0'), cancellationToken: cancellationToken).ConfigureAwait(false);
MSBuild (1)
XMake.cs (1)
2665getResultOutputFile = commandLineSwitches[CommandLineSwitches.ParameterizedSwitch.GetResultOutputFile].FirstOrDefault() ?? string.Empty;
Mvc.RoutingWebSite (1)
StartupForRouteGroupsWithMetadata.cs (1)
22var old = builder.PartManager.FeatureProviders.OfType<IApplicationFeatureProvider<ControllerFeature>>().FirstOrDefault();
RunTests (1)
TestHistoryManager.cs (1)
158return builds?.FirstOrDefault();
ServerComparison.FunctionalTests (2)
ResponseCompressionTests.cs (1)
221return response.Content.Headers.TryGetValues(HeaderNames.ContentLength, out var values) ? values.FirstOrDefault() : null;
ResponseTests.cs (1)
270return response.Content.Headers.TryGetValues(HeaderNames.ContentLength, out values) ? values.FirstOrDefault() : null;
Shared.Tests (1)
JsonSchemaExporter\TestTypes.cs (1)
1289(TAttribute?)provider?.GetCustomAttributes(typeof(TAttribute), inherit: false).FirstOrDefault();
StaticFilesAuth (1)
Startup.cs (1)
40userName = userName?.Split('@').FirstOrDefault();
Swaggatherer (1)
src\Shared\CommandLineUtils\CommandLine\CommandArgument.cs (1)
25return Values.FirstOrDefault();
System.ComponentModel.Annotations (1)
System\ComponentModel\DataAnnotations\AssociatedMetadataTypeTypeDescriptor.cs (1)
184MemberInfo? matchingMember = type.GetMember(memberName, allowedMemberTypes, searchFlags).FirstOrDefault();
System.ComponentModel.Composition (2)
Microsoft\Internal\AttributeServices.cs (2)
23return GetAttributes<T>(attributeProvider).FirstOrDefault(); 28return GetAttributes<T>(attributeProvider, inherit).FirstOrDefault();
System.ComponentModel.Composition.Registration (10)
System\ComponentModel\Composition\Registration\PartBuilder.cs (10)
256bool isConfigured = type.GetCustomAttributes(typeof(ExportAttribute), false).FirstOrDefault() != null || MemberHasExportMetadata(type); 275bool isConfigured = type.GetCustomAttributes(typeof(PartCreationPolicyAttribute), false).FirstOrDefault() != null; 289bool isConfigured = type.GetCustomAttributes(typeof(PartMetadataAttribute), false).FirstOrDefault() != null; 306bool isConfigured = type.GetCustomAttributes(typeof(PartMetadataAttribute), false).FirstOrDefault() != null; 326bool isConfigured = type.GetCustomAttributes(typeof(ExportAttribute), false).FirstOrDefault() != null || MemberHasExportMetadata(type); 424bool isConfigured = pi.GetCustomAttributes(typeof(ImportAttribute), false).FirstOrDefault() != null || pi.GetCustomAttributes(typeof(ImportManyAttribute), false).FirstOrDefault() != null; 472isConfigured = pi.GetCustomAttributes(typeof(ImportAttribute), false).FirstOrDefault() != null || pi.GetCustomAttributes(typeof(ImportManyAttribute), false).FirstOrDefault() != null; 512isConfigured = pi.GetCustomAttributes(typeof(ExportAttribute), false).FirstOrDefault() != null || MemberHasExportMetadata(pi);
System.Composition.Convention (11)
System\Composition\Convention\PartConventionBuilder.cs (11)
495bool isConfigured = type.GetTypeInfo().GetCustomAttributes<ExportAttribute>(false).FirstOrDefault() != null || MemberHasExportMetadata(type.GetTypeInfo()); 513bool isConfigured = type.GetTypeInfo().GetCustomAttributes<SharedAttribute>(false).FirstOrDefault() != null; 529bool isConfigured = type.GetTypeInfo().GetCustomAttributes<PartMetadataAttribute>(false).FirstOrDefault() != null; 546bool isConfigured = type.GetTypeInfo().GetCustomAttributes<PartMetadataAttribute>(false).FirstOrDefault() != null; 566bool isConfigured = type.GetTypeInfo().GetCustomAttributes<ExportAttribute>(false).FirstOrDefault() != null || MemberHasExportMetadata(type.GetTypeInfo()); 657bool isConfigured = pi.GetCustomAttributes<ImportAttribute>(false).FirstOrDefault() != null || pi.GetCustomAttributes<ImportManyAttribute>(false).FirstOrDefault() != null; 699isConfigured = mi.GetCustomAttributes<OnImportsSatisfiedAttribute>(false).FirstOrDefault() != null; 757isConfigured = pi.GetCustomAttributes<ImportAttribute>(false).FirstOrDefault() != null || pi.GetCustomAttributes<ImportManyAttribute>(false).FirstOrDefault() != null; 799isConfigured = pi.GetCustomAttributes<ExportAttribute>(false).FirstOrDefault() != null || MemberHasExportMetadata(pi);
System.Linq.Parallel (1)
System\Linq\ParallelEnumerable.cs (1)
5494settings.CancellationState).FirstOrDefault();
System.Private.DataContractSerialization (3)
System\Runtime\Serialization\CollectionDataContract.cs (3)
996Type? t = type.GetInterfaces().Where(it => it.Equals(interfaceType)).FirstOrDefault(); 1293Type? t = type.GetInterfaces().Where(it => it.Equals(interfaceType)).FirstOrDefault(); 1350interfaceType.GetInterfaces().Where(t => t.FullName!.StartsWith("System.Collections.Generic.IEnumerable")).FirstOrDefault() ??
System.Private.Windows.Core.TestUtilities (1)
XUnit\SkipOnArchitectureDiscoverer.cs (1)
26if (traitAttribute.GetConstructorArguments().FirstOrDefault() is TestArchitectures architectures)
System.Private.Xml.Linq (1)
System\Xml\XPath\XNodeNavigator.cs (1)
986return node.XPathSelectElements(expression, resolver).FirstOrDefault();
System.Security.Cryptography.Pkcs (1)
System\Security\Cryptography\Pkcs\SignerInfo.cs (1)
716X509ChainStatus status = chain.ChainStatus.FirstOrDefault();
System.ServiceModel.Federation.Tests (1)
WSTrustChannelSecurityTokenProviderTest.cs (1)
68ClaimType ctype = trustRequest.Claims.ClaimTypes.FirstOrDefault();
System.Text.RegularExpressions.Generator (2)
UpgradeToGeneratedRegexCodeFixer.cs (2)
102SyntaxNode? typeDeclarationOrCompilationUnit = nodeToFix.Ancestors().OfType<TypeDeclarationSyntax>().FirstOrDefault(); 148nodeToFix.Ancestors().OfType<TypeDeclarationSyntax>().FirstOrDefault() :
System.Windows.Forms (1)
System\Windows\Forms\ActiveX\Control.ActiveXImpl.cs (1)
1448if (controlType.GetCustomAttributes<ComSourceInterfacesAttribute>(inherit: false).FirstOrDefault()
System.Windows.Forms.Analyzers.CodeFixes.CSharp (2)
System\Windows\Forms\CSharp\CodeFixes\AddDesignerSerializationVisibility\AddDesignerSerializationVisibilityCodeFixProvider.cs (2)
112.FirstOrDefault() is not null; 127.FirstOrDefault()
System.Windows.Forms.Primitives.TestUtilities (1)
NoAssertContext.cs (1)
52if (Trace.Listeners.OfType<ThrowingTraceListener>().FirstOrDefault() is { } throwingTraceListener)
System.Windows.Forms.Tests (3)
System\Windows\Forms\MonthCalendarTests.cs (1)
4654cal => cal.MonthlyBoldedDates.FirstOrDefault(),
System\Windows\Forms\TreeNodeTests.cs (2)
109Assert.Same(children.FirstOrDefault(), node.FirstNode); 200Assert.Same(children.FirstOrDefault(), node.FirstNode);
TaskUsageLogger (2)
TaskUsageLogger.cs (2)
341UsingTaskData matchingData = usingTasks.Where(ut => IsPartialNameMatch(taskName, ut.TaskName)).FirstOrDefault(); 359matchingData = defaultUsingTasks.Where(ut => IsPartialNameMatch(taskName, ut.TaskName)).FirstOrDefault();
Templates.Blazor.Tests (3)
src\ProjectTemplates\Shared\Project.cs (2)
271var file = Directory.EnumerateFiles(fullPath).Where(f => f.EndsWith($"{migration}.cs", StringComparison.Ordinal)).FirstOrDefault(); 355var projectFile = Directory.EnumerateFiles(TemplateOutputDir, "*proj").FirstOrDefault();
src\Shared\CommandLineUtils\CommandLine\CommandArgument.cs (1)
25return Values.FirstOrDefault();
Templates.Blazor.WebAssembly.Auth.Tests (3)
src\ProjectTemplates\Shared\Project.cs (2)
271var file = Directory.EnumerateFiles(fullPath).Where(f => f.EndsWith($"{migration}.cs", StringComparison.Ordinal)).FirstOrDefault(); 355var projectFile = Directory.EnumerateFiles(TemplateOutputDir, "*proj").FirstOrDefault();
src\Shared\CommandLineUtils\CommandLine\CommandArgument.cs (1)
25return Values.FirstOrDefault();
Templates.Blazor.WebAssembly.Tests (3)
src\ProjectTemplates\Shared\Project.cs (2)
271var file = Directory.EnumerateFiles(fullPath).Where(f => f.EndsWith($"{migration}.cs", StringComparison.Ordinal)).FirstOrDefault(); 355var projectFile = Directory.EnumerateFiles(TemplateOutputDir, "*proj").FirstOrDefault();
src\Shared\CommandLineUtils\CommandLine\CommandArgument.cs (1)
25return Values.FirstOrDefault();
Templates.Mvc.Tests (3)
src\ProjectTemplates\Shared\Project.cs (2)
271var file = Directory.EnumerateFiles(fullPath).Where(f => f.EndsWith($"{migration}.cs", StringComparison.Ordinal)).FirstOrDefault(); 355var projectFile = Directory.EnumerateFiles(TemplateOutputDir, "*proj").FirstOrDefault();
src\Shared\CommandLineUtils\CommandLine\CommandArgument.cs (1)
25return Values.FirstOrDefault();
Templates.Tests (3)
src\ProjectTemplates\Shared\Project.cs (2)
271var file = Directory.EnumerateFiles(fullPath).Where(f => f.EndsWith($"{migration}.cs", StringComparison.Ordinal)).FirstOrDefault(); 355var projectFile = Directory.EnumerateFiles(TemplateOutputDir, "*proj").FirstOrDefault();
src\Shared\CommandLineUtils\CommandLine\CommandArgument.cs (1)
25return Values.FirstOrDefault();
Wasm.Performance.ConsoleHost (1)
src\Shared\CommandLineUtils\CommandLine\CommandArgument.cs (1)
25return Values.FirstOrDefault();
xunit.assert (1)
Sdk\ArgumentFormatter.cs (1)
591 select @interface.GetTypeInfo()).FirstOrDefault()?.GenericTypeArguments[0];