4887 references to OfType
ApiExplorerWebSite (1)
ApiExplorerRouteChangeConvention.cs (1)
19if (action.Attributes.OfType<ReloadAttribute>().Any() && ChangeToken.TokenSource.IsCancellationRequested)
ApplicationModelWebSite (1)
Conventions\CloneActionConvention.cs (1)
15var actionName = action.Attributes.OfType<CloneActionAttribute>()?.FirstOrDefault()?.ActionName;
Aspire.Hosting (17)
ApplicationModel\CustomResourceSnapshot.cs (1)
340foreach (var annotation in resource.Annotations.OfType<ResourceRelationshipAnnotation>())
ApplicationModel\EndpointReference.cs (1)
109_endpointAnnotation ??= Resource.Annotations.OfType<EndpointAnnotation>().SingleOrDefault(a => StringComparers.EndpointAnnotationName.Equals(a.Name, EndpointName));
ApplicationModel\ResourceExtensions.cs (4)
22if (resource.Annotations.OfType<T>().LastOrDefault() is { } lastAnnotation) 43var matchingTypeAnnotations = resource.Annotations.OfType<T>().ToArray(); 83foreach (var annotation in resource.Annotations.OfType<T>()) 279if (resource.Annotations.OfType<ContainerImageAnnotation>().LastOrDefault() is { } imageAnnotation)
ApplicationModel\ResourceNotificationService.cs (2)
398foreach (var annotation in resource.Annotations.OfType<ResourceCommandAnnotation>()) 485if (resource.Annotations.OfType<ResourceSnapshotAnnotation>().LastOrDefault() is { } annotation)
ContainerResourceExtensions.cs (1)
40return resource.Annotations.OfType<ContainerImageAnnotation>().Any();
Dashboard\DashboardLifecycleHook.cs (1)
137var endpointAnnotations = dashboardResource.Annotations.OfType<EndpointAnnotation>().ToList();
Dcp\ApplicationExecutor.cs (1)
1773if (modelContainerResource.Annotations.OfType<DockerfileBuildAnnotation>().SingleOrDefault() is { } dockerfileBuildAnnotation)
Devcontainers\DevcontainerPortForwardingLifecycleHook.cs (1)
51foreach (var endpoint in resourceWithEndpoints.Annotations.OfType<EndpointAnnotation>())
DistributedApplicationResourceBuilder.cs (1)
27if (behavior == ResourceAnnotationMutationBehavior.Replace && Resource.Annotations.OfType<TAnnotation>().SingleOrDefault() is { } existingAnnotation)
ResourceBuilderExtensions.cs (4)
436.OfType<EndpointReferenceAnnotation>() 478.OfType<EndpointAnnotation>() 530if (builder.Resource.Annotations.OfType<EndpointAnnotation>().Any(sb => string.Equals(sb.Name, annotation.Name, StringComparisons.EndpointAnnotationName))) 1002var existingAnnotation = builder.Resource.Annotations.OfType<ResourceCommandAnnotation>().SingleOrDefault(a => a.Name == name);
Aspire.Hosting.Azure (3)
AzureResourceInfrastructure.cs (1)
33internal IEnumerable<ProvisioningParameter> GetParameters() => GetProvisionableResources().OfType<ProvisioningParameter>();
Provisioning\Provisioners\AzureProvisioner.cs (2)
65else if (resource.Annotations.OfType<AzureBicepResourceAnnotation>().SingleOrDefault() is { } annotation) 110_parentChildLookup = appModel.Resources.OfType<IResourceWithParent>().ToLookup(r => r.Parent);
Aspire.Hosting.Azure.AppContainers (1)
ContainerAppExtensions.cs (1)
65var containerAppManagedEnvironmentIdParameter = module.GetProvisionableResources().OfType<ProvisioningParameter>().Single(
Aspire.Hosting.Azure.EventHubs (1)
AzureEventHubsExtensions.cs (1)
199var eventHubsEmulatorResources = builder.ApplicationBuilder.Resources.OfType<AzureEventHubsResource>().Where(x => x is { } eventHubsResource && eventHubsResource.IsEmulator);
Aspire.Hosting.Azure.Functions (3)
AzureFunctionsProjectResourceExtensions.cs (3)
43.OfType<AzureStorageResource>() 57var storageAccount = infrastructure.GetProvisionableResources().OfType<StorageAccount>().FirstOrDefault(r => r.BicepIdentifier == storageResourceName) 76foreach (var item in data.Model.Resources.OfType<AzureFunctionsProjectResource>())
Aspire.Hosting.Azure.PostgreSQL (3)
AzurePostgresExtensions.cs (3)
80if (builder.Resource.Annotations.OfType<ContainerImageAnnotation>().SingleOrDefault() is { } containerAnnotation) 214.OfType<AzurePostgresFlexibleServerDatabaseResource>() 450foreach (var firewall in infrastructure.GetProvisionableResources().OfType<PostgreSqlFlexibleServerFirewallRule>())
Aspire.Hosting.Azure.Redis (1)
AzureRedisExtensions.cs (1)
70if (builder.Resource.Annotations.OfType<ContainerImageAnnotation>().SingleOrDefault() is { } containerAnnotation)
Aspire.Hosting.Azure.Sql (2)
AzureSqlExtensions.cs (2)
38if (builder.Resource.Annotations.OfType<ContainerImageAnnotation>().SingleOrDefault() is { } containerAnnotation) 158.OfType<AzureSqlDatabaseResource>()
Aspire.Hosting.Azure.Tests (39)
AzureBicepResourceTests.cs (12)
89Assert.Single(hooks.OfType<AzureProvisioner>()); 249callbackDatabases = infrastructure.GetProvisionableResources().OfType<CosmosDBSqlDatabase>(); 343callbackDatabases = infrastructure.GetProvisionableResources().OfType<CosmosDBSqlDatabase>(); 1882var sa = infrastructure.GetProvisionableResources().OfType<StorageAccount>().Single(); 2040var sa = infrastructure.GetProvisionableResources().OfType<StorageAccount>().Single(); 2199var sa = infrastructure.GetProvisionableResources().OfType<StorageAccount>().Single(); 2357var sa = infrastructure.GetProvisionableResources().OfType<StorageAccount>().Single(); 2517var search = infrastructure.GetProvisionableResources().OfType<SearchService>().Single(); 2639aiDeployments = infrastructure.GetProvisionableResources().OfType<CognitiveServicesAccountDeployment>(); 2643var account = infrastructure.GetProvisionableResources().OfType<CognitiveServicesAccount>().Single(); 2784var vault = r.GetProvisionableResources().OfType<KeyVaultService>().Single(); 2794var vault = r.GetProvisionableResources().OfType<KeyVaultService>().Single();
AzureEventHubsExtensionsTests.cs (6)
109var volumeAnnotation = eventHubs.Resource.Annotations.OfType<ContainerMountAnnotation>().Single(a => !a.Target.Contains("Config.json")); 126var volumeAnnotation = eventHubs.Resource.Annotations.OfType<ContainerMountAnnotation>().Single(a => !a.Target.Contains("Config.json")); 143var volumeAnnotation = eventHubs.Resource.Annotations.OfType<ContainerMountAnnotation>().Single(a => !a.Target.Contains("Config.json")); 160var volumeAnnotation = eventHubs.Resource.Annotations.OfType<ContainerMountAnnotation>().Single(a => !a.Target.Contains("Config.json")); 180eventHubs.Resource.Annotations.OfType<EndpointAnnotation>(), 202var containerImageAnnotation = eventHubs.Resource.Annotations.OfType<ContainerImageAnnotation>().FirstOrDefault();
AzureFunctionsTests.cs (10)
35var functionsResource = Assert.Single(builder.Resources.OfType<AzureFunctionsProjectResource>()); 50var functionsResource = Assert.Single(builder.Resources.OfType<AzureFunctionsProjectResource>()); 64var functionsResource = Assert.Single(builder.Resources.OfType<AzureFunctionsProjectResource>()); 78var functionsResource = Assert.Single(builder.Resources.OfType<AzureFunctionsProjectResource>()); 92var functionsResource = Assert.Single(builder.Resources.OfType<AzureFunctionsProjectResource>()); 106var storageResources = Assert.Single(builder.Resources.OfType<AzureStorageResource>()); 125Assert.DoesNotContain(model.Resources.OfType<AzureStorageResource>(), 127var storageResource = Assert.Single(model.Resources.OfType<AzureStorageResource>()); 146Assert.Single(model.Resources.OfType<AzureStorageResource>(), 158var resource = Assert.Single(builder.Resources.OfType<AzureStorageResource>());
AzureResourceExtensionsTests.cs (7)
33var volumeAnnotation = storage.Resource.Annotations.OfType<ContainerMountAnnotation>().Single(); 59var volumeAnnotation = storage.Resource.Annotations.OfType<ContainerMountAnnotation>().Single(); 85var volumeAnnotation = storage.Resource.Annotations.OfType<ContainerMountAnnotation>().Single(); 111var volumeAnnotation = storage.Resource.Annotations.OfType<ContainerMountAnnotation>().Single(); 130storage.Resource.Annotations.OfType<EndpointAnnotation>(), 151var endpointAnnotation = cosmos.Resource.Annotations.OfType<EndpointAnnotation>().FirstOrDefault(); 172var containerImageAnnotation = cosmos.Resource.Annotations.OfType<ContainerImageAnnotation>().FirstOrDefault();
AzureWebPubSubExtensionsTests.cs (4)
32realHub = infrastructure.GetProvisionableResources().OfType<WebPubSubHub>().Single(); 121var hub = infrastructure.GetProvisionableResources().OfType<WebPubSubHub>().First(i => i.BicepIdentifier == hubName); 282var hub = infrastructure.GetProvisionableResources().OfType<WebPubSubHub>().First(i => string.Equals(i.BicepIdentifier, "abc", StringComparison.OrdinalIgnoreCase)); 360var hub = infrastructure.GetProvisionableResources().OfType<WebPubSubHub>().First(i => i.BicepIdentifier == "hub1");
Aspire.Hosting.Containers.Tests (20)
ContainerResourceBuilderTests.cs (10)
17Assert.Equal("redis-stack", redis.Resource.Annotations.OfType<ContainerImageAnnotation>().Single().Image); 25Assert.Equal("redis-stack", redis.Resource.Annotations.OfType<ContainerImageAnnotation>().Single().Image); 26Assert.Equal("1.0.0", redis.Resource.Annotations.OfType<ContainerImageAnnotation>().Single().Tag); 37Assert.Equal("new-image", container.Resource.Annotations.OfType<ContainerImageAnnotation>().Single().Image); 38Assert.Equal("latest", container.Resource.Annotations.OfType<ContainerImageAnnotation>().Single().Tag); 49Assert.Equal("new-image", container.Resource.Annotations.OfType<ContainerImageAnnotation>().Last().Image); 50Assert.Equal("latest", container.Resource.Annotations.OfType<ContainerImageAnnotation>().Last().Tag); 58Assert.Equal("7.1", redis.Resource.Annotations.OfType<ContainerImageAnnotation>().Single().Tag); 66Assert.Equal("myregistry.azurecr.io", redis.Resource.Annotations.OfType<ContainerImageAnnotation>().Single().Registry); 74Assert.Equal("42b5c726e719639fcc1e9dbc13dd843f567dcd37911d0e1abb9f47f2cc1c95cd", redis.Resource.Annotations.OfType<ContainerImageAnnotation>().Single().SHA256);
ContainerResourceTests.cs (2)
27var containerAnnotation = Assert.Single(containerResource.Annotations.OfType<ContainerImageAnnotation>()); 46var containerAnnotation = Assert.Single(containerResource.Annotations.OfType<ContainerImageAnnotation>());
WithDockerfileTests.cs (8)
620var annotation = Assert.Single(container.Resource.Annotations.OfType<DockerfileBuildAnnotation>()); 635var annotation = Assert.Single(container.Resource.Annotations.OfType<DockerfileBuildAnnotation>()); 651var annotation = Assert.Single(container.Resource.Annotations.OfType<DockerfileBuildAnnotation>()); 666var annotation = Assert.Single(container.Resource.Annotations.OfType<DockerfileBuildAnnotation>()); 682var annotation = Assert.Single(container.Resource.Annotations.OfType<DockerfileBuildAnnotation>()); 697var annotation = Assert.Single(container.Resource.Annotations.OfType<DockerfileBuildAnnotation>()); 713var annotation = Assert.Single(container.Resource.Annotations.OfType<DockerfileBuildAnnotation>()); 728var annotation = Assert.Single(container.Resource.Annotations.OfType<DockerfileBuildAnnotation>());
Aspire.Hosting.Dapr (4)
DaprDistributedApplicationLifecycleHook.cs (4)
56var sidecarOptionsAnnotation = daprSidecar.Annotations.OfType<DaprSidecarOptionsAnnotation>().LastOrDefault(); 73var componentReferenceAnnotations = resource.Annotations.OfType<DaprComponentReferenceAnnotation>(); 226daprCli.Annotations.AddRange(daprSidecar.Annotations.OfType<EnvironmentCallbackAnnotation>()); 367.OfType<DaprComponentResource>()
Aspire.Hosting.Dapr.Tests (8)
DaprTests.cs (8)
41var container = Assert.Single(model.Resources.OfType<ContainerResource>()); 42var sidecarResource = Assert.Single(model.Resources.OfType<IDaprSidecarResource>()); 43var sideCarCli = Assert.Single(model.Resources.OfType<ExecutableResource>()); 88Assert.NotNull(container.Annotations.OfType<DaprSidecarAnnotation>()); 140var container = Assert.Single(model.Resources.OfType<ContainerResource>()); 141var sidecarResource = Assert.Single(model.Resources.OfType<IDaprSidecarResource>()); 142var sideCarCli = Assert.Single(model.Resources.OfType<ExecutableResource>()); 169Assert.NotNull(container.Annotations.OfType<DaprSidecarAnnotation>());
Aspire.Hosting.Elasticsearch.Tests (7)
AddElasticsearchTests.cs (7)
26var containerResource = Assert.Single(appModel.Resources.OfType<ElasticsearchResource>()); 29var endpoints = containerResource.Annotations.OfType<EndpointAnnotation>(); 50var containerAnnotation = Assert.Single(containerResource.Annotations.OfType<ContainerImageAnnotation>()); 88var containerResource = Assert.Single(appModel.Resources.OfType<ElasticsearchResource>()); 91var endpoints = containerResource.Annotations.OfType<EndpointAnnotation>(); 112var containerAnnotation = Assert.Single(containerResource.Annotations.OfType<ContainerImageAnnotation>()); 149var connectionStringResource = Assert.Single(appModel.Resources.OfType<ElasticsearchResource>()) as IResourceWithConnectionString;
Aspire.Hosting.Garnet.Tests (11)
AddGarnetTests.cs (11)
24var containerResource = Assert.Single(appModel.Resources.OfType<GarnetResource>()); 27var endpoint = Assert.Single(containerResource.Annotations.OfType<EndpointAnnotation>()); 36var containerAnnotation = Assert.Single(containerResource.Annotations.OfType<ContainerImageAnnotation>()); 52var containerResource = Assert.Single(appModel.Resources.OfType<GarnetResource>()); 55var endpoint = Assert.Single(containerResource.Annotations.OfType<EndpointAnnotation>()); 64var containerAnnotation = Assert.Single(containerResource.Annotations.OfType<ContainerImageAnnotation>()); 81var connectionStringResource = Assert.Single(appModel.Resources.OfType<IResourceWithConnectionString>()); 130var volumeAnnotation = garnet.Resource.Annotations.OfType<ContainerMountAnnotation>().Single(); 155var volumeAnnotation = garnet.Resource.Annotations.OfType<ContainerMountAnnotation>().Single(); 189var persistenceAnnotation = garnet.Resource.Annotations.OfType<CommandLineArgsCallbackAnnotation>().SingleOrDefault(); 220var persistenceAnnotation = garnet.Resource.Annotations.OfType<CommandLineArgsCallbackAnnotation>().SingleOrDefault();
Aspire.Hosting.Kafka (2)
KafkaBuilderExtensions.cs (2)
96if (builder.ApplicationBuilder.Resources.OfType<KafkaUIContainerResource>().SingleOrDefault() is { } existingKafkaUIResource) 115var kafkaResources = builder.ApplicationBuilder.Resources.OfType<KafkaServerResource>();
Aspire.Hosting.Kafka.Tests (8)
AddKafkaTests.cs (8)
25var containerResource = Assert.Single(appModel.Resources.OfType<KafkaServerResource>()); 28var endpoints = containerResource.Annotations.OfType<EndpointAnnotation>(); 49var containerAnnotation = Assert.Single(containerResource.Annotations.OfType<ContainerImageAnnotation>()); 67var connectionStringResource = Assert.Single(appModel.Resources.OfType<KafkaServerResource>()) as IResourceWithConnectionString; 123var volumeAnnotation = kafka.Resource.Annotations.OfType<ContainerMountAnnotation>().Single(); 141var volumeAnnotation = kafka.Resource.Annotations.OfType<ContainerMountAnnotation>().Single(); 173Assert.Single(builder.Resources.OfType<KafkaUIContainerResource>()); 176var kafkaUiEndpoint = kafkaUiResource.Annotations.OfType<EndpointAnnotation>().Single();
Aspire.Hosting.Keycloak.Tests (6)
KeycloakResourceBuilderTests.cs (6)
26var containerResource = Assert.Single(appModel.Resources.OfType<KeycloakResource>()); 29var endpoint = Assert.Single(containerResource.Annotations.OfType<EndpointAnnotation>()); 38var containerAnnotation = Assert.Single(containerResource.Annotations.OfType<ContainerImageAnnotation>()); 53var volumeAnnotation = keycloak.Resource.Annotations.OfType<ContainerMountAnnotation>().Single(); 68var volumeAnnotation = keycloak.Resource.Annotations.OfType<ContainerMountAnnotation>().Single(); 99var containerAnnotation = keycloak.Resource.Annotations.OfType<ContainerMountAnnotation>().Single();
Aspire.Hosting.Milvus.Tests (7)
AddMilvusTests.cs (7)
32var containerAnnotation = Assert.Single(containerResource.Annotations.OfType<ContainerImageAnnotation>()); 37var endpoint = containerResource.Annotations.OfType<EndpointAnnotation>() 63var containerAnnotation = Assert.Single(containerResource.Annotations.OfType<ContainerImageAnnotation>()); 68var endpoint = containerResource.Annotations.OfType<EndpointAnnotation>() 193var milvusResource = Assert.Single(appModel.Resources.OfType<MilvusServerResource>()); 196Assert.Single(milvusResource.Annotations.OfType<EndpointAnnotation>()); 198var grpcEndpoint = milvusResource.Annotations.OfType<EndpointAnnotation>().Single(e => e.Name == "grpc");
Aspire.Hosting.MongoDB.Tests (14)
AddMongoDBTests.cs (14)
26var containerResource = Assert.Single(appModel.Resources.OfType<MongoDBServerResource>()); 29var endpoint = Assert.Single(containerResource.Annotations.OfType<EndpointAnnotation>()); 38var containerAnnotation = Assert.Single(containerResource.Annotations.OfType<ContainerImageAnnotation>()); 54var containerResource = Assert.Single(appModel.Resources.OfType<MongoDBServerResource>()); 57var endpoint = Assert.Single(containerResource.Annotations.OfType<EndpointAnnotation>()); 66var containerAnnotation = Assert.Single(containerResource.Annotations.OfType<ContainerImageAnnotation>()); 85var dbResource = Assert.Single(appModel.Resources.OfType<MongoDBDatabaseResource>()); 104Assert.Single(builder.Resources.OfType<MongoExpressContainerResource>()); 118var resource = Assert.Single(builder.Resources.OfType<MongoExpressContainerResource>()); 119var containerAnnotation = Assert.Single(resource.Annotations.OfType<ContainerImageAnnotation>()); 134var resource = Assert.Single(builder.Resources.OfType<MongoExpressContainerResource>()); 135var endpoint = Assert.Single(resource.Annotations.OfType<EndpointAnnotation>()); 147var mongoExpress = Assert.Single(builder.Resources.OfType<MongoExpressContainerResource>()); 186Assert.Equal(2, builder.Resources.OfType<MongoExpressContainerResource>().Count());
Aspire.Hosting.MySql (2)
MySqlBuilderExtensions.cs (2)
98if (builder.ApplicationBuilder.Resources.OfType<PhpMyAdminContainerResource>().Any()) 117var mySqlInstances = builder.ApplicationBuilder.Resources.OfType<MySqlServerResource>();
Aspire.Hosting.MySql.Tests (11)
AddMySqlTests.cs (11)
46var containerResource = Assert.Single(appModel.Resources.OfType<MySqlServerResource>()); 49var containerAnnotation = Assert.Single(containerResource.Annotations.OfType<ContainerImageAnnotation>()); 54var endpoint = Assert.Single(containerResource.Annotations.OfType<EndpointAnnotation>()); 89var containerAnnotation = Assert.Single(containerResource.Annotations.OfType<ContainerImageAnnotation>()); 94var endpoint = Assert.Single(containerResource.Annotations.OfType<EndpointAnnotation>()); 124var connectionStringResource = Assert.Single(appModel.Resources.OfType<IResourceWithConnectionString>()); 143var mySqlResource = Assert.Single(appModel.Resources.OfType<MySqlServerResource>()); 146var mySqlDatabaseResource = Assert.Single(appModel.Resources.OfType<MySqlDatabaseResource>()); 230Assert.Single(builder.Resources.OfType<ContainerResource>().Where(resource => resource.Name is "mySql-phpmyadmin")); 261var volume = container.Annotations.OfType<ContainerMountAnnotation>().Single(); 279var volume = myAdmin.Annotations.OfType<ContainerMountAnnotation>().Single();
Aspire.Hosting.Nats.Tests (10)
AddNatsTests.cs (10)
49var natsResource = Assert.Single(appModel.Resources.OfType<NatsServerResource>()); 78var connectionStringResource = Assert.Single(appModel.Resources.OfType<NatsServerResource>()) as IResourceWithConnectionString; 96var containerResource = Assert.Single(appModel.Resources.OfType<NatsServerResource>()); 99var endpoint = Assert.Single(containerResource.Annotations.OfType<EndpointAnnotation>()); 108var containerAnnotation = Assert.Single(containerResource.Annotations.OfType<ContainerImageAnnotation>()); 138var containerResource = Assert.Single(appModel.Resources.OfType<NatsServerResource>()); 141var mountAnnotation = Assert.Single(containerResource.Annotations.OfType<ContainerMountAnnotation>()); 145var endpoint = Assert.Single(containerResource.Annotations.OfType<EndpointAnnotation>()); 154var containerAnnotation = Assert.Single(containerResource.Annotations.OfType<ContainerImageAnnotation>()); 179Assert.Equal(2, builder.Resources.OfType<NatsServerResource>().Count());
Aspire.Hosting.Oracle.Tests (9)
AddOracleTests.cs (9)
48var containerAnnotation = Assert.Single(containerResource.Annotations.OfType<ContainerImageAnnotation>()); 53var endpoint = Assert.Single(containerResource.Annotations.OfType<EndpointAnnotation>()); 88var containerAnnotation = Assert.Single(containerResource.Annotations.OfType<ContainerImageAnnotation>()); 93var endpoint = Assert.Single(containerResource.Annotations.OfType<EndpointAnnotation>()); 123var connectionStringResource = Assert.Single(appModel.Resources.OfType<IResourceWithConnectionString>()); 143var oracleResource = Assert.Single(appModel.Resources.OfType<OracleDatabaseServerResource>()); 146var oracleDatabaseResource = Assert.Single(appModel.Resources.OfType<OracleDatabaseResource>()); 171var containerAnnotation = Assert.Single(containerResource.Annotations.OfType<ContainerImageAnnotation>()); 176var endpoint = Assert.Single(containerResource.Annotations.OfType<EndpointAnnotation>());
Aspire.Hosting.PostgreSQL (5)
PostgresBuilderExtensions.cs (5)
138if (builder.ApplicationBuilder.Resources.OfType<PgAdminContainerResource>().SingleOrDefault() is { } existingPgAdminResource) 161var postgresInstances = builder.ApplicationBuilder.Resources.OfType<PostgresServerResource>(); 272if (builder.ApplicationBuilder.Resources.OfType<PgWebContainerResource>().SingleOrDefault() is { } existingPgWebResource) 298var adminResource = builder.ApplicationBuilder.Resources.OfType<PgWebContainerResource>().Single(); 300var postgresInstances = builder.ApplicationBuilder.Resources.OfType<PostgresDatabaseResource>();
Aspire.Hosting.PostgreSQL.Tests (17)
AddPostgresTests.cs (17)
58var containerAnnotation = Assert.Single(containerResource.Annotations.OfType<ContainerImageAnnotation>()); 63var endpoint = Assert.Single(containerResource.Annotations.OfType<EndpointAnnotation>()); 113var containerAnnotation = Assert.Single(containerResource.Annotations.OfType<ContainerImageAnnotation>()); 118var endpoint = Assert.Single(containerResource.Annotations.OfType<EndpointAnnotation>()); 178var postgresResource = Assert.Single(appModel.Resources.OfType<PostgresServerResource>()); 180var postgresDatabaseResource = Assert.Single(appModel.Resources.OfType<PostgresDatabaseResource>()); 205var containerAnnotation = Assert.Single(containerResource.Annotations.OfType<ContainerImageAnnotation>()); 210var endpoint = Assert.Single(containerResource.Annotations.OfType<EndpointAnnotation>()); 381var volume = container.Annotations.OfType<ContainerMountAnnotation>().Single(); 394Assert.Single(builder.Resources.OfType<PgWebContainerResource>()); 408var resource = Assert.Single(builder.Resources.OfType<PgWebContainerResource>()); 409var containerAnnotation = Assert.Single(resource.Annotations.OfType<ContainerImageAnnotation>()); 424var resource = Assert.Single(builder.Resources.OfType<PgWebContainerResource>()); 425var endpoint = Assert.Single(resource.Annotations.OfType<EndpointAnnotation>()); 436var imageAnnotation = container.Annotations.OfType<ContainerImageAnnotation>().Single(); 464var volume = pgadmin.Annotations.OfType<ContainerMountAnnotation>().Single(); 511var volume = pgadmin.Annotations.OfType<ContainerMountAnnotation>().Single();
Aspire.Hosting.Qdrant.Tests (10)
AddQdrantTests.cs (10)
51var containerAnnotation = Assert.Single(containerResource.Annotations.OfType<ContainerImageAnnotation>()); 56var endpoint = containerResource.Annotations.OfType<EndpointAnnotation>() 90var containerAnnotation = Assert.Single(containerResource.Annotations.OfType<ContainerImageAnnotation>()); 95var endpoint = containerResource.Annotations.OfType<EndpointAnnotation>() 124var containerAnnotation = Assert.Single(containerResource.Annotations.OfType<ContainerImageAnnotation>()); 129var endpoint = containerResource.Annotations.OfType<EndpointAnnotation>() 289var qdrantResource = Assert.Single(appModel.Resources.OfType<QdrantServerResource>()); 292Assert.Equal(2, qdrantResource.Annotations.OfType<EndpointAnnotation>().Count()); 294var grpcEndpoint = qdrantResource.Annotations.OfType<EndpointAnnotation>().Single(e => e.Name == "grpc"); 302var httpEndpoint = qdrantResource.Annotations.OfType<EndpointAnnotation>().Single(e => e.Name == "http");
Aspire.Hosting.RabbitMQ (1)
RabbitMQBuilderExtensions.cs (1)
142var containerAnnotations = builder.Resource.Annotations.OfType<ContainerImageAnnotation>().ToList();
Aspire.Hosting.RabbitMQ.Tests (7)
AddRabbitMQTests.cs (7)
53var containerResource = Assert.Single(appModel.Resources.OfType<RabbitMQServerResource>()); 56var primaryEndpoint = Assert.Single(containerResource.Annotations.OfType<EndpointAnnotation>().Where(e => e.Name == "tcp")); 67var mangementEndpoint = Assert.Single(containerResource.Annotations.OfType<EndpointAnnotation>().Where(e => e.Name == "management")); 85var containerAnnotation = Assert.Single(containerResource.Annotations.OfType<ContainerImageAnnotation>()); 106var rabbitMqResource = Assert.Single(appModel.Resources.OfType<RabbitMQServerResource>()); 140var containerResource = Assert.Single(appModel.Resources.OfType<RabbitMQServerResource>()); 141var containerAnnotation = Assert.Single(containerResource.Annotations.OfType<ContainerImageAnnotation>());
Aspire.Hosting.Redis (5)
RedisBuilderExtensions.cs (5)
81if (builder.ApplicationBuilder.Resources.OfType<RedisCommanderResource>().SingleOrDefault() is { } existingRedisCommanderResource) 100var redisInstances = builder.ApplicationBuilder.Resources.OfType<RedisResource>(); 148if (builder.ApplicationBuilder.Resources.OfType<RedisInsightResource>().SingleOrDefault() is { } existingRedisCommanderResource) 176var redisInstances = builder.ApplicationBuilder.Resources.OfType<RedisResource>(); 187var redisInsightResource = builder.ApplicationBuilder.Resources.OfType<RedisInsightResource>().Single();
Aspire.Hosting.Redis.Tests (21)
AddRedisTests.cs (21)
33var containerResource = Assert.Single(appModel.Resources.OfType<RedisResource>()); 36var endpoint = Assert.Single(containerResource.Annotations.OfType<EndpointAnnotation>()); 45var containerAnnotation = Assert.Single(containerResource.Annotations.OfType<ContainerImageAnnotation>()); 61var containerResource = Assert.Single(appModel.Resources.OfType<RedisResource>()); 64var endpoint = Assert.Single(containerResource.Annotations.OfType<EndpointAnnotation>()); 73var containerAnnotation = Assert.Single(containerResource.Annotations.OfType<ContainerImageAnnotation>()); 90var connectionStringResource = Assert.Single(appModel.Resources.OfType<IResourceWithConnectionString>()); 129Assert.Single(builder.Resources.OfType<RedisCommanderResource>()); 139Assert.Single(builder.Resources.OfType<RedisInsightResource>()); 153var resource = Assert.Single(builder.Resources.OfType<RedisCommanderResource>()); 154var containerAnnotation = Assert.Single(resource.Annotations.OfType<ContainerImageAnnotation>()); 171var resource = Assert.Single(builder.Resources.OfType<RedisInsightResource>()); 172var containerAnnotation = Assert.Single(resource.Annotations.OfType<ContainerImageAnnotation>()); 187var resource = Assert.Single(builder.Resources.OfType<RedisCommanderResource>()); 188var endpoint = Assert.Single(resource.Annotations.OfType<EndpointAnnotation>()); 201var resource = Assert.Single(builder.Resources.OfType<RedisInsightResource>()); 202var endpoint = Assert.Single(resource.Annotations.OfType<EndpointAnnotation>()); 269var volumeAnnotation = redis.Resource.Annotations.OfType<ContainerMountAnnotation>().Single(); 294var volumeAnnotation = redis.Resource.Annotations.OfType<ContainerMountAnnotation>().Single(); 328var persistenceAnnotation = redis.Resource.Annotations.OfType<CommandLineArgsCallbackAnnotation>().SingleOrDefault(); 359var persistenceAnnotation = redis.Resource.Annotations.OfType<CommandLineArgsCallbackAnnotation>().SingleOrDefault();
Aspire.Hosting.SqlServer.Tests (5)
AddSqlServerTests.cs (5)
46var containerResource = Assert.Single(appModel.Resources.OfType<SqlServerServerResource>()); 49var endpoint = Assert.Single(containerResource.Annotations.OfType<EndpointAnnotation>()); 58var containerAnnotation = Assert.Single(containerResource.Annotations.OfType<ContainerImageAnnotation>()); 94var connectionStringResource = Assert.Single(appModel.Resources.OfType<SqlServerServerResource>()); 117var sqlResource = Assert.Single(appModel.Resources.OfType<SqlServerDatabaseResource>());
Aspire.Hosting.Testing.Tests (1)
TestingBuilderTests.cs (1)
97var containerImageAnnotation = resource.Annotations.OfType<ContainerImageAnnotation>().FirstOrDefault();
Aspire.Hosting.Tests (78)
AddParameterTests.cs (13)
28var parameterResource = Assert.Single(appModel.Resources.OfType<ParameterResource>()); 29var annotation = parameterResource.Annotations.OfType<ResourceSnapshotAnnotation>().SingleOrDefault(); 65var parameterResource = Assert.Single(appModel.Resources.OfType<ParameterResource>()); 66var annotation = parameterResource.Annotations.OfType<ResourceSnapshotAnnotation>().SingleOrDefault(); 112var parameterResource = Assert.Single(appModel.Resources.OfType<ParameterResource>()); 147var parameterResource = Assert.Single(appModel.Resources.OfType<ParameterResource>(), r => r.Name == "pass"); 151var paramManifest = await ManifestUtils.GetManifest(appModel.Resources.OfType<ParameterResource>().Single(r => r.Name == "pass")).DefaultTimeout(); 197var parameterResource = Assert.Single(appModel.Resources.OfType<ParameterResource>(), r => r.Name == "pass"); 201var paramManifest = await ManifestUtils.GetManifest(appModel.Resources.OfType<ParameterResource>().Single(r => r.Name == "pass")).DefaultTimeout(); 255var parameterResource = Assert.Single(appModel.Resources.OfType<ParameterResource>(), r => r.Name == "pass"); 259var paramManifest = await ManifestUtils.GetManifest(appModel.Resources.OfType<ParameterResource>().Single(r => r.Name == "pass")).DefaultTimeout(); 310var parameterResource = Assert.Single(appModel.Resources.OfType<ParameterResource>(), r => r.Name == "val"); 314var paramManifest = await ManifestUtils.GetManifest(appModel.Resources.OfType<ParameterResource>().Single(r => r.Name == "val")).DefaultTimeout();
Dashboard\DashboardResourceTests.cs (7)
48var dashboard = Assert.Single(model.Resources.OfType<ExecutableResource>()); 49var initialSnapshot = Assert.Single(dashboard.Annotations.OfType<ResourceSnapshotAnnotation>()); 173var dashboard = Assert.Single(model.Resources.OfType<ExecutableResource>()); 314var endpointAnnotation = Assert.Single(container.Annotations.OfType<EndpointAnnotation>()); 462var dashboard = Assert.Single(model.Resources.OfType<ExecutableResource>()); 513var dashboard = Assert.Single(model.Resources.OfType<ProjectResource>()); 516var annotation = Assert.Single(dashboard.Annotations.OfType<ManifestPublishingCallbackAnnotation>());
Dcp\ApplicationExecutorTests.cs (35)
44var container = Assert.Single(kubernetesService.CreatedResources.OfType<Container>()); 77var executables = kubernetesService.CreatedResources.OfType<Executable>().ToList(); 117var dcpExe = Assert.Single(kubernetesService.CreatedResources.OfType<Executable>()); 124var svc = kubernetesService.CreatedResources.OfType<Service>().Single(s => s.Name() == "CoolProgram"); 149var dcpExe = Assert.Single(kubernetesService.CreatedResources.OfType<Executable>()); 156var svc = kubernetesService.CreatedResources.OfType<Service>().Single(s => s.Name() == "CoolProgram"); 181var dcpExe = Assert.Single(kubernetesService.CreatedResources.OfType<Executable>()); 188var svc = kubernetesService.CreatedResources.OfType<Service>().Single(s => s.Name() == "CoolProgram"); 214var dcpExe = Assert.Single(kubernetesService.CreatedResources.OfType<Executable>()); 221var svc = kubernetesService.CreatedResources.OfType<Service>().Single(s => s.Name() == "CoolProgram"); 271var dcpExe = Assert.Single(kubernetesService.CreatedResources.OfType<Executable>()); 277var svc = kubernetesService.CreatedResources.OfType<Service>().Single(s => s.Name() == "CoolProgram"); 305var dcpExe = Assert.Single(kubernetesService.CreatedResources.OfType<Executable>()); 311var svc = kubernetesService.CreatedResources.OfType<Service>().Single(s => s.Name() == "CoolProgram"); 339var dcpExe = Assert.Single(kubernetesService.CreatedResources.OfType<Executable>()); 345var svc = kubernetesService.CreatedResources.OfType<Service>().Single(s => s.Name() == "CoolProgram"); 426var executables = kubernetesService.CreatedResources.OfType<Executable>().ToList(); 463var exeResource = Assert.Single(kubernetesService.CreatedResources.OfType<Container>()); 561var exeResource = Assert.Single(kubernetesService.CreatedResources.OfType<Container>()); 665var exes = kubernetesService.CreatedResources.OfType<Executable>().ToList(); 676var svc = kubernetesService.CreatedResources.OfType<Service>().Single(s => s.Name() == "ServiceA-NoPortNoTargetPort"); 710var exes = kubernetesService.CreatedResources.OfType<Executable>().ToList(); 721var svc = kubernetesService.CreatedResources.OfType<Service>().Single(s => s.Name() == "ServiceA-PortSetNoTargetPort"); 747var dcpCtr = Assert.Single(kubernetesService.CreatedResources.OfType<Container>()); 754var svc = kubernetesService.CreatedResources.OfType<Service>().Single(s => s.Name() == "database"); 782var dcpCtr = Assert.Single(kubernetesService.CreatedResources.OfType<Container>()); 789var svc = kubernetesService.CreatedResources.OfType<Service>().Single(s => s.Name() == "database"); 863var dcpCtr = Assert.Single(kubernetesService.CreatedResources.OfType<Container>()); 869var svc = kubernetesService.CreatedResources.OfType<Service>().Single(s => s.Name() == "database"); 899var dcpCtr = Assert.Single(kubernetesService.CreatedResources.OfType<Container>()); 905var svc = kubernetesService.CreatedResources.OfType<Service>().Single(s => s.Name() == "database"); 936var dcpCtr = Assert.Single(kubernetesService.CreatedResources.OfType<Container>()); 942var svc = kubernetesService.CreatedResources.OfType<Service>().Single(s => s.Name() == "database"); 966var dcpCtr = Assert.Single(kubernetesService.CreatedResources.OfType<Container>()); 1037var commandAnnotations = resource.Annotations.OfType<ResourceCommandAnnotation>().ToList();
Dcp\TestKubernetesService.cs (3)
35var res = CreatedResources.OfType<T>().FirstOrDefault(r => 98var res = CreatedResources.OfType<T>().Where(r => 111foreach (var res in CreatedResources.OfType<T>())
KestrelConfigTests.cs (5)
25resource.Annotations.OfType<EndpointAnnotation>(), 62resource.Annotations.OfType<EndpointAnnotation>(), 94resource.Annotations.OfType<EndpointAnnotation>(), 111resource.Annotations.OfType<EndpointAnnotation>(), 461foreach (var endpoint in resource.Annotations.OfType<EndpointAnnotation>())
ProjectResourceTests.cs (3)
75var serviceMetadata = Assert.Single(resource.Annotations.OfType<IProjectMetadata>()); 215var replica = Assert.Single(resource.Annotations.OfType<ReplicaAnnotation>()); 251resource.Annotations.OfType<EndpointAnnotation>(),
ResourceCommandAnnotationTests.cs (1)
43var startCommand = resourceBuilder.Resource.Annotations.OfType<ResourceCommandAnnotation>().Single(a => a.Name == commandName);
ResourceNotificationTests.cs (1)
29var annotation = custom.Resource.Annotations.OfType<ResourceSnapshotAnnotation>().SingleOrDefault();
SlimTestProgramTests.cs (2)
56var endpoint = projectBuilders.Resource.Annotations.OfType<EndpointAnnotation>().Single(); 74var endpoint = projectBuilders.Resource.Annotations.OfType<EndpointAnnotation>().Single();
Utils\WithAnnotationTests.cs (4)
18var dummyAnnotations = redis.Resource.Annotations.OfType<DummyAnnotation>(); 32var dummyAnnotations = redis.Resource.Annotations.OfType<DummyAnnotation>(); 44var firstAnnotation = redis.Resource.Annotations.OfType<DummyAnnotation>().Single(); 48var secondAnnotation = redis.Resource.Annotations.OfType<DummyAnnotation>().Single();
WithEndpointTests.cs (4)
29var endpoint = projectA.Resource.Annotations.OfType<EndpointAnnotation>() 46var endpoint = projectA.Resource.Annotations.OfType<EndpointAnnotation>() 81var endpoint = projectA.Resource.Annotations.OfType<EndpointAnnotation>() 218var endpoints = resource.Annotations.OfType<EndpointAnnotation>().ToArray();
Aspire.Hosting.Valkey.Tests (11)
AddValkeyTests.cs (11)
24var containerResource = Assert.Single(appModel.Resources.OfType<ValkeyResource>()); 27var endpoint = Assert.Single(containerResource.Annotations.OfType<EndpointAnnotation>()); 36var containerAnnotation = Assert.Single(containerResource.Annotations.OfType<ContainerImageAnnotation>()); 52var containerResource = Assert.Single(appModel.Resources.OfType<ValkeyResource>()); 55var endpoint = Assert.Single(containerResource.Annotations.OfType<EndpointAnnotation>()); 64var containerAnnotation = Assert.Single(containerResource.Annotations.OfType<ContainerImageAnnotation>()); 81var connectionStringResource = Assert.Single(appModel.Resources.OfType<IResourceWithConnectionString>()); 130var volumeAnnotation = valkey.Resource.Annotations.OfType<ContainerMountAnnotation>().Single(); 155var volumeAnnotation = valkey.Resource.Annotations.OfType<ContainerMountAnnotation>().Single(); 189var persistenceAnnotation = valkey.Resource.Annotations.OfType<CommandLineArgsCallbackAnnotation>().SingleOrDefault(); 220var persistenceAnnotation = valkey.Resource.Annotations.OfType<CommandLineArgsCallbackAnnotation>().SingleOrDefault();
Aspire.Playground.Tests (4)
AppHostTests.cs (1)
41var projects = appHost.Resources.OfType<ProjectResource>();
Infrastructure\DistributedApplicationExtensions.cs (2)
28var parameters = builder.Resources.OfType<ParameterResource>().Where(p => !p.IsConnectionString).ToList(); 53.OfType<ContainerMountAnnotation>()
Infrastructure\DistributedApplicationTestFactory.cs (1)
63.SelectMany(r => r.Annotations.OfType<ContainerImageAnnotation>()
AuthSamples.FunctionalTests (1)
TestAssert.cs (1)
40.OfType<IHtmlElement>()
BasicWebSite (3)
Controllers\ContentNegotiation\FallbackOnTypeBasedMatchController.cs (1)
19_jsonOutputFormatter = mvcOptions.Value.OutputFormatters.OfType<NewtonsoftJsonOutputFormatter>().First();
Controllers\HomeController.cs (1)
133.OfType<AssemblyPart>()
Controllers\MonitorController.cs (1)
16_counterService = providers.OfType<ActionDescriptorCreationCounter>().Single();
BoundTreeGenerator (15)
BoundNodeClassWriter.cs (15)
257foreach (var node in _tree.Types.OfType<Node>()) 265foreach (var node in _tree.Types.OfType<Node>()) 1073foreach (var node in _tree.Types.OfType<Node>()) 1089foreach (var node in _tree.Types.OfType<Node>()) 1098foreach (var node in _tree.Types.OfType<Node>()) 1116foreach (var node in _tree.Types.OfType<Node>()) 1136foreach (var node in _tree.Types.OfType<Node>()) 1151foreach (var node in _tree.Types.OfType<Node>()) 1177foreach (var node in _tree.Types.OfType<Node>()) 1205foreach (var node in _tree.Types.OfType<Node>()) 1239foreach (var node in _tree.Types.OfType<Node>()) 1310foreach (var node in _tree.Types.OfType<Node>()) 1364foreach (var node in _tree.Types.OfType<Node>()) 1408foreach (var node in _tree.Types.OfType<Node>()) 1479foreach (var node in _tree.Types.OfType<Node>())
CdkSample.AppHost (7)
Program.cs (7)
19var account = infrastructure.GetProvisionableResources().OfType<StorageAccount>().Single(); 32var keyVault = infrastructure.GetProvisionableResources().OfType<KeyVaultService>().Single(); 57var queue = infrastructure.GetProvisionableResources().OfType<ServiceBusQueue>().Single(q => q.BicepIdentifier == "queue1"); 64var topic = infrastructure.GetProvisionableResources().OfType<ServiceBusTopic>().Single(q => q.BicepIdentifier == "topic1"); 71var subscription = infrastructure.GetProvisionableResources().OfType<ServiceBusSubscription>().Single(q => q.BicepIdentifier == "subscription1"); 87var logAnalyticsWorkspace = infrastructure.GetProvisionableResources().OfType<OperationalInsightsWorkspace>().Single(); 97var appInsights = infrastructure.GetProvisionableResources().OfType<ApplicationInsightsComponent>().Single();
CSharpSyntaxGenerator (7)
AbstractFileWriter.cs (1)
33_nodeMap = tree.Types.OfType<Node>().ToDictionary(n => n.Name);
SourceWriter.cs (6)
371foreach (var node in nodes.OfType<Node>()) 440foreach (var node in nodes.OfType<Node>()) 504foreach (var node in nodes.OfType<Node>()) 1067foreach (var node in nodes.OfType<Node>()) 1293foreach (var node in nodes.OfType<Node>()) 1332var nodes = Tree.Types.Where(n => n is not PredefinedNode and not AbstractNode).OfType<Node>().ToList();
CustomResources.AppHost (1)
TestResource.cs (1)
36foreach (var resource in appModel.Resources.OfType<TestResource>())
dotnet-dev-certs (7)
src\Shared\CertificateGeneration\CertificateManager.cs (6)
71foreach (var extension in certificate.Extensions.OfType<X509Extension>()) 147certificate.Extensions.OfType<X509Extension>() 152var byteArray = c.Extensions.OfType<X509Extension>() 178certificates.AddRange(store.Certificates.OfType<X509Certificate2>()); 838.OfType<X509Certificate2>() 889foreach (var candidate in certificatesWithSubjectName.OfType<X509Certificate2>())
src\Shared\CertificateGeneration\MacOSCertificateManager.cs (1)
299var hashes = matches.OfType<Match>().Select(m => m.Groups[1].Value).ToList();
dotnet-svcutil-lib (4)
Metadata\MetadataDocumentLoader.cs (1)
579var schemas = documents.OfType<XmlNS.Schema.XmlSchema>();
Metadata\MetadataDocumentSaver.cs (1)
278var wsdlFiles = this.MetadataFiles.OfType<WsdlFileInfo>();
Metadata\ServiceDescriptor.cs (2)
242return this.metadataDocumentLoader.MetadataSections.Select((s) => s.Metadata).OfType<WsdlNS.ServiceDescription>().Any((wsdl) => ContainsHttpBindings(wsdl)); 249if (binding.Extensions.OfType<WsdlNS.HttpBinding>().Count() != 0)
HealthChecksSandbox.AppHost (1)
Program.cs (1)
67foreach (var resource in appModel.Resources.OfType<TestResource>())
IIS.FunctionalTests (1)
src\Servers\IIS\IIS\test\Common.FunctionalTests\GlobalVersionTests.cs (1)
239.OfType<XElement>()
IISExpress.FunctionalTests (1)
src\Servers\IIS\IIS\test\Common.FunctionalTests\GlobalVersionTests.cs (1)
239.OfType<XElement>()
illink (2)
InMemory.FunctionalTests (8)
CertificateLoaderTests.cs (3)
22Assert.Empty(cert.Extensions.OfType<X509EnhancedKeyUsageExtension>()); 36var eku = Assert.Single(cert.Extensions.OfType<X509EnhancedKeyUsageExtension>()); 51var eku = Assert.Single(cert.Extensions.OfType<X509EnhancedKeyUsageExtension>());
HttpsConnectionMiddlewareTests.cs (3)
1312Assert.Empty(cert.Extensions.OfType<X509EnhancedKeyUsageExtension>()); 1326var eku = Assert.Single(cert.Extensions.OfType<X509EnhancedKeyUsageExtension>()); 1345var eku = Assert.Single(cert.Extensions.OfType<X509EnhancedKeyUsageExtension>());
src\Servers\Kestrel\shared\test\CertificateAuthority.cs (2)
763_cert.Extensions.OfType<X509SubjectKeyIdentifierExtension>().SingleOrDefault(); 870intermedCert.Extensions.OfType<X509SubjectKeyIdentifierExtension>().Single();
IntegrationTestsWebsite (1)
Infrastructure\DynamicEndpointDataSource.cs (1)
42.OfType<RouteEndpoint>()
IOperationGenerator (8)
IOperationClassWriter.cs (7)
34_typeMap = _tree.Types.OfType<AbstractNode>().ToDictionary(t => t.Name, t => (AbstractNode?)t); 103foreach (var grouping in _tree.Types.OfType<AbstractNode>().GroupBy(n => n.Namespace)) 313Dictionary<int, IEnumerable<(OperationKindEntry, AbstractNode)>> explicitKinds = _tree.Types.OfType<AbstractNode>() 323List<AbstractNode> elementsToKind = _tree.Types.OfType<AbstractNode>() 393foreach (var type in _tree.Types.OfType<AbstractNode>()) 946foreach (var node in _tree.Types.OfType<Node>()) 1026var types = _tree.Types.OfType<Node>();
IOperationClassWriter.Verifier.cs (1)
16foreach (var abstractNode in tree.Types.OfType<AbstractNode>())
Microsoft.Analyzers.Extra (7)
AsyncCallInsideUsingBlockAnalyzer.cs (4)
77.OfType<IInvocationOperation>() 156.OfType<IAwaitOperation>() 164.OfType<IInvocationOperation>() 172.OfType<IPropertyReferenceOperation>()
CallAnalysis\Fixers\LegacyLoggingFixer.cs (3)
169foreach (var method in targetClass.Members.Where(m => m.IsKind(SyntaxKind.MethodDeclaration)).OfType<MethodDeclarationSyntax>()) 270var allClasses = allNodes.Where(d => d.IsKind(SyntaxKind.ClassDeclaration)).OfType<ClassDeclarationSyntax>(); 635foreach (var methodSymbol in targetClassSymbol.GetMembers().Where(m => m.Kind == SymbolKind.Method).OfType<IMethodSymbol>())
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(); 44.OfType<DocumentationCommentTriviaSyntax>()
Microsoft.AspNetCore.Analyzers (1)
CompilationFeatureDetector.cs (1)
47.OfType<IInvocationOperation>()
Microsoft.AspNetCore.Analyzers.Test (37)
MinimalStartupTest.cs (21)
82var optionsAnalysis = Assert.Single(Analyses.OfType<OptionsAnalysis>()); 85var middlewareAnalysis = Assert.Single(Analyses.OfType<MiddlewareAnalysis>()); 107var optionsAnalysis = Assert.Single(Analyses.OfType<OptionsAnalysis>()); 110var middlewareAnalysis = Assert.Single(Analyses.OfType<MiddlewareAnalysis>()); 179var optionsAnalysis = Analyses.OfType<OptionsAnalysis>().First(); 182var middlewareAnalysis = Analyses.OfType<MiddlewareAnalysis>().First(); 214var optionsAnalysis = Analyses.OfType<OptionsAnalysis>().First(); 217var middlewareAnalysis = Analyses.OfType<MiddlewareAnalysis>().First(); 268var optionsAnalysis = Analyses.OfType<OptionsAnalysis>().First(); 291var servicesAnalysis = Analyses.OfType<ServicesAnalysis>().First(); 315var middlewareAnalysis = Assert.Single(Analyses.OfType<MiddlewareAnalysis>()); 340var middlewareAnalysis = Analyses.OfType<MiddlewareAnalysis>().First(); 365var middlewareAnalysis = Analyses.OfType<MiddlewareAnalysis>().First(); 416var middlewareAnalysis = Analyses.OfType<MiddlewareAnalysis>().First(); 443var middlewareAnalysis = Analyses.OfType<MiddlewareAnalysis>().First(); 468var middlewareAnalysis = Assert.Single(Analyses.OfType<MiddlewareAnalysis>()); 502var middlewareAnalysis = Analyses.OfType<MiddlewareAnalysis>().First(); 543var optionsAnalysis = Analyses.OfType<OptionsAnalysis>().First(); 546var middlewareAnalysis = Analyses.OfType<MiddlewareAnalysis>().First(); 599var optionsAnalysis = Analyses.OfType<OptionsAnalysis>().First(); 602var middlewareAnalysis = Analyses.OfType<MiddlewareAnalysis>().First();
StartupAnalyzerTest.cs (16)
148var optionsAnalysis = Assert.Single(Analyses.OfType<OptionsAnalysis>()); 151var middlewareAnalysis = Assert.Single(Analyses.OfType<MiddlewareAnalysis>()); 185var optionsAnalysis = Assert.Single(Analyses.OfType<OptionsAnalysis>()); 188var middlewareAnalysis = Assert.Single(Analyses.OfType<MiddlewareAnalysis>()); 291var optionsAnalysis = Analyses.OfType<OptionsAnalysis>().First(); 294var middlewareAnalysis = Analyses.OfType<MiddlewareAnalysis>().First(); 339var optionsAnalysis = Analyses.OfType<OptionsAnalysis>().First(); 342var middlewareAnalysis = Analyses.OfType<MiddlewareAnalysis>().First(); 408var optionsAnalysis = Analyses.OfType<OptionsAnalysis>().First(); 442var servicesAnalysis = Analyses.OfType<ServicesAnalysis>().First(); 470var middlewareAnalysis = Assert.Single(Analyses.OfType<MiddlewareAnalysis>()); 498var middlewareAnalysis = Analyses.OfType<MiddlewareAnalysis>().First(); 527var middlewareAnalysis = Analyses.OfType<MiddlewareAnalysis>().First(); 586var middlewareAnalysis = Analyses.OfType<MiddlewareAnalysis>().First(); 617var middlewareAnalysis = Analyses.OfType<MiddlewareAnalysis>().First(); 650var middlewareAnalysis = Assert.Single(Analyses.OfType<MiddlewareAnalysis>());
Microsoft.AspNetCore.App.Analyzers (9)
Infrastructure\AmbiguousRoutePatternComparer.cs (2)
103var xParameterPolicies = x.ParameterParts.Where(p => p.Kind == RoutePatternKind.ParameterPolicy).OfType<RoutePatternPolicyParameterPartNode>().ToList(); 104var yParameterPolicies = y.ParameterParts.Where(p => p.Kind == RoutePatternKind.ParameterPolicy).OfType<RoutePatternPolicyParameterPartNode>().ToList();
RouteEmbeddedLanguage\FrameworkParametersCompletionProvider.cs (1)
360foreach (var attributeList in parameter.AttributeLists.OfType<AttributeListSyntax>())
RouteEmbeddedLanguage\Infrastructure\EmbeddedLanguageCommentDetector.cs (1)
48options = optionGroup.Captures.OfType<Capture>().Select(c => c.Value);
RouteEmbeddedLanguage\RoutePatternHighlighter.cs (1)
97.OfType<IdentifierNameSyntax>()
RouteHandlers\DisallowReturningActionResultFromMapMethods.cs (1)
54foreach (var returnOperation in methodBody.Descendants().OfType<IReturnOperation>())
RouteHandlers\RouteHandlerAnalyzer.cs (1)
82delegateCreation = argument.Descendants().OfType<IDelegateCreationOperation>().FirstOrDefault();
src\Shared\RoslynUtils\ParsabilityHelper.cs (1)
76.OfType<IMethodSymbol>();
WebApplicationBuilder\WebApplicationBuilderAnalyzer.cs (1)
282.OfType<SimpleNameSyntax>()
Microsoft.AspNetCore.Authentication.OpenIdConnect (1)
OpenIdConnectConfigureOptions.cs (1)
112var elementsFromConfig = listConfigSection.GetChildren().Select(element => element.Value).OfType<string>();
Microsoft.AspNetCore.Authentication.Test (2)
JwtBearerTests_Handler.cs (2)
1050Assert.Equal(firstKey, Convert.ToBase64String(jwtBearerOptions.TokenValidationParameters.IssuerSigningKeys.OfType<SymmetricSecurityKey>().FirstOrDefault()?.Key)); 1051Assert.Equal(secondKey, Convert.ToBase64String(jwtBearerOptions.TokenValidationParameters.IssuerSigningKeys.OfType<SymmetricSecurityKey>().LastOrDefault()?.Key));
Microsoft.AspNetCore.Authorization (3)
AuthorizationHandler.cs (2)
22foreach (var req in context.Requirements.OfType<TRequirement>()) 53foreach (var req in context.Requirements.OfType<TRequirement>())
PassThroughAuthorizationHandler.cs (1)
37foreach (var handler in context.Requirements.OfType<IAuthorizationHandler>())
Microsoft.AspNetCore.Authorization.Test (6)
AuthorizationPolicyFacts.cs (6)
42Assert.Equal(2, combined.Requirements.OfType<ClaimsAuthorizationRequirement>().Count()); 43Assert.Single(combined.Requirements.OfType<RolesAuthorizationRequirement>()); 66Assert.Empty(combined.Requirements.OfType<DenyAnonymousAuthorizationRequirement>()); 92Assert.Equal(2, combined.Requirements.OfType<ClaimsAuthorizationRequirement>().Count()); 110var rolesAuthorizationRequirement = combined.Requirements.OfType<RolesAuthorizationRequirement>().First(); 171var rolesAuthorizationRequirement = combined.Requirements.OfType<RolesAuthorizationRequirement>().First();
Microsoft.AspNetCore.Components (2)
CascadingParameterState.cs (1)
124.OfType<CascadingParameterAttributeBase>().SingleOrDefault();
Reflection\ComponentProperties.cs (1)
191!propertyInfo.GetCustomAttributes().OfType<CascadingParameterAttributeBase>().Any())
Microsoft.AspNetCore.Components.Analyzers (1)
ComponentParametersShouldBePublicCodeFixProvider.cs (1)
38var declaration = root.FindToken(diagnosticSpan.Start).Parent.AncestorsAndSelf().OfType<PropertyDeclarationSyntax>().First();
Microsoft.AspNetCore.Components.Endpoints (1)
Builder\RazorComponentsEndpointRouteBuilderExtensions.cs (1)
45var dataSource = endpoints.DataSources.OfType<RazorComponentEndpointDataSource<TRootComponent>>().FirstOrDefault();
Microsoft.AspNetCore.Components.Endpoints.Tests (1)
RazorComponentEndpointFactoryTest.cs (1)
149builder => builder.Metadata.Remove(builder.Metadata.OfType<AuthorizeAttribute>().Single())
Microsoft.AspNetCore.Components.SdkAnalyzers (1)
ComponentParametersShouldBePublicCodeFixProvider.cs (1)
38var declaration = root.FindToken(diagnosticSpan.Start).Parent.AncestorsAndSelf().OfType<PropertyDeclarationSyntax>().First();
Microsoft.AspNetCore.Components.Server.Tests (1)
ComponentEndpointRouteBuilderExtensionsTest.cs (1)
113populatedMetadata = b.Metadata.OfType<string>().ToArray();
Microsoft.AspNetCore.Components.Web.Tests (3)
Forms\EditFormTest.cs (1)
211.OfType<EditForm>()
Forms\InputRadioTest.cs (1)
109.OfType<TestInputRadio>();
Forms\InputRenderer.cs (1)
24.OfType<TComponent>()
Microsoft.AspNetCore.Components.WebAssembly.Server (2)
Builder\WebAssemblyRazorComponentsEndpointConventionBuilderExtensions.cs (2)
38var needsCoopHeaders = endpointBuilder.Metadata.OfType<ComponentTypeMetadata>().Any() // e.g., /somecomponent 39|| endpointBuilder.Metadata.OfType<WebAssemblyRenderModeWithOptions>().Any(); // e.g., /_framework/*
Microsoft.AspNetCore.Components.WebView.Test (1)
Infrastructure\TestDocument.cs (1)
444foreach (var root in _componentsById.Values.OfType<RootComponentNode>())
Microsoft.AspNetCore.DataProtection (1)
KeyManagement\XmlKeyManager.cs (1)
168return processed.OfType<IKey>().ToList().AsReadOnly();
Microsoft.AspNetCore.DeveloperCertificates.XPlat (7)
src\Shared\CertificateGeneration\CertificateManager.cs (6)
71foreach (var extension in certificate.Extensions.OfType<X509Extension>()) 147certificate.Extensions.OfType<X509Extension>() 152var byteArray = c.Extensions.OfType<X509Extension>() 178certificates.AddRange(store.Certificates.OfType<X509Certificate2>()); 838.OfType<X509Certificate2>() 889foreach (var candidate in certificatesWithSubjectName.OfType<X509Certificate2>())
src\Shared\CertificateGeneration\MacOSCertificateManager.cs (1)
299var hashes = matches.OfType<Match>().Select(m => m.Groups[1].Value).ToList();
Microsoft.AspNetCore.DeveloperCertificates.XPlat.Tests (8)
CertificateManagerTests.cs (8)
67httpsCertificate.Extensions.OfType<X509Extension>(), 75httpsCertificate.Extensions.OfType<X509Extension>(), 81httpsCertificate.Extensions.OfType<X509Extension>(), 84enhancedKeyUsage.EnhancedKeyUsages.OfType<Oid>().Single() is Oid keyUsage && 89httpsCertificate.Extensions.OfType<X509Extension>(), 95httpsCertificate.Extensions.OfType<X509Extension>(), 475firstCertificate.Extensions.OfType<X509Extension>(), 481secondCertificate.Extensions.OfType<X509Extension>(),
Microsoft.AspNetCore.Grpc.Swagger (2)
Internal\XmlComments\GrpcXmlCommentsDocumentFilter.cs (1)
37var grpcMethodMetadata = nameAndType.Value.EndpointMetadata.OfType<GrpcMethodMetadata>().First();
Internal\XmlComments\GrpcXmlCommentsOperationFilter.cs (1)
24var grpcMetadata = context.ApiDescription.ActionDescriptor.EndpointMetadata.OfType<GrpcMethodMetadata>().FirstOrDefault();
Microsoft.AspNetCore.Hosting.Tests (1)
WebHostBuilderTests.cs (1)
1378var service = host.Services.GetServices<IHostedService>().OfType<NonThrowingHostedService>().First();
Microsoft.AspNetCore.Http.Extensions (9)
RequestDelegateFactory.cs (8)
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) 815else if (parameterCustomAttributes.OfType<AsParametersAttribute>().Any())
src\Shared\PropertyAsParameterInfo.cs (1)
205NullabilityState.Unknown => !_underlyingProperty.GetCustomAttributes().OfType<RequiredMemberAttribute>().Any(),
Microsoft.AspNetCore.Http.Extensions.Tests (36)
RequestDelegateFactoryTests.cs (1)
2910var allAcceptsMetadata = metadataResult.EndpointMetadata.OfType<IAcceptsMetadata>();
RequestDelegateGenerator\RequestDelegateCreationTestBase.cs (1)
179var generatedCodeAttribute = endpoint.Metadata.OfType<GeneratedCodeAttribute>().SingleOrDefault();
RequestDelegateGenerator\RequestDelegateCreationTests.Forms.cs (15)
45var allAcceptsMetadata = endpoint.Metadata.OfType<IAcceptsMetadata>(); 50Assert.NotNull(endpoint.Metadata.OfType<IAntiforgeryMetadata>().SingleOrDefault()); 80var allAcceptsMetadata = endpoint.Metadata.OfType<IAcceptsMetadata>(); 85Assert.NotNull(endpoint.Metadata.OfType<IAntiforgeryMetadata>().SingleOrDefault()); 115Assert.NotNull(endpoint.Metadata.OfType<IAntiforgeryMetadata>().SingleOrDefault()); 153Assert.NotNull(endpoint.Metadata.OfType<IAntiforgeryMetadata>().SingleOrDefault()); 196Assert.NotNull(endpoint.Metadata.OfType<IAntiforgeryMetadata>().SingleOrDefault()); 234var allAcceptsMetadata = endpoint.Metadata.OfType<IAcceptsMetadata>(); 239Assert.NotNull(endpoint.Metadata.OfType<IAntiforgeryMetadata>().SingleOrDefault()); 269Assert.NotNull(endpoint.Metadata.OfType<IAntiforgeryMetadata>().SingleOrDefault()); 309Assert.NotNull(endpoint.Metadata.OfType<IAntiforgeryMetadata>().SingleOrDefault()); 417var allAcceptsMetadata = endpoint.Metadata.OfType<IAcceptsMetadata>(); 571var allAcceptsMetadata = endpoint.Metadata.OfType<IAcceptsMetadata>(); 618var allAcceptsMetadata = endpoint.Metadata.OfType<IAcceptsMetadata>(); 851var allAcceptsMetadata = endpoint.Metadata.OfType<IAcceptsMetadata>();
RequestDelegateGenerator\RequestDelegateCreationTests.Metadata.cs (13)
33var metadata = endpoint.Metadata.OfType<IProducesResponseTypeMetadata>().Single(); 49var metadata = endpoint.Metadata.OfType<IProducesResponseTypeMetadata>().Single(); 65var metadata = endpoint.Metadata.OfType<IProducesResponseTypeMetadata>(); 79var metadata = endpoint.Metadata.OfType<IProducesResponseTypeMetadata>().Single(); 93var metadata = endpoint.Metadata.OfType<IProducesResponseTypeMetadata>().Single(); 107var metadata = endpoint.Metadata.OfType<IProducesResponseTypeMetadata>().Single(); 121var metadata = endpoint.Metadata.OfType<IProducesResponseTypeMetadata>().Single(); 136var metadata = endpoint.Metadata.OfType<IProducesResponseTypeMetadata>().Single(); 152_ = endpoint.Metadata.OfType<CustomMetadata>().Single(m => m.Value == 42); 153_ = endpoint.Metadata.OfType<CustomMetadata>().Single(m => m.Value == 24); 167var metadata = endpoint.Metadata.OfType<CustomMetadata>().Single(); 179var responseMetadata = endpoint.Metadata.OfType<IProducesResponseTypeMetadata>().Single(); 193var responseMetadata = endpoint.Metadata.OfType<IProducesResponseTypeMetadata>().Single();
RequestDelegateGenerator\RuntimeCreationTests.ComplexFormBinding.cs (6)
36Assert.NotNull(endpoint.Metadata.OfType<IAntiforgeryMetadata>().SingleOrDefault()); 72Assert.NotNull(endpoint.Metadata.OfType<IAntiforgeryMetadata>().SingleOrDefault()); 104Assert.NotNull(endpoint.Metadata.OfType<IAntiforgeryMetadata>().SingleOrDefault()); 141Assert.NotNull(endpoint.Metadata.OfType<IAntiforgeryMetadata>().SingleOrDefault()); 213Assert.NotNull(endpoint.Metadata.OfType<IAntiforgeryMetadata>().SingleOrDefault()); 250Assert.NotNull(endpoint.Metadata.OfType<IAntiforgeryMetadata>().SingleOrDefault());
Microsoft.AspNetCore.Http.Microbenchmarks (1)
src\Http\Http.Extensions\test\RequestDelegateGenerator\RequestDelegateCreationTestBase.cs (1)
179var generatedCodeAttribute = endpoint.Metadata.OfType<GeneratedCodeAttribute>().SingleOrDefault();
Microsoft.AspNetCore.Http.RequestDelegateGenerator (1)
src\Shared\RoslynUtils\ParsabilityHelper.cs (1)
76.OfType<IMethodSymbol>();
Microsoft.AspNetCore.Http.Results.Tests (22)
AcceptedAtRouteOfTResultTests.cs (1)
133var producesResponseTypeMetadata = builder.Metadata.OfType<ProducesResponseTypeMetadata>().Last();
AcceptedAtRouteResultTests.cs (1)
87var producesResponseTypeMetadata = builder.Metadata.OfType<ProducesResponseTypeMetadata>().Last();
AcceptedOfTResultTests.cs (1)
74var producesResponseTypeMetadata = builder.Metadata.OfType<ProducesResponseTypeMetadata>().Last();
AcceptedResultTests.cs (1)
44var producesResponseTypeMetadata = builder.Metadata.OfType<ProducesResponseTypeMetadata>().Last();
BadRequestOfTResultTests.cs (1)
117var producesResponseTypeMetadata = builder.Metadata.OfType<ProducesResponseTypeMetadata>().Last();
BadRequestResultTests.cs (1)
57var producesResponseTypeMetadata = builder.Metadata.OfType<ProducesResponseTypeMetadata>().Last();
ConflictOfTResultTests.cs (1)
95var producesResponseTypeMetadata = builder.Metadata.OfType<ProducesResponseTypeMetadata>().Last();
ConflictResultTests.cs (1)
58var producesResponseTypeMetadata = builder.Metadata.OfType<ProducesResponseTypeMetadata>().Last();
CreatedAtRouteOfTResultTests.cs (1)
103var producesResponseTypeMetadata = builder.Metadata.OfType<ProducesResponseTypeMetadata>().Last();
CreatedAtRouteResultTests.cs (1)
85var producesResponseTypeMetadata = builder.Metadata.OfType<ProducesResponseTypeMetadata>().Last();
CreatedOfTResultTests.cs (1)
109var producesResponseTypeMetadata = builder.Metadata.OfType<ProducesResponseTypeMetadata>().Last();
CreatedResultTests.cs (1)
75var producesResponseTypeMetadata = builder.Metadata.OfType<ProducesResponseTypeMetadata>().Last();
InternalServerErrorOfTResultTests.cs (1)
117var producesResponseTypeMetadata = builder.Metadata.OfType<ProducesResponseTypeMetadata>().Last();
InternalServerErrorResultTests.cs (1)
57var producesResponseTypeMetadata = builder.Metadata.OfType<ProducesResponseTypeMetadata>().Last();
NoContentResultTests.cs (1)
54var producesResponseTypeMetadata = builder.Metadata.OfType<ProducesResponseTypeMetadata>().Last();
NotFoundOfTResultTests.cs (1)
77var producesResponseTypeMetadata = builder.Metadata.OfType<ProducesResponseTypeMetadata>().Last();
NotFoundResultTests.cs (1)
53var producesResponseTypeMetadata = builder.Metadata.OfType<ProducesResponseTypeMetadata>().Last();
OkOfTResultTests.cs (1)
94var producesResponseTypeMetadata = builder.Metadata.OfType<ProducesResponseTypeMetadata>().Last();
OkResultTests.cs (1)
56var producesResponseTypeMetadata = builder.Metadata.OfType<ProducesResponseTypeMetadata>().Last();
UnprocessableEntityOfTResultTests.cs (1)
94var producesResponseTypeMetadata = builder.Metadata.OfType<ProducesResponseTypeMetadata>().Last();
UnprocessableEntityResultTests.cs (1)
57var producesResponseTypeMetadata = builder.Metadata.OfType<ProducesResponseTypeMetadata>().Last();
ValidationProblemResultTests.cs (1)
105var producesResponseTypeMetadata = builder.Metadata.OfType<ProducesResponseTypeMetadata>().Last();
Microsoft.AspNetCore.Identity.EntityFrameworkCore (1)
IdentityUserContext.cs (1)
104.Extensions.OfType<CoreOptionsExtension>()
Microsoft.AspNetCore.Identity.FunctionalTests (1)
Extensions\HtmlAssert.cs (1)
28.OfType<IHtmlElement>()
Microsoft.AspNetCore.InternalTesting (10)
TestFileOutputContext.cs (3)
78var attribute = assembly.GetCustomAttributes().OfType<TestOutputDirectoryAttribute>().FirstOrDefault(); 84var attribute = assembly.GetCustomAttributes().OfType<TestOutputDirectoryAttribute>().FirstOrDefault(); 96var attribute = assembly.GetCustomAttributes().OfType<TestOutputDirectoryAttribute>().FirstOrDefault();
xunit\AspNetTestAssemblyRunner.cs (3)
88foreach (var disposable in Fixtures.OfType<IDisposable>()) 93foreach (var disposable in Fixtures.OfType<IAsyncLifetime>()) 120foreach (var fixture in Fixtures.OfType<IAcceptFailureReports>())
xunit\AspNetTestInvoker.cs (3)
64foreach (var attribute in testMethod.GetCustomAttributes(inherit: true).OfType<ITestMethodLifecycle>()) 74foreach (var attribute in testClass.GetCustomAttributes(inherit: true).OfType<ITestMethodLifecycle>()) 79foreach (var attribute in testClass.Assembly.GetCustomAttributes(inherit: true).OfType<ITestMethodLifecycle>())
xunit\TestMethodExtensions.cs (1)
20.OfType<ReflectionAttributeInfo>()
Microsoft.AspNetCore.InternalTesting.Tests (1)
TestableAssembly.cs (1)
43ThisAssembly.GetCustomAttributes().OfType<TestOutputDirectoryAttribute>().FirstOrDefault();
Microsoft.AspNetCore.Mvc (2)
MvcServiceCollectionExtensions.cs (2)
326if (!partManager.ApplicationParts.OfType<AssemblyPart>().Any(p => p.Assembly == mvcTagHelpersAssembly)) 332if (!partManager.ApplicationParts.OfType<AssemblyPart>().Any(p => p.Assembly == mvcRazorAssembly))
Microsoft.AspNetCore.Mvc.Abstractions (7)
ModelBinding\BindingInfo.cs (7)
116foreach (var binderModelNameAttribute in attributes.OfType<IModelNameProvider>()) 127foreach (var binderTypeAttribute in attributes.OfType<IBinderTypeProviderMetadata>()) 138foreach (var bindingSourceAttribute in attributes.OfType<IBindingSourceMetadata>()) 149var propertyFilterProviders = attributes.OfType<IPropertyFilterProvider>().ToArray(); 162foreach (var requestPredicateProvider in attributes.OfType<IRequestPredicateProvider>()) 172foreach (var configureEmptyBodyBehavior in attributes.OfType<IConfigureEmptyBodyBehavior>()) 180if (attributes.OfType<FromKeyedServicesAttribute>().FirstOrDefault() is { } fromKeyedServicesAttribute)
Microsoft.AspNetCore.Mvc.Api.Analyzers (1)
ActualApiResponseMetadataFactory.cs (1)
295foreach (var returnOperation in method.Descendants().OfType<IReturnOperation>())
Microsoft.AspNetCore.Mvc.ApiExplorer (15)
ApiResponseTypeProvider.cs (3)
53var producesResponseMetadata = action.EndpointMetadata.OfType<IProducesResponseTypeMetadata>().ToList(); 71.OfType<IApiResponseMetadataProvider>() 82var responseTypeMetadataProviders = _mvcOptions.OutputFormatters.OfType<IApiResponseTypeMetadataProvider>();
DefaultApiDescriptionProvider.cs (6)
66foreach (var action in context.Actions.OfType<ControllerActionDescriptor>()) 129var acceptsMetadata = action.EndpointMetadata.OfType<IAcceptsMetadata>().LastOrDefault(); 271!defaultModelMetadata.Attributes.Attributes.OfType<IFromRouteMetadata>().Any()) 367return action.ActionConstraints.OfType<HttpMethodActionConstraint>().SelectMany(c => c.HttpMethods); 495.OfType<IApiRequestMetadataProvider>() 508var endpointGroupName = action.EndpointMetadata.OfType<IEndpointGroupNameMetadata>().LastOrDefault();
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)
src\Shared\PropertyAsParameterInfo.cs (1)
205NullabilityState.Unknown => !_underlyingProperty.GetCustomAttributes().OfType<RequiredMemberAttribute>().Any(),
Microsoft.AspNetCore.Mvc.ApiExplorer.Test (28)
ApiResponseTypeProviderTest.cs (1)
793foreach (var filterAttribute in method.GetCustomAttributes().OfType<IFilterMetadata>())
DefaultApiDescriptionProviderTest.cs (2)
2311var bindingInfo = BindingInfo.GetBindingInfo(property.GetCustomAttributes().OfType<object>()); 2337BindingInfo = BindingInfo.GetBindingInfo(parameter.GetCustomAttributes().OfType<object>()),
EndpointMetadataApiDescriptionProviderTest.cs (25)
774.OfType<ApiExplorerSettingsAttribute>() 838var endpointDataSource = builder.DataSources.OfType<EndpointDataSource>().Single(); 863var endpointDataSource = builder.DataSources.OfType<EndpointDataSource>().Single(); 888var endpointDataSource = builder.DataSources.OfType<EndpointDataSource>().Single(); 914var endpointDataSource = builder.DataSources.OfType<EndpointDataSource>().Single(); 964var endpointDataSource = builder.DataSources.OfType<EndpointDataSource>().Single(); 1001var endpointDataSource = builder.DataSources.OfType<EndpointDataSource>().Single(); 1035var endpointDataSource = builder.DataSources.OfType<EndpointDataSource>().Single(); 1064var endpointDataSource = builder.DataSources.OfType<EndpointDataSource>().Single(); 1094var endpointDataSource = builder.DataSources.OfType<EndpointDataSource>().Single(); 1126var endpointDataSource = builder.DataSources.OfType<EndpointDataSource>().Single(); 1158var endpointDataSource = builder.DataSources.OfType<EndpointDataSource>().Single(); 1190var endpointDataSource = builder.DataSources.OfType<EndpointDataSource>().Single(); 1219var endpointDataSource = builder.DataSources.OfType<EndpointDataSource>().Single(); 1248var endpointDataSource = builder.DataSources.OfType<EndpointDataSource>().Single(); 1336var endpointDataSource = builder.DataSources.OfType<EndpointDataSource>().Single(); 1365var endpointDataSource = builder.DataSources.OfType<EndpointDataSource>().Single(); 1405var endpointDataSource = builder.DataSources.OfType<EndpointDataSource>().Single(); 1434var endpointDataSource = builder.DataSources.OfType<EndpointDataSource>().Single(); 1448var descriptionMetadata = apiDescription.ActionDescriptor.EndpointMetadata.OfType<IEndpointDescriptionMetadata>().SingleOrDefault(); 1452var summaryMetadata = apiDescription.ActionDescriptor.EndpointMetadata.OfType<IEndpointSummaryMetadata>().SingleOrDefault(); 1465var endpointDataSource = builder.DataSources.OfType<EndpointDataSource>().Single(); 1479var descriptionMetadata = apiDescription.ActionDescriptor.EndpointMetadata.OfType<IEndpointDescriptionMetadata>().SingleOrDefault(); 1483var summaryMetadata = apiDescription.ActionDescriptor.EndpointMetadata.OfType<IEndpointSummaryMetadata>().SingleOrDefault(); 1499var endpointDataSource = builder.DataSources.OfType<EndpointDataSource>().Single();
Microsoft.AspNetCore.Mvc.Core (52)
ApiExplorer\ApiConventionResult.cs (1)
45.OfType<IApiResponseMetadataProvider>()
ApplicationModels\ApiBehaviorApplicationModelProvider.cs (2)
119if (controller.Attributes.OfType<IApiBehaviorMetadata>().Any()) 126return assemblyAttributes.OfType<IApiBehaviorMetadata>().Any();
ApplicationModels\ApiConventionApplicationModelConvention.cs (3)
63var apiConventionAttributes = controller.Attributes.OfType<ApiConventionTypeAttribute>().ToArray(); 79action.Attributes.OfType<ProducesErrorResponseTypeAttribute>().FirstOrDefault() ?? 80action.Controller.Attributes.OfType<ProducesErrorResponseTypeAttribute>().FirstOrDefault() ??
ApplicationModels\ApplicationModelConventions.cs (5)
40.OfType<IControllerModelConvention>() 55.OfType<IActionModelConvention>() 70.OfType<IParameterModelConvention>() 104conventions.OfType<TConvention>(), 105attributes.OfType<TConvention>());
ApplicationModels\ApplicationModelFactory.cs (1)
303var verbs = selector.ActionConstraints?.OfType<HttpMethodActionConstraint>().FirstOrDefault()?.HttpMethods;
ApplicationModels\AuthorizationApplicationModelProvider.cs (4)
44var controllerModelAuthData = controllerModel.Attributes.OfType<IAuthorizeData>().ToArray(); 49foreach (var attribute in controllerModel.Attributes.OfType<IAllowAnonymous>()) 56var actionModelAuthData = actionModel.Attributes.OfType<IAuthorizeData>().ToArray(); 62foreach (var _ in actionModel.Attributes.OfType<IAllowAnonymous>())
ApplicationModels\ConsumesConstraintForFormFileParameterConvention.cs (1)
43if (action.Filters.OfType<IConsumesActionConstraint>().Any())
ApplicationModels\DefaultApplicationModelProvider.cs (13)
125.OfType<IRouteTemplateProvider>() 168AddRange(controllerModel.Filters, attributes.OfType<IFilterMetadata>()); 170foreach (var routeValueProvider in attributes.OfType<IRouteValueProvider>()) 175var apiVisibility = attributes.OfType<IApiDescriptionVisibilityProvider>().FirstOrDefault(); 181var apiGroupName = attributes.OfType<IApiDescriptionGroupNameProvider>().FirstOrDefault(); 271AddRange(actionModel.Filters, attributes.OfType<IFilterMetadata>()); 273var actionName = attributes.OfType<ActionNameAttribute>().FirstOrDefault(); 283var apiVisibility = attributes.OfType<IApiDescriptionVisibilityProvider>().FirstOrDefault(); 289var apiGroupName = attributes.OfType<IApiDescriptionGroupNameProvider>().FirstOrDefault(); 295foreach (var routeValueProvider in attributes.OfType<IRouteValueProvider>()) 315.OfType<IRouteTemplateProvider>() 628AddRange(selectorModel.ActionConstraints, attributes.OfType<IActionConstraintMetadata>()); 633.OfType<IActionHttpMethodProvider>()
ApplicationParts\ApplicationPartManager.cs (1)
45foreach (var provider in FeatureProviders.OfType<IApplicationFeatureProvider<TFeature>>())
Builder\ControllerEndpointRouteBuilderExtensions.cs (1)
530var dataSource = endpoints.DataSources.OfType<ControllerActionEndpointDataSource>().FirstOrDefault();
Controllers\ControllerFeatureProvider.cs (1)
22foreach (var part in parts.OfType<IApplicationPartTypeProvider>())
DependencyInjection\MvcCoreServiceCollectionExtensions.cs (1)
66if (!manager.FeatureProviders.OfType<ControllerFeatureProvider>().Any())
Formatters\FormatFilter.cs (1)
83var responseTypeFilters = context.Filters.OfType<IApiResponseMetadataProvider>();
ModelBinding\Metadata\DefaultBindingMetadataProvider.cs (7)
22foreach (var binderModelNameAttribute in context.Attributes.OfType<IModelNameProvider>()) 32foreach (var binderTypeAttribute in context.Attributes.OfType<IBinderTypeProviderMetadata>()) 42foreach (var bindingSourceAttribute in context.Attributes.OfType<IBindingSourceMetadata>()) 52var propertyFilterProviders = context.Attributes.OfType<IPropertyFilterProvider>().ToArray(); 155var matchingAttributes = context.PropertyAttributes!.OfType<BindingBehaviorAttribute>(); 159.OfType<BindingBehaviorAttribute>() 162return context.ParameterAttributes!.OfType<BindingBehaviorAttribute>().FirstOrDefault();
ModelBinding\Metadata\DefaultCompositeMetadataDetailsProvider.cs (3)
33foreach (var provider in _providers.OfType<IBindingMetadataProvider>()) 44foreach (var provider in _providers.OfType<IDisplayMetadataProvider>()) 55foreach (var provider in _providers.OfType<IValidationMetadataProvider>())
ModelBinding\Metadata\DefaultValidationMetadataProvider.cs (3)
40var validationFilter = context.PropertyAttributes!.OfType<IPropertyValidationFilter>().FirstOrDefault(); 47.OfType<IPropertyValidationFilter>() 55var validationFilter = context.ParameterAttributes!.OfType<IPropertyValidationFilter>().FirstOrDefault();
ModelBinding\Metadata\SystemTextJsonValidationMetadataProvider.cs (1)
69=> attributes?.OfType<JsonPropertyNameAttribute>().FirstOrDefault()?.Name;
Routing\ActionEndpointFactory.cs (3)
388builder.Metadata.OfType<IEndpointNameMetadata>().LastOrDefault()?.EndpointName == null) 419!builder.Metadata.OfType<HttpMethodMetadata>().Any()) 424!builder.Metadata.OfType<AcceptsMetadata>().Any())
Microsoft.AspNetCore.Mvc.Core.Test (70)
ApplicationModels\ApiBehaviorApplicationModelProviderTest.cs (4)
76Assert.NotEmpty(actionModel.Filters.OfType<ModelStateInvalidFilterFactory>()); 77Assert.NotEmpty(actionModel.Filters.OfType<ClientErrorResultFilterFactory>()); 119Assert.NotEmpty(actionModel.Filters.OfType<ModelStateInvalidFilterFactory>()); 120Assert.NotEmpty(actionModel.Filters.OfType<ClientErrorResultFilterFactory>());
ApplicationModels\AuthorizationApplicationModelProviderTest.cs (1)
95var authorizeFilters = action.Filters.OfType<AuthorizeFilter>();
ApplicationModels\ClientErrorResultFilterConventionTest.cs (1)
21Assert.Single(action.Filters.OfType<ClientErrorResultFilterFactory>());
ApplicationModels\ControllerActionDescriptorProviderTests.cs (8)
311.OfType<ControllerActionDescriptor>() 325var httpMethodAttribute = Assert.Single(descriptor.EndpointMetadata.OfType<HttpMethodAttribute>()); 328var lastHttpMethodMetadata = descriptor.EndpointMetadata.OfType<IHttpMethodMetadata>().Last(); 546a => a.ActionConstraints.OfType<HttpMethodActionConstraint>().Single().HttpMethods.Single() == "PUT"); 553a => a.ActionConstraints.OfType<HttpMethodActionConstraint>().Single().HttpMethods.Single() == "POST"); 585a => a.ActionConstraints.OfType<HttpMethodActionConstraint>().Single().HttpMethods.Single() == "POST"); 592a => a.ActionConstraints.OfType<HttpMethodActionConstraint>().Single().HttpMethods.Single() == "PUT"); 647.OfType<HttpMethodActionConstraint>()
ApplicationModels\InvalidModelStateFilterConventionTest.cs (1)
21Assert.Single(action.Filters.OfType<ModelStateInvalidFilterFactory>());
ApplicationParts\ApplicationPartManagerTest.cs (2)
121foreach (var part in parts.OfType<ViewComponentsPart>()) 139foreach (var part in parts.OfType<ControllersPart>())
Infrastructure\ControllerActionInvokerProviderTest.cs (1)
55foreach (var filterAttribute in method.GetCustomAttributes().OfType<IFilterMetadata>())
ModelBinding\Metadata\DefaultModelMetadataProviderTest.cs (4)
296defaultPropertyMetadata.Attributes.Attributes.OfType<ModelAttribute>(), 305defaultPropertyMetadata.Attributes.Attributes.OfType<ModelAttribute>(), 380defaultPropertyMetadata.Attributes.Attributes.OfType<ModelAttribute>(), 389defaultPropertyMetadata.Attributes.Attributes.OfType<ModelAttribute>(),
ModelBinding\Metadata\ModelAttributesTest.cs (26)
22Assert.Single(attributes.Attributes.OfType<RequiredAttribute>()); 23Assert.Single(attributes.Attributes.OfType<StringLengthAttribute>()); 25Assert.Single(attributes.PropertyAttributes.OfType<RequiredAttribute>()); 26Assert.Single(attributes.PropertyAttributes.OfType<StringLengthAttribute>()); 40var rangeAttributes = attributes.Attributes.OfType<RangeAttribute>().ToArray(); 47Assert.Single(attributes.Attributes.OfType<FromHeaderAttribute>()); 49rangeAttributes = attributes.PropertyAttributes.OfType<RangeAttribute>().ToArray(); 56Assert.Single(attributes.PropertyAttributes.OfType<FromHeaderAttribute>()); 70Assert.Single(attributes.Attributes.OfType<RequiredAttribute>()); 71Assert.Single(attributes.Attributes.OfType<StringLengthAttribute>()); 73Assert.Single(attributes.PropertyAttributes.OfType<RequiredAttribute>()); 74Assert.Single(attributes.PropertyAttributes.OfType<StringLengthAttribute>()); 88Assert.Single(attributes.Attributes.OfType<RequiredAttribute>()); 89Assert.Single(attributes.Attributes.OfType<StringLengthAttribute>()); 92Assert.Single(attributes.PropertyAttributes.OfType<RequiredAttribute>()); 93Assert.Single(attributes.PropertyAttributes.OfType<StringLengthAttribute>()); 108Assert.Single(attributes.Attributes.OfType<RequiredAttribute>()); 109Assert.Single(attributes.Attributes.OfType<RangeAttribute>()); 111Assert.Single(attributes.PropertyAttributes.OfType<RequiredAttribute>()); 112Assert.Single(attributes.PropertyAttributes.OfType<RangeAttribute>()); 126Assert.Single(attributes.Attributes.OfType<RequiredAttribute>()); 127Assert.Single(attributes.Attributes.OfType<FromRouteAttribute>()); 129Assert.Single(attributes.PropertyAttributes.OfType<RequiredAttribute>()); 130Assert.Single(attributes.PropertyAttributes.OfType<FromRouteAttribute>()); 140Assert.Single(attributes.Attributes.OfType<ClassValidator>()); 142Assert.Single(attributes.TypeAttributes.OfType<ClassValidator>());
ModelBinding\Validation\ClientValidatorCacheTest.cs (10)
23var attribute1 = Assert.Single(validators1.OfType<RequiredAttributeAdapter>()).Attribute; 24var attribute2 = Assert.Single(validators1.OfType<StringLengthAttributeAdapter>()).Attribute; 50var validator1 = Assert.Single(validators1.OfType<RequiredAttributeAdapter>()); 51var validator2 = Assert.Single(validators1.OfType<StringLengthAttributeAdapter>()); 61Assert.Same(validator1, Assert.Single(validators2.OfType<RequiredAttributeAdapter>())); // cached 62Assert.NotSame(validator2, Assert.Single(validators2.OfType<StringLengthAttributeAdapter>())); // not cached 80var validator1 = Assert.Single(validators.OfType<RequiredAttributeAdapter>()); 81var validator2 = Assert.Single(validators.OfType<StringLengthAttributeAdapter>()); 100var validator1 = Assert.Single(validators.OfType<RequiredAttributeAdapter>()); 101var validator2 = Assert.Single(validators.OfType<StringLengthAttributeAdapter>());
Routing\ControllerActionEndpointDataSourceTest.cs (11)
91endpoints.OfType<RouteEndpoint>().Where(e => !SupportsLinkGeneration(e)).OrderBy(e => e.RoutePattern.RawText), 104endpoints.OfType<RouteEndpoint>().Where(e => SupportsLinkGeneration(e)).OrderBy(e => e.RoutePattern.RawText), 173endpoints.OfType<RouteEndpoint>().Where(e => !SupportsLinkGeneration(e)).OrderBy(e => e.RoutePattern.RawText), 188endpoints.OfType<RouteEndpoint>().Where(e => SupportsLinkGeneration(e)).OrderBy(e => e.RoutePattern.RawText), 260endpoints.OfType<RouteEndpoint>().Where(e => !SupportsLinkGeneration(e)).OrderBy(e => e.RoutePattern.RawText), 273endpoints.OfType<RouteEndpoint>().Where(e => SupportsLinkGeneration(e)).OrderBy(e => e.RoutePattern.RawText), 342endpoints.OfType<RouteEndpoint>().Where(e => !SupportsLinkGeneration(e)).OrderBy(e => e.RoutePattern.RawText), 357endpoints.OfType<RouteEndpoint>().Where(e => SupportsLinkGeneration(e)).OrderBy(e => e.RoutePattern.RawText), 436endpoints.OfType<RouteEndpoint>().Where(e => !SupportsLinkGeneration(e)).OrderBy(e => e.RoutePattern.RawText), 453endpoints.OfType<RouteEndpoint>().Where(e => SupportsLinkGeneration(e)).OrderBy(e => e.RoutePattern.RawText), 526endpoints.OfType<RouteEndpoint>().Where(e => SupportsLinkGeneration(e)).OrderBy(e => e.RoutePattern.RawText),
TestFeatureProvider.cs (1)
26foreach (var type in parts.OfType<IApplicationPartTypeProvider>().SelectMany(t => t.Types).Where(_filter))
Microsoft.AspNetCore.Mvc.Cors (8)
CorsApplicationModelProvider.cs (8)
42var isCorsEnabledGlobally = context.Result.Filters.OfType<ICorsAuthorizationFilter>().Any() || 43context.Result.Filters.OfType<CorsAuthorizationFilterFactory>().Any(); 47var enableCors = controllerModel.Attributes.OfType<IEnableCorsAttribute>().FirstOrDefault(); 53var disableCors = controllerModel.Attributes.OfType<IDisableCorsAttribute>().FirstOrDefault(); 59var corsOnController = enableCors != null || disableCors != null || controllerModel.Filters.OfType<ICorsAuthorizationFilter>().Any(); 63enableCors = actionModel.Attributes.OfType<IEnableCorsAttribute>().FirstOrDefault(); 69disableCors = actionModel.Attributes.OfType<IDisableCorsAttribute>().FirstOrDefault(); 75var corsOnAction = enableCors != null || disableCors != null || actionModel.Filters.OfType<ICorsAuthorizationFilter>().Any();
Microsoft.AspNetCore.Mvc.DataAnnotations (11)
DataAnnotationsMetadataProvider.cs (11)
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(); 378foreach (var attribute in attributes.OfType<ValidationAttribute>())
Microsoft.AspNetCore.Mvc.Formatters.Xml (1)
ModelBinding\DataMemberRequiredBindingMetadataProvider.cs (1)
34.OfType<DataMemberAttribute>()
Microsoft.AspNetCore.Mvc.IntegrationTests (4)
AuthorizeFilterIntegrationTest.cs (4)
37var authorizeData = action.Attributes.OfType<AuthorizeAttribute>(); 65var authorizeData = action.Attributes.OfType<AuthorizeAttribute>(); 96var authorizeData = action.Attributes.OfType<AuthorizeAttribute>(); 132var authorizeData = action.Attributes.OfType<AuthorizeAttribute>();
Microsoft.AspNetCore.Mvc.NewtonsoftJson (1)
NewtonsoftJsonValidationMetadataProvider.cs (1)
66=> attributes?.OfType<JsonPropertyAttribute>().FirstOrDefault()?.PropertyName;
Microsoft.AspNetCore.Mvc.Razor (4)
ApplicationParts\RazorCompiledItemFeatureProvider.cs (1)
18foreach (var provider in parts.OfType<IRazorCompiledItemProvider>())
DependencyInjection\MvcRazorMvcCoreBuilderExtensions.cs (2)
66if (!partManager.FeatureProviders.OfType<TagHelperFeatureProvider>().Any()) 71if (!partManager.FeatureProviders.OfType<RazorCompiledItemFeatureProvider>().Any())
RazorHotReload.cs (1)
29_razorCompiledItemFeatureProvider = applicationPartManager.FeatureProviders.OfType<RazorCompiledItemFeatureProvider>().FirstOrDefault();
Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation (2)
PageActionDescriptorChangeProvider.cs (1)
50var importFeatures = projectEngine.ProjectFeatures.OfType<IImportProjectFeature>().ToArray();
RuntimeViewCompiler.cs (1)
299var importFeature = _projectEngine.ProjectFeatures.OfType<IImportProjectFeature>().ToArray();
Microsoft.AspNetCore.Mvc.Razor.Test (1)
DependencyInjection\MvcRazorMvcCoreBuilderExtensionsTest.cs (1)
119foreach (var type in parts.OfType<IApplicationPartTypeProvider>().SelectMany(tp => tp.Types))
Microsoft.AspNetCore.Mvc.RazorPages (10)
ApplicationModels\AuthorizationPageApplicationModelProvider.cs (2)
39var authorizeData = pageModel.HandlerTypeAttributes.OfType<IAuthorizeData>().ToArray(); 44foreach (var _ in pageModel.HandlerTypeAttributes.OfType<IAllowAnonymous>())
ApplicationModels\AutoValidateAntiforgeryPageApplicationModelProvider.cs (1)
29if (!pageApplicationModel.Filters.OfType<IAntiforgeryPolicy>().Any())
ApplicationModels\CompiledPageRouteModelProvider.cs (1)
125.OfType<RazorCompiledItemMetadataAttribute>()
ApplicationModels\ResponseCacheFilterApplicationModelProvider.cs (1)
32var responseCacheAttributes = pageModel.HandlerTypeAttributes.OfType<ResponseCacheAttribute>();
Builder\RazorPagesEndpointRouteBuilderExtensions.cs (1)
376var dataSource = endpoints.DataSources.OfType<PageActionEndpointDataSource>().FirstOrDefault();
Infrastructure\CompiledPageActionDescriptorFactory.cs (2)
100conventions.OfType<TConvention>(), 101attributes.OfType<TConvention>());
Infrastructure\PageActionDescriptorProvider.cs (2)
37.OfType<IPageRouteModelConvention>() 135var pageRouteMetadata = selectorModel.EndpointMetadata.OfType<PageRouteMetadata>().SingleOrDefault();
Microsoft.AspNetCore.Mvc.RazorPages.Test (6)
DependencyInjection\PageConventionCollectionExtensionsTest.cs (2)
999foreach (var convention in conventions.OfType<IPageRouteModelConvention>()) 1009foreach (var convention in conventions.OfType<IPageApplicationModelConvention>())
Infrastructure\PageActionEndpointDataSourceTest.cs (4)
84endpoints.OfType<RouteEndpoint>().OrderBy(e => e.RoutePattern.RawText), 154endpoints.OfType<RouteEndpoint>().OrderBy(e => e.RoutePattern.RawText), 204endpoints.OfType<RouteEndpoint>().OrderBy(e => e.RoutePattern.RawText), 252endpoints.OfType<RouteEndpoint>().OrderBy(e => e.RoutePattern.RawText),
Microsoft.AspNetCore.Mvc.Test (4)
MvcServiceCollectionExtensionsTest.cs (4)
316Assert.Single(manager.ApplicationParts.OfType<AssemblyPart>(), p => p.Assembly == mvcRazorAssembly); 317Assert.Single(manager.ApplicationParts.OfType<AssemblyPart>(), p => p.Assembly == mvcTagHelpersAssembly); 344Assert.Single(manager.ApplicationParts.OfType<AssemblyPart>(), p => p.Assembly == mvcRazorAssembly); 345Assert.Single(manager.ApplicationParts.OfType<AssemblyPart>(), p => p.Assembly == mvcTagHelpersAssembly);
Microsoft.AspNetCore.Mvc.ViewFeatures (5)
Builder\ControllerActionEndpointConventionBuilderResourceCollectionExtensions.cs (1)
45if (endpointBuilder.Metadata.OfType<ApiControllerAttribute>().Any())
DependencyInjection\MvcViewFeaturesMvcCoreBuilderExtensions.cs (1)
64if (!manager.FeatureProviders.OfType<ViewComponentFeatureProvider>().Any())
Filters\AntiforgeryApplicationModelProvider.cs (2)
54var antiforgeryMetadata = attributes.OfType<IAntiforgeryMetadata>(); 55var antiforgeryAttribute = filters.OfType<ValidateAntiForgeryTokenAttribute>().FirstOrDefault();
ViewComponents\ViewComponentFeatureProvider.cs (1)
20foreach (var type in parts.OfType<IApplicationPartTypeProvider>().SelectMany(p => p.Types))
Microsoft.AspNetCore.Mvc.ViewFeatures.Test (4)
DependencyInjection\MvcViewFeaturesMvcBuilderExtensionsTest.cs (1)
181foreach (var type in parts.OfType<IApplicationPartTypeProvider>().SelectMany(p => p.Types))
ViewComponents\DefaultViewComponentDescriptorProviderTest.cs (1)
180foreach (var type in parts.OfType<IApplicationPartTypeProvider>().SelectMany(p => p.Types))
ViewComponents\DefaultViewComponentHelperTest.cs (1)
201foreach (var type in parts.OfType<IApplicationPartTypeProvider>().SelectMany(p => p.Types))
ViewComponents\DefaultViewComponentSelectorTest.cs (1)
262foreach (var type in parts.OfType<IApplicationPartTypeProvider>().SelectMany(p => p.Types))
Microsoft.AspNetCore.OpenApi (22)
Extensions\JsonNodeSchemaExtensions.cs (2)
308var attributes = validations.OfType<ValidationAttribute>(); 322if (parameterInfo.GetCustomAttributes().OfType<ValidationAttribute>() is { } validationAttributes)
Extensions\OpenApiEndpointConventionBuilderExtensions.cs (1)
98var methodInfo = metadata.OfType<MethodInfo>().SingleOrDefault();
Services\OpenApiDocumentService.cs (8)
298=> description.ActionDescriptor.EndpointMetadata.OfType<IEndpointSummaryMetadata>().LastOrDefault()?.Summary; 301=> description.ActionDescriptor.EndpointMetadata.OfType<IEndpointDescriptionMetadata>().LastOrDefault()?.Description; 305description.ActionDescriptor.EndpointMetadata.OfType<IEndpointNameMetadata>().LastOrDefault()?.EndpointName; 310if (actionDescriptor.EndpointMetadata?.OfType<ITagsMetadata>().LastOrDefault() is { } tagsMetadata) 381.OfType<ProducesAttribute>() 456parameterInfo.GetCustomAttributes().OfType<DescriptionAttribute>().LastOrDefault() is { } descriptionAttribute ? 552.OfType<IParameterBindingMetadata>() 683.OfType<IParameterBindingMetadata>()
Services\OpenApiGenerator.cs (7)
297var hasFormAttribute = requestBodyParameter.GetCustomAttributes().OfType<IFromFormMetadata>().FirstOrDefault() != null; 310var allowEmpty = requestBodyParameter.GetCustomAttributes().OfType<IFromBodyMetadata>().SingleOrDefault()?.AllowEmpty ?? false; 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)
Services\Schemas\OpenApiSchemaService.cs (3)
111if (attributeProvider.GetCustomAttributes(inherit: false).OfType<ValidationAttribute>() is { } validationAttributes) 115if (attributeProvider.GetCustomAttributes(inherit: false).OfType<DefaultValueAttribute>().LastOrDefault() is DefaultValueAttribute defaultValueAttribute) 119if (attributeProvider.GetCustomAttributes(inherit: false).OfType<DescriptionAttribute>().LastOrDefault() is DescriptionAttribute descriptionAttribute)
src\Shared\PropertyAsParameterInfo.cs (1)
205NullabilityState.Unknown => !_underlyingProperty.GetCustomAttributes().OfType<RequiredMemberAttribute>().Any(),
Microsoft.AspNetCore.OpenApi.Tests (3)
Services\OpenApiDocumentServiceTestsBase.cs (3)
116var endpointDataSource = builder.DataSources.OfType<EndpointDataSource>().Single(); 200var bindingInfo = BindingInfo.GetBindingInfo(property.GetCustomAttributes().OfType<object>()); 244BindingInfo = BindingInfo.GetBindingInfo(parameter.GetCustomAttributes().OfType<object>()),
Microsoft.AspNetCore.Razor.Runtime (1)
Hosting\RazorCompiledItemExtensions.cs (1)
22return item.Metadata.OfType<IRazorSourceChecksumMetadata>().ToArray();
Microsoft.AspNetCore.Routing (3)
DefaultLinkGenerator.cs (1)
185var endpoints = addressingScheme.FindEndpoints(address).OfType<RouteEndpoint>().ToList();
DefaultLinkParser.cs (1)
73var endpoints = addressingScheme.FindEndpoints(address).OfType<RouteEndpoint>().ToList();
Matching\EndpointMetadataComparer.cs (1)
39.OfType<IEndpointComparerPolicy>()
Microsoft.AspNetCore.Routing.Tests (9)
Builder\GroupTest.cs (1)
346Assert.Collection(dataSource.Endpoints.OfType<RouteEndpoint>(),
Builder\RouteHandlerEndpointRouteBuilderExtensionsTest.cs (1)
80var metadataArray = endpoint.Metadata.OfType<IHttpMethodMetadata>().ToArray();
Builder\RoutingEndpointConventionBuilderExtensionsTest.cs (2)
191var metadata = endpoint.Metadata.OfType<string>().ToList(); 222var metadata = endpoint.Metadata.OfType<string>().ToArray();
CompositeEndpointDataSourceTest.cs (4)
335if (b.Metadata.OfType<string>().SingleOrDefault() == "initial-metadata") 391if (b.Metadata.OfType<string>().SingleOrDefault() == "initial-metadata") 446if (b.Metadata.OfType<string>().SingleOrDefault() == "initial-metadata") 453if (b.Metadata.OfType<IEndpointNameMetadata>().SingleOrDefault() is not null)
Matching\DfaMatcherBuilderTest.cs (1)
2915var comparer = new EndpointComparer(policies.OrderBy(p => p.Order).OfType<IEndpointComparerPolicy>().ToArray());
Microsoft.AspNetCore.Server.IISIntegration.Tests (1)
IISExtensionTests.cs (1)
40.OfType<IISSetupFilter>();
Microsoft.AspNetCore.Server.Kestrel.Core (10)
CertificateLoader.cs (3)
43.OfType<X509Certificate2>() 91foreach (var extension in certificate.Extensions.OfType<X509EnhancedKeyUsageExtension>()) 110=> certificate.Extensions.OfType<X509SubjectAlternativeNameExtension>().Any();
src\Shared\CertificateGeneration\CertificateManager.cs (6)
71foreach (var extension in certificate.Extensions.OfType<X509Extension>()) 147certificate.Extensions.OfType<X509Extension>() 152var byteArray = c.Extensions.OfType<X509Extension>() 178certificates.AddRange(store.Certificates.OfType<X509Certificate2>()); 838.OfType<X509Certificate2>() 889foreach (var candidate in certificatesWithSubjectName.OfType<X509Certificate2>())
src\Shared\CertificateGeneration\MacOSCertificateManager.cs (1)
299var hashes = matches.OfType<Match>().Select(m => m.Groups[1].Value).ToList();
Microsoft.AspNetCore.Server.Kestrel.Core.Tests (3)
ConnectionDispatcherTests.cs (1)
42var scopeObjects = testLogger.Scopes.OfType<IReadOnlyList<KeyValuePair<string, object>>>().ToList();
src\Servers\Kestrel\shared\test\CertificateAuthority.cs (2)
763_cert.Extensions.OfType<X509SubjectKeyIdentifierExtension>().SingleOrDefault(); 870intermedCert.Extensions.OfType<X509SubjectKeyIdentifierExtension>().Single();
Microsoft.AspNetCore.StaticAssets (2)
Development\StaticAssetDevelopmentRuntimeHandler.cs (2)
32var asset = builder.Metadata.OfType<StaticAssetDescriptor>().Single(); 97var assetDescriptor = endpoint.Metadata.OfType<StaticAssetDescriptor>().Single();
Microsoft.AspNetCore.Testing.Tests (1)
FakeCertificateFactoryTests.cs (1)
23Assert.False(certificate.Extensions.OfType<X509EnhancedKeyUsageExtension>().Single().Critical);
Microsoft.AspNetCore.Tests (5)
WebApplicationTests.cs (4)
1335Assert.Single(((IConfigurationRoot)app.Configuration).Providers.OfType<RandomConfigurationProvider>()); 1637args.Payload.OfType<string>().Any(p => p.Contains(guid))); 1657args.Payload.OfType<string>().Any(p => p.Contains(guid))); 2391Assert.Single(((IConfigurationRoot)app.Configuration).Providers.OfType<RandomConfigurationProvider>());
WebHostTests.cs (1)
111args.Payload.OfType<string>().Any(p => p.Contains("Request starting")));
Microsoft.Build (8)
BackEnd\Components\Logging\LoggingService.cs (4)
526get => _includeEvaluationMetaprojects ??= _eventSinkDictionary.Values.OfType<EventSourceSink>().Any(sink => sink.IncludeEvaluationMetaprojects); 535get => _includeEvaluationProfile ??= _eventSinkDictionary.Values.OfType<EventSourceSink>().Any(sink => sink.IncludeEvaluationProfiles); 544get => _includeTaskInputs ??= _eventSinkDictionary.Values.OfType<EventSourceSink>().Any(sink => sink.IncludeTaskInputs); 577var sinks = _eventSinkDictionary.Values.OfType<EventSourceSink>().ToList();
Construction\Solution\ProjectInSolution.cs (1)
556return mainProjectElement.Attributes.OfType<XmlAttribute>().Any(a =>
Evaluation\LazyItemEvaluator.RemoveOperation.cs (1)
104var globs = _itemSpec.Fragments.OfType<GlobFragment>().Select(g => g.TextFragment);
Evaluation\LazyItemEvaluator.UpdateOperation.cs (1)
118var itemReferenceFragments = _itemSpec.Fragments.OfType<ItemSpec<P, I>.ItemExpressionFragment>().ToArray();
Instance\ProjectTargetInstance.cs (1)
335return new ReadOnlyCollection<ProjectTaskInstance>(Children.OfType<ProjectTaskInstance>());
Microsoft.Build.Engine.OM.UnitTests (26)
Definition\ProjectItem_Tests.cs (2)
2228Assert.Equal(2, project.Xml.AllChildren.OfType<ProjectItemElement>().Count()); 2288Assert.Equal(2, project.Xml.AllChildren.OfType<ProjectItemElement>().Count());
ObjectModelRemoting\LinkedConstructionReadOnly_Tests.cs (22)
92var realExtensionsList = preReal.ChildrenReversed.OfType<ProjectExtensionsElement>().ToList(); 93var viewExtensionsList = preView.ChildrenReversed.OfType<ProjectExtensionsElement>().ToList(); 218var realCollection = preReal.AllChildren.OfType<ProjectOtherwiseElement>().ToList(); 219var viewCollection = preView.AllChildren.OfType<ProjectOtherwiseElement>().ToList(); 231var realCollection = preReal.AllChildren.OfType<ProjectWhenElement>().ToList(); 232var viewCollection = preView.AllChildren.OfType<ProjectWhenElement>().ToList(); 244var realCollection = preReal.AllChildren.OfType<ProjectSdkElement>().ToList(); 245var viewCollection = preView.AllChildren.OfType<ProjectSdkElement>().ToList(); 270var realCollection = preReal.AllChildren.OfType<ProjectTaskElement>().ToList(); 271var viewCollection = preView.AllChildren.OfType<ProjectTaskElement>().ToList(); 284var realCollection = preReal.AllChildren.OfType<ProjectUsingTaskElement>().ToList(); 285var viewCollection = preView.AllChildren.OfType<ProjectUsingTaskElement>().ToList(); 297var realCollection = preReal.AllChildren.OfType<ProjectUsingTaskBodyElement>().ToList(); 298var viewCollection = preView.AllChildren.OfType<ProjectUsingTaskBodyElement>().ToList(); 310var realCollection = preReal.AllChildren.OfType<UsingTaskParameterGroupElement>().ToList(); 311var viewCollection = preView.AllChildren.OfType<UsingTaskParameterGroupElement>().ToList(); 323var realCollection = preReal.AllChildren.OfType<ProjectUsingTaskParameterElement>().ToList(); 324var viewCollection = preView.AllChildren.OfType<ProjectUsingTaskParameterElement>().ToList(); 336var realCollection = preReal.AllChildren.OfType<ProjectOnErrorElement>().ToList(); 337var viewCollection = preView.AllChildren.OfType<ProjectOnErrorElement>().ToList(); 349var realCollection = preReal.AllChildren.OfType<ProjectOutputElement>().ToList(); 350var viewCollection = preView.AllChildren.OfType<ProjectOutputElement>().ToList();
ObjectModelRemoting\LinkedSpecialCasesScenarios.cs (2)
105var existingItemGroupList = sourceProject.AllChildren.OfType<ProjectItemGroupElement>().Where((ig) => ig.Label == "Group1").ToList(); 157var existingItemGroupList = sourceProject.AllChildren.OfType<ProjectItemGroupElement>().Where((ig) => ig.Label == "Group1").ToList();
Microsoft.Build.Engine.UnitTests (50)
BackEnd\BuildManager_Logging_Tests.cs (2)
130allEvents.OfType<T>().ShouldHaveSingleItem(); 137allEvents.OfType<T>().ShouldBeEmpty();
BackEnd\BuildManager_Tests.cs (5)
209_logger.AllBuildEvents.OfType<ProjectStartedEventArgs>() 212_logger.AllBuildEvents.OfType<ProjectEvaluationFinishedEventArgs>() 216_logger.AllBuildEvents.OfType<ProjectEvaluationStartedEventArgs>() 219_logger.AllBuildEvents.OfType<ProjectEvaluationFinishedEventArgs>() 3967Assert.True(_logger.AllBuildEvents.OfType<ProjectEvaluationStartedEventArgs>().GroupBy(args => args.BuildEventContext.EvaluationId).All(g => g.Count() == 1));
BackEnd\TranslationHelpers.cs (3)
172.OfType<DictionaryEntry>() 182.OfType<DictionaryEntry>() 191.OfType<object>()
BuildEventArgsSerialization_Tests.cs (2)
236e => ToString(e.TargetOutputs.OfType<ITaskItem>())); 1203return i.ItemSpec + string.Join(";", i.CloneCustomMetadata().Keys.OfType<string>().Select(k => i.GetMetadata(k)));
Evaluation\EvaluationLogging_Tests.cs (1)
164foreach (var e in logger.AllBuildEvents.OfType<ProjectEvaluationFinishedEventArgs>())
Evaluation\Evaluator_Tests.cs (31)
4715.OfType<UninitializedPropertyReadEventArgs>() 4720.OfType<EnvironmentVariableReadEventArgs>() 4727.OfType<PropertyReassignmentEventArgs>() 4733.OfType<PropertyInitialValueSetEventArgs>() 4747.OfType<UninitializedPropertyReadEventArgs>() 4752.OfType<EnvironmentVariableReadEventArgs>() 4759.OfType<PropertyReassignmentEventArgs>() 4764.OfType<PropertyInitialValueSetEventArgs>() 4778.OfType<UninitializedPropertyReadEventArgs>() 4783.OfType<EnvironmentVariableReadEventArgs>() 4790.OfType<PropertyInitialValueSetEventArgs>() 4795.OfType<PropertyReassignmentEventArgs>() 4810.OfType<UninitializedPropertyReadEventArgs>() 4815.OfType<EnvironmentVariableReadEventArgs>() 4822.OfType<PropertyReassignmentEventArgs>() 4827.OfType<PropertyInitialValueSetEventArgs>() 4862.OfType<UninitializedPropertyReadEventArgs>() 4867.OfType<EnvironmentVariableReadEventArgs>() 4872.OfType<EnvironmentVariableReadEventArgs>() 4877.OfType<PropertyReassignmentEventArgs>() 4882.OfType<PropertyInitialValueSetEventArgs>() 4896.OfType<UninitializedPropertyReadEventArgs>() 4901.OfType<EnvironmentVariableReadEventArgs>() 4908.OfType<PropertyReassignmentEventArgs>() 4913.OfType<PropertyInitialValueSetEventArgs>() 4927.OfType<UninitializedPropertyReadEventArgs>() 4932.OfType<EnvironmentVariableReadEventArgs>() 4937.OfType<EnvironmentVariableReadEventArgs>() 4942.OfType<PropertyReassignmentEventArgs>() 4947.OfType<PropertyInitialValueSetEventArgs>() 5071.OfType<PropertyReassignmentEventArgs>()
Evaluation\ProjectSdkImplicitImport_Tests.cs (1)
488ProjectImportedEventArgs[] events = logger.BuildMessageEvents.OfType<ProjectImportedEventArgs>().ToArray();
Graph\IsolateProjects_Tests.cs (5)
238logger.AllBuildEvents.OfType<ProjectStartedEventArgs>().Count().ShouldBe(3); 260logger.AllBuildEvents.OfType<ProjectStartedEventArgs>().Count().ShouldBe(3); 355rootLogger.AllBuildEvents.OfType<ProjectStartedEventArgs>().Count().ShouldBe(2); 356declaredReferenceLogger.AllBuildEvents.OfType<ProjectStartedEventArgs>().Count().ShouldBe(2); 387logger.AllBuildEvents.OfType<ProjectStartedEventArgs>().Count().ShouldBe(2);
Microsoft.Build.Tasks.CodeAnalysis.UnitTests (1)
TestUtilities\TaskTestUtil.cs (1)
41var message = engine.BuildMessages.OfType<TaskCommandLineEventArgs>().Single();
Microsoft.Build.Tasks.Core (5)
AssemblyDependency\GenerateBindingRedirects.cs (5)
75.OfType<XElement>() 198.OfType<XElement>() 205.OfType<XElement>() 212.OfType<XElement>() 225.OfType<XElement>()
Microsoft.Build.UnitTests.Shared (2)
EngineTestEnvironment.cs (2)
212mockLogger = expectedLoggers.OfType<MockLogger>().First(); 213var binaryLogger = expectedLoggers.OfType<BinaryLogger>().FirstOrDefault();
Microsoft.Build.Utilities.Core (1)
SDKManifest.cs (1)
370foreach (XmlAttribute attribute in attributes.OfType<XmlAttribute>())
Microsoft.Cci.Extensions (18)
Differs\IDifferences.cs (1)
21return !differences.OfType<IncompatibleDifference>().Any();
Experimental\APIEmitter.cs (2)
35IEnumerable<INamespaceDefinition> namespaces = @namespace.Members.OfType<INamespaceDefinition>(); 36IEnumerable<INamespaceTypeDefinition> types = @namespace.Members.OfType<INamespaceTypeDefinition>();
Extensions\CSharp\CSharpCciExtensions.cs (5)
506foreach (IFieldDefinition baseField in baseClass.GetMembersNamed(field.Name, false).OfType<IFieldDefinition>()) 530foreach (IEventDefinition baseEvent in baseClass.GetMembersNamed(evnt.Name, false).OfType<IEventDefinition>()) 556foreach (IPropertyDefinition baseProperty in baseClass.GetMembersNamed(property.Name, false).OfType<IPropertyDefinition>()) 583foreach (IMethodDefinition baseMethod in baseClass.GetMembersNamed(method.Name, false).OfType<IMethodDefinition>()) 621foreach (ITypeDefinition baseType in baseClass.GetMembersNamed(nestedType.Name, ignoreCase: false).OfType<ITypeDefinition>())
Extensions\TypeExtensions.cs (2)
301foreach (var nestedNs in ns.Members.OfType<INamespaceDefinition>()) 330types = ns.Members.OfType<INamespaceTypeDefinition>();
Filters\ExcludeCompilerGeneratedCciFilter.cs (1)
65foreach (var arg in attribute.Arguments.OfType<IMetadataTypeOf>())
Filters\InternalsAndPublicCciFilter.cs (1)
101foreach (var arg in attribute.Arguments.OfType<IMetadataTypeOf>())
Filters\PublicAndProtectedFilter.cs (1)
19return ns.Members.OfType<ITypeDefinition>().Any(Include);
Filters\PublicOnlyCciFilter.cs (1)
83foreach(var arg in attribute.Arguments.OfType<IMetadataTypeOf>())
HostEnvironment.cs (2)
228IAssembly[] loadedAssemblies = this.LoadedUnits.OfType<IAssembly>().ToArray(); 313foreach (var loadedAssembly in this.LoadedUnits.OfType<IAssembly>())
Mappings\AssemblyMapping.cs (1)
78foreach (IAliasForType alias in assembly.ExportedTypes.OfType<IAliasForType>())
Writers\CSharp\CSDeclarationWriter.Attributes.cs (1)
393var arg = c.Arguments.OfType<IMetadataConstant>().FirstOrDefault();
Microsoft.CodeAnalysis (5)
DocumentationCommentId.cs (2)
826containers.AddRange(results.OfType<INamespaceOrTypeSymbol>()); 918results.AddRange(contexts.OfType<ITypeSymbol>());
Operations\ControlFlowGraphBuilder.cs (1)
1884foreach (IFlowCaptureReferenceOperation reference in operation.DescendantsAndSelf().OfType<IFlowCaptureReferenceOperation>())
Syntax\SyntaxNodeExtensions_Tracking.cs (2)
84return GetCurrentNodeFromTrueRoots(GetRoot(root), node).OfType<TNode>(); 117foreach (var newNode in GetCurrentNodeFromTrueRoots(trueRoot, node).OfType<TNode>())
Microsoft.CodeAnalysis.CodeStyle (23)
src\Analyzers\Core\Analyzers\MatchFolderAndNamespace\AbstractMatchFolderAndNamespaceDiagnosticAnalyzer.cs (2)
98if (namespaceDeclaration.Ancestors().OfType<TNamespaceSyntax>().Any()) 106.OfType<TNamespaceSyntax>().Any();
src\Analyzers\Core\Analyzers\SimplifyInterpolation\AbstractSimplifyInterpolationHelpers.cs (1)
160var interpolatedStringOperation = AncestorsAndSelf(operation).OfType<IInterpolatedStringOperation>().FirstOrDefault();
src\Analyzers\Core\Analyzers\UseAutoProperty\AbstractUseAutoPropertyAnalyzer.cs (1)
237foreach (var identifierName in codeBlock.DescendantNodesAndSelf().OfType<TIdentifierName>())
src\Analyzers\Core\Analyzers\UseCollectionInitializer\UpdateExpressionState.cs (1)
110foreach (var subExpression in expression.DescendantNodesAndSelf().OfType<TExpressionSyntax>())
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\ICompilationExtensions.cs (1)
27foreach (var reference in compilation.References.OfType<CompilationReference>())
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\ISymbolExtensions.cs (4)
722if (!members.OfType<IPropertySymbol>().Any(p => p.Name == WellKnownMemberNames.CurrentPropertyName && p.GetMethod != null)) 728if (!members.OfType<IMethodSymbol>().Any(x => 762if (!members.OfType<IPropertySymbol>().Any(p => p.Name == WellKnownMemberNames.CurrentPropertyName && p.GetMethod != null)) 771if (!members.OfType<IMethodSymbol>().Any(x => x.Name == WellKnownMemberNames.MoveNextAsyncMethodName))
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\ITypeSymbolExtensions.cs (1)
410.OfType<IMethodSymbol>()
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\SyntaxNodeExtensions.cs (1)
328=> node.GetAnnotatedNodesAndTokens(syntaxAnnotation).Select(n => n.AsNode()).OfType<T>();
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\SyntaxTokenExtensions.cs (1)
28? token.Parent.AncestorsAndSelf().OfType<T>()
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\SyntaxFacts\AbstractDocumentationCommentService.cs (1)
66documentationComment.ChildNodes().OfType<TXmlElementSyntax>()
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\AnnotationTable.cs (8)
124=> this.GetAnnotations(node).OfType<TSpecificAnnotation>(); 127=> this.GetAnnotations(token).OfType<TSpecificAnnotation>(); 130=> this.GetAnnotations(trivia).OfType<TSpecificAnnotation>(); 133=> this.GetAnnotations(nodeOrToken).OfType<TSpecificAnnotation>(); 148=> this.GetAnnotations(node).OfType<TSpecificAnnotation>().Any(); 151=> this.GetAnnotations(token).OfType<TSpecificAnnotation>().Any(); 154=> this.GetAnnotations(trivia).OfType<TSpecificAnnotation>().Any(); 157=> this.GetAnnotations(nodeOrToken).OfType<TSpecificAnnotation>().Any();
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\EnumValueUtilities.cs (1)
26.OfType<IComparable>()
Microsoft.CodeAnalysis.CodeStyle.Fixes (11)
src\Analyzers\Core\CodeFixes\AddParameter\AddParameterService.cs (1)
222.OfType<IMethodSymbol>()
src\Analyzers\Core\CodeFixes\DocumentationComments\AbstractAddDocCommentNodesCodeFixProvider.cs (2)
127var nodes = docComment.ChildNodes().OfType<TXmlElementSyntax>() 136.OfType<TXmlElementSyntax>()
src\Analyzers\Core\CodeFixes\RemoveAsyncModifier\AbstractRemoveAsyncModifierCodeFixProvider.cs (1)
192var returns = node.DescendantNodes(n => n == node || !IsAsyncSupportingFunctionSyntax(n)).OfType<TReturnStatementSyntax>();
src\Analyzers\Core\CodeFixes\RemoveUnusedParametersAndValues\AbstractRemoveUnusedValuesCodeFixProvider.cs (1)
633foreach (var localDeclarationStatement in containingMemberDeclaration.DescendantNodes().OfType<TLocalDeclarationStatementSyntax>())
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\AbstractCodeGenerationService.cs (1)
376var field = members.OfType<IFieldSymbol>().FirstOrDefault();
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeRefactorings\AbstractRefactoringHelpersService.cs (1)
358var nonHiddenExtractedSelectedNodes = ExtractNodesSimple(selectionNode, syntaxFacts).OfType<TSyntaxNode>().Where(n => !n.OverlapsHiddenPosition(cancellationToken));
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\LanguageServices\AddImports\AbstractAddImportsService.cs (4)
145var externAliases = filteredImports.OfType<TExternSyntax>().ToArray(); 146var usingDirectives = filteredImports.OfType<TUsingOrAliasSyntax>().Where(IsSimpleUsing).ToArray(); 147var staticUsingDirectives = filteredImports.OfType<TUsingOrAliasSyntax>().Where(IsStaticUsing).ToArray(); 148var aliasDirectives = filteredImports.OfType<TUsingOrAliasSyntax>().Where(IsAlias).ToArray();
Microsoft.CodeAnalysis.CSharp (10)
Binder\Binder_Statements.cs (1)
3876containerNode = containingType.DeclaringSyntaxReferences.Select(r => r.GetSyntax()).OfType<TypeDeclarationSyntax>().First();
Compilation\CSharpCompilation.cs (1)
2133symbols: viableEntryPoints.OfType<Symbol>().AsImmutable(),
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();
Compiler\MethodCompiler.cs (1)
2066).OfType<IdentifierNameSyntax>().Where(
Symbols\Source\SourceLocalSymbol.cs (1)
175Contains(nodeToBind.Ancestors().OfType<StatementSyntax>().First().Kind()) ||
Microsoft.CodeAnalysis.CSharp.CodeStyle (24)
src\Analyzers\CSharp\Analyzers\ConvertProgram\ConvertProgramAnalysis_ProgramMain.cs (2)
63return root.Members.OfType<GlobalStatementSyntax>().First().GetFirstToken().GetLocation(); 72TextSpan.FromBounds(start, root.Members.OfType<GlobalStatementSyntax>().Last().FullSpan.End));
src\Analyzers\CSharp\Analyzers\ConvertProgram\ConvertToTopLevelStatementsDiagnosticAnalyzer.cs (1)
66var methodDeclarations = root.DescendantNodes(n => n is CompilationUnitSyntax or BaseNamespaceDeclarationSyntax or ClassDeclarationSyntax).OfType<MethodDeclarationSyntax>();
src\Analyzers\CSharp\Analyzers\InlineDeclaration\CSharpInlineDeclarationDiagnosticAnalyzer.cs (1)
273return compilationUnit.Members.OfType<GlobalStatementSyntax>().Last().Statement;
src\Analyzers\CSharp\Analyzers\NewLines\EmbeddedStatementPlacement\EmbeddedStatementPlacementDiagnosticAnalyzer.cs (1)
113if (parent.DescendantNodes().OfType<StatementSyntax>().Count() <= 1)
src\Analyzers\CSharp\Analyzers\RemoveUnusedMembers\CSharpRemoveUnusedMembersDiagnosticAnalyzer.cs (1)
30.OfType<TypeDeclarationSyntax>();
src\Analyzers\CSharp\Analyzers\UseAutoProperty\CSharpUseAutoPropertyAnalyzer.cs (4)
72foreach (var argument in codeBlock.DescendantNodesAndSelf().OfType<ArgumentSyntax>()) 86foreach (var refExpression in codeBlock.DescendantNodesAndSelf().OfType<RefExpressionSyntax>()) 91foreach (var addressOfExpression in codeBlock.DescendantNodesAndSelf().OfType<PrefixUnaryExpressionSyntax>()) 97foreach (var memberAccess in codeBlock.DescendantNodesAndSelf().OfType<MemberAccessExpressionSyntax>())
src\Analyzers\CSharp\Analyzers\UseCollectionExpression\CSharpUseCollectionExpressionForBuilderDiagnosticAnalyzer.cs (1)
214foreach (var identifierName in statement.DescendantNodesAndSelf().OfType<IdentifierNameSyntax>())
src\Analyzers\CSharp\Analyzers\UseCollectionExpression\UseCollectionExpressionHelpers.cs (2)
552foreach (var identifier in containingBlock.DescendantNodes().OfType<IdentifierNameSyntax>()) 831if (assignmentExpression.Right.DescendantNodesAndSelf().OfType<IdentifierNameSyntax>().Any(
src\Analyzers\CSharp\Analyzers\UseDeconstruction\CSharpUseDeconstructionDiagnosticAnalyzer.cs (1)
252foreach (var identifierName in searchScope.DescendantNodes().OfType<IdentifierNameSyntax>())
src\Analyzers\CSharp\Analyzers\UsePatternMatching\CSharpAsAndNullCheckDiagnosticAnalyzer.Analyzer.cs (1)
269if (_declarator.DescendantNodesAndSelf().OfType<ExpressionSyntax>().Any(
src\Analyzers\CSharp\Analyzers\UseUnboundGenericTypeInNameOf\CSharpUseUnboundGenericTypeInNameOfDiagnosticAnalyzer.cs (1)
68foreach (var typeArgumentList in invocation.DescendantNodesAndSelf().OfType<TypeArgumentListSyntax>())
src\Analyzers\CSharp\Analyzers\UseUtf8StringLiteral\UseUtf8StringLiteralDiagnosticAnalyzer.cs (1)
82if (arrayCreationOperation.Syntax.Ancestors().OfType<AttributeSyntax>().Any())
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Rules\ElasticTriviaFormattingRule.cs (1)
121if (previousToken.Parent.Ancestors().OfType<TypeParameterConstraintClauseSyntax>().Any())
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Services\SemanticFacts\CSharpSemanticFacts.cs (3)
95var enumDecl = namedTypeSymbol.DeclaringSyntaxReferences.Select(r => r.GetSyntax()).OfType<EnumDeclarationSyntax>().FirstOrDefault(); 140AppendAliasNames(root.Members.OfType<BaseNamespaceDeclarationSyntax>(), builder, cancellationToken); 165AppendAliasNames(@namespace.Members.OfType<BaseNamespaceDeclarationSyntax>(), builder, cancellationToken);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Services\SyntaxFacts\CSharpBlockFacts.cs (1)
43CompilationUnitSyntax compilationUnit => compilationUnit.Members.OfType<GlobalStatementSyntax>().SelectAsArray(globalStatement => globalStatement.Statement),
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Utilities\SpeculationAnalyzer.cs (2)
255var originalIdentifierNodes = originalLambdaBody.DescendantNodes().OfType<IdentifierNameSyntax>().Where(node => paramNames.Contains(node.Identifier.ValueText)); 261var replacedIdentifierNodes = replacedLambdaBody.DescendantNodes().OfType<IdentifierNameSyntax>().Where(node => paramNames.Contains(node.Identifier.ValueText));
Microsoft.CodeAnalysis.CSharp.CodeStyle.Fixes (25)
src\Analyzers\CSharp\CodeFixes\ConvertToRecord\ConvertToRecordEngine.cs (3)
56.OfType<PropertyDeclarationSyntax>() 140foreach (var constructor in typeDeclaration.Members.OfType<ConstructorDeclarationSyntax>()) 219foreach (var method in typeDeclaration.Members.OfType<MethodDeclarationSyntax>())
src\Analyzers\CSharp\CodeFixes\DocumentationComments\CSharpAddDocCommentNodesCodeFixProvider.cs (2)
35=> node.StartTag.Attributes.OfType<XmlNameAttributeSyntax>().ToList(); 47var descendentXmlElements = nodeStructure.DescendantNodes().OfType<XmlElementSyntax>();
src\Analyzers\CSharp\CodeFixes\InlineDeclaration\CSharpInlineDeclarationCodeFixProvider.cs (1)
249return compilationUnit.Members.OfType<GlobalStatementSyntax>().Select(g => g.Statement).ToImmutableArray();
src\Analyzers\CSharp\CodeFixes\MakeStructFieldsWritable\CSharpMakeStructFieldsWritableCodeFixProvider.cs (1)
50.OfType<FieldDeclarationSyntax>();
src\Analyzers\CSharp\CodeFixes\MisplacedUsingDirectives\MisplacedUsingDirectivesCodeFixProvider.cs (3)
218var namespaceDeclarations = compilationUnit.Members.OfType<BaseNamespaceDeclarationSyntax>(); 252var namespaceDeclarations = usingContainer.Members.OfType<BaseNamespaceDeclarationSyntax>(); 401.OfType<BaseNamespaceDeclarationSyntax>();
src\Analyzers\CSharp\CodeFixes\NewLines\EmbeddedStatementPlacement\EmbeddedStatementPlacementCodeFixProvider.cs (2)
78var descendentStatements = startStatement.DescendantNodesAndSelf().OfType<StatementSyntax>(); 104var ancestorBlocks = startStatement.AncestorsAndSelf().OfType<BlockSyntax>();
src\Analyzers\CSharp\CodeFixes\RemoveUnnecessaryLambdaExpression\CSharpRemoveUnnecessaryLambdaExpressionCodeFixProvider.cs (1)
66var containingStatement = anonymousFunction.AncestorsAndSelf().OfType<StatementSyntax>().FirstOrDefault();
src\Analyzers\CSharp\CodeFixes\UsePatternMatching\CSharpAsAndMemberAccessCodeFixProvider.cs (1)
127unaryPattern.DescendantNodes().OfType<DeclarationPatternSyntax>().Any())
src\Analyzers\CSharp\CodeFixes\UsePrimaryConstructor\CSharpUsePrimaryConstructorCodeFixProvider.cs (2)
282parameterList.DescendantNodes().OfType<SimpleNameSyntax>(), 588var xmlElement = identifier.AncestorsAndSelf().OfType<XmlEmptyElementSyntax>().FirstOrDefault();
src\Analyzers\CSharp\CodeFixes\UseUnboundGenericTypeInNameOf\CSharpUseUnboundGenericTypeInNameOfCodeFixProvider.cs (1)
56foreach (var typeArgumentList in nameofInvocation.DescendantNodes().OfType<TypeArgumentListSyntax>().OrderByDescending(t => t.SpanStart))
src\Analyzers\CSharp\CodeFixes\UseUtf8StringLiteral\UseUtf8StringLiteralCodeFixProvider.cs (1)
119.OfType<IArrayCreationOperation>()
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\CSharpCodeGenerationService.cs (1)
547var newStatements = statements.OfType<StatementSyntax>().ToArray();
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\FieldGenerator.cs (3)
28var lastConst = members.OfType<FieldDeclarationSyntax>() 39var lastReadOnly = members.OfType<FieldDeclarationSyntax>() 43var lastNormal = members.OfType<FieldDeclarationSyntax>()
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\StatementGenerator.cs (1)
16=> [.. statements.OfType<StatementSyntax>()];
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\LanguageServices\CSharpTypeInferenceService.TypeInferrer.cs (2)
1391return types.OfType<IArrayTypeSymbol>().Select(t => new TypeInferenceInfo(t.ElementType)); 2214foreach (var descendant in container.DescendantNodesAndSelf().OfType<IdentifierNameSyntax>())
Microsoft.CodeAnalysis.CSharp.EditorFeatures.UnitTests (15)
CompleteStatement\CSharpCompleteStatementCommandHandlerTests.cs (1)
4867=> workspace.ExportProvider.GetExportedValues<ICommandHandler>().OfType<CompleteStatementCommandHandler>().Single();
PdbSourceDocument\AbstractPdbSourceDocumentTests.cs (1)
172var provider = workspace.ExportProvider.GetExportedValues<IMetadataAsSourceFileProvider>().OfType<PdbSourceDocumentMetadataAsSourceFileProvider>().Single();
QuickInfo\SyntacticQuickInfoSourceTests.cs (1)
570var textElements = containerElement.Elements.OfType<ClassifiedTextElement>();
SymbolKey\SymbolKeyCompilationsTests.cs (2)
267var members1 = symbols1.OfType<INamespaceOrTypeSymbol>().SelectMany(n => n.GetMembers()).ToList(); 268var members2 = symbols2.OfType<INamespaceOrTypeSymbol>().SelectMany(n => n.GetMembers()).ToList();
SymbolKey\SymbolKeyTestBase.cs (7)
252var usingNodes = tree.GetRoot().DescendantNodes().OfType<UsingDirectiveSyntax>(); 350var labels = body.DescendantNodes().OfType<LabeledStatementSyntax>(); 358var swlabels = body.DescendantNodes().OfType<SwitchLabelSyntax>(); 372IEnumerable<ExpressionSyntax> exprs = body.DescendantNodes().OfType<SimpleLambdaExpressionSyntax>(); 373IEnumerable<ExpressionSyntax> tmp = body.DescendantNodes().OfType<ParenthesizedLambdaExpressionSyntax>(); 375tmp = body.DescendantNodes().OfType<AnonymousMethodExpressionSyntax>(); 378tmp = body.DescendantNodes().OfType<AnonymousObjectCreationExpressionSyntax>();
SymbolKey\SymbolKeyTests.cs (1)
296var varDecl = root.DescendantNodesAndSelf().OfType<VariableDeclaratorSyntax>().Single();
Utilities\CSharpServiceTestExtensions.cs (2)
40return node.ChildNodes().OfType<T>().First(); 50=> (syntaxTree.GetRoot() as CompilationUnitSyntax).Members.OfType<TypeDeclarationSyntax>().First();
Microsoft.CodeAnalysis.CSharp.Emit.UnitTests (359)
CodeGen\CodeGenAsyncMethodBuilderOverrideTests.cs (2)
895var lambdas = tree.GetRoot().DescendantNodes().OfType<LambdaExpressionSyntax>().ToArray(); 947var lambdas = tree.GetRoot().DescendantNodes().OfType<LambdaExpressionSyntax>().ToArray();
CodeGen\CodeGenAwaitForeachTests.cs (31)
936var foreachSyntax = tree.GetRoot().DescendantNodes().OfType<ForEachStatementSyntax>().Single(); 1661var foreachSyntax = tree.GetRoot().DescendantNodes().OfType<ForEachStatementSyntax>().Single(); 1721var foreachSyntax = tree.GetRoot().DescendantNodes().OfType<ForEachStatementSyntax>().Single(); 1865var foreachSyntax = tree.GetRoot().DescendantNodes().OfType<ForEachStatementSyntax>().Single(); 1902var foreachSyntax = tree.GetRoot().DescendantNodes().OfType<ForEachStatementSyntax>().Single(); 1942var foreachSyntax = tree.GetRoot().DescendantNodes().OfType<ForEachStatementSyntax>().Single(); 1979var foreachSyntax = tree.GetRoot().DescendantNodes().OfType<ForEachStatementSyntax>().Single(); 2013var foreachSyntax = tree.GetRoot().DescendantNodes().OfType<ForEachStatementSyntax>().Single(); 2969var foreachSyntax = tree.GetRoot().DescendantNodes().OfType<ForEachStatementSyntax>().Single(); 3034var foreachSyntax = tree.GetRoot().DescendantNodes().OfType<ForEachStatementSyntax>().Single(); 3119var foreachSyntax = tree.GetRoot().DescendantNodes().OfType<ForEachStatementSyntax>().Single(); 3237var foreachSyntax = tree.GetRoot().DescendantNodes().OfType<ForEachStatementSyntax>().Single(); 3292var foreachSyntax = tree.GetRoot().DescendantNodes().OfType<ForEachStatementSyntax>().Single(); 3350var foreachSyntax = tree.GetRoot().DescendantNodes().OfType<ForEachStatementSyntax>().Single(); 3546var foreachSyntax = tree.GetRoot().DescendantNodes().OfType<ForEachStatementSyntax>().Single(); 3594var foreachSyntax = tree.GetRoot().DescendantNodes().OfType<ForEachStatementSyntax>().Single(); 3715var foreachSyntax = tree.GetRoot().DescendantNodes().OfType<ForEachStatementSyntax>().Single(); 4239var loop = tree.GetRoot().DescendantNodes().OfType<ForEachStatementSyntax>().Single(); 4462var foreachSyntax = tree.GetRoot().DescendantNodes().OfType<ForEachStatementSyntax>().Single(); 4536var foreachSyntax = tree.GetRoot().DescendantNodes().OfType<ForEachStatementSyntax>().Single(); 4646var foreachSyntax = tree.GetRoot().DescendantNodes().OfType<ForEachVariableStatementSyntax>().Single(); 4745var foreachSyntax = tree.GetRoot().DescendantNodes().OfType<ForEachVariableStatementSyntax>().Single(); 5049var foreachSyntax = tree.GetRoot().DescendantNodes().OfType<ForEachStatementSyntax>().Single(); 5130var foreachSyntax = tree.GetRoot().DescendantNodes().OfType<ForEachStatementSyntax>().Single(); 5356var foreachSyntax = tree.GetRoot().DescendantNodes().OfType<ForEachStatementSyntax>().Single(); 6439var foreachSyntax = tree.GetRoot().DescendantNodes().OfType<ForEachStatementSyntax>().Single(); 9107var foreachSyntax = tree.GetRoot().DescendantNodes().OfType<ForEachStatementSyntax>().Single(); 9183var foreachSyntax = tree.GetRoot().DescendantNodes().OfType<ForEachStatementSyntax>().Single(); 9261var foreachSyntax = tree.GetRoot().DescendantNodes().OfType<ForEachStatementSyntax>().Single(); 9322var foreachSyntax = tree.GetRoot().DescendantNodes().OfType<ForEachStatementSyntax>().Single(); 9393var foreachSyntax = tree.GetRoot().DescendantNodes().OfType<ForEachVariableStatementSyntax>().Single();
CodeGen\CodeGenCheckedTests.cs (3)
2915var xNode = tree.GetRoot().DescendantNodes().OfType<CheckedExpressionSyntax>().Single().Expression; 2922var checkedNode = tree.GetRoot().DescendantNodes().OfType<CheckedExpressionSyntax>().Single(); 2947var xNode = tree.GetRoot().DescendantNodes().OfType<CheckedExpressionSyntax>().Single().Expression;
CodeGen\CodeGenDeconstructTests.cs (48)
96var lhs = tree.GetRoot().DescendantNodes().OfType<TupleExpressionSyntax>().First(); 101var right = tree.GetRoot().DescendantNodes().OfType<ObjectCreationExpressionSyntax>().Single(); 1111var deconstruction = tree.GetRoot().DescendantNodes().OfType<AssignmentExpressionSyntax>().Single(); 1128var tuple = tree.GetRoot().DescendantNodes().OfType<TupleExpressionSyntax>().ElementAt(1); 1368var x = nodes.OfType<VariableDeclaratorSyntax>().ElementAt(2); 1425var x = nodes.OfType<VariableDeclaratorSyntax>().ElementAt(2); 1469var xy = nodes.OfType<TupleExpressionSyntax>().Single(); 1474var ab = nodes.OfType<DeclarationExpressionSyntax>().Single(); 1510var tuple1 = nodes.OfType<TupleExpressionSyntax>().ElementAt(0); 1515var tuple2 = nodes.OfType<TupleExpressionSyntax>().ElementAt(1); 1563var tuple = nodes.OfType<TupleExpressionSyntax>().ElementAt(0); 1669var declarations = nodes.OfType<VariableDeclaratorSyntax>(); 2688var lhs = tree.GetRoot().DescendantNodes().OfType<TupleExpressionSyntax>().First(); 3130var lhs = tree.GetRoot().DescendantNodes().OfType<DeclarationExpressionSyntax>().First(); 3135var lhsNested = tree.GetRoot().DescendantNodes().OfType<ParenthesizedVariableDesignationSyntax>().ElementAt(1); 3178var lhs = tree.GetRoot().DescendantNodes().OfType<TupleExpressionSyntax>().First(); 3184var x234 = tree.GetRoot().DescendantNodes().OfType<DeclarationExpressionSyntax>().ElementAt(1); 3189var x34 = tree.GetRoot().DescendantNodes().OfType<ParenthesizedVariableDesignationSyntax>().ElementAt(1); 3242var x123 = tree.GetRoot().DescendantNodes().OfType<TupleExpressionSyntax>().First(); 3248var x23 = tree.GetRoot().DescendantNodes().OfType<TupleExpressionSyntax>().ElementAt(1); 3280var lhs = tree.GetRoot().DescendantNodes().OfType<TupleExpressionSyntax>().First(); 3286var lhsNested = tree.GetRoot().DescendantNodes().OfType<DeclarationExpressionSyntax>().ElementAt(1); 3330var lhs = tree.GetRoot().DescendantNodes().OfType<TupleExpressionSyntax>().First(); 3336var lhsNested = tree.GetRoot().DescendantNodes().OfType<DeclarationExpressionSyntax>().ElementAt(2); 3443var lhs = tree.GetRoot().DescendantNodes().OfType<TupleExpressionSyntax>().First(); 3447var literal = tree.GetRoot().DescendantNodes().OfType<TupleExpressionSyntax>().ElementAt(1); 3479var lhs = tree.GetRoot().DescendantNodes().OfType<TupleExpressionSyntax>().First(); 3483var literal = tree.GetRoot().DescendantNodes().OfType<TupleExpressionSyntax>().ElementAt(1); 3635return tree.GetRoot().DescendantNodes().OfType<SingleVariableDesignationSyntax>().Where(d => d.Identifier.ValueText == name).Single(); 3640return tree.GetRoot().DescendantNodes().OfType<DiscardDesignationSyntax>(); 3645return tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(i => i.Identifier.ContextualKind() == SyntaxKind.UnderscoreToken); 3662return tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == name); 4042var deconstructionForeach = tree.GetRoot().DescendantNodes().OfType<ForEachVariableStatementSyntax>().Single(); 4405var collection = tree.GetRoot().DescendantNodes().OfType<ForEachVariableStatementSyntax>().Single().Expression; 5472var firstX1 = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().Where(d => d.Identifier.ValueText == "x1").Single(); 5504var firstY = tree.GetRoot().DescendantNodes().OfType<SingleVariableDesignationSyntax>().Where(d => d.Identifier.ValueText == "y").First(); 5509var secondY = tree.GetRoot().DescendantNodes().OfType<SingleVariableDesignationSyntax>().Where(d => d.Identifier.ValueText == "y").ElementAt(1); 5535var firstX = tree.GetRoot().DescendantNodes().OfType<SingleVariableDesignationSyntax>().Where(d => d.Identifier.ValueText == "x").First(); 5540var secondX = tree.GetRoot().DescendantNodes().OfType<SingleVariableDesignationSyntax>().Where(d => d.Identifier.ValueText == "x").ElementAt(1); 6408var yz = tree.GetRoot().DescendantNodes().OfType<TupleExpressionSyntax>().ElementAt(2); 6413var y = tree.GetRoot().DescendantNodes().OfType<DeclarationExpressionSyntax>().ElementAt(1); 7067var discard = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().First(); 7238var lhs = tree.GetRoot().DescendantNodes().OfType<TupleExpressionSyntax>().ElementAt(1); 7520var lhs = tree.GetRoot().DescendantNodes().OfType<TupleExpressionSyntax>().ElementAt(2); 8358var node = tree.GetRoot().DescendantNodes().OfType<CastExpressionSyntax>().Single(); 8585var node = tree.GetRoot().DescendantNodes().OfType<CastExpressionSyntax>().Single(); 8629var node = tree.GetRoot().DescendantNodes().OfType<CastExpressionSyntax>().ElementAt(1); 9010var node = tree.GetRoot().DescendantNodes().OfType<AssignmentExpressionSyntax>().First();
CodeGen\CodeGenForEachTests.cs (1)
1758var foreachSyntax = tree.GetRoot().DescendantNodes().OfType<ForEachStatementSyntax>().Single();
CodeGen\CodeGenFunctionPointersTests.cs (20)
3062var addressOfs = syntaxTree.GetRoot().DescendantNodes().OfType<PrefixUnaryExpressionSyntax>().ToArray(); 3114var addressOf = syntaxTree.GetRoot().DescendantNodes().OfType<PrefixUnaryExpressionSyntax>().Single(); 3339var declarators = syntaxTree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().Where(d => d.Initializer!.Value.IsKind(SyntaxKind.AddressOfExpression)).ToArray(); 3410var declarator = syntaxTree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().Single(); 3457var declarator = syntaxTree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().Single(); 3568var decls = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().ToArray(); 3620var decls = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().ToArray(); 3671var decls = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().ToArray(); 3710var decls = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().ToArray(); 4115var variableDeclaratorSyntax = syntaxTree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().Single(); 4920.OfType<LiteralExpressionSyntax>() 7415var lambda = tree.GetRoot().DescendantNodes().OfType<LambdaExpressionSyntax>().Single(); 7517var functionPointerSyntaxes = tree.GetRoot().DescendantNodes().OfType<FunctionPointerTypeSyntax>().ToArray(); 7573var functionPointerSyntax = tree.GetRoot().DescendantNodes().OfType<FunctionPointerTypeSyntax>().Single(); 7593functionPointerSyntax = tree.GetRoot().DescendantNodes().OfType<FunctionPointerTypeSyntax>().Single(); 7642var functionPointerSyntax = tree.GetRoot().DescendantNodes().OfType<FunctionPointerTypeSyntax>().Single(); 7662functionPointerSyntax = tree.GetRoot().DescendantNodes().OfType<FunctionPointerTypeSyntax>().Single(); 7729var functionPointerSyntax = tree.GetRoot().DescendantNodes().OfType<FunctionPointerTypeSyntax>().Single(); 7747functionPointerSyntax = tree.GetRoot().DescendantNodes().OfType<FunctionPointerTypeSyntax>().Single(); 10804var lambdas = tree.GetRoot().DescendantNodes().OfType<LambdaExpressionSyntax>().ToArray();
CodeGen\CodeGenInterpolatedString.cs (1)
37var interpolatedStrings = tree.GetRoot().DescendantNodes().OfType<InterpolatedStringExpressionSyntax>().ToArray();
CodeGen\CodeGenLocalFunctionTests.cs (6)
146var localFunction = tree.GetRoot().DescendantNodes().OfType<LocalFunctionStatementSyntax>().Single(); 147var creation = localFunction.DescendantNodes().OfType<ObjectCreationExpressionSyntax>().Single(); 5749.GetDeclaredSymbol(syntaxTree.GetRoot().DescendantNodes().OfType<LocalFunctionStatementSyntax>().Single()) 5824.GetDeclaredSymbol(syntaxTree.GetRoot().DescendantNodes().OfType<LocalFunctionStatementSyntax>().Single()) 5897var localFunctions = syntaxTree.GetRoot().DescendantNodes().OfType<LocalFunctionStatementSyntax>().ToList(); 6162var localFunctionSyntax = tree.GetRoot().DescendantNodes().OfType<LocalFunctionStatementSyntax>().Single();
CodeGen\CodeGenOperators.cs (3)
5409ControlFlowGraph.Create((IMethodBodyOperation)model.GetOperation(tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Where(m => m.Identifier.ValueText == "Calculate").Single())); 5699ControlFlowGraph.Create((IMethodBodyOperation)model.GetOperation(tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Where(m => m.Identifier.ValueText == "Calculate").Single())); 5735ControlFlowGraph.Create((IMethodBodyOperation)model.GetOperation(tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Where(m => m.Identifier.ValueText == "Calculate").Single()));
CodeGen\CodeGenRefLocalTests.cs (6)
4033var xDecl = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().ElementAt(1); 4036var refVar = tree.GetRoot().DescendantNodes().OfType<RefTypeSyntax>().Single(); 4070var xDecl = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().ElementAt(1); 4073var refVar = tree.GetRoot().DescendantNodes().OfType<RefTypeSyntax>().Single(); 4104var xDecl = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().ElementAt(1); 4107var refInt = tree.GetRoot().DescendantNodes().OfType<RefTypeSyntax>().Single();
CodeGen\CodeGenTupleEqualityTests.cs (47)
362var tupleX = tree.GetCompilationUnitRoot().DescendantNodes().OfType<TupleExpressionSyntax>().First(); 381var tupleY = tree.GetCompilationUnitRoot().DescendantNodes().OfType<TupleExpressionSyntax>().Last(); 682var tuple1 = tree.GetCompilationUnitRoot().DescendantNodes().OfType<TupleExpressionSyntax>().ElementAt(0); 688var tuple2 = tree.GetCompilationUnitRoot().DescendantNodes().OfType<TupleExpressionSyntax>().ElementAt(1); 713var equals = tree.GetCompilationUnitRoot().DescendantNodes().OfType<BinaryExpressionSyntax>().Single(); 769var tuple = tree.GetCompilationUnitRoot().DescendantNodes().OfType<TupleExpressionSyntax>().Single(); 793var tuple1 = tree.GetCompilationUnitRoot().DescendantNodes().OfType<TupleExpressionSyntax>().ElementAt(0); 806var tuple2 = tree.GetCompilationUnitRoot().DescendantNodes().OfType<TupleExpressionSyntax>().ElementAt(1); 854var equals = tree.GetCompilationUnitRoot().DescendantNodes().OfType<BinaryExpressionSyntax>().Single(); 902var equals = tree.GetCompilationUnitRoot().DescendantNodes().OfType<BinaryExpressionSyntax>().Single(); 951var equals = tree.GetCompilationUnitRoot().DescendantNodes().OfType<BinaryExpressionSyntax>().Single(); 1001var tuple = tree.GetCompilationUnitRoot().DescendantNodes().OfType<TupleExpressionSyntax>().ElementAt(1); 1008var lastEquals = tree.GetCompilationUnitRoot().DescendantNodes().OfType<BinaryExpressionSyntax>().Last(); 1055var defaultLiterals = tree.GetCompilationUnitRoot().DescendantNodes().OfType<LiteralExpressionSyntax>() 1089var defaultLiterals = tree.GetCompilationUnitRoot().DescendantNodes().OfType<LiteralExpressionSyntax>() 1121var defaultLiterals = tree.GetCompilationUnitRoot().DescendantNodes().OfType<LiteralExpressionSyntax>() 1152var defaultLiterals = tree.GetCompilationUnitRoot().DescendantNodes().OfType<LiteralExpressionSyntax>() 1211var defaults = tree.GetCompilationUnitRoot().DescendantNodes().OfType<LiteralExpressionSyntax>() 1311var lastTuple = tree.GetCompilationUnitRoot().DescendantNodes().OfType<TupleExpressionSyntax>().Last(); 1397var literals = tree.GetCompilationUnitRoot().DescendantNodes().OfType<LiteralExpressionSyntax>(); 1408var defaultLiterals = tree.GetCompilationUnitRoot().DescendantNodes().OfType<LiteralExpressionSyntax>() 1463var defaultLiterals = tree.GetCompilationUnitRoot().DescendantNodes().OfType<LiteralExpressionSyntax>() 1497var tuple = tree.GetCompilationUnitRoot().DescendantNodes().OfType<TupleExpressionSyntax>().ElementAt(3); 1557var nulls = tree.GetCompilationUnitRoot().DescendantNodes().OfType<LiteralExpressionSyntax>(); 1566var tuples = tree.GetCompilationUnitRoot().DescendantNodes().OfType<TupleExpressionSyntax>(); 1594var lastLiteral = tree.GetCompilationUnitRoot().DescendantNodes().OfType<LiteralExpressionSyntax>().Last(); 1619var rightTuple = tree.GetCompilationUnitRoot().DescendantNodes().OfType<TupleExpressionSyntax>().ElementAt(2); 1675var tuple1 = tree.GetCompilationUnitRoot().DescendantNodes().OfType<TupleExpressionSyntax>().ElementAt(0); 1683var tuple2 = tree.GetCompilationUnitRoot().DescendantNodes().OfType<TupleExpressionSyntax>().ElementAt(1); 1707var addition = tree.GetCompilationUnitRoot().DescendantNodes().OfType<BinaryExpressionSyntax>().Last(); 1776var tuple1 = tree.GetCompilationUnitRoot().DescendantNodes().OfType<TupleExpressionSyntax>().ElementAt(0); 1782var tuple2 = tree.GetCompilationUnitRoot().DescendantNodes().OfType<TupleExpressionSyntax>().ElementAt(1); 1918var tuple1 = tree.GetCompilationUnitRoot().DescendantNodes().OfType<TupleExpressionSyntax>().ElementAt(0); 1924var tuple2 = tree.GetCompilationUnitRoot().DescendantNodes().OfType<TupleExpressionSyntax>().ElementAt(1); 2574var firstEquals = tree.GetCompilationUnitRoot().DescendantNodes().OfType<BinaryExpressionSyntax>().First(); 2582var secondEquals = tree.GetCompilationUnitRoot().DescendantNodes().OfType<BinaryExpressionSyntax>().Last(); 2642var equals = tree.GetCompilationUnitRoot().DescendantNodes().OfType<BinaryExpressionSyntax>().Last(); 3278var comparison = tree.GetCompilationUnitRoot().DescendantNodes().OfType<BinaryExpressionSyntax>().Single(); 3684var comparison = tree.GetCompilationUnitRoot().DescendantNodes().OfType<BinaryExpressionSyntax>().Single(); 3808var comparison = tree.GetCompilationUnitRoot().DescendantNodes().OfType<BinaryExpressionSyntax>().Single(); 3911var comparison = tree.GetCompilationUnitRoot().DescendantNodes().OfType<BinaryExpressionSyntax>().Single(); 4036var comparison = tree.GetCompilationUnitRoot().DescendantNodes().OfType<BinaryExpressionSyntax>().Single(); 4083var comparison = tree.GetCompilationUnitRoot().DescendantNodes().OfType<BinaryExpressionSyntax>().First(); 4184var lastNull = tree.GetCompilationUnitRoot().DescendantNodes().OfType<LiteralExpressionSyntax>().Last(); 4276var comparison = tree.GetRoot().DescendantNodes().OfType<BinaryExpressionSyntax>().Last(); 5122var equals = tree.GetCompilationUnitRoot().DescendantNodes().OfType<BinaryExpressionSyntax>().First(); 5158var equals = tree.GetCompilationUnitRoot().DescendantNodes().OfType<BinaryExpressionSyntax>().First();
CodeGen\CodeGenTupleTest.cs (183)
1610var node = nodes.OfType<TupleExpressionSyntax>().Single(); 1615var x = nodes.OfType<VariableDeclaratorSyntax>().First(); 3220var x = nodes.OfType<VariableDeclaratorSyntax>().First(); 3253var x = nodes.OfType<VariableDeclaratorSyntax>().First(); 3466var node = nodes.OfType<TupleExpressionSyntax>().Single(); 3637var node = nodes.OfType<TupleExpressionSyntax>().Single(); 3688var yTuple = nodes.OfType<TupleExpressionSyntax>().ElementAt(0); 3705var zTuple = nodes.OfType<TupleExpressionSyntax>().ElementAt(1); 3934var yTuple = nodes.OfType<TupleExpressionSyntax>().ElementAt(0); 3938var zTuple = nodes.OfType<TupleExpressionSyntax>().ElementAt(1); 3941var tTuple = nodes.OfType<TupleExpressionSyntax>().ElementAt(2); 3993var yTuple = nodes.OfType<TupleExpressionSyntax>().ElementAt(0); 4024var result = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().Where(d => d.Identifier.ValueText == "result").Single(); 4156var node = nodes.OfType<MemberAccessExpressionSyntax>().Where(n => n.ToString() == "x.Rest").First(); 4839var invocation1 = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().ElementAt(0); 4844var invocation2 = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().ElementAt(2); 5075var invocation = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().ElementAt(0); 5119var invocation = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().ElementAt(0); 5160var memberAccess = tree.GetRoot().DescendantNodes().OfType<MemberAccessExpressionSyntax>().ElementAt(0); 5164var memberAccess2 = tree.GetRoot().DescendantNodes().OfType<MemberAccessExpressionSyntax>().ElementAt(1); 5168var memberAccess3 = tree.GetRoot().DescendantNodes().OfType<MemberAccessExpressionSyntax>().ElementAt(2); 5204var invocation = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().ElementAt(0); 6200Assert.All(tupleWithoutNames.GetMembers().OfType<IFieldSymbol>().Select(f => f.Locations.FirstOrDefault()), 7497var declaration = tree.GetRoot().DescendantNodes().OfType<LocalDeclarationStatementSyntax>().First(); 7530var declaration = tree.GetRoot().DescendantNodes().OfType<LocalDeclarationStatementSyntax>().First(); 7568var tuples = tree.GetRoot().DescendantNodes().OfType<TupleExpressionSyntax>(); 7631var tuples = tree.GetRoot().DescendantNodes().OfType<TupleExpressionSyntax>(); 8292var node = nodes.OfType<TupleExpressionSyntax>().Single(); 8299var x = nodes.OfType<VariableDeclaratorSyntax>().First(); 8324var l11 = nodes.OfType<LiteralExpressionSyntax>().ElementAt(2); 8331var node = nodes.OfType<TupleExpressionSyntax>().Single(); 8356var x = nodes.OfType<VariableDeclaratorSyntax>().First(); 8378var node = nodes.OfType<TupleExpressionSyntax>().Single(); 8407var node = nodes.OfType<TupleExpressionSyntax>().Single(); 8414var x = nodes.OfType<VariableDeclaratorSyntax>().First(); 8436var node = nodes.OfType<TupleExpressionSyntax>().Single(); 8461var x = nodes.OfType<VariableDeclaratorSyntax>().First(); 8484var node = nodes.OfType<ParenthesizedExpressionSyntax>().Single().Parent; 8491node = nodes.OfType<ParenthesizedExpressionSyntax>().Single(); 8518var node = nodes.OfType<ParenthesizedExpressionSyntax>().Single().Parent; 8525node = nodes.OfType<ParenthesizedExpressionSyntax>().Single(); 8551var node = nodes.OfType<TupleExpressionSyntax>().Single(); 8558var x = nodes.OfType<VariableDeclaratorSyntax>().First(); 8580var node = nodes.OfType<TupleExpressionSyntax>().Single(); 8605var x = nodes.OfType<VariableDeclaratorSyntax>().First(); 8627var node = nodes.OfType<TupleExpressionSyntax>().Single(); 8640var x = nodes.OfType<VariableDeclaratorSyntax>().First(); 8662var node = nodes.OfType<TupleExpressionSyntax>().Single(); 8669var x = nodes.OfType<VariableDeclaratorSyntax>().First(); 8691var node = nodes.OfType<TupleExpressionSyntax>().Single(); 8698var x = nodes.OfType<VariableDeclaratorSyntax>().First(); 8720var node = nodes.OfType<TupleExpressionSyntax>().Single(); 8727var x = nodes.OfType<VariableDeclaratorSyntax>().First(); 8751var l11 = nodes.OfType<LiteralExpressionSyntax>().ElementAt(2); 8758var node = nodes.OfType<TupleExpressionSyntax>().Single(); 8783var x = nodes.OfType<VariableDeclaratorSyntax>().First(); 8805var node = nodes.OfType<TupleExpressionSyntax>().Single(); 8812var x = nodes.OfType<VariableDeclaratorSyntax>().First(); 8836var lnull = nodes.OfType<LiteralExpressionSyntax>().ElementAt(2); 8843var node = nodes.OfType<TupleExpressionSyntax>().Single(); 8856var x = nodes.OfType<VariableDeclaratorSyntax>().First(); 8894var node = nodes.OfType<TupleExpressionSyntax>().Single(); 8901var x = nodes.OfType<VariableDeclaratorSyntax>().First(); 8941var node = nodes.OfType<TupleExpressionSyntax>().Single(); 8966var x = nodes.OfType<VariableDeclaratorSyntax>().First(); 9014var node = nodes.OfType<TupleExpressionSyntax>().Single(); 9071var node = nodes.OfType<TupleExpressionSyntax>().Single(); 9143var node = nodes.OfType<TupleExpressionSyntax>().First(); 9224var node = nodes.OfType<TupleExpressionSyntax>().First(); 9307var node = nodes.OfType<TupleExpressionSyntax>().First(); 9854var names = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>(); 9905var names = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>(); 9947var names = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>(); 9993var names = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>(); 10059var t1 = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().ElementAt(3); 10098var t1 = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().ElementAt(2); 10101var t2 = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().ElementAt(3); 10132var names = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>(); 11815foreach (var m in m3TupleRestTuple.GetMembers().OfType<FieldSymbol>()) 12024foreach (var m in m4TupleRestTuple.GetMembers().OfType<FieldSymbol>()) 12261foreach (var m in m5TupleRestTuple.GetMembers().OfType<FieldSymbol>()) 12295foreach (var m in m5TupleRestTupleRestTuple.GetMembers().OfType<FieldSymbol>()) 12693var node = tree.GetRoot().DescendantNodes().OfType<TupleExpressionSyntax>().First(); 13974var nameofNode = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "nameof").Single(); 13981var typeofNodes = tree.GetRoot().DescendantNodes().OfType<TypeOfExpressionSyntax>().ToArray(); 14245var m1 = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "M1").Single(); 14261var m2 = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "M2").Single(); 14275var f1 = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "F1").First(); 14289var p1 = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "P1").First(); 14306var m3 = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "M3").Single(); 14324var m4 = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "M4").Single(); 14331var m5 = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "M5").Single(); 14338var m6 = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "M6").Single(); 14433var e1 = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "E1").Single(); 14447var m5 = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "M5").Single(); 14454var v1 = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "v1").Single(); 14464var v2 = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "v2").Single(); 16540var node = nodes.OfType<TupleExpressionSyntax>().Single(); 16568var x = nodes.OfType<VariableDeclaratorSyntax>().First(); 16605var x = nodes.OfType<VariableDeclaratorSyntax>().First(); 17212var n1 = nodes.OfType<TupleExpressionSyntax>().ElementAt(0); 17219var n2 = nodes.OfType<TupleExpressionSyntax>().ElementAt(1); 17226var n3 = nodes.OfType<LiteralExpressionSyntax>().ElementAt(4); 17233var n4 = nodes.OfType<LiteralExpressionSyntax>().ElementAt(5); 17240var n5 = nodes.OfType<LambdaExpressionSyntax>().Single(); 17273var n1 = nodes.OfType<TupleExpressionSyntax>().ElementAt(0); 17280var n2 = nodes.OfType<TupleExpressionSyntax>().ElementAt(1); 17287var n3 = nodes.OfType<LiteralExpressionSyntax>().ElementAt(4); 17294var n4 = nodes.OfType<LiteralExpressionSyntax>().ElementAt(5); 17301var n5 = nodes.OfType<LambdaExpressionSyntax>().Single(); 17332var n1 = nodes.OfType<TupleExpressionSyntax>().ElementAt(0); 17339var n2 = nodes.OfType<TupleExpressionSyntax>().ElementAt(1); 17370var nc = nodes.OfType<NameColonSyntax>().ElementAt(0); 17403var x1Bob = nodes.OfType<MemberAccessExpressionSyntax>().ElementAt(1); 17410var secondElement = nodes.OfType<TupleExpressionSyntax>().First().Arguments[1]; 17436var x1 = nodes.OfType<VariableDeclaratorSyntax>().Single(); 19231var x1 = model.GetDeclaredSymbol(nodes.OfType<VariableDeclaratorSyntax>().Skip(1).First()); 19234var x2 = model.GetDeclaredSymbol(nodes.OfType<VariableDeclaratorSyntax>().Skip(5).First()); 19293var x1 = model.GetDeclaredSymbol(nodes.OfType<VariableDeclaratorSyntax>().ElementAt(2)); 19296var x2 = model.GetDeclaredSymbol(nodes.OfType<VariableDeclaratorSyntax>().ElementAt(3)); 19299var x3 = model.GetDeclaredSymbol(nodes.OfType<VariableDeclaratorSyntax>().ElementAt(4)); 19302var x4 = model.GetDeclaredSymbol(nodes.OfType<VariableDeclaratorSyntax>().ElementAt(5)); 19305var x5 = model.GetDeclaredSymbol(nodes.OfType<VariableDeclaratorSyntax>().ElementAt(6)); 19308var x6 = model.GetDeclaredSymbol(nodes.OfType<VariableDeclaratorSyntax>().ElementAt(7)); 19311var x7 = model.GetDeclaredSymbol(nodes.OfType<VariableDeclaratorSyntax>().ElementAt(8)); 19314var x8 = model.GetDeclaredSymbol(nodes.OfType<VariableDeclaratorSyntax>().ElementAt(9)); 19317var x9 = model.GetDeclaredSymbol(nodes.OfType<VariableDeclaratorSyntax>().ElementAt(10)); 19320var x6double = model.GetDeclaredSymbol(nodes.OfType<VariableDeclaratorSyntax>().ElementAt(11)); 19396var x1 = model.GetDeclaredSymbol(nodes.OfType<VariableDeclaratorSyntax>().Skip(1).First()); 19399var x2 = model.GetDeclaredSymbol(nodes.OfType<VariableDeclaratorSyntax>().Skip(2).First()); 19426var x1 = model.GetDeclaredSymbol(nodes.OfType<VariableDeclaratorSyntax>().Skip(1).First()); 19480var x1 = model.GetDeclaredSymbol(nodes.OfType<VariableDeclaratorSyntax>().First()); 19538var x1 = model.GetDeclaredSymbol(nodes.OfType<VariableDeclaratorSyntax>().First()); 19661var invocation1 = model.GetSymbolInfo(nodes.OfType<InvocationExpressionSyntax>().First()); 19664var invocation2 = model.GetSymbolInfo(nodes.OfType<InvocationExpressionSyntax>().Skip(4).First()); 19667var invocation3 = model.GetSymbolInfo(nodes.OfType<InvocationExpressionSyntax>().Skip(5).First()); 19705var invocation1 = model.GetSymbolInfo(nodes.OfType<InvocationExpressionSyntax>().First()); 19708var invocation2 = model.GetSymbolInfo(nodes.OfType<InvocationExpressionSyntax>().Skip(1).First()); 19711var invocation3 = model.GetSymbolInfo(nodes.OfType<InvocationExpressionSyntax>().Skip(2).First()); 19736var invocation1 = model.GetSymbolInfo(nodes.OfType<InvocationExpressionSyntax>().First()); 20359var c1 = nodes.OfType<ClassDeclarationSyntax>().First(); 20364var c2 = nodes.OfType<ClassDeclarationSyntax>().Skip(1).First(); 20368var c3 = nodes.OfType<ClassDeclarationSyntax>().Skip(2).First(); 21352var x1 = nodes.OfType<VariableDeclaratorSyntax>().First(); 21355var x2 = nodes.OfType<VariableDeclaratorSyntax>().Skip(1).First(); 22857var x = nodes.OfType<VariableDeclaratorSyntax>().First(); 24180var nodes = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "elem2").ToArray(); 24196var type = tree.GetRoot().DescendantNodes().OfType<TupleTypeSyntax>().Single(); 24259var derived = tree.GetRoot().DescendantNodes().OfType<ClassDeclarationSyntax>().ElementAt(1); 24269var xSymbol = model.GetDeclaredSymbol(tree.GetRoot().DescendantNodes().OfType<ForEachStatementSyntax>().Single()); 24322var derived = tree.GetRoot().DescendantNodes().OfType<ClassDeclarationSyntax>().ElementAt(1); 24332var xSymbol = model.GetDeclaredSymbol(tree.GetRoot().DescendantNodes().OfType<ForEachStatementSyntax>().Single()); 24386var derived = tree.GetRoot().DescendantNodes().OfType<ClassDeclarationSyntax>().ElementAt(1); 24396var collection = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().ElementAt(3); 24459var derived = tree.GetRoot().DescendantNodes().OfType<ClassDeclarationSyntax>().ElementAt(1); 24469var collection = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().ElementAt(3); 24532var derived = tree.GetRoot().DescendantNodes().OfType<ClassDeclarationSyntax>().ElementAt(1); 24542var collection = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().ElementAt(3); 24606var derived = tree.GetRoot().DescendantNodes().OfType<ClassDeclarationSyntax>().ElementAt(1); 24616var collection = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().ElementAt(3); 25024var x = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().ElementAt(1); 25053var y = tree.GetRoot().DescendantNodes().OfType<TupleTypeSyntax>().ElementAt(0); 25058var z = tree.GetRoot().DescendantNodes().OfType<TupleTypeSyntax>().ElementAt(1); 25084var tuple = tree.GetRoot().DescendantNodes().OfType<TupleExpressionSyntax>().ElementAt(0); 25703var tuple = tree.GetRoot().DescendantNodes().OfType<TupleExpressionSyntax>().Single(); 25774var tuple = tree.GetRoot().DescendantNodes().OfType<TupleExpressionSyntax>().Single(); 25839var tuple = tree.GetRoot().DescendantNodes().OfType<TupleExpressionSyntax>().Single(); 25881var tuple = tree.GetRoot().DescendantNodes().OfType<TupleExpressionSyntax>().ElementAt(1); 25911var tuple = tree.GetRoot().DescendantNodes().OfType<TupleExpressionSyntax>().Single(); 26224var node = nodes.OfType<TupleExpressionSyntax>().Single(); 26295var doSyntax = tree.GetCompilationUnitRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().Single(); 26328var doSyntax = tree.GetCompilationUnitRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().Single(); 26361var doSyntax = tree.GetCompilationUnitRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().Single(); 26394var doSyntax = tree.GetCompilationUnitRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().Single(); 27567var literal = tree.GetRoot().DescendantNodes().OfType<LiteralExpressionSyntax>().Single(); 28070var fields = type.GetMembers().OfType<FieldSymbol>(); 28408var fields = namedType.GetMembers().OfType<FieldSymbol>(); 28493var fields = namedType.GetMembers().OfType<FieldSymbol>(); 28758var fields = type.GetMembers().OfType<FieldSymbol>(); 28769var fields = type.GetMembers().OfType<FieldSymbol>(); 28780var fields = type.GetMembers().OfType<FieldSymbol>(); 28929var fields = type.GetMembers().OfType<FieldSymbol>(); 28940var fields = type.GetMembers().OfType<FieldSymbol>();
CodeGen\ForeachTest.cs (1)
1687var decl = tree.GetRoot().DescendantNodes().OfType<ForEachStatementSyntax>().Single();
CodeGen\IndexAndRangeTests.cs (2)
34return (model, root.DescendantNodes().OfType<ElementAccessExpressionSyntax>().ToList()); 3857var receivers = tree.GetRoot().DescendantNodes().OfType<ElementAccessExpressionSyntax>().Select(e => e.Expression).ToArray();
CodeGen\ObjectAndCollectionInitializerTests.cs (2)
1107var node = tree.GetRoot().DescendantNodes().OfType<Syntax.ObjectCreationExpressionSyntax>().Last(); 3589var node = tree.GetRoot().DescendantNodes().OfType<Syntax.ObjectCreationExpressionSyntax>().Single();
CodeGen\PatternTests.cs (3)
5004var switchExpressions = tree.GetRoot().DescendantNodes().OfType<SwitchExpressionSyntax>().ToArray(); 5130var attributeArguments = tree.GetRoot().DescendantNodes().OfType<AttributeArgumentSyntax>().ToArray(); 5279var attributeArguments = tree.GetRoot().DescendantNodes().OfType<AttributeArgumentSyntax>().ToArray();
Microsoft.CodeAnalysis.CSharp.Emit2.UnitTests (36)
CodeGen\IndexAndRangeTests.cs (18)
91var node = tree.GetRoot().DescendantNodes().OfType<ObjectCreationExpressionSyntax>().Skip(2).First(); 332var node = tree.GetRoot().DescendantNodes().OfType<ObjectCreationExpressionSyntax>().First(); 419var node = tree.GetRoot().DescendantNodes().OfType<ObjectCreationExpressionSyntax>().First(); 506var node = tree.GetRoot().DescendantNodes().OfType<ObjectCreationExpressionSyntax>().First(); 624var node = tree.GetRoot().DescendantNodes().OfType<ObjectCreationExpressionSyntax>().Single(); 1573var node = tree.GetRoot().DescendantNodes().OfType<ObjectCreationExpressionSyntax>().First(); 1808var node = tree.GetRoot().DescendantNodes().OfType<ObjectCreationExpressionSyntax>().First(); 2263var node = tree.GetRoot().DescendantNodes().OfType<ObjectCreationExpressionSyntax>().Last(); 2678var node = tree.GetRoot().DescendantNodes().OfType<ObjectCreationExpressionSyntax>().Last(); 2841var node = tree.GetRoot().DescendantNodes().OfType<ObjectCreationExpressionSyntax>().Last(); 3019var node = tree.GetRoot().DescendantNodes().OfType<ObjectCreationExpressionSyntax>().Last(); 3133var node = tree.GetRoot().DescendantNodes().OfType<ObjectCreationExpressionSyntax>().Last(); 3304var node = tree.GetRoot().DescendantNodes().OfType<ObjectCreationExpressionSyntax>().Last(); 3455var node = tree.GetRoot().DescendantNodes().OfType<ObjectCreationExpressionSyntax>().Last(); 3641var node = tree.GetRoot().DescendantNodes().OfType<ObjectCreationExpressionSyntax>().Last(); 3731var node = tree.GetRoot().DescendantNodes().OfType<ObjectCreationExpressionSyntax>().Last(); 3817var node = tree.GetRoot().DescendantNodes().OfType<ObjectCreationExpressionSyntax>().Last(); 3890var node = tree.GetRoot().DescendantNodes().OfType<ObjectCreationExpressionSyntax>().Last();
Emit\NumericIntPtrTests.cs (18)
699var actualLocals = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().Select(d => model.GetDeclaredSymbol(d).ToTestDisplayString()); 1917var nodes = tree.GetRoot().DescendantNodes().OfType<PrefixUnaryExpressionSyntax>(); 1969var nodes = tree.GetRoot().DescendantNodes().OfType<BinaryExpressionSyntax>(); 6009var expr = tree.GetRoot().DescendantNodes().OfType<ReturnStatementSyntax>().Single().Expression; 6245var expr = tree.GetRoot().DescendantNodes().OfType<PrefixUnaryExpressionSyntax>().Single(); 8126var expr = tree.GetRoot().DescendantNodes().OfType<BinaryExpressionSyntax>().Single(); 10547var returnStatements = tree.GetRoot().DescendantNodes().OfType<ReturnStatementSyntax>().ToArray(); 10686var methods = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().ToArray(); 11172var docComments = tree.GetCompilationUnitRoot().DescendantTrivia().Select(trivia => trivia.GetStructure()).OfType<DocumentationCommentTriviaSyntax>(); 11173var cref = docComments.First().DescendantNodes().OfType<XmlCrefAttributeSyntax>().First().Cref; 11195var docComments = tree.GetCompilationUnitRoot().DescendantTrivia().Select(trivia => trivia.GetStructure()).OfType<DocumentationCommentTriviaSyntax>(); 11196var cref = docComments.First().DescendantNodes().OfType<XmlCrefAttributeSyntax>().First().Cref; 11223var docComments = tree.GetCompilationUnitRoot().DescendantTrivia().Select(trivia => trivia.GetStructure()).OfType<DocumentationCommentTriviaSyntax>(); 11224var cref = docComments.First().DescendantNodes().OfType<XmlCrefAttributeSyntax>().First().Cref; 11248var docComments = tree.GetCompilationUnitRoot().DescendantTrivia().Select(trivia => trivia.GetStructure()).OfType<DocumentationCommentTriviaSyntax>(); 11249var cref = docComments.First().DescendantNodes().OfType<XmlCrefAttributeSyntax>().First().Cref; 11293var docComments = tree.GetCompilationUnitRoot().DescendantTrivia().Select(trivia => trivia.GetStructure()).OfType<DocumentationCommentTriviaSyntax>(); 11294var cref = docComments.First().DescendantNodes().OfType<XmlCrefAttributeSyntax>().First().Cref;
Microsoft.CodeAnalysis.CSharp.Emit3.UnitTests (692)
Attributes\AttributeTests.cs (19)
87var nodes = Parse(aliases).GetRoot().DescendantNodes().OfType<UsingDirectiveSyntax>(); 707var attrSyntax = root.DescendantNodes().OfType<AttributeSyntax>().Last(); 710var m0 = semanticModel.GetDeclaredSymbol(root.DescendantNodes().OfType<MethodDeclarationSyntax>().Last()); 748var attrSyntax = root.DescendantNodes().OfType<AttributeSyntax>().Last(); 752var newAttrSyntax = newRoot.DescendantNodes().OfType<AttributeSyntax>().Last(); 812var attrSyntax = root.DescendantNodes().OfType<AttributeSyntax>().Last(); 813var interpolationSyntax = root.DescendantNodes().OfType<InterpolationSyntax>().Single(); 817var newAttrSyntax = newRoot.DescendantNodes().OfType<AttributeSyntax>().Last(); 854var attrSyntax = root.DescendantNodes().OfType<AttributeSyntax>().Last(); 858var newAttrSyntax = newRoot.DescendantNodes().OfType<AttributeSyntax>().Last(); 895var attrSyntax = root.DescendantNodes().OfType<AttributeSyntax>().Last(); 899var newAttrSyntax = newRoot.DescendantNodes().OfType<AttributeSyntax>().Last(); 934var attrSyntax = root.DescendantNodes().OfType<AttributeSyntax>().First(); 938var newAttrSyntax = newRoot.DescendantNodes().OfType<AttributeSyntax>().First(); 7537var attrArgSyntaxes = tree.GetCompilationUnitRoot().DescendantNodes().OfType<AttributeArgumentSyntax>(); 7578var attrArgSyntax = tree.GetCompilationUnitRoot().DescendantNodes().OfType<AttributeArgumentSyntax>().Single(); 11637var firstArgument = tree.GetRoot().DescendantNodes().OfType<AttributeArgumentSyntax>().First(); 11641var secondArgument = tree.GetRoot().DescendantNodes().OfType<AttributeArgumentSyntax>().Skip(1).First(); 11645var thirdArgument = tree.GetRoot().DescendantNodes().OfType<AttributeArgumentSyntax>().Skip(2).Single();
Attributes\AttributeTests_RefReadOnly.cs (4)
1379var userFunction = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Single(method => method.Identifier.Text == "User"); 1421var userFunction = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Single(method => method.Identifier.Text == "User"); 1450var userFunction = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Single(method => method.Identifier.Text == "User"); 1477var userFunction = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Single(method => method.Identifier.Text == "User");
Attributes\AttributeTests_WellKnownAttributes.cs (7)
5768var localFunctionSyntax = tree.GetRoot().DescendantNodes().OfType<LocalFunctionStatementSyntax>().Single(); 9550var syntax = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().Single(); 9599var syntax = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().Single(); 9655var syntax = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Last(n => n.Identifier.ValueText == "OnBehaviorAttached"); 11398var exprs = tree.GetRoot().DescendantNodes().OfType<LambdaExpressionSyntax>().ToImmutableArray(); 11423var exprs = tree.GetRoot().DescendantNodes().OfType<LambdaExpressionSyntax>().ToImmutableArray(); 11454var exprs = tree.GetRoot().DescendantNodes().OfType<LambdaExpressionSyntax>().ToImmutableArray();
Diagnostics\DiagnosticAnalyzerTests.cs (4)
3682var field1 = tree1.GetRoot().DescendantNodes().OfType<FieldDeclarationSyntax>().Single().Declaration.Variables.Single().Identifier; 3749var localDecl1 = tree.GetRoot().DescendantNodes().OfType<LocalDeclarationStatementSyntax>().First(); 4152var baseListNode = root.DescendantNodes().OfType<BaseListSyntax>().Single(); 4310var localDeclaration = tree.GetRoot().DescendantNodes().OfType<LocalDeclarationStatementSyntax>().First();
Diagnostics\GetDiagnosticsTests.cs (3)
782var localDecl = syntaxTree.GetRoot().DescendantNodes().OfType<LocalDeclarationStatementSyntax>().First(); 1061var localDecl = syntaxTree.GetRoot().DescendantNodes().OfType<LocalDeclarationStatementSyntax>().First(); 1549var localDecl = tree1.GetRoot().DescendantNodes().OfType<LocalDeclarationStatementSyntax>().First();
FieldKeywordTests.cs (9)
1275var attributeArguments = tree.GetRoot().DescendantNodes().OfType<AttributeArgumentSyntax>().Select(arg => arg.Expression).ToArray(); 1333var attributeArguments = tree.GetRoot().DescendantNodes().OfType<AttributeArgumentSyntax>().Select(arg => arg.Expression).ToArray(); 9474return tree.GetRoot().DescendantNodes().OfType<PropertyDeclarationSyntax>(). 10490var previousAccessor = tree.GetRoot().DescendantNodes().OfType<AccessorDeclarationSyntax>().Single(); 10493var modifiedAccessor = modifiedTree.GetRoot().DescendantNodes().OfType<AccessorDeclarationSyntax>().Single(); 10495var expr = modifiedAccessor.DescendantNodes().OfType<FieldExpressionSyntax>().Single(); 10524var previousAccessor = tree.GetRoot().DescendantNodes().OfType<AccessorDeclarationSyntax>().First(); 10527var modifiedAccessor = modifiedTree.GetRoot().DescendantNodes().OfType<AccessorDeclarationSyntax>().First(); 10529var expr = modifiedAccessor.DescendantNodes().OfType<FieldExpressionSyntax>().Single();
FirstClassSpanTests.cs (4)
2824var arg = tree.GetRoot().DescendantNodes().OfType<ReturnStatementSyntax>().Single().Expression; 2857var casts = tree.GetRoot().DescendantNodes().OfType<CastExpressionSyntax>().ToImmutableArray(); 5001var aVariable = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().First(); 5004var d1Access = tree.GetRoot().DescendantNodes().OfType<MemberAccessExpressionSyntax>()
FlowAnalysis\FlowTestBase.cs (6)
125foreach (var expr in GetSyntaxNodeList(tree).OfType<ConstructorInitializerSyntax>()) 146foreach (var expr in GetSyntaxNodeList(tree).OfType<PrimaryConstructorBaseTypeSyntax>()) 178foreach (var expr in GetSyntaxNodeList(tree).OfType<ExpressionSyntax>()) 199foreach (var stmt in GetSyntaxNodeList(tree).OfType<StatementSyntax>()) 218return GetSyntaxNodeList(tree).OfType<T>().Where(n => n.Span.Contains(offset)).FirstOrDefault(); 224return GetSyntaxNodeList(tree).OfType<T>().Where(n => n.Span.Contains(offset)).Last();
FlowAnalysis\FlowTests.cs (1)
5841var declarations = tree.GetRoot().DescendantNodes().OfType<PropertyDeclarationSyntax>().ToImmutableArray();
FlowAnalysis\IterationJumpYieldStatementTests.cs (1)
914var foreachNode = tree.GetCompilationUnitRoot().DescendantNodes().OfType<ForEachStatementSyntax>().Single();
FlowAnalysis\RegionAnalysisTests.cs (25)
3102var statement = compilation.SyntaxTrees[0].GetCompilationUnitRoot().DescendantNodesAndSelf().OfType<StatementSyntax>().First(); 4526var stmt1 = tree.GetCompilationUnitRoot().DescendantNodesAndSelf().OfType<StatementSyntax>().Where(n => n.ToString() == "IntPtr p;").Single(); 4527var stmt2 = tree.GetCompilationUnitRoot().DescendantNodesAndSelf().OfType<StatementSyntax>().Where(n => n.ToString().StartsWith(keyword)).First(); 5487var methodBlock = tree.GetCompilationUnitRoot().DescendantNodes().OfType<BlockSyntax>().First(); 5488var foreachStatement = methodBlock.DescendantNodes().OfType<ForEachStatementSyntax>().First(); 5489var foreachBlock = foreachStatement.DescendantNodes().OfType<BlockSyntax>().First(); 5490var lambdaExpression = methodBlock.DescendantNodes().OfType<ParenthesizedLambdaExpressionSyntax>().First(); 5491var lambdaBlock = lambdaExpression.DescendantNodes().OfType<BlockSyntax>().First(); 5536var node = root.DescendantNodes().OfType<LambdaExpressionSyntax>().Single(); 5580var node = root.DescendantNodes().OfType<LambdaExpressionSyntax>().Single(); 5623var node = root.DescendantNodes().OfType<LambdaExpressionSyntax>().Single(); 6217var invocation = tree.GetCompilationUnitRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().Single(); 6228var lambda = tree.GetCompilationUnitRoot().DescendantNodes().OfType<ParenthesizedLambdaExpressionSyntax>().Single(); 6418var statement = tree.GetCompilationUnitRoot().DescendantNodes().OfType<BlockSyntax>().FirstOrDefault(); 7909var stmt = tree.GetCompilationUnitRoot().DescendantNodesAndSelf().OfType<ForEachStatementSyntax>().Single().Statement; 8099var expr = tree.GetRoot().DescendantNodes().OfType<LiteralExpressionSyntax>().Single(); 8127var expr = tree.GetRoot().DescendantNodes().OfType<LiteralExpressionSyntax>().Single(); 14121var assignment = tree.GetRoot().DescendantNodes().OfType<AssignmentExpressionSyntax>().Single(); 14144var assignment = tree.GetRoot().DescendantNodes().OfType<AssignmentExpressionSyntax>().Single(); 14169var decls = tree.GetRoot().DescendantNodes().OfType<LocalDeclarationStatementSyntax>().ToArray(); 14176var binOps = tree.GetRoot().DescendantNodes().OfType<BinaryExpressionSyntax>().ToArray(); 14207var decl = tree.GetRoot().DescendantNodes().OfType<ExpressionStatementSyntax>().Single(); 14212var binOps = tree.GetRoot().DescendantNodes().OfType<BinaryExpressionSyntax>().ToArray(); 14252var decl = tree.GetRoot().DescendantNodes().OfType<ExpressionStatementSyntax>().Last(); 14258var binOps = tree.GetRoot().DescendantNodes().OfType<BinaryExpressionSyntax>().ToArray();
OverloadResolutionPriorityTests.cs (8)
444var invocation = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().Single(); 700var invocation = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().Single(); 760var accesses = tree.GetRoot().DescendantNodes().OfType<ElementAccessExpressionSyntax>().ToArray(); 808var creation = tree.GetRoot().DescendantNodes().OfType<ObjectCreationExpressionSyntax>().Single(); 979var secondCtor = tree.GetRoot().DescendantNodes().OfType<ConstructorDeclarationSyntax>().Skip(ctorToForce).First(); 2313var invocation = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().First(); 2411var invocation = tree.GetRoot().DescendantNodes().OfType<ObjectCreationExpressionSyntax>().First(); 2584.OfType<ElementAccessExpressionSyntax>()
RefReadonlyParameterTests.cs (5)
1525var local = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().Single(); 7102var docComment = tree.GetCompilationUnitRoot().DescendantTrivia().Select(trivia => trivia.GetStructure()).OfType<DocumentationCommentTriviaSyntax>().Single(); 7103var cref = docComment.DescendantNodes().OfType<XmlCrefAttributeSyntax>().Select(attr => attr.Cref).Single(); 7130var docComment = tree.GetCompilationUnitRoot().DescendantTrivia().Select(trivia => trivia.GetStructure()).OfType<DocumentationCommentTriviaSyntax>().Single(); 7131var cref = docComment.DescendantNodes().OfType<XmlCrefAttributeSyntax>().Select(attr => attr.Cref).Single();
RefStructInterfacesTests.cs (114)
6629var node = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Where(m => m.Identifier.ValueText == "Main").Single(); 6766var node = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Where(m => m.Identifier.ValueText == "Test1").Single(); 6882var node = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Where(m => m.Identifier.ValueText == "Main").Single(); 7014var node = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Where(m => m.Identifier.ValueText == "Test").Single(); 7143var node = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Where(m => m.Identifier.ValueText == "Test").Single(); 7473var node = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Where(m => m.Identifier.ValueText == "Main").Single(); 7576var foreachSyntax = tree.GetRoot().DescendantNodes().OfType<ForEachStatementSyntax>().Single(); 7663var node = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Where(m => m.Identifier.ValueText == "Main").Single(); 7766var foreachSyntax = tree.GetRoot().DescendantNodes().OfType<ForEachStatementSyntax>().Single(); 7882var node = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Where(m => m.Identifier.ValueText == "Test1").Single(); 7985var foreachSyntax = tree.GetRoot().DescendantNodes().OfType<ForEachStatementSyntax>().First(); 8076var node = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Where(m => m.Identifier.ValueText == "Test").Single(); 8176var foreachSyntax = tree.GetRoot().DescendantNodes().OfType<ForEachStatementSyntax>().Single(); 8269var node = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Where(m => m.Identifier.ValueText == "Test").Single(); 8369var foreachSyntax = tree.GetRoot().DescendantNodes().OfType<ForEachStatementSyntax>().Single(); 8442var node = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Where(m => m.Identifier.ValueText == "Test").Single(); 8444var foreachSyntax = tree.GetRoot().DescendantNodes().OfType<ForEachStatementSyntax>().Single(); 8548var node = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Where(m => m.Identifier.ValueText == "Test").Single(); 8648var foreachSyntax = tree.GetRoot().DescendantNodes().OfType<ForEachStatementSyntax>().Single(); 8932var node = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Where(m => m.Identifier.ValueText == "Main").Single(); 9019var foreachSyntax = tree.GetRoot().DescendantNodes().OfType<ForEachStatementSyntax>().Single(); 9136var node = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Where(m => m.Identifier.ValueText == "Main").Single(); 9223var foreachSyntax = tree.GetRoot().DescendantNodes().OfType<ForEachStatementSyntax>().Single(); 9332var node = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Where(m => m.Identifier.ValueText == "Main").Single(); 9387var foreachSyntax = tree.GetRoot().DescendantNodes().OfType<ForEachStatementSyntax>().Single(); 9500var node = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Where(m => m.Identifier.ValueText == "Main").Single(); 9587var foreachSyntax = tree.GetRoot().DescendantNodes().OfType<ForEachStatementSyntax>().Single(); 9715var node = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Where(m => m.Identifier.ValueText == "Test").Single(); 9811var foreachSyntax = tree.GetRoot().DescendantNodes().OfType<ForEachStatementSyntax>().Single(); 9936var node = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Where(m => m.Identifier.ValueText == "Test").Single(); 10020var foreachSyntax = tree.GetRoot().DescendantNodes().OfType<ForEachStatementSyntax>().Single(); 10151var node = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Where(m => m.Identifier.ValueText == "Test").Single(); 10247var foreachSyntax = tree.GetRoot().DescendantNodes().OfType<ForEachStatementSyntax>().Single(); 10348var node = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Where(m => m.Identifier.ValueText == "Test").Single(); 10350var foreachSyntax = tree.GetRoot().DescendantNodes().OfType<ForEachStatementSyntax>().Single(); 10443var node = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Where(m => m.Identifier.ValueText == "Test").Single(); 10445var foreachSyntax = tree.GetRoot().DescendantNodes().OfType<ForEachStatementSyntax>().Single(); 10543var node = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Where(m => m.Identifier.ValueText == "Main").Single(); 10630var foreachSyntax = tree.GetRoot().DescendantNodes().OfType<ForEachStatementSyntax>().Single(); 10740var node = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Where(m => m.Identifier.ValueText == "Main").Single(); 10827var foreachSyntax = tree.GetRoot().DescendantNodes().OfType<ForEachStatementSyntax>().Single(); 10980var node = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Where(m => m.Identifier.ValueText == "Test1").Single(); 11067var foreachSyntax = tree.GetRoot().DescendantNodes().OfType<ForEachStatementSyntax>().First(); 11199var node = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Where(m => m.Identifier.ValueText == "Test").Single(); 11295var foreachSyntax = tree.GetRoot().DescendantNodes().OfType<ForEachStatementSyntax>().Single(); 11423var node = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Where(m => m.Identifier.ValueText == "Test").Single(); 11507var foreachSyntax = tree.GetRoot().DescendantNodes().OfType<ForEachStatementSyntax>().Single(); 11607var foreachSyntax = tree.GetRoot().DescendantNodes().OfType<ForEachStatementSyntax>().Single(); 11702var foreachSyntax = tree.GetRoot().DescendantNodes().OfType<ForEachStatementSyntax>().Single(); 12149var node = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Where(m => m.Identifier.ValueText == "Main").Single(); 12417var node = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Where(m => m.Identifier.ValueText == "Test1").Single(); 12662var node = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Where(m => m.Identifier.ValueText == "Main").Single(); 12925var node = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Where(m => m.Identifier.ValueText == "Test").Single(); 13192var node = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Where(m => m.Identifier.ValueText == "Test").Single(); 13454var node = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Where(m => m.Identifier.ValueText == "Test").Single(); 14152var node = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Where(m => m.Identifier.ValueText == "Main").Single(); 14259var foreachSyntax = tree.GetRoot().DescendantNodes().OfType<ForEachStatementSyntax>().Single(); 14493var node = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Where(m => m.Identifier.ValueText == "Main").Single(); 14600var foreachSyntax = tree.GetRoot().DescendantNodes().OfType<ForEachStatementSyntax>().Single(); 14855var node = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Where(m => m.Identifier.ValueText == "Test1").Single(); 14966var foreachSyntax = tree.GetRoot().DescendantNodes().OfType<ForEachStatementSyntax>().First(); 15206var node = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Where(m => m.Identifier.ValueText == "Test").Single(); 15310var foreachSyntax = tree.GetRoot().DescendantNodes().OfType<ForEachStatementSyntax>().Single(); 15554var node = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Where(m => m.Identifier.ValueText == "Test").Single(); 15658var foreachSyntax = tree.GetRoot().DescendantNodes().OfType<ForEachStatementSyntax>().Single(); 15733var node = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Where(m => m.Identifier.ValueText == "Test").Single(); 15735var foreachSyntax = tree.GetRoot().DescendantNodes().OfType<ForEachStatementSyntax>().Single(); 15988var node = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Where(m => m.Identifier.ValueText == "Test").Single(); 16096var foreachSyntax = tree.GetRoot().DescendantNodes().OfType<ForEachStatementSyntax>().Single(); 16759var node = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Where(m => m.Identifier.ValueText == "Main").Single(); 16761var foreachSyntax = tree.GetRoot().DescendantNodes().OfType<ForEachStatementSyntax>().Single(); 16824var node = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Where(m => m.Identifier.ValueText == "Main").Single(); 16826var foreachSyntax = tree.GetRoot().DescendantNodes().OfType<ForEachStatementSyntax>().Single(); 16889var node = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Where(m => m.Identifier.ValueText == "Main").Single(); 16891var foreachSyntax = tree.GetRoot().DescendantNodes().OfType<ForEachStatementSyntax>().Single(); 16973var node = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Where(m => m.Identifier.ValueText == "Main").Single(); 16975var foreachSyntax = tree.GetRoot().DescendantNodes().OfType<ForEachStatementSyntax>().Single(); 17061var node = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Where(m => m.Identifier.ValueText == "Main").Single(); 17063var foreachSyntax = tree.GetRoot().DescendantNodes().OfType<ForEachStatementSyntax>().Single(); 17154var node = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Where(m => m.Identifier.ValueText == "Main").Single(); 17156var foreachSyntax = tree.GetRoot().DescendantNodes().OfType<ForEachStatementSyntax>().Single(); 17251var node = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Where(m => m.Identifier.ValueText == "Main").Single(); 17253var foreachSyntax = tree.GetRoot().DescendantNodes().OfType<ForEachStatementSyntax>().Single(); 17335var node = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Where(m => m.Identifier.ValueText == "Main").Single(); 17337var foreachSyntax = tree.GetRoot().DescendantNodes().OfType<ForEachStatementSyntax>().Single(); 17656var node = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Where(m => m.Identifier.ValueText == "Main").Single(); 17763var foreachSyntax = tree.GetRoot().DescendantNodes().OfType<ForEachStatementSyntax>().Single(); 17853var node = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Where(m => m.Identifier.ValueText == "Main").Single(); 17960var foreachSyntax = tree.GetRoot().DescendantNodes().OfType<ForEachStatementSyntax>().Single(); 18076var node = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Where(m => m.Identifier.ValueText == "Test1").Single(); 18183var foreachSyntax = tree.GetRoot().DescendantNodes().OfType<ForEachStatementSyntax>().First(); 18276var node = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Where(m => m.Identifier.ValueText == "Test").Single(); 18380var foreachSyntax = tree.GetRoot().DescendantNodes().OfType<ForEachStatementSyntax>().Single(); 18477var node = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Where(m => m.Identifier.ValueText == "Test").Single(); 18581var foreachSyntax = tree.GetRoot().DescendantNodes().OfType<ForEachStatementSyntax>().Single(); 18653var node = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Where(m => m.Identifier.ValueText == "Test").Single(); 18655var foreachSyntax = tree.GetRoot().DescendantNodes().OfType<ForEachStatementSyntax>().Single(); 18761var node = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Where(m => m.Identifier.ValueText == "Test").Single(); 18865var foreachSyntax = tree.GetRoot().DescendantNodes().OfType<ForEachStatementSyntax>().Single(); 19129var node = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Where(m => m.Identifier.ValueText == "Main").Single(); 19200var foreachSyntax = tree.GetRoot().DescendantNodes().OfType<ForEachStatementSyntax>().Single(); 19300var node = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Where(m => m.Identifier.ValueText == "Main").Single(); 19371var foreachSyntax = tree.GetRoot().DescendantNodes().OfType<ForEachStatementSyntax>().Single(); 19473var node = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Where(m => m.Identifier.ValueText == "Main").Single(); 19528var foreachSyntax = tree.GetRoot().DescendantNodes().OfType<ForEachStatementSyntax>().Single(); 19625var node = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Where(m => m.Identifier.ValueText == "Main").Single(); 19696var foreachSyntax = tree.GetRoot().DescendantNodes().OfType<ForEachStatementSyntax>().Single(); 19864var foreachSyntax = tree.GetRoot().DescendantNodes().OfType<ForEachStatementSyntax>().Single(); 19967var node = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Where(m => m.Identifier.ValueText == "Test").Single(); 19969var foreachSyntax = tree.GetRoot().DescendantNodes().OfType<ForEachStatementSyntax>().Single(); 21239var lambda = tree.GetRoot().DescendantNodes().OfType<ParenthesizedLambdaExpressionSyntax>().Single(); 21245var localFunctions = tree.GetRoot().DescendantNodes().OfType<LocalFunctionStatementSyntax>().ToArray(); 21306var declarator = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().First(); 21708var lambdas = tree.GetRoot().DescendantNodes().OfType<ParenthesizedLambdaExpressionSyntax>().ToArray();
Semantics\CollectionExpressionTests.cs (51)
201var collections = tree.GetRoot().DescendantNodes().OfType<CollectionExpressionSyntax>().ToArray(); 236var collections = tree.GetRoot().DescendantNodes().OfType<CollectionExpressionSyntax>().ToArray(); 4770var invocation = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().First(); 7534var method = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Single(m => m.Identifier.Text == "Create"); 8257var method = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Single(m => m.Identifier.Text == "Create"); 8328var method = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Single(m => m.Identifier.Text == "Create"); 8412var method = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Single(m => m.Identifier.Text == "Create"); 8497var method = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Single(m => m.Identifier.Text == "Create"); 14234var returnValue = tree.GetRoot().DescendantNodes().OfType<ReturnStatementSyntax>().Last().Expression; 14310var returnValue = tree.GetRoot().DescendantNodes().OfType<ReturnStatementSyntax>().Last().Expression; 14383var collection = tree.GetRoot().DescendantNodes().OfType<CollectionExpressionSyntax>().Single(); 14446var cast = tree.GetRoot().DescendantNodes().OfType<ReturnStatementSyntax>().Last().Expression; 14451var value = tree.GetRoot().DescendantNodes().OfType<CastExpressionSyntax>().Last().Expression; 14570var cast = tree.GetRoot().DescendantNodes().OfType<ReturnStatementSyntax>().Last().Expression; 14575var value = tree.GetRoot().DescendantNodes().OfType<CastExpressionSyntax>().Last().Expression; 14653var nestedCollection = tree.GetRoot().DescendantNodes().OfType<CollectionExpressionSyntax>().Last(); 14742var nestedCollection = tree.GetRoot().DescendantNodes().OfType<CollectionExpressionSyntax>().Last(); 15080var collections = tree.GetRoot().DescendantNodes().OfType<CollectionExpressionSyntax>().ToArray(); 26013var method = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Single(m => m.Identifier.Text == "Create"); 26139var method = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Single(m => m.Identifier.Text == "Create"); 26253var method = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Single(m => m.Identifier.Text == "Create"); 26311var method = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Single(m => m.Identifier.Text == "Create"); 26382var method = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Single(m => m.Identifier.Text == "Create"); 26464var method = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Single(m => m.Identifier.Text == "Create"); 26530var method = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Single(m => m.Identifier.Text == "Create"); 26591var method = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Single(m => m.Identifier.Text == "Create"); 26661var method = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Single(m => m.Identifier.Text == "Create"); 26836var method = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Single(m => m.Identifier.Text == "Create"); 26901var method = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Single(m => m.Identifier.Text == "CreateCollection"); 26957var method = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Single(m => m.Identifier.Text == "Create"); 28620var collections = tree.GetRoot().DescendantNodes().OfType<CollectionExpressionSyntax>().ToArray(); 28664var collections = tree.GetRoot().DescendantNodes().OfType<CollectionExpressionSyntax>().ToArray(); 28710var collections = tree.GetRoot().DescendantNodes().OfType<CollectionExpressionSyntax>().ToArray(); 28754var collections = tree.GetRoot().DescendantNodes().OfType<CollectionExpressionSyntax>().ToArray(); 28797var collections = tree.GetRoot().DescendantNodes().OfType<CollectionExpressionSyntax>().ToArray(); 28840var collection = tree.GetRoot().DescendantNodes().OfType<CollectionExpressionSyntax>().Single(); 28879var collection = tree.GetRoot().DescendantNodes().OfType<CollectionExpressionSyntax>().Last(); 28912var collection = tree.GetRoot().DescendantNodes().OfType<CollectionExpressionSyntax>().Single(); 28946var collections = tree.GetRoot().DescendantNodes().OfType<CollectionExpressionSyntax>().ToArray(); 28999var collections = tree.GetRoot().DescendantNodes().OfType<CollectionExpressionSyntax>().ToArray(); 29065var collections = tree.GetRoot().DescendantNodes().OfType<CollectionExpressionSyntax>().ToArray(); 29126var collections = tree.GetRoot().DescendantNodes().OfType<CollectionExpressionSyntax>().ToArray(); 29202var collection = tree.GetRoot().DescendantNodes().OfType<CollectionExpressionSyntax>().Single(); 29245var collections = tree.GetRoot().DescendantNodes().OfType<CollectionExpressionSyntax>().ToArray(); 29292var collection = tree.GetRoot().DescendantNodes().OfType<CollectionExpressionSyntax>().Last(); 32304var collection = tree.GetRoot().DescendantNodes().OfType<CollectionExpressionSyntax>().Single(); 32399var collection = tree.GetRoot().DescendantNodes().OfType<CollectionExpressionSyntax>().Single(); 32441var collection = tree.GetRoot().DescendantNodes().OfType<CollectionExpressionSyntax>().Single(); 32486var collection = tree.GetRoot().DescendantNodes().OfType<CollectionExpressionSyntax>().Single(); 33465var collectionExpression = tree.GetRoot().DescendantNodes().OfType<CollectionExpressionSyntax>().First(); 33506var collectionExpression = tree.GetRoot().DescendantNodes().OfType<CollectionExpressionSyntax>().First();
Semantics\InlineArrayTests.cs (16)
2359var c = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(m => m.Identifier.ValueText == "c").Single(); 2394var c = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(m => m.Identifier.ValueText == "c").Single(); 2428var c = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(m => m.Identifier.ValueText == "c").Single(); 2508var f = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(m => m.Identifier.ValueText == "F").First(); 6033var f = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(m => m.Identifier.ValueText == "F").First(); 6199var f = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(m => m.Identifier.ValueText == "F").Last(); 8118var f = tree.GetRoot().DescendantNodes().OfType<AssignmentExpressionSyntax>().Last().Left; 8835var m3 = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(m => m.Identifier.ValueText == "M3").Single().Parent; 9203var m3 = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(m => m.Identifier.ValueText == "M3").Single(); 10547var f = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(m => m.Identifier.ValueText == "F").Last(); 11291var f = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(m => m.Identifier.ValueText == "F").Last(); 15208var f = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(m => m.Identifier.ValueText == "F").ToArray(); 16495var m3 = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(m => m.Identifier.ValueText == "M3").First().Parent; 18583var f = tree.GetRoot().DescendantNodes().OfType<ForEachStatementSyntax>().Single().Expression; 18909var f = tree.GetRoot().DescendantNodes().OfType<ForEachStatementSyntax>().Single().Expression; 19246var collection = tree.GetRoot().DescendantNodes().OfType<ForEachStatementSyntax>().Single().Expression;
Semantics\OutVarTests.cs (95)
178Assert.False(compilation.SyntaxTrees.Single().GetRoot().DescendantNodes().OfType<DeclarationExpressionSyntax>().Any()); 386Assert.False(compilation.SyntaxTrees.Single().GetRoot().DescendantNodes().OfType<DeclarationExpressionSyntax>().Any()); 423Assert.False(compilation.SyntaxTrees.Single().GetRoot().DescendantNodes().OfType<DeclarationExpressionSyntax>().Any()); 461Assert.False(compilation.SyntaxTrees.Single().GetRoot().DescendantNodes().OfType<DeclarationExpressionSyntax>().Any()); 499Assert.False(compilation.SyntaxTrees.Single().GetRoot().DescendantNodes().OfType<DeclarationExpressionSyntax>().Any()); 537Assert.False(compilation.SyntaxTrees.Single().GetRoot().DescendantNodes().OfType<DeclarationExpressionSyntax>().Any()); 575Assert.False(compilation.SyntaxTrees.Single().GetRoot().DescendantNodes().OfType<DeclarationExpressionSyntax>().Any()); 622Assert.False(compilation.SyntaxTrees.Single().GetRoot().DescendantNodes().OfType<DeclarationExpressionSyntax>().Any()); 659Assert.False(compilation.SyntaxTrees.Single().GetRoot().DescendantNodes().OfType<DeclarationExpressionSyntax>().Any()); 697Assert.False(compilation.SyntaxTrees.Single().GetRoot().DescendantNodes().OfType<DeclarationExpressionSyntax>().Any()); 737Assert.False(compilation.SyntaxTrees.Single().GetRoot().DescendantNodes().OfType<DeclarationExpressionSyntax>().Any()); 776Assert.False(compilation.SyntaxTrees.Single().GetRoot().DescendantNodes().OfType<DeclarationExpressionSyntax>().Any()); 816Assert.False(compilation.SyntaxTrees.Single().GetRoot().DescendantNodes().OfType<DeclarationExpressionSyntax>().Any()); 833return tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == name); 838return tree.GetRoot().DescendantNodes().OfType<DeclarationExpressionSyntax>() 854return tree.GetRoot().DescendantNodes().OfType<DeclarationExpressionSyntax>() 860return tree.GetRoot().DescendantNodes().OfType<DiscardDesignationSyntax>(); 865return tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(i => i.Identifier.ContextualKind() == SyntaxKind.UnderscoreToken); 870return tree.GetRoot().DescendantNodes().OfType<DeclarationExpressionSyntax>() 1078var typeofExpression = decl.Ancestors().OfType<TypeOfExpressionSyntax>().FirstOrDefault(); 1277if ((forStatement = decl.Ancestors().OfType<ForStatementSyntax>().FirstOrDefault()) != null && 1279forStatement.Statement.DescendantNodes().OfType<ForStatementSyntax>().Any(f => f.Condition == null)) 1284var containingStatement = decl.Ancestors().OfType<StatementSyntax>().FirstOrDefault(); 1302reference.Ancestors().OfType<DoStatementSyntax>().Join( 1303decl.Ancestors().OfType<DoStatementSyntax>(), d => d, d => d, (d1, d2) => true).Any()))) 5313var node = tree.GetRoot().DescendantNodes().OfType<EqualsValueClauseSyntax>().First(); 5583var node = tree.GetRoot().DescendantNodes().OfType<EqualsValueClauseSyntax>().Single(); 9702var d = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().Where(id => id.Identifier.ValueText == "d").Single(); 10269var d = tree.GetRoot().DescendantNodes().OfType<SingleVariableDesignationSyntax>().Where(id => id.Identifier.ValueText == "d").Single(); 11077var node = tree.GetRoot().DescendantNodes().OfType<EqualsValueClauseSyntax>().First(); 11335var node = tree.GetRoot().DescendantNodes().OfType<EqualsValueClauseSyntax>().Single(); 17749var x2Decl = tree.GetRoot().DescendantNodes().OfType<LocalDeclarationStatementSyntax>().Single(); 18444var initializer = tree.GetRoot().DescendantNodes().OfType<ConstructorInitializerSyntax>().Single(); 20658Assert.Equal(1, compilation.SyntaxTrees[0].GetRoot().DescendantNodesAndSelf().OfType<DeclarationExpressionSyntax>().Count()); 20954Assert.True(decl.Ancestors().OfType<VariableDeclaratorSyntax>().First().ArgumentList.Contains(decl)); 20958=> Assert.Empty(decl.Ancestors().OfType<VariableDeclaratorSyntax>()); 21370var e = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().Where(id => id.Identifier.ValueText == "e").Single(); 32232var b = (IFieldSymbol)model.GetDeclaredSymbol(tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().Where(d => d.Identifier.ValueText == "b").Single()); 32272var b = (IFieldSymbol)model.GetDeclaredSymbol(tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().Where(d => d.Identifier.ValueText == "b").Single()); 32312var a = (IFieldSymbol)model.GetDeclaredSymbol(tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().Where(d => d.Identifier.ValueText == "a").Single()); 32385var bDecl = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().Where(d => d.Identifier.ValueText == "b").Single(); 32483var x1Decl = tree.GetRoot().DescendantNodes().OfType<DeclarationExpressionSyntax>() 32506var one = node0.DescendantNodes().OfType<LiteralExpressionSyntax>().Single(); 32521var x1Decl = tree.GetRoot().DescendantNodes().OfType<DeclarationExpressionSyntax>() 32755var declarator = decl.Ancestors().OfType<VariableDeclaratorSyntax>().FirstOrDefault(); 33506var x = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(n => n.ToString() == "x").Single(); 33694var z1 = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "z1").First(); 34329var method = syntaxTree.GetCompilationUnitRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().ElementAt(i + 2); 34330var rankSpecifierOld = method.DescendantNodes().OfType<ArrayRankSpecifierSyntax>().Single(); 34543var method = syntaxTree.GetCompilationUnitRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().ElementAt(i + 2); 34544var rankSpecifierOld = method.DescendantNodes().OfType<ArrayRankSpecifierSyntax>().Single(); 35179var varType = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "var").Single(); 35218var varType = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "var").Single(); 35262var varType = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "var").Single(); 35293var varType = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "var").Single(); 35332var varType = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "var").Single(); 35364var varType = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "var").Single(); 35400var varType = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "var").Single(); 35439var varType = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "var").Single(); 35469var varType = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "var").Single(); 35506var varType = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "var").Single(); 35664var statementBefore = identifierBefore.Ancestors().OfType<StatementSyntax>().First(); 35668var identifierAfter = statementAfter.DescendantNodes().OfType<IdentifierNameSyntax>().Single(id => id.Identifier.ValueText == "G"); 35697var foreachStatement = tree.GetRoot().DescendantNodes().OfType<ForEachStatementSyntax>().Single(); 35852var node = tree.GetRoot().DescendantNodes().OfType<ObjectCreationExpressionSyntax>().Single(); 35898var node = tree.GetRoot().DescendantNodes().OfType<ObjectCreationExpressionSyntax>().Single(); 35982var initializerSyntax = tree.GetRoot().DescendantNodes().OfType<ConstructorInitializerSyntax>().Single(); 36001var blockBodySyntax = tree.GetRoot().DescendantNodes().OfType<BlockSyntax>().First(); 36026var expressionBodySyntax = tree.GetRoot().DescendantNodes().OfType<ArrowExpressionClauseSyntax>().First(); 36049var declarationSyntax = tree.GetRoot().DescendantNodes().OfType<ConstructorDeclarationSyntax>().First(); 36122var expressionBodySyntax = tree.GetRoot().DescendantNodes().OfType<ArrowExpressionClauseSyntax>().First(); 36146var blockBodySyntax = tree.GetRoot().DescendantNodes().OfType<BlockSyntax>().First(); 36170var propertyExpressionBodySyntax = tree.GetRoot().DescendantNodes().OfType<ArrowExpressionClauseSyntax>().ElementAt(1); 36175var declarationSyntax = tree.GetRoot().DescendantNodes().OfType<AccessorDeclarationSyntax>().Single(); 36230var node3 = tree.GetRoot().DescendantNodes().OfType<ArrowExpressionClauseSyntax>().First(); 36323var node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "Test3").Last(); 36363var method = tree2.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().First(); 36366var invocation = tree2.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().Single(); 36371Assert.True(model.TryGetSpeculativeSemanticModel(method.Body.SpanStart + 1, method.DescendantNodes().OfType<AttributeSyntax>().Single(), out speculativeModel)); 36409var method = tree2.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().First(); 36412var invocation = tree2.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().Skip(1).First(); 36416Assert.Same(symbolInfo.Symbol, speculativeModel.GetDeclaredSymbol(tree2.GetRoot().DescendantNodes().OfType<LocalFunctionStatementSyntax>().Where(l => l.Identifier.ValueText == "M2").Single())); 36449var method = tree2.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().First(); 36452var invocation = tree2.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().Single(); 36457var equalsValue = method.DescendantNodes().OfType<EqualsValueClauseSyntax>().Single(); 36491var method = tree2.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().First(); 36494var invocation = tree2.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().Single(); 36498Assert.Same(symbolInfo.Symbol, speculativeModel.GetDeclaredSymbol(tree2.GetRoot().DescendantNodes().OfType<LocalFunctionStatementSyntax>().Where(l => l.Identifier.ValueText == "M2").Single())); 36526var method = tree2.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().First(); 36529var invocation = tree2.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().Single(); 36534var equalsValue = method.DescendantNodes().OfType<ParameterSyntax>().Single() 36535.DescendantNodes().OfType<EqualsValueClauseSyntax>().Single(); 36564var method = tree2.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().First(); 36567var invocation = tree2.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().Single(); 36571Assert.Same(symbolInfo.Symbol, speculativeModel.GetDeclaredSymbol(tree2.GetRoot().DescendantNodes().OfType<LocalFunctionStatementSyntax>().Where(l => l.Identifier.ValueText == "M2").Single()));
Semantics\ParamsCollectionTests.cs (22)
119var nodes = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().Take(3).ToArray(); 218var nodes = tree.GetRoot().DescendantNodes().OfType<LiteralExpressionSyntax>().ToArray(); 334var nodes = tree.GetRoot().DescendantNodes().OfType<LiteralExpressionSyntax>().ToArray(); 517var nodes = tree.GetRoot().DescendantNodes().OfType<LiteralExpressionSyntax>().ToArray(); 662var nodes = tree.GetRoot().DescendantNodes().OfType<LiteralExpressionSyntax>().ToArray(); 1406var nodes = tree.GetRoot().DescendantNodes().OfType<LiteralExpressionSyntax>().ToArray(); 2530var nodes = tree.GetRoot().DescendantNodes().OfType<LiteralExpressionSyntax>().ToArray(); 2666var nodes = tree.GetRoot().DescendantNodes().OfType<LiteralExpressionSyntax>().ToArray(); 2757var parameter = (IParameterSymbol)model.GetDeclaredSymbol(tree.GetRoot().DescendantNodes().OfType<ParameterSyntax>().Single()); 2791parameter = (IParameterSymbol)model.GetDeclaredSymbol(tree.GetRoot().DescendantNodes().OfType<ParameterSyntax>().Single()); 2955var parameter = (IParameterSymbol)model.GetDeclaredSymbol(tree.GetRoot().DescendantNodes().OfType<ParameterSyntax>().Single()); 2986parameter = (IParameterSymbol)model.GetDeclaredSymbol(tree.GetRoot().DescendantNodes().OfType<ParameterSyntax>().Single()); 3596var node = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Where(m => m.Identifier.ValueText == "Test1").Single(); 3886var node = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Where(m => m.Identifier.ValueText == "Test1").Single(); 4340var parameter = (IParameterSymbol)model.GetDeclaredSymbol(tree.GetRoot().DescendantNodes().OfType<ParameterSyntax>().First()); 4346parameter = (IParameterSymbol)model.GetDeclaredSymbol(tree.GetRoot().DescendantNodes().OfType<ParameterSyntax>().Skip(1).First()); 5893var f1 = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "F1").Single(); 5895var f2 = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "F2").Single(); 5975var f1 = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "F1").Single(); 5977var f2 = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "F2").Single(); 9072var parameterDecl = tree.GetRoot().DescendantNodes().OfType<ParameterSyntax>().Where(p => p.Identifier.ValueText == "paramsParameter").Single(); 12533var node = tree.GetRoot().DescendantNodes().OfType<ForEachStatementSyntax>().Single();
Semantics\PatternMatchingTestBase.cs (9)
37return tree.GetRoot().DescendantNodes().OfType<SingleVariableDesignationSyntax>().Where(p => p.Parent.Kind() == SyntaxKind.DeclarationPattern || p.Parent.Kind() == SyntaxKind.VarPattern); 47return tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>(); 52return tree.GetRoot().DescendantNodes().OfType<DiscardDesignationSyntax>(); 62return tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == name); 291var declarator = designation.Ancestors().OfType<VariableDeclaratorSyntax>().FirstOrDefault(); 350Assert.True(decl.Ancestors().OfType<VariableDeclaratorSyntax>().First().ArgumentList.Contains(decl)); 354=> Assert.Empty(decl.Ancestors().OfType<VariableDeclaratorSyntax>()); 428Assert.Empty(tree.GetRoot().DescendantNodes().OfType<GlobalStatementSyntax>()); 459var node = tree.GetRoot().DescendantNodes().OfType<T>().ElementAt(index);
Semantics\PatternMatchingTests.cs (37)
849var yRef = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(name => name.Identifier.ValueText == id).Single(); 1432var x1Decl = tree.GetRoot().DescendantNodes().OfType<SingleVariableDesignationSyntax>().Where(p => p.Identifier.ValueText == "x1").ToArray(); 1433var x1Ref = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "x1").ToArray(); 1482var x1Decl = tree.GetRoot().DescendantNodes().OfType<SingleVariableDesignationSyntax>().Where(p => p.Identifier.ValueText == "x1").ToArray(); 1483var x1Ref = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "x1").ToArray(); 1591var x1Decl = tree.GetRoot().DescendantNodes().OfType<SingleVariableDesignationSyntax>().Where(p => p.Identifier.ValueText == "x1").ToArray(); 1592var x1Ref = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "x1").ToArray(); 1656var x1Decl = tree.GetRoot().DescendantNodes().OfType<SingleVariableDesignationSyntax>().Where(p => p.Identifier.ValueText == "x1").ToArray(); 1657var x1Ref = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "x1").ToArray(); 1662var x2Decl = tree.GetRoot().DescendantNodes().OfType<SingleVariableDesignationSyntax>().Where(p => p.Identifier.ValueText == "x2").ToArray(); 1663var x2Ref = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "x2").ToArray(); 1668var x3Decl = tree.GetRoot().DescendantNodes().OfType<SingleVariableDesignationSyntax>().Where(p => p.Identifier.ValueText == "x3").ToArray(); 1669var x3Ref = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "x3").ToArray(); 1739var x2Decl = tree.GetRoot().DescendantNodes().OfType<SingleVariableDesignationSyntax>().Where(p => p.Identifier.ValueText == "x2").ToArray(); 1740var x2Ref = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "x2").ToArray(); 1745var x3Decl = tree.GetRoot().DescendantNodes().OfType<SingleVariableDesignationSyntax>().Where(p => p.Identifier.ValueText == "x3").ToArray(); 1746var x3Ref = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "x3").ToArray(); 2702var x1Decl = tree.GetRoot().DescendantNodes().OfType<SingleVariableDesignationSyntax>().Where(p => p.Identifier.ValueText == "x1").ToArray(); 2703var x1Ref = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "x1").ToArray(); 2747var x1Decl = tree.GetRoot().DescendantNodes().OfType<SingleVariableDesignationSyntax>().Where(p => p.Identifier.ValueText == "x1").ToArray(); 2748var x1Ref = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "x1").ToArray(); 2791var x1Decl = tree.GetRoot().DescendantNodes().OfType<SingleVariableDesignationSyntax>().Where(p => p.Identifier.ValueText == "x1").ToArray(); 2792var x1Ref = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "x1").ToArray(); 2843var x1Decl = tree.GetRoot().DescendantNodes().OfType<SingleVariableDesignationSyntax>().Where(p => p.Identifier.ValueText == "x1").ToArray(); 2844var x1Ref = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "x1").ToArray(); 3040var x1Decl = tree.GetRoot().DescendantNodes().OfType<SingleVariableDesignationSyntax>().Where(p => p.Identifier.ValueText == "x1").ToArray(); 3041var x1Ref = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "x1").ToArray(); 3087var x1Decl = tree.GetRoot().DescendantNodes().OfType<SingleVariableDesignationSyntax>().Where(p => p.Identifier.ValueText == "x1").ToArray(); 3088var x1Ref = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "x1").ToArray(); 3265foreach (var isExpression in tree.GetRoot().DescendantNodes().OfType<IsPatternExpressionSyntax>()) 3445var declaration = tree.GetRoot().DescendantNodes().OfType<IsPatternExpressionSyntax>().Single(); 3577var node = tree.GetRoot().DescendantNodes().OfType<IsPatternExpressionSyntax>().First(); 6573var caseDefault = tree.GetRoot().DescendantNodes().OfType<CasePatternSwitchLabelSyntax>().First(); 11365var exprs = tree.GetRoot().DescendantNodes().OfType<LiteralExpressionSyntax>().ToArray(); 11389var locals = tree.GetRoot().DescendantNodes().OfType<SingleVariableDesignationSyntax>().ToArray(); 11410var syntax = tree.GetRoot().DescendantNodes().OfType<BlockSyntax>().Single(); 11467var syntax = tree.GetRoot().DescendantNodes().OfType<BlockSyntax>().Single();
Semantics\PatternMatchingTests_ListPatterns.cs (11)
3319var declarations = tree.GetRoot().DescendantNodes().OfType<VarPatternSyntax>().ToArray(); 3324var localDeclarations = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().ToArray(); 3618var nodes = tree.GetRoot().DescendantNodes().OfType<SingleVariableDesignationSyntax>(); 3676.OfType<PropertyPatternClauseSyntax>() 3720var designations = tree.GetRoot().DescendantNodes().OfType<SingleVariableDesignationSyntax>().ToArray(); 4085var declarations = tree.GetRoot().DescendantNodes().OfType<VarPatternSyntax>().ToArray(); 4172var declarations = tree.GetRoot().DescendantNodes().OfType<VarPatternSyntax>().ToArray(); 4249var declarations = tree.GetRoot().DescendantNodes().OfType<VarPatternSyntax>().ToArray(); 4363var declarations = tree.GetRoot().DescendantNodes().OfType<VarPatternSyntax>().ToArray(); 4405var nodes = tree.GetRoot().DescendantNodes().OfType<SingleVariableDesignationSyntax>(); 4556var declarations = tree.GetRoot().DescendantNodes().OfType<VarPatternSyntax>().ToArray();
Semantics\PatternMatchingTests_Scope.cs (73)
678var x1Decl = tree.GetRoot().DescendantNodes().OfType<SingleVariableDesignationSyntax>().Where(p => p.Identifier.ValueText == "x1").Single(); 679var x1Ref = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "x1").Single(); 713tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "SpeculateHere").Single().SpanStart, 719var x1Decl = tree.GetRoot().DescendantNodes().OfType<SingleVariableDesignationSyntax>().Where(p => p.Identifier.ValueText == "x1").Single(); 720var x1Ref = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "x1").ToArray(); 947var x1Decl = tree.GetRoot().DescendantNodes().OfType<SingleVariableDesignationSyntax>().Where(p => p.Identifier.ValueText == "x1").Single(); 948var x1Ref = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "x1").Single(); 982tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "SpeculateHere").Single().SpanStart, 988var x1Decl = tree.GetRoot().DescendantNodes().OfType<SingleVariableDesignationSyntax>().Where(p => p.Identifier.ValueText == "x1").Single(); 989var x1Ref = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "x1").ToArray(); 2222var yRef = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(name => name.Identifier.ValueText == id).ToArray(); 2358var yRef = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(name => name.Identifier.ValueText == id).ToArray(); 2421var yRef = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(name => name.Identifier.ValueText == id).ToArray(); 2486var yRef = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(name => name.Identifier.ValueText == id).Single(); 2556var yRef = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(name => name.Identifier.ValueText == id).Single(); 2712var yRef = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(name => name.Identifier.ValueText == id).ToArray(); 6525var d = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().Where(id => id.Identifier.ValueText == "d").Single(); 6590var x1Decl = tree.GetRoot().DescendantNodes().OfType<SingleVariableDesignationSyntax>().Where(p => p.Identifier.ValueText == "x1").Single(); 6591var x1Ref = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "x1").Single(); 6594var x4Decl = tree.GetRoot().DescendantNodes().OfType<SingleVariableDesignationSyntax>().Where(p => p.Identifier.ValueText == "x4").Single(); 6595var x4Ref = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "x4").ToArray(); 6601var x6Decl = tree.GetRoot().DescendantNodes().OfType<SingleVariableDesignationSyntax>().Where(p => p.Identifier.ValueText == "x6").Single(); 6602var x6Ref = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "x6").Single(); 6605var x8Decl = tree.GetRoot().DescendantNodes().OfType<SingleVariableDesignationSyntax>().Where(p => p.Identifier.ValueText == "x8").Single(); 6606var x8Ref = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "x8").ToArray(); 6610var x14Decl = tree.GetRoot().DescendantNodes().OfType<SingleVariableDesignationSyntax>().Where(p => p.Identifier.ValueText == "x14").ToArray(); 6611var x14Ref = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "x14").Single(); 6679var x1Decl = tree.GetRoot().DescendantNodes().OfType<SingleVariableDesignationSyntax>().Where(p => p.Identifier.ValueText == "x1").Single(); 6680var x1Ref = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "x1").Single(); 6683var x4Decl = tree.GetRoot().DescendantNodes().OfType<SingleVariableDesignationSyntax>().Where(p => p.Identifier.ValueText == "x4").Single(); 6684var x4Ref = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "x4").ToArray(); 6690var x6Decl = tree.GetRoot().DescendantNodes().OfType<SingleVariableDesignationSyntax>().Where(p => p.Identifier.ValueText == "x6").Single(); 6691var x6Ref = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "x6").Single(); 6694var x8Decl = tree.GetRoot().DescendantNodes().OfType<SingleVariableDesignationSyntax>().Where(p => p.Identifier.ValueText == "x8").Single(); 6695var x8Ref = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "x8").ToArray(); 6699var x14Decl = tree.GetRoot().DescendantNodes().OfType<SingleVariableDesignationSyntax>().Where(p => p.Identifier.ValueText == "x14").ToArray(); 6700var x14Ref = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "x14").Single(); 6838var x2Decl = tree.GetRoot().DescendantNodes().OfType<SingleVariableDesignationSyntax>().Where(p => p.Identifier.ValueText == "x2").ToArray(); 6839var x2Ref = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "x2").ToArray(); 6845var x3Decl = tree.GetRoot().DescendantNodes().OfType<SingleVariableDesignationSyntax>().Where(p => p.Identifier.ValueText == "x3").Single(); 6846var x3Ref = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "x3").ToArray(); 6850var x4Decl = tree.GetRoot().DescendantNodes().OfType<SingleVariableDesignationSyntax>().Where(p => p.Identifier.ValueText == "x4").Single(); 6851var x4Ref = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "x4").ToArray(); 6884bool success = model.TryGetSpeculativeSemanticModel(tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "SpeculateHere").Single().SpanStart, statement, out model); 6930var x1Decl = tree.GetRoot().DescendantNodes().OfType<SingleVariableDesignationSyntax>().Where(p => p.Identifier.ValueText == "x1").Single(); 6931var x1Ref = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "x1").ToArray(); 6936var d = tree.GetRoot().DescendantNodes().OfType<SingleVariableDesignationSyntax>().Where(id => id.Identifier.ValueText == "d").Single(); 10589var x1Decl = tree.GetRoot().DescendantNodes().OfType<SingleVariableDesignationSyntax>().Where(p => p.Identifier.ValueText == "x1").ToArray(); 10590var x1Ref = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "x1").ToArray(); 10597var x2Decl = tree.GetRoot().DescendantNodes().OfType<SingleVariableDesignationSyntax>().Where(p => p.Identifier.ValueText == "x2").Single(); 10598var x2Ref = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "x2").Single(); 10601var x3Decl = tree.GetRoot().DescendantNodes().OfType<SingleVariableDesignationSyntax>().Where(p => p.Identifier.ValueText == "x3").Single(); 10602var x3Ref = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "x3").Single(); 10605var x4Decl = tree.GetRoot().DescendantNodes().OfType<SingleVariableDesignationSyntax>().Where(p => p.Identifier.ValueText == "x4").Single(); 10606var x4Ref = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "x4").ToArray(); 10612var x5Decl = tree.GetRoot().DescendantNodes().OfType<SingleVariableDesignationSyntax>().Where(p => p.Identifier.ValueText == "x5").Single(); 10613var x5Ref = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "x5").ToArray(); 10617var x8Decl = tree.GetRoot().DescendantNodes().OfType<SingleVariableDesignationSyntax>().Where(p => p.Identifier.ValueText == "x8").ToArray(); 10618var x8Ref = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "x8").ToArray(); 10627var x9Decl = tree.GetRoot().DescendantNodes().OfType<SingleVariableDesignationSyntax>().Where(p => p.Identifier.ValueText == "x9").Single(); 10628var x9Ref = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "x9").Single(); 10631var x10Decl = tree.GetRoot().DescendantNodes().OfType<SingleVariableDesignationSyntax>().Where(p => p.Identifier.ValueText == "x10").Single(); 10632var x10Ref = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "x10").Single(); 10635var x11Decl = tree.GetRoot().DescendantNodes().OfType<SingleVariableDesignationSyntax>().Where(p => p.Identifier.ValueText == "x11").Single(); 10636var x11Ref = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "x11").ToArray(); 10640var x12Decl = tree.GetRoot().DescendantNodes().OfType<SingleVariableDesignationSyntax>().Where(p => p.Identifier.ValueText == "x12").Single(); 10641var x12Ref = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "x12").ToArray(); 10685var x1Decl = tree.GetRoot().DescendantNodes().OfType<SingleVariableDesignationSyntax>().Where(p => p.Identifier.ValueText == "x1").Single(); 10686var x1Ref = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "x1").Single(); 10720tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "SpeculateHere").Single().SpanStart, 10726var x1Decl = tree.GetRoot().DescendantNodes().OfType<SingleVariableDesignationSyntax>().Where(p => p.Identifier.ValueText == "x1").Single(); 10727var x1Ref = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "x1").ToArray(); 12211var e = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().Where(id => id.Identifier.ValueText == "e").Single();
Semantics\PatternMatchingTests2.cs (9)
720foreach (var designation in tree.GetRoot().DescendantNodes().OfType<SingleVariableDesignationSyntax>()) 727foreach (var ident in tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>()) 2020var returnStatement = tree.GetRoot().DescendantNodes().OfType<ReturnStatementSyntax>().Single(); 2061var returnStatement = tree.GetRoot().DescendantNodes().OfType<ReturnStatementSyntax>().Single(); 2160foreach (var pat in tree.GetRoot().DescendantNodesAndSelf().OfType<PatternSyntax>()) 2251var patterns = tree.GetRoot().DescendantNodesAndSelf().OfType<PatternSyntax>().ToArray(); 2295var patterns = tree.GetRoot().DescendantNodesAndSelf().OfType<PatternSyntax>().ToArray(); 2341var patterns = tree.GetRoot().DescendantNodesAndSelf().OfType<PatternSyntax>().ToArray(); 2881var switches = tree.GetRoot().DescendantNodes().OfType<SwitchExpressionSyntax>().ToArray();
Semantics\PatternMatchingTests3.cs (12)
49var subpatterns = tree.GetRoot().DescendantNodes().OfType<SubpatternSyntax>().ToArray(); 109var subpatterns = tree.GetRoot().DescendantNodes().OfType<SubpatternSyntax>().ToArray(); 160var subpatterns = tree.GetRoot().DescendantNodes().OfType<SubpatternSyntax>().ToArray(); 205var subpatterns = tree.GetRoot().DescendantNodes().OfType<SubpatternSyntax>().ToArray(); 256var subpatterns = tree.GetRoot().DescendantNodes().OfType<SubpatternSyntax>().ToArray(); 299var subpatterns = tree.GetRoot().DescendantNodes().OfType<SubpatternSyntax>().ToArray(); 346var subpatterns = tree.GetRoot().DescendantNodes().OfType<SubpatternSyntax>().ToArray(); 1611var node1 = tree.GetRoot().DescendantNodes().OfType<BaseMethodDeclarationSyntax>().Single(); 1889var strDecl = tree.GetRoot().DescendantNodes().OfType<SingleVariableDesignationSyntax>().Where(s => s.Identifier.ValueText == "str").ToArray(); 1893var arrDecl = tree.GetRoot().DescendantNodes().OfType<SingleVariableDesignationSyntax>().Where(s => s.Identifier.ValueText == "arr").ToArray(); 4107var patterns = tree.GetRoot().DescendantNodes().OfType<PatternSyntax>().ToArray(); 4334var patterns = tree.GetRoot().DescendantNodes().OfType<PatternSyntax>().ToArray();
Semantics\PatternMatchingTests4.cs (13)
1010var dpcss = tree.GetRoot().DescendantNodes().OfType<PositionalPatternClauseSyntax>().ToArray(); 4017var @switch = tree.GetRoot().DescendantNodes().OfType<SwitchStatementSyntax>().Single(); 4086var @switch = tree.GetRoot().DescendantNodes().OfType<SwitchStatementSyntax>().Single(); 4159var @switch = tree.GetRoot().DescendantNodes().OfType<SwitchStatementSyntax>().Single(); 4231var @is = tree.GetRoot().DescendantNodes().OfType<IsPatternExpressionSyntax>().Single(); 4275var @switch = tree.GetRoot().DescendantNodes().OfType<SwitchExpressionSyntax>().Single(); 4322var @switch = tree.GetRoot().DescendantNodes().OfType<SwitchExpressionSyntax>().Single(); 4404var @switch = tree.GetRoot().DescendantNodes().OfType<SwitchExpressionSyntax>().Single(); 4486var @switch = tree.GetRoot().DescendantNodes().OfType<SwitchExpressionSyntax>().Single(); 4568var @switch = tree.GetRoot().DescendantNodes().OfType<SwitchExpressionSyntax>().Single(); 4650var @switch = tree.GetRoot().DescendantNodes().OfType<SwitchExpressionSyntax>().Single(); 4734var @switch = tree.GetRoot().DescendantNodes().OfType<SwitchExpressionSyntax>().Single(); 4828var x = tree.GetRoot().DescendantNodes().OfType<SingleVariableDesignationSyntax>().First();
Semantics\PatternMatchingTests5.cs (9)
427var isPattern = tree.GetRoot().DescendantNodes().OfType<IsPatternExpressionSyntax>().Single(); 564var isPattern = tree.GetRoot().DescendantNodes().OfType<IsPatternExpressionSyntax>().Single(); 795var isPattern = tree.GetRoot().DescendantNodes().OfType<IsPatternExpressionSyntax>().Single(); 841var isPattern = tree.GetRoot().DescendantNodes().OfType<IsPatternExpressionSyntax>().Single(); 895var isPattern = tree.GetRoot().DescendantNodes().OfType<IsPatternExpressionSyntax>().Single(); 1106var subpatterns = tree.GetRoot().DescendantNodes().OfType<SubpatternSyntax>().ToArray(); 1186var subpatterns = tree.GetRoot().DescendantNodes().OfType<SubpatternSyntax>().ToArray(); 1237var subpatterns = tree.GetRoot().DescendantNodes().OfType<SubpatternSyntax>().ToArray(); 1289var subpatterns = tree.GetRoot().DescendantNodes().OfType<SubpatternSyntax>().ToArray();
Semantics\PatternSwitchTests.cs (6)
1515var sRef = tree.GetCompilationUnitRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(n => n.ToString() == "s").Single(); 1517var iRef = tree.GetCompilationUnitRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(n => n.ToString() == "i").Single(); 1519var s2Ref = tree.GetCompilationUnitRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(n => n.ToString() == "s2").Single(); 1521var i2Ref = tree.GetCompilationUnitRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(n => n.ToString() == "i2").Single(); 3253.OfType<IdentifierNameSyntax>() 3284.OfType<IdentifierNameSyntax>()
Semantics\PrimaryConstructorTests.cs (60)
420var parameters = tree.GetRoot().DescendantNodes().OfType<ParameterSyntax>().ToArray(); 961var outVarSyntax = tree.GetRoot().DescendantNodes().OfType<SingleVariableDesignationSyntax>().Single(); 1003var xs = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "X").ToArray(); 1072var x = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "X").ElementAt(1); 1085var baseWithargs = tree.GetRoot().DescendantNodes().OfType<PrimaryConstructorBaseTypeSyntax>().Single(); 1184var equalsValue = tree.GetRoot().DescendantNodes().OfType<EqualsValueClauseSyntax>().First(); 1194var baseWithargs = tree.GetRoot().DescendantNodes().OfType<ConstructorInitializerSyntax>().Single(); 1220var equalsValue = tree.GetRoot().DescendantNodes().OfType<EqualsValueClauseSyntax>().Last(); 1300var x = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "X").ElementAt(1); 1311var y = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "y").First(); 1324var test = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "Test").First(); 1365var x = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "X").First(); 1411var x = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "X").First(); 1422var classDeclarations = tree.GetRoot().DescendantNodes().OfType<ClassDeclarationSyntax>().Skip(1).ToArray(); 1467var xs = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "X").ToArray(); 1483var classDeclarations = tree.GetRoot().DescendantNodes().OfType<ClassDeclarationSyntax>().Skip(1).ToArray(); 1526var xs = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "X").ToArray(); 1551var classDeclarations = tree.GetRoot().DescendantNodes().OfType<ClassDeclarationSyntax>().Skip(1).ToArray(); 1615var xs = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "X").ToArray(); 1640var classDeclarations = tree.GetRoot().DescendantNodes().OfType<ClassDeclarationSyntax>().Skip(1).ToArray(); 1814var x = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "X").First(); 1854var x = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "X").First(); 1897var x = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "X").First(); 1967var x = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "X").ElementAt(1); 2118var baseWithargs = tree.GetRoot().DescendantNodes().OfType<PrimaryConstructorBaseTypeSyntax>().Single(); 2173Assert.False(model.TryGetSpeculativeSemanticModel(tree.GetRoot().DescendantNodes().OfType<ReturnStatementSyntax>().Single().SpanStart, 2217Assert.Equal(TypeInfo.None, model.GetSpeculativeTypeInfo(tree.GetRoot().DescendantNodes().OfType<ConstructorInitializerSyntax>().Single().ArgumentList.OpenParenToken.SpanStart, 2221var baseWithargs = tree.GetRoot().DescendantNodes().OfType<ConstructorInitializerSyntax>().Single(); 2300var baseWithargs = tree.GetRoot().DescendantNodes().OfType<PrimaryConstructorBaseTypeSyntax>().Single(); 2325Assert.False(model.TryGetSpeculativeSemanticModel(tree.GetRoot().DescendantNodes().OfType<ReturnStatementSyntax>().Single().SpanStart, 2356Assert.Equal(TypeInfo.None, model.GetSpeculativeTypeInfo(tree.GetRoot().DescendantNodes().OfType<ConstructorInitializerSyntax>().Single().ArgumentList.OpenParenToken.SpanStart, 2360var baseWithargs = tree.GetRoot().DescendantNodes().OfType<ConstructorInitializerSyntax>().Single(); 2425var x = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "X").First(); 2474tree.GetRoot().DescendantNodes().OfType<PrimaryConstructorBaseTypeSyntax>().First(); 2484tree.GetRoot().DescendantNodes().OfType<PrimaryConstructorBaseTypeSyntax>().Skip(1).First(); 2489var baseWithoutParens = tree.GetRoot().DescendantNodes().OfType<SimpleBaseTypeSyntax>().Single(); 2641var x = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "X").First(); 2652var typeDeclaration = tree.GetRoot().DescendantNodes().OfType<TypeDeclarationSyntax>().Single(); 2679var x = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "X").First(); 2716var x = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "X").First(); 2752var x = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "X").First(); 6090var doc = tree.GetRoot().DescendantTrivia().Select(trivia => trivia.GetStructure()).OfType<DocumentationCommentTriviaSyntax>().Single(); 6091var x = doc.DescendantNodes().OfType<IdentifierNameSyntax>().Single(); 6832var xReference = tree.GetRoot().DescendantNodes().OfType<PrimaryConstructorBaseTypeSyntax>().Single().ArgumentList.Arguments[0].Expression; 6858var mCall = tree.GetRoot().DescendantNodes().OfType<PrimaryConstructorBaseTypeSyntax>().Single().ArgumentList.Arguments[0].Expression; 6859var attrApplication = tree.GetRoot().DescendantNodes().OfType<AttributeSyntax>().Single(); 6860var mDefinition = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Single(); 7794var p1 = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "p1").Single(); 8756var p1s = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "p1").ToArray(); 9162var p1s = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "p1").ToArray(); 19784var indexer = tree.GetRoot().DescendantNodes().OfType<ElementAccessExpressionSyntax>().Single(); 20610var typeDeclaration = tree.GetRoot().ChildNodes().OfType<TypeDeclarationSyntax>().Single(); 20644var typeDeclaration1 = root.ChildNodes().OfType<TypeDeclarationSyntax>().First(); 20655var typeDeclaration2 = root.ChildNodes().OfType<TypeDeclarationSyntax>().Last(); 20688var typeDeclaration1 = root.ChildNodes().OfType<TypeDeclarationSyntax>().First(); 20699var typeDeclaration2 = root.ChildNodes().OfType<TypeDeclarationSyntax>().Last(); 20735var typeDeclaration1 = root.ChildNodes().OfType<TypeDeclarationSyntax>().First(); 20744var typeDeclaration2 = root.ChildNodes().OfType<TypeDeclarationSyntax>().Last(); 20785var typeDeclaration1 = root.ChildNodes().OfType<TypeDeclarationSyntax>().First(); 20796var typeDeclaration2 = root.ChildNodes().OfType<TypeDeclarationSyntax>().Last();
Semantics\RecordTests.cs (59)
282var node = tree.GetRoot().DescendantNodes().OfType<BinaryExpressionSyntax>().Single(); 448var parameterSyntax = tree.GetRoot().DescendantNodes().OfType<ParameterSyntax>().Single(); 454var initializerSyntax = tree.GetRoot().DescendantNodes().OfType<EqualsValueClauseSyntax>().Single(); 480var outVarSyntax = tree.GetRoot().DescendantNodes().OfType<SingleVariableDesignationSyntax>().Single(); 1816var main = root.DescendantNodes().OfType<MethodDeclarationSyntax>().First(); 2489var x = tree.GetRoot().DescendantNodes().OfType<AssignmentExpressionSyntax>().Last().Left; 8091var withExpr1 = root.DescendantNodes().OfType<WithExpressionSyntax>().First(); 8130var main = root.DescendantNodes().OfType<MethodDeclarationSyntax>().First(); 8603var withExpr = root.DescendantNodes().OfType<WithExpressionSyntax>().Single(); 8630var main = root.DescendantNodes().OfType<MethodDeclarationSyntax>().Single(); 8717var withExpr = root.DescendantNodes().OfType<WithExpressionSyntax>().Single(); 8735var main = root.DescendantNodes().OfType<MethodDeclarationSyntax>().Single(); 8865var withExpr1 = root.DescendantNodes().OfType<WithExpressionSyntax>().First(); 8878var withExpr2 = root.DescendantNodes().OfType<WithExpressionSyntax>().Skip(1).Single(); 21189var x = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "X").ElementAt(1); 21202var baseWithargs = tree.GetRoot().DescendantNodes().OfType<PrimaryConstructorBaseTypeSyntax>().Single(); 21302var equalsValue = tree.GetRoot().DescendantNodes().OfType<EqualsValueClauseSyntax>().First(); 21313var baseWithargs = tree.GetRoot().DescendantNodes().OfType<ConstructorInitializerSyntax>().Single(); 21339var equalsValue = tree.GetRoot().DescendantNodes().OfType<EqualsValueClauseSyntax>().Last(); 21419var x = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "X").ElementAt(1); 21430var y = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "y").First(); 21443var test = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "Test").First(); 21484var x = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "X").First(); 21530var x = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "X").First(); 21541var recordDeclarations = tree.GetRoot().DescendantNodes().OfType<RecordDeclarationSyntax>().Skip(1).ToArray(); 21586var xs = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "X").ToArray(); 21602var recordDeclarations = tree.GetRoot().DescendantNodes().OfType<RecordDeclarationSyntax>().Skip(1).ToArray(); 21645var xs = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "X").ToArray(); 21670var recordDeclarations = tree.GetRoot().DescendantNodes().OfType<RecordDeclarationSyntax>().Skip(1).ToArray(); 21734var xs = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "X").ToArray(); 21759var recordDeclarations = tree.GetRoot().DescendantNodes().OfType<RecordDeclarationSyntax>().Skip(1).ToArray(); 21933var x = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "X").First(); 21970var x = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "X").First(); 22010var x = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "X").First(); 22045var x = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "X").First(); 22124var x = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "X").ElementAt(1); 22275var baseWithargs = tree.GetRoot().DescendantNodes().OfType<PrimaryConstructorBaseTypeSyntax>().Single(); 22330Assert.False(model.TryGetSpeculativeSemanticModel(tree.GetRoot().DescendantNodes().OfType<ReturnStatementSyntax>().Single().SpanStart, 22374Assert.Equal(TypeInfo.None, model.GetSpeculativeTypeInfo(tree.GetRoot().DescendantNodes().OfType<ConstructorInitializerSyntax>().Single().ArgumentList.OpenParenToken.SpanStart, 22378var baseWithargs = tree.GetRoot().DescendantNodes().OfType<ConstructorInitializerSyntax>().Single(); 22457var baseWithargs = tree.GetRoot().DescendantNodes().OfType<PrimaryConstructorBaseTypeSyntax>().Single(); 22482Assert.False(model.TryGetSpeculativeSemanticModel(tree.GetRoot().DescendantNodes().OfType<ReturnStatementSyntax>().Single().SpanStart, 22513Assert.Equal(TypeInfo.None, model.GetSpeculativeTypeInfo(tree.GetRoot().DescendantNodes().OfType<ConstructorInitializerSyntax>().Single().ArgumentList.OpenParenToken.SpanStart, 22517var baseWithargs = tree.GetRoot().DescendantNodes().OfType<ConstructorInitializerSyntax>().Single(); 22962var recordDeclaration = tree.GetRoot().DescendantNodes().OfType<RecordDeclarationSyntax>().First(); 23416var recordDeclaration = tree.GetRoot().DescendantNodes().OfType<RecordDeclarationSyntax>().ElementAt(1); 24688var x = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "X").First(); 24699var recordDeclaration = tree.GetRoot().DescendantNodes().OfType<RecordDeclarationSyntax>().Single(); 24723var x = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "X").First(); 24757var x = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "X").First(); 24792var x = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "X").First(); 28231var doc = tree.GetRoot().DescendantTrivia().Select(trivia => trivia.GetStructure()).OfType<DocumentationCommentTriviaSyntax>().First(); 28232var x = doc.DescendantNodes().OfType<IdentifierNameSyntax>().Single(); 28388var docComments = tree.GetCompilationUnitRoot().DescendantTrivia().Select(trivia => trivia.GetStructure()).OfType<DocumentationCommentTriviaSyntax>(); 28389var cref = docComments.First().DescendantNodes().OfType<XmlCrefAttributeSyntax>().First().Cref; 30416var xReference = tree.GetRoot().DescendantNodes().OfType<PrimaryConstructorBaseTypeSyntax>().Single().ArgumentList.Arguments[0].Expression; 30440var mCall = tree.GetRoot().DescendantNodes().OfType<PrimaryConstructorBaseTypeSyntax>().Single().ArgumentList.Arguments[0].Expression; 30441var attrApplication = tree.GetRoot().DescendantNodes().OfType<AttributeSyntax>().Single(); 30442var mDefinition = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Single();
Microsoft.CodeAnalysis.CSharp.EndToEnd.UnitTests (4)
EndToEndTests.cs (4)
493var node = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Single(); 614var literals = tree.GetRoot().DescendantNodes().OfType<LiteralExpressionSyntax>().ToArray(); 701var nodes = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().SelectAsArray(node => model.GetInterceptableLocation(node)); 880var isPattern = tree.GetRoot().DescendantNodes().OfType<IsPatternExpressionSyntax>().Single();
Microsoft.CodeAnalysis.CSharp.Features (79)
AddImport\CSharpAddImportFeatureService.cs (2)
253var query = node.AncestorsAndSelf().OfType<QueryExpressionSyntax>().First(); 502.OfType<AliasQualifiedNameSyntax>()
ChangeSignature\CSharpChangeSignatureService.cs (3)
189var parameters = matchingNode.ChildNodes().OfType<BaseParameterListSyntax>().SingleOrDefault(); 780.OfType<XmlElementSyntax>() 819var identifier = nameAttribute.DescendantNodes(descendIntoTrivia: true).OfType<IdentifierNameSyntax>().FirstOrDefault();
CodeRefactorings\ConvertLocalFunctionToMethod\CSharpConvertLocalFunctionToMethodCodeRefactoringProvider.cs (1)
302foreach (var id in localFunction.DescendantNodes().OfType<IdentifierNameSyntax>())
CodeRefactorings\InlineTemporary\InlineTemporaryCodeRefactoringProvider.cs (3)
184.OfType<ExpressionSyntax>() 275var parentExpressions = scope.AncestorsAndSelf().OfType<ExpressionSyntax>(); 432=> expression.AncestorsAndSelf().OfType<ExpressionSyntax>().Last();
CodeRefactorings\SyncNamespace\CSharpChangeNamespaceService.cs (2)
364var namespaceDecls = node.AncestorsAndSelf().OfType<BaseNamespaceDeclarationSyntax>().ToImmutableArray(); 391.OfType<BaseNamespaceDeclarationSyntax>().Any();
CodeRefactorings\SyncNamespace\CSharpSyncNamespaceCodeRefactoringProvider.cs (1)
39.OfType<BaseNamespaceDeclarationSyntax>().ToImmutableArray();
CodeRefactorings\UseRecursivePatterns\UseRecursivePatternsCodeRefactoringProvider.cs (1)
313.OfType<SingleVariableDesignationSyntax>()
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\ObjectAndWithInitializerCompletionProvider.cs (2)
178return [.. initializer.Expressions.OfType<AssignmentExpressionSyntax>() 181.OfType<IdentifierNameSyntax>()
Completion\CompletionProviders\PartialMethodCompletionProvider.cs (1)
84var declarations = method.DeclaringSyntaxReferences.Select(r => r.GetSyntax()).OfType<MethodDeclarationSyntax>();
Completion\KeywordRecommenders\AllowsKeywordRecommender.cs (1)
44.OfType<ClassOrStructConstraintSyntax>()
Completion\KeywordRecommenders\NewKeywordRecommender.cs (1)
105.OfType<ClassOrStructConstraintSyntax>()
Completion\KeywordRecommenders\RefKeywordRecommender.cs (1)
111.OfType<ClassOrStructConstraintSyntax>()
ConvertLinq\ConvertForEachToLinqQuery\CSharpConvertForEachToLinqQueryProvider.cs (1)
287var yieldStatementsCount = memberDeclarationSyntax.DescendantNodes().OfType<YieldStatementSyntax>()
ConvertLinq\CSharpConvertLinqQueryToForEachProvider.cs (1)
754if (memberDeclarationNode.DescendantNodes().OfType<ReturnStatementSyntax>().Count() == 1)
ConvertNamespace\ConvertNamespaceCodeRefactoringProvider.cs (1)
96var namespaceDecl = root.DescendantNodes().OfType<BaseNamespaceDeclarationSyntax>().FirstOrDefault();
ConvertProgram\ConvertProgramTransform_ProgramMain.cs (4)
39var oldClassDeclaration = root.Members.OfType<ClassDeclarationSyntax>().FirstOrDefault(IsProgramClass); 44var newRoot = root.RemoveNodes(root.Members.OfType<GlobalStatementSyntax>().Skip(1), SyntaxGenerator.DefaultRemoveOptions); 53var firstGlobalStatement = newRoot.Members.OfType<GlobalStatementSyntax>().Single(); 127foreach (var globalStatement in root.Members.OfType<GlobalStatementSyntax>())
ConvertProgram\ConvertProgramTransform_TopLevelStatements.cs (1)
63return root.Members.OfType<FileScopedNamespaceDeclarationSyntax>().FirstOrDefault() is { } fileScopedNamespace
ConvertToRawString\ConvertInterpolatedStringToRawStringCodeRefactoringProvider.cs (2)
357var interpolation = stringExpression.Contents.OfType<InterpolationSyntax>().Single(i => i.Span.Contains(start)); 500foreach (var descendant in interpolation.DescendantNodes().OfType<ExpressionSyntax>())
Debugging\CSharpProximityExpressionsService.Worker.cs (1)
220var statementAncestor = _parentStatement.Ancestors().OfType<StatementSyntax>().FirstOrDefault(node => !node.IsKind(SyntaxKind.Block));
DocumentationComments\CSharpDocumentationCommentSnippetService.cs (1)
190block.DescendantNodes().OfType<ThrowStatementSyntax>().Any(t => t.Expression is null))
EditAndContinue\CSharpEditAndContinueAnalyzer.cs (1)
1622var globalStatements = unit.Members.OfType<GlobalStatementSyntax>();
EncapsulateField\CSharpEncapsulateFieldService.cs (2)
130.OfType<FieldDeclarationSyntax>() 204c => c.DeclaringSyntaxReferences.Select(d => d.GetSyntax()).OfType<ConstructorDeclarationSyntax>());
ExtractMethod\CSharpMethodExtractor.CSharpCodeGenerator.cs (1)
791var returnOperations = methodOperation.DescendantsAndSelf().OfType<IReturnOperation>();
ExtractMethod\CSharpMethodExtractor.CSharpCodeGenerator.MultipleStatementsCodeGenerator.cs (1)
74GlobalStatementSyntax globalStatement => ((CompilationUnitSyntax)globalStatement.Parent).Members.OfType<GlobalStatementSyntax>().Select(globalStatement => globalStatement.Statement),
Formatting\CSharpNamespaceDeclarationNewDocumentFormattingProvider.cs (1)
47var declarations = root.DescendantNodes().OfType<BaseNamespaceDeclarationSyntax>();
GenerateType\CSharpGenerateTypeService.cs (1)
477? genericName.TypeArgumentList.Arguments.OfType<SyntaxNode>().ToList()
InheritanceMargin\CSharpInheritanceMarginService.cs (1)
30var typeDeclarationNodes = nodesToSearch.OfType<TypeDeclarationSyntax>();
IntroduceVariable\CSharpIntroduceVariableService_IntroduceLocal.cs (2)
291? scope.ChildNodes().OfType<GlobalStatementSyntax>() 322var firstAffectedGlobalStatement = compilationUnit.Members.OfType<GlobalStatementSyntax>().Single(s => firstAffectedExpression.GetAncestorOrThis<GlobalStatementSyntax>().Contains(s));
SignatureHelp\TupleConstructionSignatureHelpProvider.cs (1)
137var tupleTypes = inferredTypes.Where(t => t.IsTupleType).OfType<INamedTypeSymbol>().ToList();
src\Analyzers\CSharp\Analyzers\ConvertProgram\ConvertProgramAnalysis_ProgramMain.cs (2)
63return root.Members.OfType<GlobalStatementSyntax>().First().GetFirstToken().GetLocation(); 72TextSpan.FromBounds(start, root.Members.OfType<GlobalStatementSyntax>().Last().FullSpan.End));
src\Analyzers\CSharp\Analyzers\ConvertProgram\ConvertToTopLevelStatementsDiagnosticAnalyzer.cs (1)
66var methodDeclarations = root.DescendantNodes(n => n is CompilationUnitSyntax or BaseNamespaceDeclarationSyntax or ClassDeclarationSyntax).OfType<MethodDeclarationSyntax>();
src\Analyzers\CSharp\Analyzers\InlineDeclaration\CSharpInlineDeclarationDiagnosticAnalyzer.cs (1)
273return compilationUnit.Members.OfType<GlobalStatementSyntax>().Last().Statement;
src\Analyzers\CSharp\Analyzers\NewLines\EmbeddedStatementPlacement\EmbeddedStatementPlacementDiagnosticAnalyzer.cs (1)
113if (parent.DescendantNodes().OfType<StatementSyntax>().Count() <= 1)
src\Analyzers\CSharp\Analyzers\RemoveUnusedMembers\CSharpRemoveUnusedMembersDiagnosticAnalyzer.cs (1)
30.OfType<TypeDeclarationSyntax>();
src\Analyzers\CSharp\Analyzers\UseAutoProperty\CSharpUseAutoPropertyAnalyzer.cs (4)
72foreach (var argument in codeBlock.DescendantNodesAndSelf().OfType<ArgumentSyntax>()) 86foreach (var refExpression in codeBlock.DescendantNodesAndSelf().OfType<RefExpressionSyntax>()) 91foreach (var addressOfExpression in codeBlock.DescendantNodesAndSelf().OfType<PrefixUnaryExpressionSyntax>()) 97foreach (var memberAccess in codeBlock.DescendantNodesAndSelf().OfType<MemberAccessExpressionSyntax>())
src\Analyzers\CSharp\Analyzers\UseCollectionExpression\CSharpUseCollectionExpressionForBuilderDiagnosticAnalyzer.cs (1)
214foreach (var identifierName in statement.DescendantNodesAndSelf().OfType<IdentifierNameSyntax>())
src\Analyzers\CSharp\Analyzers\UseCollectionExpression\UseCollectionExpressionHelpers.cs (2)
552foreach (var identifier in containingBlock.DescendantNodes().OfType<IdentifierNameSyntax>()) 831if (assignmentExpression.Right.DescendantNodesAndSelf().OfType<IdentifierNameSyntax>().Any(
src\Analyzers\CSharp\Analyzers\UseDeconstruction\CSharpUseDeconstructionDiagnosticAnalyzer.cs (1)
252foreach (var identifierName in searchScope.DescendantNodes().OfType<IdentifierNameSyntax>())
src\Analyzers\CSharp\Analyzers\UsePatternMatching\CSharpAsAndNullCheckDiagnosticAnalyzer.Analyzer.cs (1)
269if (_declarator.DescendantNodesAndSelf().OfType<ExpressionSyntax>().Any(
src\Analyzers\CSharp\Analyzers\UseUnboundGenericTypeInNameOf\CSharpUseUnboundGenericTypeInNameOfDiagnosticAnalyzer.cs (1)
68foreach (var typeArgumentList in invocation.DescendantNodesAndSelf().OfType<TypeArgumentListSyntax>())
src\Analyzers\CSharp\Analyzers\UseUtf8StringLiteral\UseUtf8StringLiteralDiagnosticAnalyzer.cs (1)
82if (arrayCreationOperation.Syntax.Ancestors().OfType<AttributeSyntax>().Any())
src\Analyzers\CSharp\CodeFixes\ConvertToRecord\ConvertToRecordEngine.cs (3)
56.OfType<PropertyDeclarationSyntax>() 140foreach (var constructor in typeDeclaration.Members.OfType<ConstructorDeclarationSyntax>()) 219foreach (var method in typeDeclaration.Members.OfType<MethodDeclarationSyntax>())
src\Analyzers\CSharp\CodeFixes\DocumentationComments\CSharpAddDocCommentNodesCodeFixProvider.cs (2)
35=> node.StartTag.Attributes.OfType<XmlNameAttributeSyntax>().ToList(); 47var descendentXmlElements = nodeStructure.DescendantNodes().OfType<XmlElementSyntax>();
src\Analyzers\CSharp\CodeFixes\InlineDeclaration\CSharpInlineDeclarationCodeFixProvider.cs (1)
249return compilationUnit.Members.OfType<GlobalStatementSyntax>().Select(g => g.Statement).ToImmutableArray();
src\Analyzers\CSharp\CodeFixes\MakeStructFieldsWritable\CSharpMakeStructFieldsWritableCodeFixProvider.cs (1)
50.OfType<FieldDeclarationSyntax>();
src\Analyzers\CSharp\CodeFixes\MisplacedUsingDirectives\MisplacedUsingDirectivesCodeFixProvider.cs (3)
218var namespaceDeclarations = compilationUnit.Members.OfType<BaseNamespaceDeclarationSyntax>(); 252var namespaceDeclarations = usingContainer.Members.OfType<BaseNamespaceDeclarationSyntax>(); 401.OfType<BaseNamespaceDeclarationSyntax>();
src\Analyzers\CSharp\CodeFixes\NewLines\EmbeddedStatementPlacement\EmbeddedStatementPlacementCodeFixProvider.cs (2)
78var descendentStatements = startStatement.DescendantNodesAndSelf().OfType<StatementSyntax>(); 104var ancestorBlocks = startStatement.AncestorsAndSelf().OfType<BlockSyntax>();
src\Analyzers\CSharp\CodeFixes\RemoveUnnecessaryLambdaExpression\CSharpRemoveUnnecessaryLambdaExpressionCodeFixProvider.cs (1)
66var containingStatement = anonymousFunction.AncestorsAndSelf().OfType<StatementSyntax>().FirstOrDefault();
src\Analyzers\CSharp\CodeFixes\UsePatternMatching\CSharpAsAndMemberAccessCodeFixProvider.cs (1)
127unaryPattern.DescendantNodes().OfType<DeclarationPatternSyntax>().Any())
src\Analyzers\CSharp\CodeFixes\UsePrimaryConstructor\CSharpUsePrimaryConstructorCodeFixProvider.cs (2)
282parameterList.DescendantNodes().OfType<SimpleNameSyntax>(), 588var xmlElement = identifier.AncestorsAndSelf().OfType<XmlEmptyElementSyntax>().FirstOrDefault();
src\Analyzers\CSharp\CodeFixes\UseUnboundGenericTypeInNameOf\CSharpUseUnboundGenericTypeInNameOfCodeFixProvider.cs (1)
56foreach (var typeArgumentList in nameofInvocation.DescendantNodes().OfType<TypeArgumentListSyntax>().OrderByDescending(t => t.SpanStart))
src\Analyzers\CSharp\CodeFixes\UseUtf8StringLiteral\UseUtf8StringLiteralCodeFixProvider.cs (1)
119.OfType<IArrayCreationOperation>()
Microsoft.CodeAnalysis.CSharp.Features.UnitTests (18)
EditAndContinue\SyntaxUtilitiesTests.cs (18)
87var leftPosition = leftRoot.DescendantNodes().OfType<LiteralExpressionSyntax>().ElementAt(2).SpanStart; // 0 within Console.WriteLine(0) 134var leftPosition = leftRoot.DescendantNodes().OfType<LiteralExpressionSyntax>().ElementAt(5).SpanStart; // 3 within Console.WriteLine(3) 184var m0 = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Single(m => m.Identifier.ValueText == "M0"); 185var m1 = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Single(m => m.Identifier.ValueText == "M1"); 186var m2 = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Single(m => m.Identifier.ValueText == "M2"); 187var m3 = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Single(m => m.Identifier.ValueText == "M3"); 189var f1 = tree.GetRoot().DescendantNodes().OfType<LocalFunctionStatementSyntax>().Single(m => m.Identifier.ValueText == "f1"); 190var f2 = tree.GetRoot().DescendantNodes().OfType<LocalFunctionStatementSyntax>().Single(m => m.Identifier.ValueText == "f2"); 192var l1 = m3.DescendantNodes().OfType<VariableDeclaratorSyntax>().Single(m => m.Identifier.ValueText == "l1").Initializer. 193DescendantNodes().OfType<LambdaExpressionSyntax>().Single(); 195var l2 = m3.DescendantNodes().OfType<VariableDeclaratorSyntax>().Single(m => m.Identifier.ValueText == "l2").Initializer. 196DescendantNodes().OfType<LambdaExpressionSyntax>().Single(); 198var l3 = m3.DescendantNodes().OfType<VariableDeclaratorSyntax>().Single(m => m.Identifier.ValueText == "l3").Initializer. 199DescendantNodes().OfType<AnonymousFunctionExpressionSyntax>().Single(); 252var x = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().Single(m => m.Identifier.ValueText == "X"); 253var m1 = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Single(m => m.Identifier.ValueText == "M1"); 254var m2 = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Single(m => m.Identifier.ValueText == "M2"); 255var f = m2.DescendantNodes().OfType<LocalFunctionStatementSyntax>().Single(m => m.Identifier.ValueText == "f");
Microsoft.CodeAnalysis.CSharp.IOperation.UnitTests (96)
IOperation\IOperationTests.cs (12)
181var m = comp.SyntaxTrees.Single().GetRoot().DescendantNodes().OfType<BlockSyntax>().Single(); 260var m = tree.GetRoot().DescendantNodes().OfType<BlockSyntax>().First(); 311var op = (IForLoopOperation)comp.GetSemanticModel(tree).GetOperation(tree.GetRoot().DescendantNodes().OfType<ForStatementSyntax>().Single()); 352var m = tree.GetRoot().DescendantNodes().OfType<BlockSyntax>().First(); 379var op = (IForEachLoopOperation)comp.GetSemanticModel(tree).GetOperation(tree.GetRoot().DescendantNodes().OfType<ForEachStatementSyntax>().Single()); 413var nodes = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().ToArray(); 463var assignments = tree.GetRoot().DescendantNodes().OfType<AssignmentExpressionSyntax>().ToArray(); 509var statement = tree.GetRoot().DescendantNodes().OfType<StatementSyntax>().Single(); 588var literal = root.DescendantNodes().OfType<LiteralExpressionSyntax>().Single(); 589var methodDeclSyntax = literal.Ancestors().OfType<MethodDeclarationSyntax>().Single(); 667var catchBlock = syntaxTree.GetRoot().DescendantNodes().OfType<CatchClauseSyntax>().Single(); 711var fieldInitializer = tree.GetRoot().DescendantNodes().OfType<EqualsValueClauseSyntax>().Last().Value;
IOperation\IOperationTests_IAnonymousFunctionExpression.cs (6)
409var variableDeclaration = syntaxTree.GetRoot().DescendantNodes().OfType<LocalDeclarationStatementSyntax>().Single(); 489var variableDeclaration = syntaxTree.GetRoot().DescendantNodes().OfType<LocalDeclarationStatementSyntax>().Single(); 847var graphM = ControlFlowGraph.Create((IMethodBodyOperation)semanticModel.GetOperation(tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Single())); 877return graph.Blocks.SelectMany(b => b.Operations.SelectMany(o => o.DescendantsAndSelf())).OfType<IFlowAnonymousFunctionOperation>().Single(); 902var graphM = ControlFlowGraph.Create((IMethodBodyOperation)semanticModel.GetOperation(tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Single())); 933return graph.Blocks.SelectMany(b => b.Operations.SelectMany(o => o.DescendantsAndSelf())).OfType<IFlowAnonymousFunctionOperation>().ElementAt(index);
IOperation\IOperationTests_IArgument.cs (1)
4096var conversion = operation.Descendants().OfType<IConversionOperation>().Single();
IOperation\IOperationTests_ICoalesceAssignmentOperation.cs (1)
253var m = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Single();
IOperation\IOperationTests_ICoalesceOperation.cs (11)
36var node = tree.GetRoot().DescendantNodes().OfType<BinaryExpressionSyntax>().Single(); 147var node = tree.GetRoot().DescendantNodes().OfType<BinaryExpressionSyntax>().Single(); 262var node = tree.GetRoot().DescendantNodes().OfType<BinaryExpressionSyntax>().Single(); 377var node = tree.GetRoot().DescendantNodes().OfType<BinaryExpressionSyntax>().Single(); 493var node = tree.GetRoot().DescendantNodes().OfType<BinaryExpressionSyntax>().Single(); 606var node = tree.GetRoot().DescendantNodes().OfType<BinaryExpressionSyntax>().Single(); 721var node = tree.GetRoot().DescendantNodes().OfType<BinaryExpressionSyntax>().Single(); 837var node = tree.GetRoot().DescendantNodes().OfType<BinaryExpressionSyntax>().Single(); 951var node = tree.GetRoot().DescendantNodes().OfType<BinaryExpressionSyntax>().Single(); 1053var node = tree.GetRoot().DescendantNodes().OfType<BinaryExpressionSyntax>().Single(); 1168var node = tree.GetRoot().DescendantNodes().OfType<BinaryExpressionSyntax>().Single();
IOperation\IOperationTests_IConstructorBodyOperation.cs (19)
40var node1 = tree.GetRoot().DescendantNodes().OfType<ConstructorDeclarationSyntax>().Single(); 67var node1 = tree.GetRoot().DescendantNodes().OfType<ConstructorDeclarationSyntax>().Single(); 123var node1 = tree.GetRoot().DescendantNodes().OfType<ConstructorDeclarationSyntax>().Single(); 189var node1 = tree.GetRoot().DescendantNodes().OfType<ConstructorDeclarationSyntax>().Single(); 257var node1 = tree.GetRoot().DescendantNodes().OfType<ConstructorDeclarationSyntax>().Single(); 323var node1 = tree.GetRoot().DescendantNodes().OfType<ConstructorDeclarationSyntax>().Single(); 398var node1 = tree.GetRoot().DescendantNodes().OfType<ConstructorDeclarationSyntax>().Single(); 487var node1 = tree.GetRoot().DescendantNodes().OfType<ConstructorDeclarationSyntax>().Single(); 514var node1 = tree.GetRoot().DescendantNodes().OfType<ConstructorDeclarationSyntax>().Single(); 589var node1 = tree.GetRoot().DescendantNodes().OfType<ConstructorDeclarationSyntax>().Single(); 651var node1 = tree.GetRoot().DescendantNodes().OfType<ConstructorDeclarationSyntax>().First(); 721var node1 = tree.GetRoot().DescendantNodes().OfType<ConstructorDeclarationSyntax>().First(); 796var node1 = tree.GetRoot().DescendantNodes().OfType<ConstructorDeclarationSyntax>().First(); 865var node1 = tree.GetRoot().DescendantNodes().OfType<ConstructorDeclarationSyntax>().First(); 955var node1 = tree.GetRoot().DescendantNodes().OfType<ConstructorDeclarationSyntax>().First(); 1072var node1 = tree.GetRoot().DescendantNodes().OfType<ConstructorDeclarationSyntax>().Single(); 1092var node1 = tree.GetRoot().DescendantNodes().OfType<ConstructorDeclarationSyntax>().Single(); 1125var node1 = tree.GetRoot().DescendantNodes().OfType<ConstructorDeclarationSyntax>().Single(); 1163var node1 = tree.GetRoot().DescendantNodes().OfType<ConstructorDeclarationSyntax>().Skip(1).Single();
IOperation\IOperationTests_IConversionExpression.cs (1)
5292var assignment = tree.GetRoot().DescendantNodes().OfType<AssignmentExpressionSyntax>().First();
IOperation\IOperationTests_IFieldReferenceExpression.cs (3)
707var classDecl = root.DescendantNodes().OfType<ClassDeclarationSyntax>().Single(); 711var methodDecl = root.DescendantNodes().OfType<MethodDeclarationSyntax>().Single(); 713var fieldReferenceOperation = methodBlockOperation.Descendants().OfType<IFieldReferenceOperation>().Single();
IOperation\IOperationTests_IFixedStatement.cs (1)
693var expr = tree.GetRoot().DescendantNodes().OfType<ConditionalExpressionSyntax>().Single();
IOperation\IOperationTests_ILocalFunctionStatement.cs (2)
1793var graphM = ControlFlowGraph.Create((IMethodBodyOperation)semanticModel.GetOperation(tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().First())); 1848var graphM = ControlFlowGraph.Create((IMethodBodyOperation)semanticModel.GetOperation(tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().First()));
IOperation\IOperationTests_IMethodBodyOperation.cs (27)
35var node1 = tree.GetRoot().DescendantNodes().OfType<BaseMethodDeclarationSyntax>().Single(); 56var node1 = tree.GetRoot().DescendantNodes().OfType<BaseMethodDeclarationSyntax>().Single(); 109var node1 = tree.GetRoot().DescendantNodes().OfType<BaseMethodDeclarationSyntax>().Single(); 171var node1 = tree.GetRoot().DescendantNodes().OfType<BaseMethodDeclarationSyntax>().Single(); 243var node1 = tree.GetRoot().DescendantNodes().OfType<BaseMethodDeclarationSyntax>().Single(); 285var node1 = tree.GetRoot().DescendantNodes().OfType<BaseMethodDeclarationSyntax>().Single(); 333var node1 = tree.GetRoot().DescendantNodes().OfType<BaseMethodDeclarationSyntax>().Single(); 400var node1 = tree.GetRoot().DescendantNodes().OfType<BaseMethodDeclarationSyntax>().Single(); 444var node1 = tree.GetRoot().DescendantNodes().OfType<BaseMethodDeclarationSyntax>().First(); 506var node1 = tree.GetRoot().DescendantNodes().OfType<BaseMethodDeclarationSyntax>().First(); 562var node1 = tree.GetRoot().DescendantNodes().OfType<BaseMethodDeclarationSyntax>().Single(); 581var node1 = tree.GetRoot().DescendantNodes().OfType<BaseMethodDeclarationSyntax>().Single(); 613var node1 = tree.GetRoot().DescendantNodes().OfType<BaseMethodDeclarationSyntax>().Single(); 657var node1 = tree.GetRoot().DescendantNodes().OfType<BaseMethodDeclarationSyntax>().Single(); 704var node1 = tree.GetRoot().DescendantNodes().OfType<BaseMethodDeclarationSyntax>().Single(); 723var node1 = tree.GetRoot().DescendantNodes().OfType<BaseMethodDeclarationSyntax>().Single(); 755var node1 = tree.GetRoot().DescendantNodes().OfType<BaseMethodDeclarationSyntax>().Single(); 799var node1 = tree.GetRoot().DescendantNodes().OfType<BaseMethodDeclarationSyntax>().Single(); 846var node1 = tree.GetRoot().DescendantNodes().OfType<BaseMethodDeclarationSyntax>().Single(); 865var node1 = tree.GetRoot().DescendantNodes().OfType<BaseMethodDeclarationSyntax>().Single(); 897var node1 = tree.GetRoot().DescendantNodes().OfType<BaseMethodDeclarationSyntax>().Single(); 938var node1 = tree.GetRoot().DescendantNodes().OfType<BaseMethodDeclarationSyntax>().Single(); 978var node1 = tree.GetRoot().DescendantNodes().OfType<AccessorDeclarationSyntax>().Single(); 1000var node1 = tree.GetRoot().DescendantNodes().OfType<AccessorDeclarationSyntax>().Single(); 1035var node1 = tree.GetRoot().DescendantNodes().OfType<AccessorDeclarationSyntax>().First(); 1080var node1 = tree.GetRoot().DescendantNodes().OfType<AccessorDeclarationSyntax>().First(); 1124var node1 = tree.GetRoot().DescendantNodes().OfType<AccessorDeclarationSyntax>().Single();
IOperation\IOperationTests_IObjectCreationExpression.cs (6)
782var m1 = comp.SyntaxTrees[0].GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Single(); 1069var main = comp.SyntaxTrees[0].GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Single(); 1295var m1 = comp.SyntaxTrees[0].GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Single(); 1574var main = comp.SyntaxTrees[0].GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Single(); 2276var m = comp.SyntaxTrees[0].GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Single(); 2400var m = comp.SyntaxTrees[0].GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Single(m => m.Identifier.ValueText == "M");
IOperation\IOperationTests_IVariableDeclaration.cs (6)
927var literalExpr = nodes.OfType<LiteralExpressionSyntax>().ElementAt(0); 934var invocExpr = nodes.OfType<InvocationExpressionSyntax>().ElementAt(0); 1215var rankSpecifierOld = syntaxTree.GetCompilationUnitRoot().DescendantNodes().OfType<ArrayRankSpecifierSyntax>().First(); 2301var rankSpecifierOld = syntaxTree.GetCompilationUnitRoot().DescendantNodes().OfType<ArrayRankSpecifierSyntax>().First(); 2362var rankSpecifierOld = syntaxTree.GetCompilationUnitRoot().DescendantNodes().OfType<ArrayRankSpecifierSyntax>().First(); 2830var rankSpecifierOld = syntaxTree.GetCompilationUnitRoot().DescendantNodes().OfType<ArrayRankSpecifierSyntax>().First();
Microsoft.CodeAnalysis.CSharp.Semantic.UnitTests (1313)
Semantics\AccessCheckTests.cs (8)
743IAliasSymbol aliasA = model.GetDeclaredSymbol(tree.GetRoot().DescendantNodes().OfType<UsingDirectiveSyntax>().Where(u => u.Alias != null).Single()) as IAliasSymbol; 761var discards = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(i => i.Identifier.ContextualKind() == SyntaxKind.UnderscoreToken).ToArray(); 897IAliasSymbol SomeAlias = model.GetDeclaredSymbol(tree.GetRoot().DescendantNodes().OfType<UsingDirectiveSyntax>().Where(u => u.Alias != null).Single()); 911IMethodSymbol IntegerPlus = model.GetSymbolInfo(tree.GetRoot().DescendantNodes().OfType<BinaryExpressionSyntax>().Single()).Symbol as IMethodSymbol; 959var classC = compilation.GlobalNamespace.GetMembers("C").OfType<INamedTypeSymbol>().Single(); 960var classQ = compilation.GlobalNamespace.GetMembers("Q").OfType<INamedTypeSymbol>().Single(); 969var c2 = ((Compilation)c).GlobalNamespace.GetMembers("C").OfType<INamedTypeSymbol>().Single(); 973classQ = ((Compilation)c).GlobalNamespace.GetMembers("Q").OfType<INamedTypeSymbol>().Single();
Semantics\AnonymousFunctionTests.cs (6)
983var anonymousMethodSyntax = root.DescendantNodes().OfType<AnonymousMethodExpressionSyntax>().Single(); 984var simpleLambdaSyntax = root.DescendantNodes().OfType<SimpleLambdaExpressionSyntax>().Single(); 985var parenthesizedLambdaSyntax = root.DescendantNodes().OfType<ParenthesizedLambdaExpressionSyntax>().Single(); 1017var anonymousMethodSyntax = root.DescendantNodes().OfType<AnonymousMethodExpressionSyntax>().Single(); 1018var simpleLambdaSyntax = root.DescendantNodes().OfType<SimpleLambdaExpressionSyntax>().Single(); 1019var parenthesizedLambdaSyntax = root.DescendantNodes().OfType<ParenthesizedLambdaExpressionSyntax>().Single();
Semantics\AwaitExpressionTests.cs (2)
84var awaitExpression = tree.GetRoot().DescendantNodes().OfType<AwaitExpressionSyntax>().First(); 273var decl = compilation.SyntaxTrees[0].GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().AsSingleton();
Semantics\BetterCandidates.cs (4)
1087var invocations = compilation.SyntaxTrees[0].GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().ToArray(); 1164var invocations = compilation.SyntaxTrees[0].GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().ToArray(); 1212var invocations = compilation.SyntaxTrees[0].GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().ToArray(); 1265var invocations = compilation.SyntaxTrees[0].GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().ToArray();
Semantics\BindingAsyncTests.cs (3)
58var simple = tree.GetCompilationUnitRoot().DescendantNodes().OfType<SimpleLambdaExpressionSyntax>().Single(); 61var parens = tree.GetCompilationUnitRoot().DescendantNodes().OfType<ParenthesizedLambdaExpressionSyntax>(); 87var del = tree.GetCompilationUnitRoot().DescendantNodes().OfType<AnonymousMethodExpressionSyntax>().Single();
Semantics\BindingTests.cs (10)
2725.OfType<IdentifierNameSyntax>() 2737.OfType<IdentifierNameSyntax>() 2781.OfType<IdentifierNameSyntax>() 2836.OfType<IdentifierNameSyntax>() 2848.OfType<IdentifierNameSyntax>() 3912var node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(n => n.ToString() == "G").First(); 3939var lambda = tree.GetRoot().DescendantNodes().OfType<SimpleLambdaExpressionSyntax>().Single(s => s.Parameter.Identifier.Text == "x"); 3985var ids = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().ToArray(); 4026var ids = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().ToArray(); 4038var ifStmt = tree.GetRoot().DescendantNodes().OfType<IfStatementSyntax>().First();
Semantics\ColorColorTests.cs (8)
1882var node1 = tree.GetRoot().DescendantNodes().OfType<MemberAccessExpressionSyntax>().Single(); 1892var node2 = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(n => n.Identifier.Text == "E" && (n.Parent is EqualsValueClauseSyntax)).Single(); 1939var node1 = tree.GetRoot().DescendantNodes().OfType<MemberAccessExpressionSyntax>().Single(); 1949var node2 = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(n => n.Identifier.Text == "E" && (n.Parent is EqualsValueClauseSyntax)).Single(); 1996var node1 = tree.GetRoot().DescendantNodes().OfType<MemberAccessExpressionSyntax>().Single(); 2006var node2 = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(n => n.Identifier.Text == "E" && (n.Parent is EqualsValueClauseSyntax)).Single(); 2046var node1 = tree.GetRoot().DescendantNodes().OfType<MemberAccessExpressionSyntax>().Single(); 2055var node2 = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(n => n.Identifier.Text == "E" && (n.Parent is EqualsValueClauseSyntax)).Single();
Semantics\ConditionalOperatorTests.cs (3)
1346var memberBinding = tree.GetRoot().DescendantNodes().OfType<MemberBindingExpressionSyntax>().Single(); 1400var memberBinding = tree.GetRoot().DescendantNodes().OfType<MemberBindingExpressionSyntax>().Single(); 1447var memberBinding = tree.GetRoot().DescendantNodes().OfType<MemberBindingExpressionSyntax>().Single();
Semantics\ConstantTests.cs (3)
1456OfType<BoundExpression>(). 2923var expr = tree.GetCompilationUnitRoot().DescendantNodes().OfType<BinaryExpressionSyntax>().First(); 3521var initializer = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().Single().Initializer.Value;
Semantics\DeconstructionTests.cs (46)
1840var y = nodes.OfType<VariableDeclaratorSyntax>().Skip(1).First(); 3767var literal1 = nodes.OfType<TupleExpressionSyntax>().First(); 3770var literal2 = nodes.OfType<TupleExpressionSyntax>().Skip(1).First(); 4169var designations = tree.GetCompilationUnitRoot().DescendantNodes().OfType<SingleVariableDesignationSyntax>().ToArray(); 4171var refs = tree.GetCompilationUnitRoot().DescendantNodes().OfType<IdentifierNameSyntax>(); 4237var designations = tree.GetCompilationUnitRoot().DescendantNodes().OfType<SingleVariableDesignationSyntax>().ToArray(); 4256var declarations = tree.GetCompilationUnitRoot().DescendantNodes().OfType<DeclarationExpressionSyntax>().ToArray(); 4314var tuple = tree.GetCompilationUnitRoot().DescendantNodes().OfType<TupleExpressionSyntax>().Single(); 4372var designations = tree.GetCompilationUnitRoot().DescendantNodes().OfType<SingleVariableDesignationSyntax>().ToArray(); 4391var declarations = tree.GetCompilationUnitRoot().DescendantNodes().OfType<DeclarationExpressionSyntax>().ToArray(); 4445var tuple = tree.GetCompilationUnitRoot().DescendantNodes().OfType<TupleExpressionSyntax>().Single(); 4507foreach (var designation in tree.GetCompilationUnitRoot().DescendantNodes().OfType<DiscardDesignationSyntax>()) 4515var declarations = tree.GetCompilationUnitRoot().DescendantNodes().OfType<DeclarationExpressionSyntax>().ToArray(); 4579var tuple = tree.GetCompilationUnitRoot().DescendantNodes().OfType<TupleExpressionSyntax>().Single(); 4665var declarations = tree.GetCompilationUnitRoot().DescendantNodes().OfType<DeclarationExpressionSyntax>().ToArray(); 4724var aa = nodes.OfType<DeclarationExpressionSyntax>().ElementAt(0); 4759var declarations = tree.GetCompilationUnitRoot().DescendantNodes().OfType<DeclarationExpressionSyntax>().ToArray(); 4837var declarations = tree.GetCompilationUnitRoot().DescendantNodes().OfType<DeclarationExpressionSyntax>().ToArray(); 4942var declaration = tree.GetCompilationUnitRoot().DescendantNodes().OfType<DeclarationExpressionSyntax>().Single(); 4988var declaration = tree.GetCompilationUnitRoot().DescendantNodes().OfType<DeclarationExpressionSyntax>().Single(); 5046var declaration = tree.GetCompilationUnitRoot().DescendantNodes().OfType<DeclarationExpressionSyntax>().Single(); 5130Assert.False(tree.GetCompilationUnitRoot().DescendantNodes().OfType<DeclarationExpressionSyntax>().Any()); 5186var designations = tree.GetCompilationUnitRoot().DescendantNodes().OfType<SingleVariableDesignationSyntax>().ToArray(); 5205var declarations = tree.GetCompilationUnitRoot().DescendantNodes().OfType<DeclarationExpressionSyntax>().ToArray(); 5259var tuples = tree.GetCompilationUnitRoot().DescendantNodes().OfType<TupleExpressionSyntax>().ToArray(); 5330var designations = tree.GetCompilationUnitRoot().DescendantNodes().OfType<SingleVariableDesignationSyntax>().ToArray(); 5349var declarations = tree.GetCompilationUnitRoot().DescendantNodes().OfType<DeclarationExpressionSyntax>().ToArray(); 5403var tuples = tree.GetCompilationUnitRoot().DescendantNodes().OfType<TupleExpressionSyntax>().ToArray(); 5478foreach (var designation in tree.GetCompilationUnitRoot().DescendantNodes().OfType<DiscardDesignationSyntax>()) 5486var declarations = tree.GetCompilationUnitRoot().DescendantNodes().OfType<DeclarationExpressionSyntax>().ToArray(); 5546var tuples = tree.GetCompilationUnitRoot().DescendantNodes().OfType<TupleExpressionSyntax>().ToArray(); 5654var designations = tree.GetCompilationUnitRoot().DescendantNodes().OfType<SingleVariableDesignationSyntax>().ToArray(); 5673var declarations = tree.GetCompilationUnitRoot().DescendantNodes().OfType<DeclarationExpressionSyntax>().ToArray(); 5709var tuple = tree.GetCompilationUnitRoot().DescendantNodes().OfType<TupleExpressionSyntax>().Single(); 5764var designations = tree.GetCompilationUnitRoot().DescendantNodes().OfType<SingleVariableDesignationSyntax>().ToArray(); 5783var declarations = tree.GetCompilationUnitRoot().DescendantNodes().OfType<DeclarationExpressionSyntax>().ToArray(); 5819var tuple = tree.GetCompilationUnitRoot().DescendantNodes().OfType<TupleExpressionSyntax>().Single(); 5878foreach (var designation in tree.GetCompilationUnitRoot().DescendantNodes().OfType<DiscardDesignationSyntax>()) 5886var declarations = tree.GetCompilationUnitRoot().DescendantNodes().OfType<DeclarationExpressionSyntax>().ToArray(); 5925var tuple = tree.GetCompilationUnitRoot().DescendantNodes().OfType<TupleExpressionSyntax>().Single(); 5986var mainCall = tree.GetRoot().DescendantNodes().OfType<ExpressionSyntax>().Where(n => n.ToString() == "Main()").Single(); 6029var mainCall = tree.GetRoot().DescendantNodes().OfType<ExpressionSyntax>().Where(n => n.ToString() == "Main()").Single(); 6069var mainCall = tree.GetRoot().DescendantNodes().OfType<ExpressionSyntax>().Where(n => n.ToString() == "Main()").Single(); 6111var two = tree.GetRoot().DescendantNodes().OfType<ExpressionSyntax>().Where(n => n.ToString() == "2").Single(); 6151var mainCall = tree.GetRoot().DescendantNodes().OfType<ExpressionSyntax>().Where(n => n.ToString() == "Main()").Single(); 6554var assignment = tree.GetRoot().DescendantNodes().OfType<AssignmentExpressionSyntax>().Single();
Semantics\DelegateTypeTests.cs (36)
749var expr = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().Single().Initializer!.Value; 795var expr = ((CastExpressionSyntax)tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().Single().Initializer!.Value).Expression; 895var expr = tree.GetRoot().DescendantNodes().OfType<AnonymousFunctionExpressionSyntax>().Single(); 938var expr = ((CastExpressionSyntax)tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().Single().Initializer!.Value).Expression; 996var expr = tree.GetRoot().DescendantNodes().OfType<AnonymousFunctionExpressionSyntax>().Single(); 1036var expr = ((CastExpressionSyntax)tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().Single().Initializer!.Value).Expression; 1211var expr = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().Single().Initializer!.Value; 1247var expr = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().Single().Initializer!.Value; 1332var expr = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().Single().Initializer!.Value; 1372var expr = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().Single().Initializer!.Value; 1415var expr = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().Single().Initializer!.Value; 1459var expr = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().Single().Initializer!.Value; 1554var expr = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().Single().Initializer!.Value; 1634var expr = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().Single().Initializer!.Value; 1684var expr = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().Single().Initializer!.Value; 1734var expr = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().Single().Initializer!.Value; 1784var expr = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().Single().Initializer!.Value; 1834var expr = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().Single().Initializer!.Value; 1884var expr = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().Single().Initializer!.Value; 1934var expr = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().Single().Initializer!.Value; 1980var expr = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().Single().Initializer!.Value; 2028var expr = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().Single().Initializer!.Value; 3603var exprs = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().Select(d => d.Initializer!.Value).ToArray(); 8028var expr = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().Single().Initializer!.Value; 8051var expr = tree.GetRoot().DescendantNodes().OfType<AnonymousFunctionExpressionSyntax>().Single(); 10386var variables = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().Where(v => v.Initializer != null); 11086var variables = nodes.OfType<VariableDeclaratorSyntax>().Where(v => v.Identifier.Text == "d").ToArray(); 11092var identifiers = nodes.OfType<InvocationExpressionSyntax>().Where(i => i.Expression is IdentifierNameSyntax id && id.Identifier.Text == "Report").Select(i => i.ArgumentList.Arguments[0].Expression).ToArray(); 11170var variables = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().Where(v => v.Identifier.Text == "d").ToArray(); 12110var syntax = syntaxTree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().Single(); 14732var syntax = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().Single(); 14777var expr = tree.GetRoot().DescendantNodes().OfType<LambdaExpressionSyntax>().Single(); 19792var declarator = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().Single(); 19800typeInfo = model.GetTypeInfo(declarator.Initializer!.Value.DescendantNodes().OfType<ParenthesizedLambdaExpressionSyntax>().Single()); 19834var declarator = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().Single(); 19842typeInfo = model.GetTypeInfo(declarator.Initializer!.Value.DescendantNodes().OfType<ParenthesizedLambdaExpressionSyntax>().Single());
Semantics\DynamicTests.cs (186)
3860var node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(n => n.Identifier.ValueText == "Goo").Single(); 3893var node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(n => n.Identifier.ValueText == "Goo").Single(); 3921var node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(n => n.Identifier.ValueText == "Goo").Single(); 3949var node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(n => n.Identifier.ValueText == "Goo").Single(); 4000var node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(n => n.Identifier.ValueText == "Goo").Single(); 4976var node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "result").Single(); 4985var call = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().First(); 5059node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "result").Single(); 5100var node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "result").Single(); 5109var call = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().First(); 5182node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "result").Single(); 5223var node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "result").Single(); 5232var call = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().First(); 5306node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "result").Single(); 5341var node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "result").Single(); 5346var call = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().First(); 5382var node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "result").Single(); 5387var call = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().First(); 5426var node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "result").Single(); 5431var call = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().First(); 5470var node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "result").Single(); 5475var call = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().First(); 5514var node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "result").Single(); 5519var call = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().First(); 5578var node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "a").Single(); 5616var node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "a").Single(); 5655var node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "e").Single(); 5691var node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "result").Single(); 5696var call = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().First(); 5732var node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "result").Single(); 5737var call = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().First(); 5777var node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "result").Single(); 5782var call = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().First(); 5822var node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "result").Single(); 5827var call = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().First(); 5867var node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "result").Single(); 5872var call = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().First(); 5935var node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "a").Single(); 5974var node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "a").Single(); 6022var node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "result").Single(); 6031var elementAccess = tree.GetRoot().DescendantNodes().OfType<ElementAccessExpressionSyntax>().Single(); 6104node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "result").Single(); 6145var node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "result").Single(); 6154var elementAccess = tree.GetRoot().DescendantNodes().OfType<ElementAccessExpressionSyntax>().Single(); 6227node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "result").Single(); 6265var node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "result").Single(); 6274var elementAccess = tree.GetRoot().DescendantNodes().OfType<ElementAccessExpressionSyntax>().Single(); 6347node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "result").Single(); 6377var node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "result").Single(); 6382var elementAccess = tree.GetRoot().DescendantNodes().OfType<ElementAccessExpressionSyntax>().Single(); 6419var node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "result").Single(); 6424var elementAccess = tree.GetRoot().DescendantNodes().OfType<ElementAccessExpressionSyntax>().Single(); 6466var node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "result").Single(); 6471var elementAccess = tree.GetRoot().DescendantNodes().OfType<ElementAccessExpressionSyntax>().Single(); 6510var node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "result").Single(); 6515var elementAccess = tree.GetRoot().DescendantNodes().OfType<ElementAccessExpressionSyntax>().Single(); 6552var node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "a").Single(); 6559foreach (var elementAccess in tree.GetRoot().DescendantNodes().OfType<ElementAccessExpressionSyntax>()) 6571var increment = tree.GetRoot().DescendantNodes().OfType<PostfixUnaryExpressionSyntax>().Single(); 6606var node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "a").Single(); 6613foreach (var elementAccess in tree.GetRoot().DescendantNodes().OfType<ElementAccessExpressionSyntax>()) 6671var node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "a").Single(); 6680var elementAccess = tree.GetRoot().DescendantNodes().OfType<ElementAccessExpressionSyntax>().Single(); 6736node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "a").Single(); 6780var node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "a").Single(); 6789var elementAccess = tree.GetRoot().DescendantNodes().OfType<ElementAccessExpressionSyntax>().Single(); 6845node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "a").Single(); 6890var node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "a").Single(); 6899var elementAccess = tree.GetRoot().DescendantNodes().OfType<ElementAccessExpressionSyntax>().Single(); 6956node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "a").Single(); 6991var node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "a").Single(); 6996var elementAccess = tree.GetRoot().DescendantNodes().OfType<ElementAccessExpressionSyntax>().Single(); 7059var node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "a").Single(); 7068var elementAccess = tree.GetRoot().DescendantNodes().OfType<ElementAccessExpressionSyntax>().Single(); 7118node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "a").Single(); 7162var node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "a").Single(); 7171var elementAccess = tree.GetRoot().DescendantNodes().OfType<ElementAccessExpressionSyntax>().Single(); 7230node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "a").Single(); 7275var node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "a").Single(); 7284var elementAccess = tree.GetRoot().DescendantNodes().OfType<ElementAccessExpressionSyntax>().Single(); 7346node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "a").Single(); 7391var node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "a").Single(); 7400var elementAccess = tree.GetRoot().DescendantNodes().OfType<ElementAccessExpressionSyntax>().Single(); 7463node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "a").Single(); 7504var node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "a").Single(); 7513var elementAccess = tree.GetRoot().DescendantNodes().OfType<ElementAccessExpressionSyntax>().Single(); 7581var node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "a").Single(); 7590var elementAccess = tree.GetRoot().DescendantNodes().OfType<ElementAccessExpressionSyntax>().Single(); 7642node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "a").Single(); 7686var node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "a").Single(); 7695var elementAccess = tree.GetRoot().DescendantNodes().OfType<ElementAccessExpressionSyntax>().Single(); 7748node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "a").Single(); 7792var node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "a").Single(); 7801var elementAccess = tree.GetRoot().DescendantNodes().OfType<ElementAccessExpressionSyntax>().Single(); 7854node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "a").Single(); 7895var node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "a").Single(); 7905var elementAccess = tree.GetRoot().DescendantNodes().OfType<ElementAccessExpressionSyntax>().Single(); 7967var node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "a").Single(); 7976var elementAccess = tree.GetRoot().DescendantNodes().OfType<ElementAccessExpressionSyntax>().Single(); 8029node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "a").Single(); 8073var node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "a").Single(); 8082var elementAccess = tree.GetRoot().DescendantNodes().OfType<ElementAccessExpressionSyntax>().Single(); 8135node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "a").Single(); 8178var node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "a").Single(); 8187var elementAccess = tree.GetRoot().DescendantNodes().OfType<ElementAccessExpressionSyntax>().Single(); 8239node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "a").Single(); 8283var node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "a").Single(); 8292var elementAccess = tree.GetRoot().DescendantNodes().OfType<ElementAccessExpressionSyntax>().Single(); 8348node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "a").Single(); 8392var node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "a").Single(); 8401var elementAccess = tree.GetRoot().DescendantNodes().OfType<ElementAccessExpressionSyntax>().Single(); 8457node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "a").Single(); 8501var node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "a").Single(); 8510var elementAccess = tree.GetRoot().DescendantNodes().OfType<ElementAccessExpressionSyntax>().Single(); 8566node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "a").Single(); 8611var node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "a").Single(); 8620var elementAccess = tree.GetRoot().DescendantNodes().OfType<ElementAccessExpressionSyntax>().Single(); 8677node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "a").Single(); 8724var node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "a").Single(); 8729var elementAccess = tree.GetRoot().DescendantNodes().OfType<ElementAccessExpressionSyntax>().Single(); 8793var node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "a").Single(); 8798var elementAccess = tree.GetRoot().DescendantNodes().OfType<ElementAccessExpressionSyntax>().Single(); 8861var node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "a").Single(); 8870var elementAccess = tree.GetRoot().DescendantNodes().OfType<ElementAccessExpressionSyntax>().Single(); 8926var elementAccess = tree.GetRoot().DescendantNodes().OfType<ImplicitElementAccessSyntax>().Single(); 9016var elementAccess = tree.GetRoot().DescendantNodes().OfType<ImplicitElementAccessSyntax>().Single(); 9107var elementAccess = tree.GetRoot().DescendantNodes().OfType<ImplicitElementAccessSyntax>().Single(); 9197var elementAccess = tree.GetRoot().DescendantNodes().OfType<ImplicitElementAccessSyntax>().Single(); 9253var elementAccess = tree.GetRoot().DescendantNodes().OfType<ImplicitElementAccessSyntax>().Single(); 9314var elementAccess = tree.GetRoot().DescendantNodes().OfType<ImplicitElementAccessSyntax>().Single(); 9435var elementAccess = tree.GetRoot().DescendantNodes().OfType<ImplicitElementAccessSyntax>().Single(); 9555var elementAccess = tree.GetRoot().DescendantNodes().OfType<ImplicitElementAccessSyntax>().Single(); 9669var elementAccess = tree.GetRoot().DescendantNodes().OfType<ImplicitElementAccessSyntax>().Single(); 9780var elementAccess = tree.GetRoot().DescendantNodes().OfType<ImplicitElementAccessSyntax>().Single(); 9891var elementAccess = tree.GetRoot().DescendantNodes().OfType<ImplicitElementAccessSyntax>().Single(); 10009var node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "a").First(); 10014node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "Item1").Single(); 10022var elementAccess = tree.GetRoot().DescendantNodes().OfType<ElementAccessExpressionSyntax>().Single(); 10092node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "Item1").Single(); 10137var node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "a").First(); 10142node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "Item1").Single(); 10150var elementAccess = tree.GetRoot().DescendantNodes().OfType<ElementAccessExpressionSyntax>().Single(); 10220node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "Item1").Single(); 10265var node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "a").First(); 10270node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "Item1").Single(); 10278var elementAccess = tree.GetRoot().DescendantNodes().OfType<ElementAccessExpressionSyntax>().Single(); 10348node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "Item1").Single(); 10419var node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "a").First(); 10424node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "Item1").Single(); 10432var elementAccess = tree.GetRoot().DescendantNodes().OfType<ElementAccessExpressionSyntax>().Single(); 10500node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "Item1").Single(); 10553var node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "a").First(); 10558node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "Item1").Single(); 10566var elementAccess = tree.GetRoot().DescendantNodes().OfType<ElementAccessExpressionSyntax>().Single(); 10647node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "Item1").Single(); 10701var node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "a").First(); 10706node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "Item1").Single(); 10714var elementAccess = tree.GetRoot().DescendantNodes().OfType<ElementAccessExpressionSyntax>().Single(); 10797node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "Item1").Single(); 10971var node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "a").First(); 10976node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "Item1").Single(); 10984var elementAccess = tree.GetRoot().DescendantNodes().OfType<ElementAccessExpressionSyntax>().Single(); 11063node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "Item1").Single(); 11100var node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "a").Single(); 11105var elementAccess = tree.GetRoot().DescendantNodes().OfType<ElementAccessExpressionSyntax>().Single(); 11184var node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "a").Single(); 11189var elementAccess = tree.GetRoot().DescendantNodes().OfType<ElementAccessExpressionSyntax>().Single(); 11262var node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "a").Single(); 11267var elementAccess = tree.GetRoot().DescendantNodes().OfType<ElementAccessExpressionSyntax>().Single(); 11317var node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "result").Single(); 11326var call = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().First(); 11370var node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "result").Single(); 11379var call = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().First(); 11419var call = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().First(); 11450var node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "result").Single(); 11455var call = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().First(); 11494var node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "result").Single(); 11499var call = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().First(); 11535var node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "result").Single(); 11540var call = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().First(); 11584var node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "result").Single(); 11593var elementAccess = tree.GetRoot().DescendantNodes().OfType<ElementAccessExpressionSyntax>().Single(); 11636var node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "result").Single(); 11645var elementAccess = tree.GetRoot().DescendantNodes().OfType<ElementAccessExpressionSyntax>().Single(); 11680var node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "result").Single(); 11685var elementAccess = tree.GetRoot().DescendantNodes().OfType<ElementAccessExpressionSyntax>().Single();
Semantics\ExpressionBodiedMemberTests.cs (23)
43.OfType<MethodDeclarationSyntax>() 426var node = tree.GetRoot().DescendantNodes().OfType<ParenthesizedLambdaExpressionSyntax>().Single(); 475var node = tree.GetRoot().DescendantNodes().OfType<ArrowExpressionClauseSyntax>().Single().Expression; 506var node = tree.GetRoot().DescendantNodes().OfType<ArrowExpressionClauseSyntax>().Single().Expression; 535var node = tree.GetRoot().DescendantNodes().OfType<ArrowExpressionClauseSyntax>().Single().Expression; 540Assert.Contains("P1", model.LookupNames(tree.GetRoot().DescendantNodes().OfType<ConstructorDeclarationSyntax>().Single().Body.Position)); 542var node2 = tree.GetRoot().DescendantNodes().OfType<ConstructorDeclarationSyntax>().Single() 543.Body.DescendantNodes().OfType<AssignmentExpressionSyntax>() 575var node = tree.GetRoot().DescendantNodes().OfType<ArrowExpressionClauseSyntax>().Single().Expression; 580Assert.Contains("P1", model.LookupNames(tree.GetRoot().DescendantNodes().OfType<DestructorDeclarationSyntax>().Single().Body.Position)); 582var node2 = tree.GetRoot().DescendantNodes().OfType<DestructorDeclarationSyntax>().Single() 583.Body.DescendantNodes().OfType<AssignmentExpressionSyntax>() 616Assert.Equal(1, tree.GetRoot().DescendantNodes().OfType<ArrowExpressionClauseSyntax>().Count()); 649var node = tree.GetRoot().DescendantNodes().OfType<ArrowExpressionClauseSyntax>().Single().Expression; 680var node = tree.GetRoot().DescendantNodes().OfType<ArrowExpressionClauseSyntax>().Single().Expression; 711var node = tree.GetRoot().DescendantNodes().OfType<ReturnStatementSyntax>().Single().Expression; 742var node = tree.GetRoot().DescendantNodes().OfType<ReturnStatementSyntax>().Single().Expression; 777var node = tree.GetRoot().DescendantNodes().OfType<ReturnStatementSyntax>().Single().Expression; 808var node = tree.GetRoot().DescendantNodes().OfType<ReturnStatementSyntax>().Single().Expression; 839var nodes = tree.GetRoot().DescendantNodes().OfType<AssignmentExpressionSyntax>(); 874var nodes = tree.GetRoot().DescendantNodes().OfType<AssignmentExpressionSyntax>(); 913var nodes = tree.GetRoot().DescendantNodes().OfType<AssignmentExpressionSyntax>(); 1021var nodes = tree.GetRoot().DescendantNodes().OfType<LiteralExpressionSyntax>().ToArray();
Semantics\ForEachTests.cs (6)
2129var loopSyntax = tree.GetRoot().DescendantNodes().OfType<ForEachStatementSyntax>().Single(); 2181var loopSyntaxes = tree.GetRoot().DescendantNodes().OfType<ForEachStatementSyntax>().ToArray(); 2885var foreachSyntax = tree.GetRoot().DescendantNodes().OfType<ForEachStatementSyntax>().Single(); 3326var loop = tree.GetRoot().DescendantNodes().OfType<ForEachStatementSyntax>().Single(); 3360var loop = tree.GetRoot().DescendantNodes().OfType<ForEachStatementSyntax>().Single(); 3421var node = tree.GetRoot().DescendantNodes().Where(n => n.Kind() == SyntaxKind.ForEachStatement).OfType<ForEachStatementSyntax>().Single();
Semantics\FunctionPointerTests.cs (50)
201var initializer1 = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().First().Initializer!.Value; 203var parameter = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().First().ArgumentList.Arguments.Single(); 205var initializer2 = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().Last().Initializer!.Value; 293foreach (var literal in tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().Select(v => v.Initializer!.Value)) 351var conversions = tree.GetRoot().DescendantNodes().OfType<CastExpressionSyntax>().ToList(); 402var conversions = tree.GetRoot().DescendantNodes().OfType<CastExpressionSyntax>().ToList(); 454var conversions = tree.GetRoot().DescendantNodes().OfType<CastExpressionSyntax>().ToList(); 502var conversions = tree.GetRoot().DescendantNodes().OfType<CastExpressionSyntax>().ToList(); 600var decls = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().Select(d => d.Initializer!.Value).ToList(); 839var decls = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().Select(d => d.Initializer!.Value).ToList(); 882var variableDeclaratorSyntax = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().Single(); 942var variableDeclaratorSyntax = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().Single(); 978var variableDeclaratorSyntaxes = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().ToArray(); 1046var decls = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().ToArray(); 1126var decls = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().ToArray(); 1271var decls = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().ToArray(); 1366var decls = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().ToArray(); 1507var decls = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().ToArray(); 1564var decls = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().ToArray(); 1615var invocation = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().Single(); 1662var m1Invocation = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().First(); 1695var m1Invocation = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().First(); 1728var m1Invocation = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().First(); 1775var invocation = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().Single(); 1822var m1Invocation = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().First(); 1855var m1Invocation = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().First(); 1888var m1Invocation = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().First(); 1936var invocation = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().Single(); 2054var invocation = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().Single(); 2088var localSyntax = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().Single(); 2227.OfType<InvocationExpressionSyntax>() 2284.OfType<InvocationExpressionSyntax>() 2357.OfType<InvocationExpressionSyntax>() 2431.OfType<ImplicitArrayCreationExpressionSyntax>() 2499.OfType<ConditionalExpressionSyntax>() 2596.OfType<ConditionalExpressionSyntax>() 2669.OfType<ConditionalExpressionSyntax>() 3178var invocations = tree.GetRoot().DescendantNodes().OfType<ConditionalAccessExpressionSyntax>().ToList(); 3297var invocations = tree.GetRoot().DescendantNodes().OfType<ConditionalAccessExpressionSyntax>().ToList(); 3376var isPatterns = syntaxTree.GetRoot().DescendantNodes().OfType<IsPatternExpressionSyntax>().ToArray(); 3433var isPattern = syntaxTree.GetRoot().DescendantNodes().OfType<IsPatternExpressionSyntax>().Single(); 3475var isPattern = syntaxTree.GetRoot().DescendantNodes().OfType<IsPatternExpressionSyntax>().Single(); 3528var binaryExpressions = syntaxTree.GetRoot().DescendantNodes().OfType<BinaryExpressionSyntax>().ToArray(); 3582var isPattern = syntaxTree.GetRoot().DescendantNodes().OfType<IsPatternExpressionSyntax>().Single(); 3583var funcPtrTypeSyntax = isPattern.DescendantNodes().OfType<FunctionPointerTypeSyntax>().Single(); 3678.OfType<MethodDeclarationSyntax>() 3805VariableDeclarationSyntax fieldDeclaration = syntaxTree.GetRoot().DescendantNodes().OfType<FieldDeclarationSyntax>().Single().Declaration; 3816.OfType<MethodDeclarationSyntax>() 3818.OfType<VariableDeclarationSyntax>() 3950.OfType<MethodDeclarationSyntax>()
Semantics\GenericConstraintsTests.cs (4)
3140var call = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().Single(); 3170var call = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().Single(); 3196var call = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().Single(); 3225var call = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().Single();
Semantics\GlobalUsingDirectiveTests.cs (42)
3842var ext = tree.GetRoot().DescendantNodes().OfType<ExternAliasDirectiveSyntax>().ToArray(); 3844var aliases = tree.GetRoot().DescendantNodes().OfType<UsingDirectiveSyntax>().ToArray(); 3868ext = tree.GetRoot().DescendantNodes().OfType<ExternAliasDirectiveSyntax>().ToArray(); 3870aliases = tree.GetRoot().DescendantNodes().OfType<UsingDirectiveSyntax>().ToArray(); 3890aliases = tree.GetRoot().DescendantNodes().OfType<UsingDirectiveSyntax>().ToArray(); 3899ext = tree.GetRoot().DescendantNodes().OfType<ExternAliasDirectiveSyntax>().ToArray(); 3901aliases = tree.GetRoot().DescendantNodes().OfType<UsingDirectiveSyntax>().ToArray(); 3918aliases = tree.GetRoot().DescendantNodes().OfType<UsingDirectiveSyntax>().ToArray(); 3932ext = tree.GetRoot().DescendantNodes().OfType<ExternAliasDirectiveSyntax>().ToArray(); 3934aliases = tree.GetRoot().DescendantNodes().OfType<UsingDirectiveSyntax>().ToArray(); 3952ext = tree.GetRoot().DescendantNodes().OfType<ExternAliasDirectiveSyntax>().ToArray(); 3954aliases = tree.GetRoot().DescendantNodes().OfType<UsingDirectiveSyntax>().ToArray(); 3968aliases = tree.GetRoot().DescendantNodes().OfType<UsingDirectiveSyntax>().ToArray(); 3977ext = tree.GetRoot().DescendantNodes().OfType<ExternAliasDirectiveSyntax>().ToArray(); 3979aliases = tree.GetRoot().DescendantNodes().OfType<UsingDirectiveSyntax>().ToArray(); 3990aliases = tree.GetRoot().DescendantNodes().OfType<UsingDirectiveSyntax>().ToArray(); 4004ext = tree.GetRoot().DescendantNodes().OfType<ExternAliasDirectiveSyntax>().ToArray(); 4006aliases = tree.GetRoot().DescendantNodes().OfType<UsingDirectiveSyntax>().ToArray(); 4024ext = tree.GetRoot().DescendantNodes().OfType<ExternAliasDirectiveSyntax>().ToArray(); 4026aliases = tree.GetRoot().DescendantNodes().OfType<UsingDirectiveSyntax>().ToArray(); 4040aliases = tree.GetRoot().DescendantNodes().OfType<UsingDirectiveSyntax>().ToArray(); 4049ext = tree.GetRoot().DescendantNodes().OfType<ExternAliasDirectiveSyntax>().ToArray(); 4051aliases = tree.GetRoot().DescendantNodes().OfType<UsingDirectiveSyntax>().ToArray(); 4062aliases = tree.GetRoot().DescendantNodes().OfType<UsingDirectiveSyntax>().ToArray(); 4076ext = tree.GetRoot().DescendantNodes().OfType<ExternAliasDirectiveSyntax>().ToArray(); 4078aliases = tree.GetRoot().DescendantNodes().OfType<UsingDirectiveSyntax>().ToArray(); 4090ext = tree.GetRoot().DescendantNodes().OfType<ExternAliasDirectiveSyntax>().ToArray(); 4092aliases = tree.GetRoot().DescendantNodes().OfType<UsingDirectiveSyntax>().ToArray(); 4100aliases = tree.GetRoot().DescendantNodes().OfType<UsingDirectiveSyntax>().ToArray(); 4111ext = tree.GetRoot().DescendantNodes().OfType<ExternAliasDirectiveSyntax>().ToArray(); 4113aliases = tree.GetRoot().DescendantNodes().OfType<UsingDirectiveSyntax>().ToArray(); 4133ext = tree.GetRoot().DescendantNodes().OfType<ExternAliasDirectiveSyntax>().ToArray(); 4135aliases = tree.GetRoot().DescendantNodes().OfType<UsingDirectiveSyntax>().ToArray(); 4149ext = tree.GetRoot().DescendantNodes().OfType<ExternAliasDirectiveSyntax>().ToArray(); 4151aliases = tree.GetRoot().DescendantNodes().OfType<UsingDirectiveSyntax>().ToArray(); 4243var node = tree.GetRoot().DescendantNodes().OfType<ObjectCreationExpressionSyntax>().Single(); 4251node = tree.GetRoot().DescendantNodes().OfType<ObjectCreationExpressionSyntax>().Single(); 4279node = tree.GetRoot().DescendantNodes().OfType<ObjectCreationExpressionSyntax>().Single(); 4287node = tree.GetRoot().DescendantNodes().OfType<ObjectCreationExpressionSyntax>().Single(); 4295node = tree.GetRoot().DescendantNodes().OfType<ObjectCreationExpressionSyntax>().Single(); 4303node = tree.GetRoot().DescendantNodes().OfType<ObjectCreationExpressionSyntax>().Single(); 4315node = tree.GetRoot().DescendantNodes().OfType<ObjectCreationExpressionSyntax>().Single();
Semantics\ImplicitObjectCreationTests.cs (27)
56var nodes = tree.GetCompilationUnitRoot().DescendantNodes().OfType<ImplicitObjectCreationExpressionSyntax>().ToArray(); 131var nodes = tree.GetCompilationUnitRoot().DescendantNodes().OfType<ImplicitObjectCreationExpressionSyntax>().ToArray(); 178var nodes = tree.GetCompilationUnitRoot().DescendantNodes().OfType<ImplicitObjectCreationExpressionSyntax>().ToArray(); 228var nodes = tree.GetCompilationUnitRoot().DescendantNodes().OfType<ImplicitObjectCreationExpressionSyntax>().ToArray(); 842var nodes = tree.GetCompilationUnitRoot().DescendantNodes().OfType<ImplicitObjectCreationExpressionSyntax>().ToArray(); 883var nodes = tree.GetCompilationUnitRoot().DescendantNodes().OfType<ImplicitObjectCreationExpressionSyntax>().ToArray(); 1706var nodes = tree.GetCompilationUnitRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().ToArray(); 1868var def = nodes.OfType<ImplicitObjectCreationExpressionSyntax>().Single(); 1898var def = nodes.OfType<ImplicitObjectCreationExpressionSyntax>().Single(); 1928var def = nodes.OfType<ImplicitObjectCreationExpressionSyntax>().Single(); 1980var def = nodes.OfType<ImplicitObjectCreationExpressionSyntax>().ElementAt(0); 2038var @new = nodes.OfType<ImplicitObjectCreationExpressionSyntax>().Single(); 2045var newObject = nodes.OfType<ObjectCreationExpressionSyntax>().Single(); 2073var @new = nodes.OfType<ImplicitObjectCreationExpressionSyntax>().Single(); 2080var newObject = nodes.OfType<ObjectCreationExpressionSyntax>().Single(); 2125var nodes = tree.GetCompilationUnitRoot().DescendantNodes().OfType<ImplicitObjectCreationExpressionSyntax>().ToArray(); 2219var def = nodes.OfType<ImplicitObjectCreationExpressionSyntax>().ElementAt(0); 2516var def = nodes.OfType<ImplicitObjectCreationExpressionSyntax>().First(); 2567var def = nodes.OfType<ImplicitObjectCreationExpressionSyntax>().First(); 2922var nodes = tree.GetCompilationUnitRoot().DescendantNodes().OfType<ImplicitObjectCreationExpressionSyntax>().ToArray(); 3217var first = nodes.OfType<ImplicitObjectCreationExpressionSyntax>().ElementAt(1); 3221var second = nodes.OfType<ImplicitObjectCreationExpressionSyntax>().ElementAt(2); 3225var third = nodes.OfType<ImplicitObjectCreationExpressionSyntax>().ElementAt(3); 3229var fourth = nodes.OfType<ImplicitObjectCreationExpressionSyntax>().ElementAt(4); 4157var node = tree.GetCompilationUnitRoot().DescendantNodes().OfType<LiteralExpressionSyntax>().Single(); 4184var node = tree.GetCompilationUnitRoot().DescendantNodes().OfType<ExpressionStatementSyntax>().Single(); 4574var node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "aParameter").Single();
Semantics\IndexAndRangeTests.cs (9)
898var expression = tree.GetRoot().DescendantNodes().OfType<PrefixUnaryExpressionSyntax>().Single(); 918var expression = tree.GetRoot().DescendantNodes().OfType<PrefixUnaryExpressionSyntax>().Single(); 939var expression = tree.GetRoot().DescendantNodes().OfType<PrefixUnaryExpressionSyntax>().Single(); 1122var expressions = tree.GetRoot().DescendantNodes().OfType<RangeExpressionSyntax>().ToArray(); 1251var expression = tree.GetRoot().DescendantNodes().OfType<RangeExpressionSyntax>().ElementAt(1); 1284var expression = tree.GetRoot().DescendantNodes().OfType<RangeExpressionSyntax>().ElementAt(2); 1317var expression = tree.GetRoot().DescendantNodes().OfType<RangeExpressionSyntax>().ElementAt(3); 1341var expressions = tree.GetRoot().DescendantNodes().OfType<RangeExpressionSyntax>().ToArray(); 1384var expressions = tree.GetRoot().DescendantNodes().OfType<RangeExpressionSyntax>().ToArray();
Semantics\InitOnlyMemberTests.cs (6)
2521var invocation = root.DescendantNodes().OfType<InvocationExpressionSyntax>().Single(); 3140AccessorDeclarationSyntax accessorDecl = root.DescendantNodes().OfType<AccessorDeclarationSyntax>().Single(); 3155.OfType<IdentifierNameSyntax>() 3192var nodes = tree.GetRoot().DescendantNodes().OfType<AssignmentExpressionSyntax>(); 4143var localFunctionSyntax = tree.GetRoot().DescendantNodes().OfType<LocalFunctionStatementSyntax>().Single(); 4148var delegateSyntax = tree.GetRoot().DescendantNodes().OfType<DelegateDeclarationSyntax>().Single();
Semantics\InteractiveUsingTests.cs (2)
87var syntax = tree.GetRoot().DescendantNodes().OfType<UsingDirectiveSyntax>().Single(); 117var syntax = tree.GetRoot().DescendantNodes().OfType<UsingDirectiveSyntax>().Single();
Semantics\InterceptorsTests.cs (29)
46var nodes = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().SelectAsArray(node => model.GetInterceptableLocation(node)); 179var invocation = source.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().Single(); 1378Assert.Collection(source.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>(), 1983var invocation = source.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().Single(); 2286var invocation = source.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().Last(); 3543var interceptableName = sourceTree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().Last().GetInterceptableNameSyntax()!; 6152var node = source.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().Single(); 7298var node = source.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().Single(); 7348if (tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().ToList() is not [var node, var otherNode]) 7500var node = source.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().Single(); 7541var node = sourceTree1.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().Single(); 7587var node = source.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().Single(); 7633var node = source.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().Single(); 7684var node = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().Single(); 7709var node = source.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().Single(); 7755var node = source.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().First(); 7796var node = source.GetRoot().DescendantNodes().OfType<MemberBindingExpressionSyntax>().Single(); 7837var node = source.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().First(); 7881var node = source.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().First(); 7924var node = source.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().Single(); 7977var node = source.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().Single(); 8023var node = source.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().Last(); 8082var node = source.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().Last(); 8142var node = source.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().Last(); 8197var node = source.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().Last(); 8252var node = source.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().Last(); 8302var node = source.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().Last(); 8360var node = source.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().Single(i => i.ToString() == "RS().M()"); 8424var node = source.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().Single(i => i.ToString() == "new S().M()");
Semantics\InterpolationTests.cs (4)
4601(ExpressionSyntax)descendentNodes.OfType<BinaryExpressionSyntax>() 4602.Where(b => b.DescendantNodes().OfType<InterpolatedStringExpressionSyntax>().Any()) 4604?? descendentNodes.OfType<InterpolatedStringExpressionSyntax>().Single(); 4825SyntaxNode syntax = tree.GetRoot().DescendantNodes().OfType<CastExpressionSyntax>().Single();
Semantics\IteratorTests.cs (3)
578var node = tree.GetRoot().DescendantNodes().OfType<YieldStatementSyntax>().First(); 609var node = tree.GetRoot().DescendantNodes().OfType<ObjectCreationExpressionSyntax>().Single(); 647var node = tree.GetRoot().DescendantNodes().OfType<ObjectCreationExpressionSyntax>().Single();
Semantics\LambdaDiscardParametersTests.cs (8)
68var underscores = tree.GetRoot().DescendantNodes().OfType<ParameterSyntax>().Where(p => p.Identifier.ToString() == "_").ToArray(); 386var exprs = tree.GetRoot().DescendantNodes().OfType<LambdaExpressionSyntax>(); 417var underscoreParameters = tree.GetRoot().DescendantNodes().OfType<ParameterSyntax>().Where(p => p.ToString() == "_").ToArray(); 422var underscore = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(p => p.ToString() == "_").Single(); 448var underscores = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(p => p.ToString() == "_").ToArray(); 482var underscore = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(p => p.ToString() == "_").Single(); 513var underscores = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(p => p.ToString() == "_").ToArray(); 566var underscoreParameters = tree.GetRoot().DescendantNodes().OfType<ParameterSyntax>().Where(p => p.ToString() == "_").ToArray();
Semantics\LambdaTests.cs (81)
841ExpressionSyntax expr = tree.GetCompilationUnitRoot().DescendantNodes().OfType<BinaryExpressionSyntax>(). 849var exprs = tree.GetCompilationUnitRoot().DescendantNodes().OfType<ParenthesizedLambdaExpressionSyntax>(); 941var invocation = tree.GetCompilationUnitRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().Single(); 1036.OfType<ExpressionSyntax>() 1090.OfType<NameSyntax>() 1125.OfType<ExpressionSyntax>() 1178var expr = (ExpressionSyntax)tree.GetCompilationUnitRoot().DescendantNodes().OfType<ParenthesizedLambdaExpressionSyntax>().Single().Body; 1206var expr = (ExpressionSyntax)tree.GetCompilationUnitRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().Single().Initializer.Value; 1238var expr = (ExpressionSyntax)tree.GetCompilationUnitRoot().DescendantNodes().OfType<ParenthesizedLambdaExpressionSyntax>().Single().Body; 1513var node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "a").Single(); 1548var node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "a").Single(); 1582var node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "a").Single(); 1614var node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "a").Single(); 2120var lambda = tree.GetCompilationUnitRoot().DescendantNodes().OfType<LambdaExpressionSyntax>().Single(); 2121var eReference = lambda.Body.DescendantNodes().OfType<IdentifierNameSyntax>().First(); 2166var lambda = tree.GetCompilationUnitRoot().DescendantNodes().OfType<LambdaExpressionSyntax>().Single(); 2167var eReference = lambda.Body.DescendantNodes().OfType<IdentifierNameSyntax>().First(); 2212var lambda = tree.GetCompilationUnitRoot().DescendantNodes().OfType<LambdaExpressionSyntax>().Single(); 2213var eReference = lambda.Body.DescendantNodes().OfType<IdentifierNameSyntax>().First(); 2258var lambda = tree.GetCompilationUnitRoot().DescendantNodes().OfType<LambdaExpressionSyntax>().Single(); 2259var eReference = lambda.Body.DescendantNodes().OfType<IdentifierNameSyntax>().First(); 2304var lambda = tree.GetCompilationUnitRoot().DescendantNodes().OfType<LambdaExpressionSyntax>().Single(); 2305var eReference = lambda.Body.DescendantNodes().OfType<IdentifierNameSyntax>().First(); 2334var lambda = tree.GetCompilationUnitRoot().DescendantNodes().OfType<LambdaExpressionSyntax>().Single(); 2335var eReference = lambda.Body.DescendantNodes().OfType<IdentifierNameSyntax>().First(); 2361var lambda = tree.GetCompilationUnitRoot().DescendantNodes().OfType<LambdaExpressionSyntax>().Single(); 2362var eReference = lambda.Body.DescendantNodes().OfType<IdentifierNameSyntax>().First(); 2415foreach (var lambda in tree.GetRoot().DescendantNodes().OfType<LambdaExpressionSyntax>()) 2417var reference = lambda.Body.DescendantNodesAndSelf().OfType<IdentifierNameSyntax>().First(); 2461foreach (var lambda in tree.GetRoot().DescendantNodes().OfType<LambdaExpressionSyntax>()) 2463var reference = lambda.Body.DescendantNodesAndSelf().OfType<IdentifierNameSyntax>().First(); 2507foreach (var lambda in tree.GetRoot().DescendantNodes().OfType<LambdaExpressionSyntax>()) 2509var reference = lambda.Body.DescendantNodesAndSelf().OfType<IdentifierNameSyntax>().First(); 2540foreach (var lambda in tree.GetRoot().DescendantNodes().OfType<LambdaExpressionSyntax>()) 2542var reference = lambda.Body.DescendantNodesAndSelf().OfType<IdentifierNameSyntax>().First(); 2573foreach (var lambda in tree.GetRoot().DescendantNodes().OfType<LambdaExpressionSyntax>()) 2575var reference = lambda.Body.DescendantNodesAndSelf().OfType<IdentifierNameSyntax>().First(); 2610foreach (var lambda in tree.GetRoot().DescendantNodes().OfType<LambdaExpressionSyntax>()) 2612var reference = lambda.Body.DescendantNodesAndSelf().OfType<IdentifierNameSyntax>().First(); 2662var lambdas = tree.GetRoot().DescendantNodes().OfType<ParenthesizedLambdaExpressionSyntax>().ToArray(); 2997ExpressionSyntax contentType = tree.GetCompilationUnitRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "ContentType").Single(); 3004ExpressionSyntax b = tree.GetCompilationUnitRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "b").Single(); 3013ParameterSyntax parameterSyntax = tree.GetCompilationUnitRoot().DescendantNodes().OfType<ParameterSyntax>().Single(); 3039ExpressionSyntax contentType = tree.GetCompilationUnitRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "ContentType").Single(); 3046ExpressionSyntax b = tree.GetCompilationUnitRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "b").Single(); 3054ParameterSyntax parameterSyntax = tree.GetCompilationUnitRoot().DescendantNodes().OfType<ParameterSyntax>().Single(); 3612var exprs = tree.GetRoot().DescendantNodes().OfType<LambdaExpressionSyntax>(); 3893var lambda = tree.GetRoot().DescendantNodes().OfType<LambdaExpressionSyntax>().Single(); 3937var attributeSyntaxes = tree.GetRoot().DescendantNodes().OfType<AttributeSyntax>().ToImmutableArray(); 3977var a = (IdentifierNameSyntax)tree.GetRoot().DescendantNodes().OfType<AttributeSyntax>().Single().Name; 3986var m = newTree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Single(); 3990a = (IdentifierNameSyntax)newTree.GetRoot().DescendantNodes().OfType<AttributeSyntax>().Single().Name; 4093var expr = tree.GetRoot().DescendantNodes().OfType<LambdaExpressionSyntax>().Single(); 4122var exprs = tree.GetRoot().DescendantNodes().OfType<LambdaExpressionSyntax>().ToImmutableArray(); 4157var exprs = tree.GetRoot().DescendantNodes().OfType<LambdaExpressionSyntax>().ToImmutableArray(); 4185var exprs = tree.GetRoot().DescendantNodes().OfType<LambdaExpressionSyntax>().ToImmutableArray(); 4212var exprs = tree.GetRoot().DescendantNodes().OfType<LambdaExpressionSyntax>().ToImmutableArray(); 4787var exprs = tree.GetRoot().DescendantNodes().OfType<LambdaExpressionSyntax>().ToImmutableArray(); 4872var exprs = tree.GetRoot().DescendantNodes().OfType<LambdaExpressionSyntax>().ToImmutableArray(); 4927var exprs = tree.GetRoot().DescendantNodes().OfType<LambdaExpressionSyntax>().ToImmutableArray(); 4954var exprs = tree.GetRoot().DescendantNodes().OfType<LambdaExpressionSyntax>().ToImmutableArray(); 4982var exprs = tree.GetRoot().DescendantNodes().OfType<LambdaExpressionSyntax>().ToImmutableArray(); 5028var expr = tree.GetRoot().DescendantNodes().OfType<LambdaExpressionSyntax>().First(); 5636var lambdaSyntax = tree.GetRoot().DescendantNodes().OfType<ParenthesizedLambdaExpressionSyntax>().Single(); 6509var parameterUsages = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>() 6819var discard = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>() 6848var underscore = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>() 6897var lambdas = tree.GetRoot().DescendantNodes().OfType<ParenthesizedLambdaExpressionSyntax>().Select(e => model.GetSymbolInfo(e).Symbol.GetSymbol<LambdaSymbol>()).ToArray(); 7011var action = syntaxTree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().First(id => id.Identifier.ValueText == "Action"); 7108var lambdas = root.DescendantNodes().OfType<LambdaExpressionSyntax>().ToArray(); 8058var lambda = tree.GetRoot().DescendantNodes().OfType<LambdaExpressionSyntax>().Single(); 8059var equalsValue = lambda.DescendantNodes().OfType<EqualsValueClauseSyntax>().Single(); 8087var newLambda = newMethod.DescendantNodes().OfType<LambdaExpressionSyntax>().Single(); 8118var decls = tree.GetRoot().DescendantNodes().OfType<LocalDeclarationStatementSyntax>().ToImmutableArray(); 8126var defaultValue = decls[1].DescendantNodes().OfType<LambdaExpressionSyntax>().Single() 8127.DescendantNodes().OfType<EqualsValueClauseSyntax>().Single().Value; 8132var lhs = decls[2].DescendantNodes().OfType<EqualsValueClauseSyntax>().Single().Value; 8157var defaultValue = tree.GetRoot().DescendantNodes().OfType<LambdaExpressionSyntax>().Single() 8158.DescendantNodes().OfType<EqualsValueClauseSyntax>().Single().Value; 8360var exprs = tree.GetRoot().DescendantNodes().OfType<LambdaExpressionSyntax>().ToImmutableArray(); 8393var exprs = tree.GetRoot().DescendantNodes().OfType<LambdaExpressionSyntax>().ToImmutableArray();
Semantics\LocalFunctionTests.cs (51)
349.DescendantNodes().OfType<MethodDeclarationSyntax>().Single(); 353var x = newTree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Single(); 395.OfType<IdentifierNameSyntax>().ElementAt(2); 405.DescendantNodes().OfType<MethodDeclarationSyntax>().Single(); 409a = newTree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().ElementAt(2); 451var attributeSyntax = tree.GetRoot().DescendantNodes().OfType<AttributeSyntax>().Single(); 494.OfType<LocalFunctionStatementSyntax>() 542.OfType<LocalFunctionStatementSyntax>() 806.OfType<LocalFunctionStatementSyntax>() 852var localFunction = tree.GetRoot().DescendantNodes().OfType<LocalFunctionStatementSyntax>().Single(); 968var localFunction = tree.GetRoot().DescendantNodes().OfType<LocalFunctionStatementSyntax>().Single(); 1022var attributeSyntaxes = tree.GetRoot().DescendantNodes().OfType<AttributeSyntax>().ToList(); 1060var attrSyntax = tree.GetRoot().DescendantNodes().OfType<AttributeSyntax>().Single(); 1720var x = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().Where(v => v.Identifier.ValueText == "x").Single(); 1768.OfType<IdentifierNameSyntax>() 1786.OfType<IdentifierNameSyntax>() 1843.OfType<IdentifierNameSyntax>() 1861.OfType<IdentifierNameSyntax>() 2373LocalFunctionStatementSyntax declaration = tree.GetRoot().DescendantNodes().OfType<LocalFunctionStatementSyntax>().First(); 2587var exprs = tree.GetRoot().DescendantNodes().OfType<LocalFunctionStatementSyntax>().ToImmutableArray(); 4690var designation = descendents.OfType<SingleVariableDesignationSyntax>().Where(d => d.Identifier.ValueText == name).Single(); 4694var refs = descendents.OfType<IdentifierNameSyntax>().Where(n => n.Identifier.ValueText == name).ToArray(); 4726var parameter = descendents.OfType<ParameterSyntax>().Single(); 4731var declarator = descendents.OfType<VariableDeclaratorSyntax>().Where(d => d.Identifier.ValueText == name).Single(); 4735var refs = descendents.OfType<IdentifierNameSyntax>().Where(n => n.Identifier.ValueText == name).ToArray(); 4962var b2 = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "b2").Single(); 4965var b1 = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "b1").Single(); 6489var exprs = tree.GetRoot().DescendantNodes().OfType<TypeOfExpressionSyntax>().Select(n => n.Type).ToImmutableArray(); 6536var exprs = tree.GetRoot().DescendantNodes().OfType<SizeOfExpressionSyntax>().Select(n => n.Type).ToImmutableArray(); 6551OfType<InvocationExpressionSyntax>(). 7038var nodes = tree.GetRoot().DescendantNodes().OfType<AssignmentExpressionSyntax>(); 7098var nodes = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>(); 7360=> SyntaxFactory.ParseCompilationUnit($@"class X {{ {source} void M() {{ }} }}", options: parseOptions).DescendantNodes().OfType<AttributeSyntax>().Single(); 7383return node.DescendantNodes().OfType<IdentifierNameSyntax>().Where(i => i.Identifier.ValueText == "TParameter").Single(); 7451return tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(i => i.Identifier.ValueText == identifier).Single().SpanStart; 7455=> SyntaxFactory.ParseCompilationUnit($@"{source};", options: parseOptions).DescendantNodes().OfType<InvocationExpressionSyntax>().Single(); 7458=> SyntaxFactory.ParseCompilationUnit($@"{source};", options: parseOptions).DescendantNodes().OfType<IdentifierNameSyntax>().Single(); 7532=> SyntaxFactory.ParseCompilationUnit($@"class X {{ {source} void M() {{ }} }}", options: parseOptions).DescendantNodes().OfType<AttributeSyntax>().Single(); 7585=> SyntaxFactory.ParseCompilationUnit($@"class X {{ {source} void M() {{ }} }}", options: parseOptions).DescendantNodes().OfType<AttributeSyntax>().Single(); 7639var tParameterUsages = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>() 8684var parameterUsages = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>() 8739var method = tree2.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().First(); 8742var invocation = tree2.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().Single(); 8779var nameofExpression = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().Single(); 8941=> SyntaxFactory.ParseCompilationUnit($@"class X {{ {source} void M() {{ }} }}", options: parseOptions).DescendantNodes().OfType<AttributeSyntax>().Single(); 8964return node.DescendantNodes().OfType<IdentifierNameSyntax>().Where(i => i.Identifier.ValueText == "parameter").Single(); 9445=> SyntaxFactory.ParseCompilationUnit($@"class X {{ {source} void M() {{ }} }}", options: parseOptions).DescendantNodes().OfType<AttributeSyntax>().Single(); 9552var node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>() 9763=> SyntaxFactory.ParseCompilationUnit($@"class X {{ {source} void M() {{ }} }}", options: parseOptions).DescendantNodes().OfType<AttributeSyntax>().Single(); 10172var node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>() 10385var localFunction = root.DescendantNodes().OfType<LocalFunctionStatementSyntax>().Single();
Semantics\LockTests.cs (9)
45var localDecl = tree.GetCompilationUnitRoot().DescendantNodes().OfType<LocalDeclarationStatementSyntax>().Single(); 50var lockStatement = tree.GetCompilationUnitRoot().DescendantNodes().OfType<LockStatementSyntax>().Single(); 55var memberAccessExpression = tree.GetCompilationUnitRoot().DescendantNodes().OfType<MemberAccessExpressionSyntax>().Single(); 489var lockStatements = tree.GetCompilationUnitRoot().DescendantNodes().OfType<LockStatementSyntax>().ToList(); 550var localDecl = tree.GetCompilationUnitRoot().DescendantNodes().OfType<TypeParameterSyntax>().Single(); 575var lockStatements = tree.GetCompilationUnitRoot().DescendantNodes().OfType<LockStatementSyntax>().ToList(); 604var localDecl = tree.GetCompilationUnitRoot().DescendantNodes().OfType<LocalDeclarationStatementSyntax>().Single(); 628var localDecl = tree.GetCompilationUnitRoot().DescendantNodes().OfType<LocalDeclarationStatementSyntax>().Single(); 699var lockStatements = tree.GetCompilationUnitRoot().DescendantNodes().OfType<LockStatementSyntax>().ToList();
Semantics\LookupTests.cs (7)
1501var node = tree.GetRoot().DescendantNodes().OfType<ExpressionSyntax>().Where(n => n.ToString() == "m.M").Single(); 1725var syntaxes = tree.GetRoot().DescendantNodes().OfType<MemberAccessExpressionSyntax>().ToArray(); 2014var call = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().First(); 2044var node = tree.GetRoot().DescendantNodes().OfType<ConditionalAccessExpressionSyntax>().Single().Expression; 2074var node = tree.GetRoot().DescendantNodes().OfType<ConditionalAccessExpressionSyntax>().Single().Expression; 2100var node = tree.GetRoot().DescendantNodes().OfType<GenericNameSyntax>().Single(); 2122var node = tree.GetRoot().DescendantNodes().OfType<AttributeSyntax>().Single();
Semantics\MethodTypeInferenceTests.cs (4)
859return tree.GetRoot().DescendantNodes().OfType<DiscardDesignationSyntax>(); 864return tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(i => i.Identifier.ContextualKind() == SyntaxKind.UnderscoreToken); 1047var syntax = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().Single(); 1077var syntax = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().Single();
Semantics\NamedAndOptionalTests.cs (5)
2047var methods = module.GlobalNamespace.GetMember<NamedTypeSymbol>("C").GetMembers().OfType<MethodSymbol>().Where(m => m.MethodKind == MethodKind.Ordinary).ToArray(); 2129var methods = module.GlobalNamespace.GetMember<NamedTypeSymbol>("C").GetMembers().OfType<MethodSymbol>().Where(m => m.MethodKind == MethodKind.Ordinary).ToArray(); 2180var methods = module.GlobalNamespace.GetMember<NamedTypeSymbol>("C").GetMembers().OfType<MethodSymbol>().Where(m => m.MethodKind == MethodKind.Ordinary).ToArray(); 2263var methods = module.GlobalNamespace.GetMember<NamedTypeSymbol>("C").GetMembers().OfType<MethodSymbol>().Where(m => m.MethodKind == MethodKind.Ordinary).ToArray(); 2345var methods = module.GlobalNamespace.GetMember<NamedTypeSymbol>("C").GetMembers().OfType<MethodSymbol>().Where(m => m.MethodKind == MethodKind.Ordinary).ToArray();
Semantics\NameOfTests.cs (19)
685var node = tree.GetRoot().DescendantNodes().Where(n => n.ToString() == "SomeClass.Goo").OfType<ExpressionSyntax>().First(); 711var node = tree.GetRoot().DescendantNodes().Where(n => n.ToString() == "SomeClass.Goo").OfType<ExpressionSyntax>().First(); 746var node = tree.GetRoot().DescendantNodes().Where(n => n.ToString() == "a.Extension").OfType<ExpressionSyntax>().First(); 793var node = tree.GetRoot().DescendantNodes().Where(n => n.ToString() == "a.Extension").OfType<ExpressionSyntax>().First(); 830var node = tree.GetRoot().DescendantNodes().Where(n => n.ToString() == "a.Extension").OfType<ExpressionSyntax>().First(); 866var node = tree.GetRoot().DescendantNodes().Where(n => n.ToString() == "a.Nested").OfType<ExpressionSyntax>().First(); 912var node = tree.GetRoot().DescendantNodes().Where(n => n.ToString() == "A.Extension").OfType<ExpressionSyntax>().First(); 945var node = tree.GetRoot().DescendantNodes().Where(n => n.ToString() == "a.Extension").OfType<ExpressionSyntax>().First(); 977var initializer = tree2.GetRoot().DescendantNodes().OfType<EqualsValueClauseSyntax>().Single(); 1017return tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>() 1049var initializer = tree2.GetRoot().DescendantNodes().OfType<EqualsValueClauseSyntax>().Single(); 1091return tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>() 1131var initializer = tree2.GetRoot().DescendantNodes().OfType<EqualsValueClauseSyntax>().Single(); 1174return tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>() 1212var initializer = tree2.GetRoot().DescendantNodes().OfType<EqualsValueClauseSyntax>().Single(); 1255return tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>() 1422var node = tree.GetRoot().DescendantNodes().Where(n => n.ToString() == "X1.Extension").OfType<ExpressionSyntax>().First(); 3043var firstGeneric = root.DescendantNodes().OfType<GenericNameSyntax>().First(); 3044var lastGeneric = root.DescendantNodes().OfType<GenericNameSyntax>().Last();
Semantics\NativeIntegerTests.cs (23)
1789var actualLocals = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().Select(d => model.GetDeclaredSymbol(d).ToTestDisplayString()); 2346var actualLocals = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().Select(d => model.GetDeclaredSymbol(d).ToTestDisplayString()); 2466var actualLocals = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().Select(d => model.GetDeclaredSymbol(d).ToTestDisplayString()); 3636var underlyingType = model.GetDeclaredSymbol(nodes.OfType<ClassDeclarationSyntax>().Single()); 3639var method = model.GetDeclaredSymbol(nodes.OfType<MethodDeclarationSyntax>().Single()); 4118var nodes = tree.GetRoot().DescendantNodes().OfType<ObjectCreationExpressionSyntax>().ToArray(); 6061var nodes = tree.GetRoot().DescendantNodes().OfType<PrefixUnaryExpressionSyntax>(); 6109var nodes = tree.GetRoot().DescendantNodes().OfType<BinaryExpressionSyntax>(); 9495var expr = tree.GetRoot().DescendantNodes().OfType<ReturnStatementSyntax>().Single().Expression; 9730var expr = tree.GetRoot().DescendantNodes().OfType<PrefixUnaryExpressionSyntax>().Single(); 12381var expr = tree.GetRoot().DescendantNodes().OfType<BinaryExpressionSyntax>().Single(); 15316var docComments = tree.GetCompilationUnitRoot().DescendantTrivia().Select(trivia => trivia.GetStructure()).OfType<DocumentationCommentTriviaSyntax>(); 15317var cref = docComments.First().DescendantNodes().OfType<XmlCrefAttributeSyntax>().First().Cref; 15337var docComments = tree.GetCompilationUnitRoot().DescendantTrivia().Select(trivia => trivia.GetStructure()).OfType<DocumentationCommentTriviaSyntax>(); 15338var cref = docComments.First().DescendantNodes().OfType<XmlCrefAttributeSyntax>().First().Cref; 15360var docComments = tree.GetCompilationUnitRoot().DescendantTrivia().Select(trivia => trivia.GetStructure()).OfType<DocumentationCommentTriviaSyntax>(); 15361var cref = docComments.First().DescendantNodes().OfType<XmlCrefAttributeSyntax>().First().Cref; 15388var docComments = tree.GetCompilationUnitRoot().DescendantTrivia().Select(trivia => trivia.GetStructure()).OfType<DocumentationCommentTriviaSyntax>(); 15389var cref = docComments.First().DescendantNodes().OfType<XmlCrefAttributeSyntax>().First().Cref; 15411var docComments = tree.GetCompilationUnitRoot().DescendantTrivia().Select(trivia => trivia.GetStructure()).OfType<DocumentationCommentTriviaSyntax>(); 15412var cref = docComments.First().DescendantNodes().OfType<XmlCrefAttributeSyntax>().First().Cref; 15441var docComments = tree.GetCompilationUnitRoot().DescendantTrivia().Select(trivia => trivia.GetStructure()).OfType<DocumentationCommentTriviaSyntax>(); 15442var cref = docComments.First().DescendantNodes().OfType<XmlCrefAttributeSyntax>().First().Cref;
Semantics\NonTrailingNamedArgumentsTests.cs (18)
46var firstInvocation = nodes.OfType<InvocationExpressionSyntax>().ElementAt(2); 51var firstNamedArgA = nodes.OfType<NameColonSyntax>().ElementAt(0); 58var secondInvocation = nodes.OfType<InvocationExpressionSyntax>().ElementAt(3); 63var secondNamedArgA = nodes.OfType<NameColonSyntax>().ElementAt(1); 368var invocation = nodes.OfType<InvocationExpressionSyntax>().ElementAt(1); 394var invocation = nodes.OfType<InvocationExpressionSyntax>().ElementAt(1); 424var invocation = nodes.OfType<InvocationExpressionSyntax>().ElementAt(1); 456var invocation = nodes.OfType<InvocationExpressionSyntax>().Single(); 485var invocation = nodes.OfType<InvocationExpressionSyntax>().Single(); 535var invocation = nodes.OfType<InvocationExpressionSyntax>().Single(); 570var invocation = nodes.OfType<InvocationExpressionSyntax>().Single(); 599var invocation = nodes.OfType<InvocationExpressionSyntax>().Single(); 653var invocation = nodes.OfType<InvocationExpressionSyntax>().Single(); 680var invocation = nodes.OfType<InvocationExpressionSyntax>().ElementAt(1); 711var firstInvocation = nodes.OfType<InvocationExpressionSyntax>().Single(); 745var invocation = nodes.OfType<InvocationExpressionSyntax>().ElementAt(1); 777var invocation = nodes.OfType<InvocationExpressionSyntax>().ElementAt(1); 984var invocation = nodes.OfType<AttributeSyntax>().ElementAt(1);
Semantics\NullableContextTests.cs (18)
67var classDeclPosition = syntaxTree.GetRoot().DescendantNodes().OfType<ClassDeclarationSyntax>().Single().SpanStart; 68var methodDeclPosition = syntaxTree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Single().SpanStart; 102var classDecl1 = syntaxTree1.GetRoot().DescendantNodes().OfType<ClassDeclarationSyntax>().Single().SpanStart; 103var classDecl2 = syntaxTree2.GetRoot().DescendantNodes().OfType<ClassDeclarationSyntax>().Single().SpanStart; 350var syntax = syntaxTree.GetRoot().DescendantNodes().OfType<ReturnStatementSyntax>().Skip(1).Single(); 389var syntax = syntaxTree.GetRoot().DescendantNodes().OfType<AttributeArgumentSyntax>().Single(); 424var syntax = syntaxTree.GetRoot().DescendantNodes().OfType<EqualsValueClauseSyntax>().First().Value; 580verifyContextState(tree, syntaxNodes.OfType<ClassDeclarationSyntax>().Single(), classDirectives.ExpectedWarningsState, classDirectives.ExpectedAnnotationsState); 581verifyContextState(tree, syntaxNodes.OfType<MethodDeclarationSyntax>().Single(), expectedWarningsStateForMethod, expectedAnnotationsStateForMethod); 731var methodDeclarations = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().ToArray(); 1771var returnStatements = syntaxTree.GetRoot().DescendantNodes().OfType<ReturnStatementSyntax>().ToArray(); 1841var syntax = syntaxTree.GetRoot().DescendantNodes().OfType<AssignmentExpressionSyntax>().Single().Right; 1878var attributeArguments = syntaxTree.GetRoot().DescendantNodes().OfType<AttributeArgumentSyntax>().ToArray(); 1927var attributeArguments = syntaxTree.GetRoot().DescendantNodes().OfType<AttributeArgumentSyntax>().ToArray(); 1969var equalsValueClauses = syntaxTree.GetRoot().DescendantNodes().OfType<EqualsValueClauseSyntax>().ToArray(); 2009var declarations = syntaxTree.GetRoot().DescendantNodes().OfType<FieldDeclarationSyntax>().Select(f => f.Declaration.Variables[0]).ToArray(); 2048var declarations = syntaxTree.GetRoot().DescendantNodes().OfType<PropertyDeclarationSyntax>().ToArray(); 2228var typeOf = syntaxTree.GetRoot().DescendantNodes().OfType<TypeOfExpressionSyntax>().Single();
Semantics\NullableConversionTests.cs (1)
804var target = syntaxTree.GetRoot().DescendantNodes().OfType<CastExpressionSyntax>().ToList()[2];
Semantics\NullableReferenceTypesTests.cs (151)
1754var suppression = tree.GetRoot().DescendantNodes().OfType<PostfixUnaryExpressionSyntax>().First(); 1788var suppression = tree.GetRoot().DescendantNodes().OfType<PostfixUnaryExpressionSyntax>().First(); 1841var suppression = tree.GetRoot().DescendantNodes().OfType<PostfixUnaryExpressionSyntax>().Single(); 1867var suppressions = tree.GetRoot().DescendantNodes().OfType<PostfixUnaryExpressionSyntax>().ToArray(); 1892var suppressions = tree.GetRoot().DescendantNodes().OfType<PostfixUnaryExpressionSyntax>().ToArray(); 1963var suppression = tree.GetRoot().DescendantNodes().OfType<PostfixUnaryExpressionSyntax>().First(); 2276var suppression = tree.GetRoot().DescendantNodes().OfType<PostfixUnaryExpressionSyntax>().Single(); 2315var suppression = tree.GetRoot().DescendantNodes().OfType<PostfixUnaryExpressionSyntax>().Single(); 2347var suppression = tree.GetRoot().DescendantNodes().OfType<PostfixUnaryExpressionSyntax>().Single(); 2381var suppression = tree.GetRoot().DescendantNodes().OfType<PostfixUnaryExpressionSyntax>().Single(); 2479var suppression = tree.GetRoot().DescendantNodes().OfType<PostfixUnaryExpressionSyntax>().First(); 3334foreach (var lambda in tree.GetRoot().DescendantNodes().OfType<LambdaExpressionSyntax>()) 3336var reference = lambda.Body.DescendantNodesAndSelf().OfType<IdentifierNameSyntax>().First(); 4526var firstCref = tree.GetRoot().DescendantNodes(descendIntoTrivia: true).OfType<NameMemberCrefSyntax>().First(); 4530var lastCref = tree.GetRoot().DescendantNodes(descendIntoTrivia: true).OfType<NameMemberCrefSyntax>().Last(); 4562var lastCref = tree.GetRoot().DescendantNodes(descendIntoTrivia: true).OfType<NameMemberCrefSyntax>().Last(); 4594var lastCref = tree.GetRoot().DescendantNodes(descendIntoTrivia: true).OfType<NameMemberCrefSyntax>().Last(); 5169var declaration = syntaxTree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().Single(); 7769var specifier = tree.GetRoot().DescendantNodes().OfType<ArrayRankSpecifierSyntax>().Single(); 10534var foreachSyntax = tree.GetRoot().DescendantNodes().OfType<ForEachStatementSyntax>().ToArray(); 13511var returnStatement = tree.GetRoot().DescendantNodes().OfType<ReturnStatementSyntax>().Skip(1).Single(); 30182var property = copen.GetMembers().OfType<PropertySymbol>().Single(); 30285var property = copen.GetMembers().OfType<PropertySymbol>().Single(); 30797var field = copen.GetMembers().OfType<FieldSymbol>().Single(); 34983var outVar = tree.GetRoot().DescendantNodes().OfType<DeclarationExpressionSyntax>().Single(); 35000var varDecl = tree.GetRoot().DescendantNodes().OfType<LocalDeclarationStatementSyntax>().Where(d => d.Declaration.Type.IsVar).Single(); 40784var field = copen.GetMembers().OfType<FieldSymbol>().Single(); 40970var property = copen.GetMembers().OfType<PropertySymbol>().Single(); 41031var property = copen.GetMembers().OfType<PropertySymbol>().Single(); 44651var property = copen.GetMembers().OfType<PropertySymbol>().Single(); 44888var field = copen.GetMembers().OfType<FieldSymbol>().Single(); 47988var property = copen.GetMembers().OfType<PropertySymbol>().Single(); 48088var field = copen.GetMembers().OfType<FieldSymbol>().Single(); 56076var nullNode = tree.GetRoot().DescendantNodes().OfType<LiteralExpressionSyntax>().First(); 56082var invocationNode = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().Single(); 56106var nullNode = tree.GetRoot().DescendantNodes().OfType<LiteralExpressionSyntax>().First(); 56112var invocationNode = tree.GetRoot().DescendantNodes().OfType<ImplicitArrayCreationExpressionSyntax>().Single(); 56139var defaultNode = tree.GetRoot().DescendantNodes().OfType<LiteralExpressionSyntax>().First(); 56145var invocationNode = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().Single(); 56176var defaultNode = tree.GetRoot().DescendantNodes().OfType<LiteralExpressionSyntax>().First(); 56182var invocationNode = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().Single(); 56212var invocationNode = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().Single(); 56246var invocationNode = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().Single(); 56277var invocationNode = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().Single(); 56304var nullNode = tree.GetRoot().DescendantNodes().OfType<LiteralExpressionSyntax>().First(); 56310var invocationNode = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().Single(); 56344var invocationNode = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().Single(); 56378var invocationNode = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().Single(); 56409var invocationNode = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().Single(); 56437var newNode = tree.GetRoot().DescendantNodes().OfType<ImplicitObjectCreationExpressionSyntax>().First(); 56442var invocationNode = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().Single(); 56472var newNode = tree.GetRoot().DescendantNodes().OfType<ImplicitObjectCreationExpressionSyntax>().First(); 56477var invocationNode = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().Single(); 56508var nullNode = tree.GetRoot().DescendantNodes().OfType<LiteralExpressionSyntax>().First(); 56513var invocationNode = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().Single(); 56588var invocationNode = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().First(); 56591var invocationNode2 = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().Last(); 56619var lambdaNode = tree.GetRoot().DescendantNodes().OfType<LambdaExpressionSyntax>().Last(); 56624var invocationNode = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().Single(); 59017var declarator = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().First(); 59022var declaration = tree.GetRoot().DescendantNodes().OfType<VariableDeclarationSyntax>().First(); 59051var declarator = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().First(); 59079var declarator = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().First(); 59111var declarator = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().First(); 59140var declarator = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().First(); 59173var declarator = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().First(); 59205var declarator = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().First(); 59238var declarator = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().Skip(1).First(); 59272var declarator = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().Skip(1).First(); 59298var declarator = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().First(); 59327var declarator = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().First(); 59356var declarators = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().ToArray(); 62841var declarators = syntaxTree.GetRoot().DescendantNodes().OfType<AnonymousObjectMemberDeclaratorSyntax>().ToImmutableArray(); 65890var function1 = tree1.GetRoot().DescendantNodes().OfType<LocalFunctionStatementSyntax>().Last(); 65894var function2 = tree2.GetRoot().DescendantNodes().OfType<LocalFunctionStatementSyntax>().Single(); 65899var object2 = tree2.GetRoot().DescendantNodes().OfType<PredefinedTypeSyntax>() 71252var declarators = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().ToArray(); 71288var declarators = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().ToArray(); 71329var declarators = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().ToArray(); 71366var declarators = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().ToArray(); 71403var declarators = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().ToArray(); 71438var declarators = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().ToArray(); 71471var declarators = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().ToArray(); 71508var declarators = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().ToArray(); 71780var discards = tree.GetRoot().DescendantNodes().OfType<AssignmentExpressionSyntax>().Select(a => a.Left).ToArray(); 71874var arguments = tree.GetRoot().DescendantNodes().OfType<ArgumentSyntax>(); 71921var arguments = tree.GetRoot().DescendantNodes().OfType<ArgumentSyntax>(); 71960var discardPatterns = tree.GetRoot().DescendantNodes().OfType<DiscardPatternSyntax>().ToArray(); 73763var node = tree.GetRoot().DescendantNodes().OfType<EnumMemberDeclarationSyntax>().ElementAt(1); 81259var declarator = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().First(); 94281var localDeclaration = syntaxTree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().ElementAt(1); 97757var localSyntaxes = tree.GetRoot().DescendantNodes().OfType<LocalFunctionStatementSyntax>().ToArray(); 99086var localSyntaxes = tree.GetRoot().DescendantNodes().OfType<LocalFunctionStatementSyntax>().ToArray(); 111770var localSyntaxes = tree.GetRoot().DescendantNodes().OfType<LocalFunctionStatementSyntax>(); 111824var localSyntaxes = tree.GetRoot().DescendantNodes().OfType<LocalFunctionStatementSyntax>(); 113192var arrays = tree.GetRoot().DescendantNodes().OfType<ArrayTypeSyntax>().ToArray(); 113594var decl = tree.GetRoot().DescendantNodes().OfType<DeclarationExpressionSyntax>().Single(); 113625var decl = tree.GetRoot().DescendantNodes().OfType<DeclarationExpressionSyntax>().Single(); 113803var decl = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().Single(); 114028var decl = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().Single(); 145375var declaration = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().Single(); 145382var invocation = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().First(); 145416var declaration = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().Single(); 145423var invocation = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().First(); 145456var declaration = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().Single(); 145463var invocation = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().First(); 145494var declaration = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().Single(); 145501var invocation = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().First(); 145532var declaration = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().Single(); 145539var invocation = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().First(); 145572var invocation = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().First(); 145605var invocation = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().First(); 145636var declaration = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().Single(); 145643var invocation = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().First(); 145675var declaration = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().Single(); 145682var invocation = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().First(); 145952var invocation = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().First(); 145983var invocation = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().First(); 146016var invocation = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().First(); 146298var @foreach = tree.GetRoot().DescendantNodes().OfType<ForEachStatementSyntax>().Single(); 146337var @foreach = tree.GetRoot().DescendantNodes().OfType<ForEachStatementSyntax>().Single(); 146377var @foreach = tree.GetRoot().DescendantNodes().OfType<ForEachStatementSyntax>().Single(); 146416var @foreach = tree.GetRoot().DescendantNodes().OfType<ForEachStatementSyntax>().Single(); 146454var ifStatement = root.DescendantNodes().OfType<IfStatementSyntax>().Single(); 146455var cast = ifStatement.DescendantNodes().OfType<CastExpressionSyntax>().Single(); 146465.OfType<AssignmentExpressionSyntax>() 154801var locals = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().ToArray(); 154869var locals = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().ToArray(); 156747var invocationNode = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().First(); 156750var invocationNode2 = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().Last(); 157581var declarators = tree.GetRoot().DescendantNodes().OfType<EqualsValueClauseSyntax>().ToArray(); 157629var method1 = model.GetDeclaredSymbol(tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Single()); 157631var invocations = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().ToArray(); 158061var item = tree.GetRoot().DescendantNodes().OfType<MemberAccessExpressionSyntax>().First(); 158097var item = tree.GetRoot().DescendantNodes().OfType<ElementAccessExpressionSyntax>().First(); 158192var item = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().First(); 158230var item = tree.GetRoot().DescendantNodes().OfType<MemberAccessExpressionSyntax>().First(); 158271var item = tree.GetRoot().DescendantNodes().OfType<MemberAccessExpressionSyntax>().First(); 158311var item = tree.GetRoot().DescendantNodes().OfType<MemberAccessExpressionSyntax>().First(); 158345var item = tree.GetRoot().DescendantNodes().OfType<MemberAccessExpressionSyntax>().First(); 158382var item = tree.GetRoot().DescendantNodes().OfType<ElementAccessExpressionSyntax>().First(); 158477var item = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().First(); 158525var item = tree.GetRoot().DescendantNodes().OfType<MemberAccessExpressionSyntax>().First(); 158567var item = tree.GetRoot().DescendantNodes().OfType<MemberAccessExpressionSyntax>().First(); 158604var item = tree.GetRoot().DescendantNodes().OfType<MemberAccessExpressionSyntax>().First(); 158815var declarations = tree.GetRoot().DescendantNodes().OfType<VariableDeclarationSyntax>(); 160690var stackallocNode = tree.GetRoot().DescendantNodes().OfType<ImplicitStackAllocArrayCreationExpressionSyntax>().Single(); 161241var arms = syntaxTree.GetRoot().DescendantNodes().OfType<SwitchExpressionArmSyntax>().ToImmutableArray(); 161245var identifiers = unreachableArm.DescendantNodes().OfType<IdentifierNameSyntax>().ToImmutableArray(); 161287var sections = syntaxTree.GetRoot().DescendantNodes().OfType<SwitchSectionSyntax>().ToImmutableArray(); 161291var identifiers = unreachableSection.DescendantNodes().OfType<IdentifierNameSyntax>().ToImmutableArray();
Semantics\NullCoalesceAssignmentTests.cs (5)
38var coalesceAssignment = syntaxRoot.DescendantNodes().OfType<AssignmentExpressionSyntax>().Single(); 76var coalesceAssignment = syntaxRoot.DescendantNodes().OfType<AssignmentExpressionSyntax>().Single(); 119var coalesceAssignment = syntaxRoot.DescendantNodes().OfType<AssignmentExpressionSyntax>().Single(); 158var coalesceAssignment = syntaxRoot.DescendantNodes().OfType<AssignmentExpressionSyntax>().Single(); 184var defaultLiteral = syntaxRoot.DescendantNodes().OfType<LiteralExpressionSyntax>().Where(expr => expr.IsKind(SyntaxKind.DefaultLiteralExpression)).Single();
Semantics\ObjectAndCollectionInitializerTests.cs (14)
3691var objectCreation = root.DescendantNodes().OfType<ObjectCreationExpressionSyntax>().Single(); 3741var objectCreation = root.DescendantNodes().OfType<ObjectCreationExpressionSyntax>().Single(); 3785var objectCreation = root.DescendantNodes().OfType<ObjectCreationExpressionSyntax>().Last(); 3814var literals = syntax.GetRoot().DescendantNodes().OfType<LiteralExpressionSyntax>().ToArray(); 3837var literals = syntax.GetRoot().DescendantNodes().OfType<LiteralExpressionSyntax>().ToArray(); 3861var literals = syntax.GetRoot().DescendantNodes().OfType<LiteralExpressionSyntax>().ToArray(); 3935var nodes = tree.GetRoot().DescendantNodes().OfType<InitializerExpressionSyntax>().Skip(1).Single().Expressions; 4017var nodes = tree.GetRoot().DescendantNodes().OfType<GenericNameSyntax>().ToArray(); 4058var node1 = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().First(); 4096var nodes = tree.GetRoot().DescendantNodes().OfType<LiteralExpressionSyntax>().Where(n => n.ToString() == "2"); 4136var node1 = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().First(); 4168var nodes = tree.GetRoot().DescendantNodes().OfType<LiteralExpressionSyntax>().Where(n => n.ToString() == "2"); 4227var elementAccess = tree.GetRoot().DescendantNodes().OfType<ImplicitElementAccessSyntax>().Single(); 4281var propertyAccess = tree.GetRoot().DescendantNodes().OfType<AssignmentExpressionSyntax>().First().Left;
Semantics\OperatorTests.cs (11)
47var orNodes = tree.GetRoot().DescendantNodes().OfType<BinaryExpressionSyntax>().ToArray(); 2985var negOne = tree.GetRoot().DescendantNodes().OfType<PrefixUnaryExpressionSyntax>().Single(); 2991var boolPlusPlus = tree.GetRoot().DescendantNodes().OfType<PostfixUnaryExpressionSyntax>().ElementAt(0); 2997var errorPlusPlus = tree.GetRoot().DescendantNodes().OfType<PostfixUnaryExpressionSyntax>().ElementAt(1); 6939var syntax = tree.GetRoot().DescendantNodes().OfType<BinaryExpressionSyntax>().Single(); 7056var syntax = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Last(); 7211var syntax = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Last(); 7330var methodBody = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Last().Body; 8812var methodDecl = tree.GetCompilationUnitRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().First(); 11337var negNode = tree.GetRoot().DescendantNodes().OfType<PrefixUnaryExpressionSyntax>().Single(); 11418var fieldInitializerOperations = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>()
Semantics\OverloadResolutionPerfTests.cs (2)
982var expr = tree.GetCompilationUnitRoot().DescendantNodes().OfType<Syntax.InvocationExpressionSyntax>().Last(); 1060var exprs = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().ToImmutableArray();
Semantics\OverloadResolutionTests.cs (9)
7149var callSyntax = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().Single(); 7259var callSyntax = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().Single(); 7433var syntax = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().Single(); 7474var syntax = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().Single(); 9071var callSyntax = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().Single(); 9419var callSyntax = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().Single(); 11763var expr = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().Single(); 11812var expr = tree.GetRoot().DescendantNodes().OfType<ElementAccessExpressionSyntax>().Single(); 11862var expr = tree.GetRoot().DescendantNodes().OfType<MemberAccessExpressionSyntax>().Single();
Semantics\QueryTests.cs (18)
1453var classC = tree.GetCompilationUnitRoot().ChildNodes().OfType<TypeDeclarationSyntax>().Where(t => t.Identifier.ValueText == "Query").Single(); 1662var classC = tree.GetCompilationUnitRoot().ChildNodes().OfType<TypeDeclarationSyntax>().Where(t => t.Identifier.ValueText == "Query").Single(); 1722var classC = tree.GetCompilationUnitRoot().ChildNodes().OfType<TypeDeclarationSyntax>().Where(t => t.Identifier.ValueText == "Query").Single(); 1760var classC = tree.GetCompilationUnitRoot().ChildNodes().OfType<TypeDeclarationSyntax>().Where(t => t.Identifier.ValueText == "Query").Single(); 2357var unknownAccessorDecls = tree.GetCompilationUnitRoot().DescendantNodes().OfType<AccessorDeclarationSyntax>(); 2429foreach (var ordering in tree.GetCompilationUnitRoot().DescendantNodes().OfType<OrderingSyntax>()) 2716var queryExpr = tree.GetCompilationUnitRoot().DescendantNodes().OfType<QueryExpressionSyntax>().Where(x => x.ToFullString() == "from i in expr1 let ").Single(); 2742var queryExpr = tree.GetCompilationUnitRoot().DescendantNodes().OfType<QueryExpressionSyntax>().Single(); 2897var classC = tree.GetCompilationUnitRoot().ChildNodes().OfType<TypeDeclarationSyntax>().Where(t => t.Identifier.ValueText == "C").Single(); 2930var classC = tree.GetCompilationUnitRoot().ChildNodes().OfType<TypeDeclarationSyntax>().Where(t => t.Identifier.ValueText == "C").Single(); 3379.OfType<ExpressionSyntax>() 3388.OfType<ExpressionSyntax>() 3420var classC = tree.GetCompilationUnitRoot().ChildNodes().OfType<TypeDeclarationSyntax>().Where(t => t.Identifier.ValueText == "Query").Single(); 3464var classC = tree.GetCompilationUnitRoot().ChildNodes().OfType<TypeDeclarationSyntax>().Where(t => t.Identifier.ValueText == "Query").Single(); 3511var classC = tree.GetCompilationUnitRoot().ChildNodes().OfType<TypeDeclarationSyntax>().Where(t => t.Identifier.ValueText == "Test").Single(); 3550var classC = tree.GetCompilationUnitRoot().ChildNodes().OfType<TypeDeclarationSyntax>().Where(t => t.Identifier.ValueText == "Test2").Single(); 3598var classC = tree.GetCompilationUnitRoot().ChildNodes().OfType<TypeDeclarationSyntax>().Where(t => t.Identifier.ValueText == "QueryExpressionTest").Single(); 3607foreach (var ordering in queryStatement.DescendantNodes().OfType<OrderingSyntax>())
Semantics\RawInterpolationTests_Handler.cs (4)
2902(ExpressionSyntax)descendentNodes.OfType<BinaryExpressionSyntax>() 2903.Where(b => b.DescendantNodes().OfType<InterpolatedStringExpressionSyntax>().Any()) 2905?? descendentNodes.OfType<InterpolatedStringExpressionSyntax>().Single(); 3126SyntaxNode syntax = tree.GetRoot().DescendantNodes().OfType<CastExpressionSyntax>().Single();
Semantics\RecordStructTests.cs (28)
534var creation = tree.GetRoot().DescendantNodes().OfType<AnonymousObjectCreationExpressionSyntax>().Single(); 554var method = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Single(); 574var method = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Single(); 596var method = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Single(); 2307var x = tree.GetRoot().DescendantNodes().OfType<ReturnStatementSyntax>().Single().Expression; 2331var x = tree.GetRoot().DescendantNodes().OfType<ReturnStatementSyntax>().Single().Expression; 2594var x = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "X").First(); 2605var recordDeclaration = tree.GetRoot().DescendantNodes().OfType<RecordDeclarationSyntax>().Single(); 2629var x = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "X").First(); 2663var x = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "X").First(); 2698var x = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "X").First(); 3242var doc = tree.GetRoot().DescendantTrivia().Select(trivia => trivia.GetStructure()).OfType<DocumentationCommentTriviaSyntax>().Single(); 3243var x = doc.DescendantNodes().OfType<IdentifierNameSyntax>().Single(); 3284var docComments = tree.GetCompilationUnitRoot().DescendantTrivia().Select(trivia => trivia.GetStructure()).OfType<DocumentationCommentTriviaSyntax>(); 3285var cref = docComments.First().DescendantNodes().OfType<XmlCrefAttributeSyntax>().First().Cref; 3332var docComments = tree.GetCompilationUnitRoot().DescendantTrivia().Select(trivia => trivia.GetStructure()).OfType<DocumentationCommentTriviaSyntax>(); 3333var cref = docComments.First().DescendantNodes().OfType<XmlCrefAttributeSyntax>().First().Cref; 3383var docComments = tree.GetCompilationUnitRoot().DescendantTrivia().Select(trivia => trivia.GetStructure()).OfType<DocumentationCommentTriviaSyntax>(); 3384var cref = docComments.First().DescendantNodes().OfType<XmlCrefAttributeSyntax>().First().Cref; 5849var parameterSyntax = tree.GetRoot().DescendantNodes().OfType<ParameterSyntax>().Single(); 5855var initializerSyntax = tree.GetRoot().DescendantNodes().OfType<EqualsValueClauseSyntax>().Single(); 5891var outVarSyntax = tree.GetRoot().DescendantNodes().OfType<SingleVariableDesignationSyntax>().Single(); 6925var with = tree.GetRoot().DescendantNodes().OfType<WithExpressionSyntax>().Single(); 7606var with = tree.GetRoot().DescendantNodes().OfType<WithExpressionSyntax>().Single(); 8811var withExpr = tree.GetRoot().DescendantNodes().OfType<WithExpressionSyntax>().Single(); 10772tree.GetRoot().DescendantNodes().OfType<PrimaryConstructorBaseTypeSyntax>().First(); 10782tree.GetRoot().DescendantNodes().OfType<PrimaryConstructorBaseTypeSyntax>().Skip(1).First(); 10787var baseWithoutParens = tree.GetRoot().DescendantNodes().OfType<SimpleBaseTypeSyntax>().Single();
Semantics\RefEscapingTests.cs (9)
70.OfType<VariableDeclaratorSyntax>() 5784var tuple2 = tree.GetCompilationUnitRoot().DescendantNodes().OfType<TupleExpressionSyntax>().ElementAt(3); 5790var tuple3 = tree.GetCompilationUnitRoot().DescendantNodes().OfType<TupleExpressionSyntax>().ElementAt(5); 5796var tuple6 = tree.GetCompilationUnitRoot().DescendantNodes().OfType<TupleExpressionSyntax>().ElementAt(11); 5802var tuple7 = tree.GetCompilationUnitRoot().DescendantNodes().OfType<TupleExpressionSyntax>().ElementAt(13); 5884var tuple2 = tree.GetCompilationUnitRoot().DescendantNodes().OfType<TupleExpressionSyntax>().ElementAt(3); 5890var tuple3 = tree.GetCompilationUnitRoot().DescendantNodes().OfType<TupleExpressionSyntax>().ElementAt(5); 5896var tuple6 = tree.GetCompilationUnitRoot().DescendantNodes().OfType<TupleExpressionSyntax>().ElementAt(11); 5902var tuple7 = tree.GetCompilationUnitRoot().DescendantNodes().OfType<TupleExpressionSyntax>().ElementAt(13);
Semantics\RefFieldTests.cs (66)
2269var actualFields = type.GetMembers().OfType<FieldSymbol>().Select(f => f.ToTestDisplayString()).ToList(); 11025var decls = tree.GetRoot().DescendantNodes().OfType<LocalFunctionStatementSyntax>().ToArray(); 11099var delegateTypesAndLambdas = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().Select(d => getDelegateTypeAndLambda(model, d)).ToArray(); 11128var value = decl.DescendantNodes().OfType<ParenthesizedLambdaExpressionSyntax>().Single(); 11221var decls = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().ToArray(); 11389var lambdas = tree.GetRoot().DescendantNodes().OfType<SimpleLambdaExpressionSyntax>().Select(e => model.GetSymbolInfo(e).Symbol.GetSymbol<LambdaSymbol>()).ToArray(); 11981var expr = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().Single().Expression; 12061var decls = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().ToArray(); 12130var decls = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().ToArray(); 12198var decls = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().ToArray(); 12380var decls = tree.GetRoot().DescendantNodes().OfType<DeclarationExpressionSyntax>(). 12419var discard = tree.GetRoot().DescendantNodes().OfType<DiscardDesignationSyntax>().ToArray(); 12567var decls = tree.GetRoot().DescendantNodes().OfType<DeclarationExpressionSyntax>(). 12599var discard = tree.GetRoot().DescendantNodes().OfType<DiscardDesignationSyntax>().ToArray(); 12793var decls = tree.GetRoot().DescendantNodes().OfType<SingleVariableDesignationSyntax>().ToArray(); 12830var discard = tree.GetRoot().DescendantNodes().OfType<DiscardDesignationSyntax>().ToArray(); 12976var decls = tree.GetRoot().DescendantNodes().OfType<SingleVariableDesignationSyntax>().ToArray(); 13006var discard = tree.GetRoot().DescendantNodes().OfType<DiscardDesignationSyntax>().ToArray(); 13151var decls = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().ToArray(); 13206var decls = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().ToArray(); 13265var decls = tree.GetRoot().DescendantNodes().OfType<SingleVariableDesignationSyntax>().ToArray(); 13308var decls = tree.GetRoot().DescendantNodes().OfType<SingleVariableDesignationSyntax>().ToArray(); 13337var decls = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().ToArray(); 13362var decls = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().ToArray(); 13382var decls = tree.GetRoot().DescendantNodes().OfType<SingleVariableDesignationSyntax>().ToArray(); 13404var decls = tree.GetRoot().DescendantNodes().OfType<SingleVariableDesignationSyntax>().ToArray(); 13439var decls = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().ToArray(); 13503var decls = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().ToArray(); 13579var decls = tree.GetRoot().DescendantNodes().OfType<SingleVariableDesignationSyntax>().ToArray(); 13650var decls = tree.GetRoot().DescendantNodes().OfType<SingleVariableDesignationSyntax>().ToArray(); 13714var decls = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().ToArray(); 14355var decls = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().ToArray(); 14397var decls = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().ToArray(); 14522var decls = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().ToArray(); 14598var decls = tree.GetRoot().DescendantNodes().OfType<ForEachStatementSyntax>().ToArray(); 14843var decls = tree.GetRoot().DescendantNodes().OfType<SingleVariableDesignationSyntax>().ToArray(); 14874var discard = tree.GetRoot().DescendantNodes().OfType<DiscardDesignationSyntax>().ToArray(); 15051var decls = tree.GetRoot().DescendantNodes().OfType<ForEachStatementSyntax>().ToArray(); 15077var decls = tree.GetRoot().DescendantNodes().OfType<ForEachStatementSyntax>().ToArray(); 15132var decls = tree.GetRoot().DescendantNodes().OfType<ForEachStatementSyntax>().ToArray(); 16550var invocations = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().ToArray(); 16591var anonymousMethod = tree.GetRoot().DescendantNodes().OfType<AnonymousMethodExpressionSyntax>().Single(); 16630var anonymousMethod = tree.GetRoot().DescendantNodes().OfType<AnonymousMethodExpressionSyntax>().Single(); 16726var lambdas = tree.GetRoot().DescendantNodes().OfType<ParenthesizedLambdaExpressionSyntax>().ToArray(); 16775var lambda = root.DescendantNodes().OfType<LambdaExpressionSyntax>().Last(); 17946var decls = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().Where(v => v.Identifier.Text == "f").ToArray(); 23384var decls = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().Where(v => v.Identifier.Text is "r1" or "r2").ToArray(); 23452var decls = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().Where(v => v.Identifier.Text is "r1" or "r2").ToArray(); 24454var lambdas = tree.GetRoot().DescendantNodes().OfType<ParenthesizedLambdaExpressionSyntax>().Select(e => model.GetSymbolInfo(e).Symbol.GetSymbol<LambdaSymbol>()).ToArray(); 24490var lambdas = tree.GetRoot().DescendantNodes().OfType<ParenthesizedLambdaExpressionSyntax>().Select(e => model.GetSymbolInfo(e).Symbol.GetSymbol<LambdaSymbol>()).ToArray(); 24527var lambdas = tree.GetRoot().DescendantNodes().OfType<ParenthesizedLambdaExpressionSyntax>().Select(e => model.GetSymbolInfo(e).Symbol.GetSymbol<LambdaSymbol>()).ToArray(); 25294var delegateTypesAndLambdas = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().Select(d => getDelegateTypeAndLambda(model, d)).ToArray(); 25314var value = decl.DescendantNodes().OfType<ParenthesizedLambdaExpressionSyntax>().Single(); 27351foreach (var node in tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().Where(d => d.Identifier.ValueText is "a" or "b" or "c")) 27403foreach (var node in tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().Where(d => d.Identifier.ValueText is "a" or "b" or "c")) 27455foreach (var node in tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().Where(d => d.Identifier.ValueText is "a" or "b" or "c")) 27610var decls = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().ToArray(); 27700var decls = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().ToArray(); 27820var decls = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().ToArray(); 27921var decls = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().ToArray(); 27966var decls = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().ToArray(); 28026var decls = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().ToArray(); 28256var decls = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().ToArray(); 28304var decls = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().ToArray(); 29394var fieldInitializerSyntax = tree.GetRoot().DescendantNodes().OfType<EqualsValueClauseSyntax>().First(); 29437var constructorSyntax = tree.GetRoot().DescendantNodes().OfType<ConstructorDeclarationSyntax>().Single();
Semantics\RefLocalsAndReturnsTests.cs (10)
4750var assignment = tree.GetRoot().DescendantNodes().OfType<AssignmentExpressionSyntax>().Single(); 4778var assignment = tree.GetRoot().DescendantNodes().OfType<AssignmentExpressionSyntax>().Single(); 4806var assignment = tree.GetRoot().DescendantNodes().OfType<AssignmentExpressionSyntax>().Single(); 4834var assignment = tree.GetRoot().DescendantNodes().OfType<AssignmentExpressionSyntax>().Single(); 4862var assignment = tree.GetRoot().DescendantNodes().OfType<AssignmentExpressionSyntax>().Single(); 4890var assignment = tree.GetRoot().DescendantNodes().OfType<AssignmentExpressionSyntax>().Single(); 4924var assignment = tree.GetRoot().DescendantNodes().OfType<AssignmentExpressionSyntax>().Single(); 5210var decls = tree.GetRoot().DescendantNodes().OfType<DeclarationExpressionSyntax>().ToArray(); 5254var decls = tree.GetRoot().DescendantNodes().OfType<SingleVariableDesignationSyntax>().ToArray(); 5293var decls = tree.GetRoot().DescendantNodes().OfType<SingleVariableDesignationSyntax>().ToArray();
Semantics\ScriptSemanticsTests.cs (5)
244var syntax = tree.GetCompilationUnitRoot().DescendantNodes().OfType<ExpressionSyntax>().First(); 561var syntax = tree.GetCompilationUnitRoot().DescendantNodes().OfType<ExpressionSyntax>().First(); 1313var x = syntaxTree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "x").Single(); 1342x = syntaxTree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "x").Single(); 1357x = syntaxTree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "x").Single();
Semantics\SemanticErrorTests.cs (3)
7488var node = tree.GetRoot().DescendantNodes().OfType<ElementAccessExpressionSyntax>().First(); 13327var node = tree.GetRoot().DescendantNodes().OfType<ElementAccessExpressionSyntax>().First(); 24224var node = tree.GetRoot().DescendantNodes().OfType<ConditionalAccessExpressionSyntax>().First();
Semantics\StackAllocInitializerTests.cs (8)
367var expressions = tree.GetCompilationUnitRoot().DescendantNodes().OfType<ImplicitStackAllocArrayCreationExpressionSyntax>().ToArray(); 443var expressions = tree.GetCompilationUnitRoot().DescendantNodes().OfType<ImplicitStackAllocArrayCreationExpressionSyntax>().ToArray(); 1045var variables = tree.GetCompilationUnitRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>(); 1147var variables = tree.GetCompilationUnitRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>(); 2359var expressions = tree.GetCompilationUnitRoot().DescendantNodes().OfType<StackAllocArrayCreationExpressionSyntax>().ToArray(); 2465var expressions = tree.GetCompilationUnitRoot().DescendantNodes().OfType<ImplicitStackAllocArrayCreationExpressionSyntax>().ToArray(); 2565var expressions = tree.GetCompilationUnitRoot().DescendantNodes().OfType<StackAllocArrayCreationExpressionSyntax>().ToArray(); 2649var expressions = tree.GetCompilationUnitRoot().DescendantNodes().OfType<ImplicitStackAllocArrayCreationExpressionSyntax>().ToArray();
Semantics\StackAllocSpanExpressionsTests.cs (2)
53var variables = tree.GetCompilationUnitRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>(); 127var variables = tree.GetCompilationUnitRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>();
Semantics\StructConstructorTests.cs (3)
1050var syntax = tree.GetRoot().DescendantNodes().OfType<ConstructorDeclarationSyntax>().First(); 1145var syntax = tree.GetRoot().DescendantNodes().OfType<ConstructorDeclarationSyntax>().First(); 1242var syntax = tree.GetRoot().DescendantNodes().OfType<ConstructorDeclarationSyntax>().First();
Semantics\SuppressAccessibilityChecksTests.cs (8)
54var invocation = semanticModel.SyntaxTree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().Single(); 72var invocation = semanticModel.SyntaxTree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().Single(); 87var invocation = semanticModel.SyntaxTree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().Single(); 96statement.DescendantNodes().OfType<ObjectCreationExpressionSyntax>().Single()); 123var expr = (ExpressionSyntax)tree.GetCompilationUnitRoot().DescendantNodes().OfType<SimpleLambdaExpressionSyntax>().Single().Body; 169var invocation = syntaxTree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().Single(); 215AccessorDeclarationSyntax accessorDecl = root.DescendantNodes().OfType<AccessorDeclarationSyntax>().Single(); 230.OfType<IdentifierNameSyntax>()
Semantics\SyntaxTreeRootTests.cs (1)
108Assert.Equal(tree, tree.GetRoot().DescendantNodes().OfType<ClassDeclarationSyntax>().Single().SyntaxTree);
Semantics\TargetTypedConditionalOperatorTests.cs (2)
668var expr = tree.GetRoot().DescendantNodes().OfType<ConditionalExpressionSyntax>().Single(); 689var expr = tree.GetRoot().DescendantNodes().OfType<ConditionalExpressionSyntax>().Single();
Semantics\TargetTypedDefaultTests.cs (46)
44var def = nodes.OfType<LiteralExpressionSyntax>().Single(); 144var def = nodes.OfType<LiteralExpressionSyntax>().Single(); 196var def = nodes.OfType<LiteralExpressionSyntax>().ElementAt(0); 244var def = nodes.OfType<LiteralExpressionSyntax>().ElementAt(0); 253var nullSyntax = nodes.OfType<LiteralExpressionSyntax>().ElementAt(1); 281var def = nodes.OfType<LiteralExpressionSyntax>().ElementAt(0); 290var nullSyntax = nodes.OfType<LiteralExpressionSyntax>().ElementAt(1); 326var default1 = nodes.OfType<LiteralExpressionSyntax>().ElementAt(0); 332var default2 = nodes.OfType<LiteralExpressionSyntax>().ElementAt(1); 520var def = nodes.OfType<LiteralExpressionSyntax>().ElementAt(0); 529var nullSyntax = nodes.OfType<LiteralExpressionSyntax>().ElementAt(2); 566var def = nodes.OfType<LiteralExpressionSyntax>().ElementAt(0); 575var nullSyntax = nodes.OfType<LiteralExpressionSyntax>().ElementAt(2); 609var def = nodes.OfType<LiteralExpressionSyntax>().ElementAt(0); 618var nullSyntax = nodes.OfType<LiteralExpressionSyntax>().ElementAt(1); 667var def = nodes.OfType<LiteralExpressionSyntax>().ElementAt(1); 748var def = nodes.OfType<LiteralExpressionSyntax>().ElementAt(0); 757var nullSyntax = nodes.OfType<LiteralExpressionSyntax>().ElementAt(1); 837var def = nodes.OfType<LiteralExpressionSyntax>().Single(); 866var def = nodes.OfType<LiteralExpressionSyntax>().Single(); 1142var def = nodes.OfType<LiteralExpressionSyntax>().ElementAt(1); 1257var addition = nodes.OfType<BinaryExpressionSyntax>().Single(); 1631var defaultLiteral = nodes.OfType<LiteralExpressionSyntax>().ElementAt(1); 1736var defaults = nodes.OfType<LiteralExpressionSyntax>().Where(l => l.ToString() == "default"); 1802var defaults = nodes.OfType<LiteralExpressionSyntax>().Where(l => l.ToString() == "default"); 1873var defaults = nodes.OfType<LiteralExpressionSyntax>().Where(l => l.ToString() == "default"); 1911var first = nodes.OfType<LiteralExpressionSyntax>().ElementAt(0); 2089var def = tree.GetCompilationUnitRoot().DescendantNodes().OfType<LiteralExpressionSyntax>().ElementAt(0); 2333var def = nodes.OfType<LiteralExpressionSyntax>().ElementAt(0); 2340var nullSyntax = nodes.OfType<LiteralExpressionSyntax>().ElementAt(1); 2414var first = nodes.OfType<LiteralExpressionSyntax>().ElementAt(2); 2419var second = nodes.OfType<LiteralExpressionSyntax>().ElementAt(3); 2424var third = nodes.OfType<LiteralExpressionSyntax>().ElementAt(4); 2429var fourth = nodes.OfType<LiteralExpressionSyntax>().ElementAt(5); 2457var def = nodes.OfType<LiteralExpressionSyntax>().ElementAt(1); 3055var def = tree.GetCompilationUnitRoot().DescendantNodes().OfType<LiteralExpressionSyntax>().Single(); 3344var def = nodes.OfType<LiteralExpressionSyntax>().First(); 3383var def = nodes.OfType<LiteralExpressionSyntax>().First(); 3514var def = nodes.OfType<LiteralExpressionSyntax>().Single(); 3524var conversionSyntax = nodes.OfType<CastExpressionSyntax>().Single(); 3575var default1 = tree.GetCompilationUnitRoot().DescendantNodes().OfType<LiteralExpressionSyntax>().Single(); 3583var default2 = tree.GetCompilationUnitRoot().DescendantNodes().OfType<DefaultExpressionSyntax>().ElementAt(0); 3590var default3 = tree.GetCompilationUnitRoot().DescendantNodes().OfType<DefaultExpressionSyntax>().ElementAt(1); 3597var default4 = tree.GetCompilationUnitRoot().DescendantNodes().OfType<DefaultExpressionSyntax>().ElementAt(2); 3673var defaultLiterals = nodes.OfType<LiteralExpressionSyntax>().ToArray(); 3713var parameters = nodes.OfType<ParameterSyntax>().ToArray();
Semantics\TopLevelStatementsTests.cs (90)
34var methods = type.GetMembers().OfType<SynthesizedSimpleProgramEntryPointSymbol>(); 194var localRef = unit1.DescendantNodes().OfType<IdentifierNameSyntax>().First(); 235var localDecl = unit1.DescendantNodes().OfType<LocalFunctionStatementSyntax>().Single(); 257foreach (var globalStatement in tree1.GetRoot().DescendantNodes().OfType<GlobalStatementSyntax>()) 319var localRef = unit1.DescendantNodes().OfType<IdentifierNameSyntax>().Single(); 358var localDecl = unit2.DescendantNodes().OfType<LocalFunctionStatementSyntax>().Single(); 408foreach (var globalStatement in tree1.GetRoot().DescendantNodes().OfType<GlobalStatementSyntax>()) 481var localDecl = tree1.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().Single(); 492var localFuncRef = tree1.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "local").Single(); 497Assert.DoesNotContain(declSymbol, model1.AnalyzeDataFlow(localDecl.Ancestors().OfType<StatementSyntax>().First()).DataFlowsOut); 500var localRef = tree2.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "i").Single(); 533var localDecl = tree1.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().Single(); 540var localRefs = tree1.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "i").ToArray(); 573var localDecl = tree1.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().Single(); 584var localFuncRef = tree1.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "local").Single(); 589Assert.Contains(declSymbol, model1.AnalyzeDataFlow(localDecl.Ancestors().OfType<StatementSyntax>().First()).DataFlowsOut); 591var localRef = tree1.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "i").Single(); 698var declarator = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().Single(); 699var reference = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "s").Single(); 871var symbol1 = model1.GetDeclaredSymbol(tree1.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().Single()); 873Assert.Same(symbol1, model1.GetSymbolInfo(tree1.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "x").Single()).Symbol); 877var symbol2 = model2.GetDeclaredSymbol(tree2.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().Single()); 879Assert.Same(symbol2, model2.GetSymbolInfo(tree2.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "x").Single()).Symbol); 985var symbol1 = model1.GetDeclaredSymbol(tree1.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().First()); 987Assert.Same(symbol1, model1.GetSymbolInfo(tree1.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "x").First()).Symbol); 989var symbol2 = model1.GetDeclaredSymbol(tree1.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().Skip(1).Single()); 991Assert.Same(symbol1, model1.GetSymbolInfo(tree1.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "x").Skip(1).Single()).Symbol); 1040var symbol1 = model1.GetDeclaredSymbol(tree1.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().First()); 1042Assert.Same(symbol1, model1.GetSymbolInfo(tree1.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "args").Single()).Symbol); 1407var nameRef = tree2.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "x").Single(); 1425nameRef = tree2.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "x").Single(); 1520var reference = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "c").Single(); 1592foreach (var id in tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>()) 1598foreach (var id in tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>()) 1685var localDecl = tree1.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().First(); 1706var nameRefs = tree1.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "Test").ToArray(); 1858var localDecl = tree1.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().Single(); 1882var nameRefs = tree2.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "Test").ToArray(); 2084var localDecl = tree1.GetRoot().DescendantNodes().OfType<LocalFunctionStatementSyntax>().Single(); 2100var nameRefs = tree1.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "Test").ToArray(); 2248var localDecl = tree1.GetRoot().DescendantNodes().OfType<LocalFunctionStatementSyntax>().Single(); 2266var nameRefs = tree2.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "Test").ToArray(); 2426var labelDecl = tree1.GetRoot().DescendantNodes().OfType<LabeledStatementSyntax>().Single(); 2446var nameRefs = tree1.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "Test").ToArray(); 2919var nameRef = tree1.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "alias1" && !id.Parent.IsKind(SyntaxKind.NameEquals)).Single(); 2924nameRef = tree1.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "alias2").Single(); 2925model1.GetDiagnostics(nameRef.Ancestors().OfType<StatementSyntax>().First().Span).Verify( 2941nameRef = tree2.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "alias2" && !id.Parent.IsKind(SyntaxKind.NameEquals)).Single(); 2946nameRef = tree2.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "alias1").Single(); 2947model2.GetDiagnostics(nameRef.Ancestors().OfType<StatementSyntax>().First().Span).Verify( 3941var nameRefs = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "args").ToArray(); 4090var nameRefs = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "args").ToArray(); 4215var declarator = tree.GetRoot().DescendantNodes().OfType<LocalFunctionStatementSyntax>().Single(); 4216var reference = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "local").Single(); 4510var symbol1 = model1.GetDeclaredSymbol(tree1.GetRoot().DescendantNodes().OfType<LocalFunctionStatementSyntax>().Single()); 4512Assert.Same(symbol1, model1.GetSymbolInfo(tree1.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "local1").Single()).Symbol); 4516var symbol2 = model2.GetDeclaredSymbol(tree2.GetRoot().DescendantNodes().OfType<LocalFunctionStatementSyntax>().First()); 4518Assert.Same(symbol2, model2.GetSymbolInfo(tree2.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "local1").Single()).Symbol); 4574var symbol1 = model1.GetDeclaredSymbol(tree1.GetRoot().DescendantNodes().OfType<LocalFunctionStatementSyntax>().First()); 4576Assert.Same(symbol1, model1.GetSymbolInfo(tree1.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "local1").First()).Symbol); 4578var symbol2 = model1.GetDeclaredSymbol(tree1.GetRoot().DescendantNodes().OfType<LocalFunctionStatementSyntax>().Skip(1).First()); 4580Assert.Same(symbol1, model1.GetSymbolInfo(tree1.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "local1").Skip(1).Single()).Symbol); 4623var symbol1 = model1.GetDeclaredSymbol(tree1.GetRoot().DescendantNodes().OfType<LocalFunctionStatementSyntax>().First()); 4625Assert.Same(symbol1, model1.GetSymbolInfo(tree1.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "args").Single()).Symbol); 4893var declarator = tree.GetRoot().DescendantNodes().OfType<LabeledStatementSyntax>().Single(); 4894var reference = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "label1").Single(); 4950var symbol1 = model1.GetDeclaredSymbol(tree1.GetRoot().DescendantNodes().OfType<LabeledStatementSyntax>().Single()); 4952Assert.Same(symbol1, model1.GetSymbolInfo(tree1.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "label1").Single()).Symbol); 4956var symbol2 = model2.GetDeclaredSymbol(tree2.GetRoot().DescendantNodes().OfType<LabeledStatementSyntax>().Single()); 4959Assert.Same(symbol2, model2.GetSymbolInfo(tree2.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "label1").Single()).Symbol); 4978var declarator = tree.GetRoot().DescendantNodes().OfType<LabeledStatementSyntax>().Single(); 4979var reference = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "args").Single(); 6030var localDecl = tree1.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().First(); 6034var localRefs = tree1.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "i").ToArray(); 6046localDecl = tree1.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().ElementAt(1); 6086var localFunctions = syntaxTree.GetRoot().DescendantNodes().OfType<LocalFunctionStatementSyntax>().ToList(); 6160.GetDeclaredSymbol(syntaxTree.GetRoot().DescendantNodes().OfType<LocalFunctionStatementSyntax>().Single()) 6232var invocation = syntaxTree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().Single(); 6276var localDecl = syntaxTree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().Single(); 6277var localRef = syntaxTree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "x").Single(); 6316var localDecl = syntaxTree1.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().Single(); 6317var localRef = syntaxTree1.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "x").Single(); 6366var localDecl = syntaxTree1.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().Single(); 6368var localRef = syntaxTree2.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "x").Single(); 8578var invocations = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().ToArray(); 8651var id = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Single(); 8673var id = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "ar").Single(); 8695var id = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "ar").Single(); 9677var identifier = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().First(id => id.Identifier.Text == "var"); 9681Assert.Equal(OperationKind.Literal, model.GetOperation(tree.GetRoot().DescendantNodes().OfType<LiteralExpressionSyntax>().Single()).Kind);
Semantics\TryCatchTests.cs (1)
45var catchClause = tree.GetCompilationUnitRoot().DescendantNodes().OfType<CatchClauseSyntax>().Single();
Semantics\UnsafeTests.cs (29)
5197var methodDecl = tree.GetCompilationUnitRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().First(); 5383Assert.True(tree.GetCompilationUnitRoot().DescendantNodes().OfType<AnonymousObjectCreationExpressionSyntax>(). 6330.OfType<VariableDeclaratorSyntax>() 6389.OfType<VariableDeclaratorSyntax>() 7257var syntax = tree.GetCompilationUnitRoot().DescendantNodes().OfType<PrefixUnaryExpressionSyntax>().Single(); 7274var declaredSymbol = model.GetDeclaredSymbol(syntax.Ancestors().OfType<VariableDeclaratorSyntax>().First()); 7294var syntax = tree.GetCompilationUnitRoot().DescendantNodes().OfType<FieldDeclarationSyntax>().Single(); 7323var syntax = tree.GetCompilationUnitRoot().DescendantNodes().OfType<PrefixUnaryExpressionSyntax>().Single(); 7361var syntax = tree.GetCompilationUnitRoot().DescendantNodes().OfType<PrefixUnaryExpressionSyntax>().Single(); 7404var syntax = tree.GetCompilationUnitRoot().DescendantNodes().OfType<PrefixUnaryExpressionSyntax>().Single(); 7535var syntax = tree.GetCompilationUnitRoot().DescendantNodes().OfType<PrefixUnaryExpressionSyntax>().Last(); 7845var syntax = tree.GetCompilationUnitRoot().DescendantNodes().OfType<MemberAccessExpressionSyntax>().Single(); 7912var syntax = tree.GetCompilationUnitRoot().DescendantNodes().OfType<MemberAccessExpressionSyntax>().Single(); 8158var syntax = tree.GetCompilationUnitRoot().DescendantNodes().OfType<ElementAccessExpressionSyntax>().Single(); 8225var syntax = tree.GetCompilationUnitRoot().DescendantNodes().OfType<ElementAccessExpressionSyntax>().Single(); 8283var syntax = tree.GetCompilationUnitRoot().DescendantNodes().OfType<ElementAccessExpressionSyntax>().Single(); 8381foreach (var declarationSyntax in tree.GetCompilationUnitRoot().DescendantNodes().OfType<VariableDeclarationSyntax>().Where(syntax => syntax.GetFirstToken().IsKind(SyntaxKind.VoidKeyword))) 8861foreach (var binOpSyntax in tree.GetCompilationUnitRoot().DescendantNodes().OfType<BinaryExpressionSyntax>()) 8911foreach (var binOpSyntax in tree.GetCompilationUnitRoot().DescendantNodes().OfType<BinaryExpressionSyntax>()) 9323foreach (var binOpSyntax in tree.GetCompilationUnitRoot().DescendantNodes().OfType<BinaryExpressionSyntax>()) 10177var declarators = tree.GetCompilationUnitRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().Reverse().Take(3).Reverse().ToArray(); 10223var declarators = tree.GetCompilationUnitRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().Reverse().Take(numSymbols).Reverse().ToArray(); 10297var declarators = tree.GetCompilationUnitRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().Reverse().Take(numSymbols).Reverse().ToArray(); 10626var syntaxes = tree.GetCompilationUnitRoot().DescendantNodes().OfType<SizeOfExpressionSyntax>(); 10688var syntaxes = tree.GetCompilationUnitRoot().DescendantNodes().OfType<SizeOfExpressionSyntax>(); 10748var syntaxes = tree.GetCompilationUnitRoot().DescendantNodes().OfType<SizeOfExpressionSyntax>(); 11305var stackAllocSyntax = tree.GetCompilationUnitRoot().DescendantNodes().OfType<StackAllocArrayCreationExpressionSyntax>().Single(); 11837var parameterSyntax = tree.GetCompilationUnitRoot().DescendantNodes().OfType<ParameterSyntax>().Single(); 11877var foreachSyntax = tree.GetCompilationUnitRoot().DescendantNodes().OfType<ForEachStatementSyntax>().Single();
Semantics\UsingStatementTests.cs (8)
60var usingStatement = tree.GetCompilationUnitRoot().DescendantNodes().OfType<UsingStatementSyntax>().Single(); 69var memberAccessExpression = tree.GetCompilationUnitRoot().DescendantNodes().OfType<MemberAccessExpressionSyntax>().Single(); 1341var usingStatement = tree.GetCompilationUnitRoot().DescendantNodes().OfType<UsingStatementSyntax>().Single(); 1376var usingStatement = tree.GetCompilationUnitRoot().DescendantNodes().OfType<UsingStatementSyntax>().Single(); 1853var node = tree.GetCompilationUnitRoot().DescendantNodes().OfType<AssignmentExpressionSyntax>().Single(); 1865var usingStatements = tree.GetCompilationUnitRoot().DescendantNodes().OfType<UsingStatementSyntax>().ToList(); 1881var usingStatements = tree.GetCompilationUnitRoot().DescendantNodes().OfType<UsingStatementSyntax>().ToList(); 1894var usingStatements = tree.GetCompilationUnitRoot().DescendantNodes().OfType<UsingStatementSyntax>().ToList();
Semantics\Utf8StringsLiteralsTests.cs (14)
2970var node = tree.GetCompilationUnitRoot().DescendantNodes().OfType<ReturnStatementSyntax>().Single().Expression; 2998var node = tree.GetCompilationUnitRoot().DescendantNodes().OfType<ReturnStatementSyntax>().Single().Expression; 3026var node = tree.GetCompilationUnitRoot().DescendantNodes().OfType<ReturnStatementSyntax>().Single().Expression; 3054var node = tree.GetCompilationUnitRoot().DescendantNodes().OfType<ReturnStatementSyntax>().Single().Expression; 3082var node = tree.GetCompilationUnitRoot().DescendantNodes().OfType<ReturnStatementSyntax>().Single().Expression; 3110var node = tree.GetCompilationUnitRoot().DescendantNodes().OfType<ReturnStatementSyntax>().Single().Expression; 3138var node = tree.GetCompilationUnitRoot().DescendantNodes().OfType<ReturnStatementSyntax>().Single().Expression; 3166var node = tree.GetCompilationUnitRoot().DescendantNodes().OfType<ReturnStatementSyntax>().Single().Expression; 3194var node = tree.GetCompilationUnitRoot().DescendantNodes().OfType<ReturnStatementSyntax>().Single().Expression; 3222var node = tree.GetCompilationUnitRoot().DescendantNodes().OfType<ReturnStatementSyntax>().Single().Expression; 3250var node = tree.GetCompilationUnitRoot().DescendantNodes().OfType<ReturnStatementSyntax>().Single().Expression; 3278var node = tree.GetCompilationUnitRoot().DescendantNodes().OfType<ReturnStatementSyntax>().Single().Expression; 3306var node = tree.GetCompilationUnitRoot().DescendantNodes().OfType<ReturnStatementSyntax>().Single().Expression; 4081foreach (var node in tree.GetCompilationUnitRoot().DescendantNodes().OfType<BinaryExpressionSyntax>().Where(b => b.IsKind(SyntaxKind.AddExpression)))
SourceGeneration\SyntaxAwareGeneratorTests.cs (2)
696var classDeclarations = testReceiver.VisitedNodes.OfType<ClassDeclarationSyntax>().Select(c => c.Identifier.Text); 753var classDeclarations = testReceiver.VisitedNodes.OfType<ClassDeclarationSyntax>().Select(c => c.Identifier.Text);
Microsoft.CodeAnalysis.CSharp.Symbol.UnitTests (697)
Compilation\GetSemanticInfoBrokenCodeTests.cs (8)
200Assert.Empty(tree.GetCompilationUnitRoot().DescendantNodes().OfType<UsingDirectiveSyntax>()); 202foreach (var identifierSyntax in tree.GetCompilationUnitRoot().DescendantNodes().OfType<IdentifierNameSyntax>()) 224var usingSyntax = tree.GetCompilationUnitRoot().DescendantNodes().OfType<UsingStatementSyntax>().Single(); 245var typeOfSyntax = tree.GetCompilationUnitRoot().DescendantNodes().OfType<TypeOfExpressionSyntax>().Single(); 267var literalSyntax = tree.GetCompilationUnitRoot().DescendantNodes().OfType<LiteralExpressionSyntax>().Single(); 300var identifierSyntax = tree.GetCompilationUnitRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Single(n => n.Identifier.ValueText == "CompletionItem"); 384return node.DescendantNodesAndSelf(descendIntoTrivia: true).OfType<ExpressionSyntax>(); 389return node.DescendantNodesAndSelf().OfType<StatementSyntax>();
Compilation\GetSemanticInfoTests.cs (37)
2356var lambdaSyntax = tree.GetCompilationUnitRoot().DescendantNodes().OfType<SimpleLambdaExpressionSyntax>().Single(); 2566var expr = tree.GetRoot().DescendantNodes().OfType<ParameterSyntax>().First(); 3607var literal = tree.GetCompilationUnitRoot().DescendantNodes().OfType<LiteralExpressionSyntax>().Single(); 3632var literal = tree.GetCompilationUnitRoot().DescendantNodes().OfType<LiteralExpressionSyntax>().Single(); 3665var literal = tree.GetCompilationUnitRoot().DescendantNodes().OfType<LiteralExpressionSyntax>().Single(); 3701var literal = tree.GetCompilationUnitRoot().DescendantNodes().OfType<LiteralExpressionSyntax>().Single(); 4106var localDecls = tree.GetCompilationUnitRoot().DescendantNodes().OfType<VariableDeclarationSyntax>(); 4161var localDecls = tree.GetCompilationUnitRoot().DescendantNodes().OfType<VariableDeclarationSyntax>(); 4212var syntax = tree.GetCompilationUnitRoot().FindToken(position).Parent.DescendantNodesAndSelf().OfType<OmittedTypeArgumentSyntax>().Single(); 4242var syntax = tree.GetCompilationUnitRoot().FindToken(position).Parent.DescendantNodesAndSelf().OfType<OmittedTypeArgumentSyntax>().Single(); 4272var syntax = tree.GetCompilationUnitRoot().FindToken(position).Parent.DescendantNodesAndSelf().OfType<GenericNameSyntax>().Single(); 4292var syntax = tree.GetCompilationUnitRoot().DescendantNodes().OfType<OmittedTypeArgumentSyntax>().Single(); 4323var initializerSyntax = speculativeSyntax.DescendantNodesAndSelf().OfType<InitializerExpressionSyntax>().Single(); 4355var syntax = tree.GetCompilationUnitRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Last(id => id.Identifier.ValueText == "b"); 4400var syntax = tree.GetCompilationUnitRoot().DescendantNodes().OfType<ParameterSyntax>().Last(); 4436var fieldSyntax = tree.GetRoot().DescendantNodes().OfType<FieldDeclarationSyntax>().Single(); 4490var memberAccessSyntax = tree.GetRoot().DescendantNodes().OfType<MemberAccessExpressionSyntax>().Single(); 4535var callSyntax = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().Single(); 4589var memberAccesses = tree.GetRoot().DescendantNodes().OfType<MemberAccessExpressionSyntax>().ToArray(); 4641var memberAccess = tree.GetRoot().DescendantNodes().OfType<MemberAccessExpressionSyntax>().Single(); 4687int position = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().First().SpanStart; 4732int position = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().First().SpanStart; 4752var trueLiteral = tree.GetRoot().DescendantNodes().OfType<LiteralExpressionSyntax>().Single(); 4785var lambdaSyntax = tree.GetRoot().DescendantNodes().OfType<ParenthesizedLambdaExpressionSyntax>().Single(); 4828var syntax = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().Single(); 4875var statement = tree.GetRoot().DescendantNodes().OfType<LocalDeclarationStatementSyntax>().Single(); 4884var newSyntaxMemberAccess = newSyntax.DescendantNodesAndSelf().OfType<MemberAccessExpressionSyntax>(). 5478var invocationSyntax = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().First(); 5484var parameterSyntax = invocationSyntax.DescendantNodes().OfType<ParameterSyntax>().First(); 5521var lambdaSyntax = tree.GetRoot().DescendantNodes().OfType<ParenthesizedLambdaExpressionSyntax>().Single(); 5535var lambdaSyntax = tree.GetRoot().DescendantNodes().OfType<ParenthesizedLambdaExpressionSyntax>().Single(); 5582var nullSyntax = tree.GetRoot().DescendantNodes().OfType<LiteralExpressionSyntax>().Single(); 5620var lambdaSyntax = tree.GetRoot().DescendantNodes().OfType<ParenthesizedLambdaExpressionSyntax>().Single(); 5667var lambdaSyntax = tree.GetRoot().DescendantNodes().OfType<ParenthesizedLambdaExpressionSyntax>().Single(); 5720var methodGroupSyntax = tree.GetRoot().DescendantNodes().OfType<ArgumentSyntax>().Single().Expression; 5988var foreachSyntaxNode = root.DescendantNodes().OfType<ForEachStatementSyntax>().Single(); 6045var typeParameters = tree.GetRoot().DescendantNodes().OfType<TypeParameterSyntax>().ToArray();
Compilation\GetUnusedImportDirectivesTests.cs (1)
93var syntax = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().Single().Expression;
Compilation\SemanticModelAPITests.cs (105)
43var m = root.DescendantNodes().OfType<MethodDeclarationSyntax>().Single(decl => decl.Identifier.ValueText == "M"); 46var accesses = m.DescendantNodes().OfType<ElementAccessExpressionSyntax>().ToList(); 51accesses = m2.DescendantNodes().OfType<ElementAccessExpressionSyntax>().ToList(); 110var invoke = root.DescendantNodes().OfType<MemberAccessExpressionSyntax>() 138var accesses = root.DescendantNodes().OfType<ElementAccessExpressionSyntax>().ToList(); 175var assignment = root.DescendantNodes().OfType<ParenthesizedExpressionSyntax>().Single(); 202var rx = root.DescendantNodes().OfType<IdentifierNameSyntax>().Last(); 209var rxDecl = root.DescendantNodes().OfType<ForStatementSyntax>().Single().Declaration; 234var rx = root.DescendantNodes().OfType<IdentifierNameSyntax>().Last(); 241var rxDecl = root.DescendantNodes().OfType<ForEachStatementSyntax>().Single(); 256var vardecl = tree.GetCompilationUnitRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().First(); 276var vardecl = tree.GetCompilationUnitRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().First(); 295var vardecl = tree.GetCompilationUnitRoot().DescendantNodes().OfType<QueryClauseSyntax>().First(); 315var vardecl = tree.GetCompilationUnitRoot().DescendantNodes().OfType<QueryClauseSyntax>().First(); 334var statement = tree.GetCompilationUnitRoot().DescendantNodes().OfType<GotoStatementSyntax>().First(); 353var paramdecl = tree.GetCompilationUnitRoot().DescendantNodes().OfType<ParameterSyntax>().First(); 375var paramdecl1 = tree1.GetCompilationUnitRoot().DescendantNodes().OfType<ParameterSyntax>().First(); 377var paramdecl2 = tree2.GetCompilationUnitRoot().DescendantNodes().OfType<ParameterSyntax>().First(); 871var pType01 = tree.GetCompilationUnitRoot().DescendantNodes().OfType<ClassDeclarationSyntax>().First(); 872var pType02 = tree.GetCompilationUnitRoot().DescendantNodes().OfType<ClassDeclarationSyntax>().Last(); 880var pMethod01 = tree.GetCompilationUnitRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().First(); 881var pMethod02 = tree.GetCompilationUnitRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Last(); 898var pParam01 = tree.GetCompilationUnitRoot().DescendantNodes().OfType<ParameterSyntax>().First(); 899var pParam02 = tree.GetCompilationUnitRoot().DescendantNodes().OfType<ParameterSyntax>().Last(); 925var exprs = root.DescendantNodes().OfType<LiteralExpressionSyntax>().ToArray(); 966var para1 = tree1.GetCompilationUnitRoot().DescendantNodes().OfType<ParameterSyntax>().First(); 967var para2 = tree2.GetCompilationUnitRoot().DescendantNodes().OfType<ParameterSyntax>().First(); 1007var para1 = tree1.GetCompilationUnitRoot().DescendantNodes().OfType<TypeParameterSyntax>().First(); 1008var para2 = tree2.GetCompilationUnitRoot().DescendantNodes().OfType<TypeParameterSyntax>().First(); 1041var anonProps = tree.GetCompilationUnitRoot().DescendantNodes().OfType<AnonymousObjectMemberDeclaratorSyntax>(); 1072var anonProps = tree.GetCompilationUnitRoot().DescendantNodes().OfType<AnonymousObjectMemberDeclaratorSyntax>(); 1113var anonProps = tree.GetCompilationUnitRoot().DescendantNodes().OfType<AnonymousObjectMemberDeclaratorSyntax>(); 1157var anonProps = tree.GetCompilationUnitRoot().DescendantNodes().OfType<AnonymousObjectMemberDeclaratorSyntax>(); 1195var paras = descendants.OfType<ParameterSyntax>(); 1200var args = descendants.OfType<ArgumentSyntax>().Where(s => s.ToString() == "index").Select(s => s); 1232var aliasSyntax = tree.GetCompilationUnitRoot().DescendantNodes().OfType<UsingDirectiveSyntax>().Single(); 1265var aliasSyntax = tree.GetCompilationUnitRoot().DescendantNodes().OfType<ExternAliasDirectiveSyntax>().Single(); 1278var aliasQualifiedSyntax = tree.GetCompilationUnitRoot().DescendantNodes().OfType<AliasQualifiedNameSyntax>().Single(); 1306var aliasSyntax = tree.GetCompilationUnitRoot().DescendantNodes().OfType<ExternAliasDirectiveSyntax>().Single(); 1311var aliasQualifiedSyntax = tree.GetCompilationUnitRoot().DescendantNodes().OfType<AliasQualifiedNameSyntax>().Single(); 1338var aliasSyntax = tree.GetCompilationUnitRoot().DescendantNodes().OfType<NameEqualsSyntax>().Single().Name; 1341var usingSyntax = tree.GetCompilationUnitRoot().DescendantNodes().OfType<UsingDirectiveSyntax>().Single(); 1361var oldSyntax = tree.GetCompilationUnitRoot().DescendantNodes().OfType<ConstructorInitializerSyntax>().Single(); 1390var oldSyntax = tree.GetCompilationUnitRoot().DescendantNodes().OfType<ConstructorDeclarationSyntax>().Single(); 1728var aliasDecl = tree.GetRoot().DescendantNodes().OfType<UsingDirectiveSyntax>().Single(); 1739var fieldDecl = tree.GetRoot().DescendantNodes().OfType<FieldDeclarationSyntax>().Single(); 1962var lambdaExpression = speculatedStatement.DescendantNodes().OfType<ParenthesizedLambdaExpressionSyntax>().FirstOrDefault(); 2027.OfType<EqualsValueClauseSyntax>().ElementAt(1); 2046var thisSyntax = expr.DescendantNodes().OfType<ThisExpressionSyntax>().Single(); 2072var oldSyntax = tree.GetCompilationUnitRoot().DescendantNodes().OfType<ConstructorInitializerSyntax>().Single(); 2092newSyntax = oldSyntax.ReplaceNode(oldSyntax.DescendantNodes().OfType<CastExpressionSyntax>().Single(), newArgument); 2109newSyntax = oldSyntax.ReplaceNode(oldSyntax.DescendantNodes().OfType<CastExpressionSyntax>().Single(), newArgument); 2141var oldSyntax = tree.GetCompilationUnitRoot().DescendantNodes().OfType<ConstructorDeclarationSyntax>().Single(); 2310var accessorSyntax = tree.GetRoot().DescendantNodes().OfType<AccessorDeclarationSyntax>().Single(); 2313var statementSyntax = tree.GetRoot().DescendantNodes().OfType<ReturnStatementSyntax>().Single(); 2683var lambdaExpression = blockStatement.Statements[0].DescendantNodes().OfType<ParenthesizedLambdaExpressionSyntax>().FirstOrDefault(); 2921var cref = typeDecl.DescendantNodes(descendIntoTrivia: true).OfType<TypeCrefSyntax>().Single(); 2961var cref = typeDecl.DescendantNodes(descendIntoTrivia: true).OfType<TypeCrefSyntax>().Single(); 3006var cref = typeDecl.DescendantNodes(descendIntoTrivia: true).OfType<TypeCrefSyntax>().Single(); 3127var syntax = tree.GetRoot().DescendantNodes().OfType<SimpleLambdaExpressionSyntax>().Single(). 3128Body.DescendantNodesAndSelf().OfType<IdentifierNameSyntax>().Single(); 3230var omittedArraySize = typeSyntax.DescendantNodes().OfType<OmittedArraySizeExpressionSyntax>().Single(); 3259var method1 = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().Single().Expression; 3271var method2 = statementSyntax.DescendantNodes().OfType<InvocationExpressionSyntax>().Single().Expression; 3300var method1 = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().Single().Expression; 3312var method2 = statementSyntax.DescendantNodes().OfType<InvocationExpressionSyntax>().Single().Expression; 3341var method1 = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().Single().Expression; 3375var method1 = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().Single().Expression; 3388var method2 = statementSyntax.DescendantNodes().OfType<InvocationExpressionSyntax>().Single().Expression; 3417var method1 = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().Single().Expression; 3429var method2 = statementSyntax.DescendantNodes().OfType<InvocationExpressionSyntax>().Single().Expression; 3458var method1 = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().Single().Expression; 3470var method2 = statementSyntax.DescendantNodes().OfType<InvocationExpressionSyntax>().Single().Expression; 3499var method1 = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().Single().Expression; 3611var crefSyntax = root.DescendantNodes(descendIntoTrivia: true).OfType<QualifiedCrefSyntax>().Single(); 3741var memberAccess = tree.GetRoot().DescendantNodes().OfType<MemberAccessExpressionSyntax>().Single(); 3785var localFunctionBody = tree.GetRoot().DescendantNodes().OfType<LambdaExpressionSyntax>().Single(); 3786var typeInfo = model.GetTypeInfo(localFunctionBody.DescendantNodes().OfType<ReturnStatementSyntax>().Single().Expression!); 3819var callSyntax = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().Single(); 3846var syntax = tree.GetRoot().DescendantNodes().OfType<AliasQualifiedNameSyntax>().Single(); 3873var methodDecl = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().First(); 3910var method = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Single(); 3911var init0 = method.Body.Statements[0].DescendantNodes().OfType<VariableDeclaratorSyntax>().Single().Initializer.Value; 3920var init1 = method.Body.Statements[2].DescendantNodes().OfType<VariableDeclaratorSyntax>().Single().Initializer.Value; 3927var init2 = method.Body.Statements[4].DescendantNodes().OfType<VariableDeclaratorSyntax>().Single().Initializer.Value; 4107var actual = tree.GetRoot().DescendantNodes().OfType<InterpolatedStringExpressionSyntax>().ToArray(); 4144var actual = tree.GetRoot().DescendantNodes().OfType<InterpolatedStringExpressionSyntax>().ToArray(); 4187var actual = tree.GetRoot().DescendantNodes().OfType<InterpolatedStringExpressionSyntax>().ToArray(); 4211var actual = tree.GetRoot().DescendantNodes().OfType<LiteralExpressionSyntax>().ToArray(); 4239var actual = tree.GetRoot().DescendantNodes().OfType<LiteralExpressionSyntax>().ToArray(); 4277var actual = tree.GetRoot().DescendantNodes().OfType<InterpolatedStringExpressionSyntax>().ToArray(); 4427var ifStatement = root.DescendantNodes().OfType<IfStatementSyntax>().Single(); 4460Assert.Equal("DEBUG", model.GetConstantValue(root.DescendantNodes().OfType<InvocationExpressionSyntax>().Single())); 4477var declarationExpression = root.DescendantNodes().OfType<DeclarationExpressionSyntax>().Single(); 4541var declarationExpression = root.DescendantNodes().OfType<DeclarationExpressionSyntax>().Single(); 4611var node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(ident => ident.Identifier.Text == "global").Single(); 4625var nodes = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(ident => ident.Identifier.Text == "global").ToArray(); 4644var identifier = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Single(i => i.Identifier.Text == "M"); 4661var identifier = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Single(i => i.Identifier.Text == "M2"); 4676var identifier = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Single(i => i.Identifier.Text == "M2"); 4692var identifier = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Single(i => i.Identifier.Text == "NotNullWhen"); 4708var identifier = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Single(i => i.Identifier.Text == "M2"); 4727var identifier = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Single(i => i.Identifier.Text == "M2"); 4743var identifier = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Single(i => i.Identifier.Text == "M2"); 4758var identifier = tree.GetRoot().DescendantNodes(descendIntoTrivia: true).OfType<IdentifierNameSyntax>().First();
Compilation\SemanticModelGetDeclaredSymbolAPITests.cs (30)
38var rxDecl = root.DescendantNodes().OfType<ForEachStatementSyntax>().Single(); 60var rxDecl = root.DescendantNodes().OfType<ForStatementSyntax>().Single().Declaration; 3177var accessorDecl = tree.GetCompilationUnitRoot().DescendantNodes().OfType<AccessorDeclarationSyntax>().Single(); 3847var queryExpr = tree.GetCompilationUnitRoot().DescendantNodes().OfType<ParenthesizedExpressionSyntax>().First(); 3901var param = tree.GetCompilationUnitRoot().DescendantNodes().OfType<ParameterSyntax>().Where(p => p.Identifier.ValueText == "name").First(); 3922var usingDirectives = tree.GetCompilationUnitRoot().DescendantNodes().OfType<UsingDirectiveSyntax>().ToArray(); 3999var typeofSyntax = tree.GetCompilationUnitRoot().DescendantNodes().OfType<TypeOfExpressionSyntax>().Single(); 4127var call = tree.GetCompilationUnitRoot().DescendantNodes().OfType<MemberAccessExpressionSyntax>().Single(); 4145call = tree.GetCompilationUnitRoot().DescendantNodes().OfType<MemberAccessExpressionSyntax>().Single(); 4440var conversionDecl = tree.GetCompilationUnitRoot().DescendantNodes().OfType<ConversionOperatorDeclarationSyntax>().Single(); 4446var lookupSymbols = model.LookupSymbols(conversionDecl.DescendantNodes().OfType<ReturnStatementSyntax>().Single().SpanStart, name: WellKnownMemberNames.ImplicitConversionName); 4471var conversionDecl = tree.GetCompilationUnitRoot().DescendantNodes().OfType<ConversionOperatorDeclarationSyntax>().Single(); 4477var lookupSymbols = model.LookupSymbols(conversionDecl.DescendantNodes().OfType<ReturnStatementSyntax>().Single().SpanStart, name: WellKnownMemberNames.ExplicitConversionName); 4502var operatorDecl = tree.GetCompilationUnitRoot().DescendantNodes().OfType<OperatorDeclarationSyntax>().Single(); 4508var lookupSymbols = model.LookupSymbols(operatorDecl.DescendantNodes().OfType<ReturnStatementSyntax>().Single().SpanStart, name: WellKnownMemberNames.AdditionOperatorName); 4741var enumDecl = tree.GetCompilationUnitRoot().DescendantNodes().OfType<EnumDeclarationSyntax>().Single(); 4742var eventDecl = tree.GetCompilationUnitRoot().DescendantNodes().OfType<EventDeclarationSyntax>().Single(); 4767var structDecl = tree.GetCompilationUnitRoot().DescendantNodes().OfType<StructDeclarationSyntax>().First(); 4768var interfaceDecl = tree.GetCompilationUnitRoot().DescendantNodes().OfType<InterfaceDeclarationSyntax>().Last(); 5222var decls = tree.GetCompilationUnitRoot().DescendantNodes().OfType<ParameterSyntax>().ToArray(); 5243var decls = tree.GetCompilationUnitRoot().DescendantNodes().OfType<ParameterSyntax>().ToArray(); 5264var decls = tree.GetCompilationUnitRoot().DescendantNodes().OfType<ParameterSyntax>().ToArray(); 5305.OfType<InitializerExpressionSyntax>() 5356.OfType<AssignmentExpressionSyntax>() 5400.OfType<InitializerExpressionSyntax>() 5448.OfType<InitializerExpressionSyntax>() 5491.OfType<InitializerExpressionSyntax>() 5542.OfType<AssignmentExpressionSyntax>() 5586.OfType<InitializerExpressionSyntax>() 5634.OfType<InitializerExpressionSyntax>()
Compilation\SemanticModelGetSemanticInfoTests.cs (4)
14484var node = tree.GetCompilationUnitRoot().DescendantNodes().OfType<OmittedArraySizeExpressionSyntax>().Last(); 14656var argumentSyntax = tree.GetCompilationUnitRoot().DescendantNodes().OfType<AttributeArgumentSyntax>().Single(); 15375foreach (var qc in tree.GetRoot().DescendantNodes().OfType<QueryClauseSyntax>()) 15380var qe = tree.GetRoot().DescendantNodes().OfType<QueryExpressionSyntax>().Single();
DocumentationComments\CrefTests.cs (12)
1248var expectedSymbol = compilation.GlobalNamespace.GetMembers("B").OfType<SourceNamedTypeSymbol>().Single(); 5697foreach (var id in cref.DescendantNodes().OfType<NameSyntax>()) 5753var parameterTypeContainingType = parameterType.DescendantNodes().OfType<SimpleNameSyntax>().First(); 5797var typeSyntax = cref.DescendantNodes().OfType<SimpleNameSyntax>().First(); 6046var typeParameterSyntax = crefSyntax.DescendantNodes().OfType<IdentifierNameSyntax>().Last(); 6070var methodNameSyntax = crefSyntax.DescendantNodes().OfType<IdentifierNameSyntax>().Last(); 6190var parameterTypeSyntax = crefSyntax.DescendantNodes().OfType<CrefParameterSyntax>().Single().Type; 6216var alias = model.GetAliasInfo(crefSyntax.DescendantNodesAndSelf().OfType<IdentifierNameSyntax>().Single()); 6245DescendantNodes().OfType<CrefParameterSyntax>().Single(). 6246DescendantNodes().OfType<IdentifierNameSyntax>().Single(); 6618var docComments = tree.GetCompilationUnitRoot().DescendantTrivia().Select(trivia => trivia.GetStructure()).OfType<DocumentationCommentTriviaSyntax>(); 6619return docComments.SelectMany(docComment => docComment.DescendantNodes().OfType<XmlCrefAttributeSyntax>().Select(attr => attr.Cref));
DocumentationComments\DocumentationCommentIDTests.cs (4)
31var syntax = tree.GetCompilationUnitRoot().DescendantNodes().OfType<UsingDirectiveSyntax>().Single(); 144var syntax = tree.GetCompilationUnitRoot().DescendantNodes().OfType<GotoStatementSyntax>().Single().Expression; 165var syntax = tree.GetCompilationUnitRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().Single(); 309var syntax = tree.GetCompilationUnitRoot().DescendantNodes().OfType<FromClauseSyntax>().Single();
DocumentationComments\ParameterTests.cs (2)
841var docComments = tree.GetCompilationUnitRoot().DescendantTrivia().Select(trivia => trivia.GetStructure()).OfType<DocumentationCommentTriviaSyntax>(); 842return docComments.SelectMany(docComment => docComment.DescendantNodes().OfType<XmlNameAttributeSyntax>().Select(attr => attr.Identifier));
SymbolDisplay\SymbolDisplayTests.cs (15)
5622var invocation = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().Single(); 6062var methodDecl = tree.GetCompilationUnitRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().First(); 6072methodDecl = tree.GetCompilationUnitRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().First(); 6748var queryExpression = root.DescendantNodes().OfType<QueryExpressionSyntax>().First(); 6842var declarator = root.DescendantNodes().OfType<VariableDeclaratorSyntax>().Single(); 6875var declarator = root.DescendantNodes().OfType<VariableDeclaratorSyntax>().Single(); 6920var declarator = root.DescendantNodes().OfType<VariableDeclaratorSyntax>().Single(); 7909var variable = tree.GetRoot().DescendantNodes().OfType<ForEachVariableStatementSyntax>().Single().Variable; 8004var constructor = tree.GetRoot().DescendantNodes().OfType<ObjectCreationExpressionSyntax>().Single(); 8064var constructor = tree.GetRoot().DescendantNodes().OfType<ObjectCreationExpressionSyntax>().Single(); 8096var continuation = tree.GetRoot().DescendantNodes().OfType<QueryContinuationSyntax>().Single(); 8484var name = tree.GetRoot().DescendantNodes().OfType<VisualBasic.Syntax.VariableDeclaratorSyntax>().Single(); 8875var decls = tree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().ToArray(); 8931var binaryExpression = tree.GetRoot().DescendantNodes().OfType<BinaryExpressionSyntax>().Single(); 9025.OfType<IdentifierNameSyntax>().First();
Symbols\AccessorOverriddenOrHiddenMembersTests.cs (2)
1007var invocationSyntax = nodes.OfType<InvocationExpressionSyntax>().Single(); 1042var explicitInterfaceImplementation = nodes.OfType<MethodDeclarationSyntax>().Single(d => d.ExplicitInterfaceSpecifier != null);
Symbols\AnonymousTypesSymbolTests.cs (1)
1640var expr = tree.GetCompilationUnitRoot().DescendantNodes().OfType<AnonymousObjectCreationExpressionSyntax>().Single();
Symbols\CheckedUserDefinedOperatorsTests.cs (10)
7210var xNode = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "x").Single(); 7211var yNode = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "y").Single(); 7282var xNode = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "x").Single(); 7283var yNode = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "y").Single(); 7353var xNode = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "x").Single(); 7354var yNode = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "y").Single(); 7426var xNode = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "x").Single(); 7427var yNode = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "y").Single(); 7490var xNode = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "x").Single(); 7491var yNode = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "y").Single();
Symbols\CompilationCreationTests.cs (3)
2582MethodSymbol m1 = classModule1.GetMembers("M1").OfType<MethodSymbol>().Single(); 2583MethodSymbol m2 = classModule1.GetMembers("M2").OfType<MethodSymbol>().Single(); 2584MethodSymbol m3 = classModule1.GetMembers("M3").OfType<MethodSymbol>().Single();
Symbols\ConversionTests.cs (4)
2069var castSyntax = tree.GetRoot().DescendantNodes().OfType<CastExpressionSyntax>().Single(); 2076var forEachSyntax = tree.GetRoot().DescendantNodes().OfType<ForEachStatementSyntax>().Single(); 2139var syntax = tree.GetRoot().DescendantNodes().OfType<CastExpressionSyntax>().Single(); 2173var syntax = tree.GetRoot().DescendantNodes().OfType<CastExpressionSyntax>().Single();
Symbols\CorLibrary\CorTypes.cs (2)
294var node = tree.GetRoot().DescendantNodes().OfType<TypeOfExpressionSyntax>().Single(); 359var node = tree.GetRoot().DescendantNodes().OfType<TypeOfExpressionSyntax>().Single();
Symbols\CovariantReturnTests.cs (2)
379foreach (var declaration in tree.GetRoot().DescendantNodes().OfType<LocalDeclarationStatementSyntax>()) 2622foreach (var localDeclaration in vbTree.GetRoot().DescendantNodes().OfType<VisualBasic.Syntax.LocalDeclarationStatementSyntax>())
Symbols\DefaultInterfaceImplementationTests.cs (2)
14042return container.GetMembers().OfType<PropertySymbol>().Single(); 27670return container.GetMembers().OfType<EventSymbol>().Single();
Symbols\DestructorTests.cs (2)
407var destructorDecl = tree.GetCompilationUnitRoot().DescendantNodes().OfType<DestructorDeclarationSyntax>().Single(); 413var finalizeSyntax = tree.GetCompilationUnitRoot().DescendantNodes().OfType<MemberAccessExpressionSyntax>().Single().Name;
Symbols\ExtensionMethodTests.cs (9)
227syntaxTree.GetCompilationUnitRoot().DescendantNodes().OfType<MemberAccessExpressionSyntax>().Single()).Symbol; 2952var memberAccess = tree.GetCompilationUnitRoot().DescendantNodes().OfType<MemberAccessExpressionSyntax>().Single(); 3010var memberAccess = tree.GetCompilationUnitRoot().DescendantNodes().OfType<MemberAccessExpressionSyntax>().Single(); 3139var nodes = tree.GetCompilationUnitRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().ToList(); 3778var member = (MemberAccessExpressionSyntax)syntaxTree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().Single().Expression; 3866var instance = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(n => n.Identifier.ValueText == "Instance").First(); 3913var instance = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(n => n.Identifier.ValueText == "Instance").First(); 3958var instance = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(n => n.Identifier.ValueText == "Instance").First(); 4008var instance = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(n => n.Identifier.ValueText == "Instance").First();
Symbols\FunctionPointerTypeSymbolTests.cs (25)
53.OfType<MethodDeclarationSyntax>() 125.OfType<MethodDeclarationSyntax>() 205.OfType<MethodDeclarationSyntax>() 285syntaxTree.GetRoot().DescendantNodes().OfType<FunctionPointerTypeSyntax>().Single(), 339var functionPointers = syntaxTree.GetRoot().DescendantNodes().OfType<FunctionPointerTypeSyntax>().ToArray(); 406.OfType<MethodDeclarationSyntax>() 486.OfType<MethodDeclarationSyntax>() 603.OfType<MethodDeclarationSyntax>() 686.OfType<MethodDeclarationSyntax>() 1150.OfType<FunctionPointerTypeSyntax>() 1261.OfType<FunctionPointerTypeSyntax>() 1318.OfType<SimpleBaseTypeSyntax>() 1429.OfType<AnonymousObjectCreationExpressionSyntax>() 1685var mDeclSyntax = syntaxTree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Skip(2).Single(); 1697var varDecl = mDeclSyntax.DescendantNodes().OfType<VariableDeclarationSyntax>().Single(); 1711var assignment = mDeclSyntax.DescendantNodes().OfType<AssignmentExpressionSyntax>().Single(); 1730InvocationExpressionSyntax invocationExpressionSyntax = mDeclSyntax.DescendantNodes().OfType<InvocationExpressionSyntax>().Single(); 1746var returnExpression = mDeclSyntax.DescendantNodes().OfType<ReturnStatementSyntax>().Single().Expression!; 1796var methodDecls = syntaxTree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().ToArray(); 1799.SelectMany(m => m.DescendantNodes().OfType<FunctionPointerTypeSyntax>()) 1820var decls = m2DeclSyntax.DescendantNodes().OfType<VariableDeclaratorSyntax>().ToArray(); 1841var invocations = m2DeclSyntax.DescendantNodes().OfType<InvocationExpressionSyntax>().ToArray(); 1867var variableDeclaratorSyntax = m3DeclSyntax.DescendantNodes().OfType<VariableDeclaratorSyntax>().Single(); 1877var invocationExpr = m3DeclSyntax.DescendantNodes().OfType<InvocationExpressionSyntax>().Single(); 1926var decls = syntaxTree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>().ToArray();
Symbols\GenericConstraintTests.cs (2)
7393var nest = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(i => i.Identifier.ValueText == "Nest").Single(); 7418var nest = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(i => i.Identifier.ValueText == "Nest").Single();
Symbols\ImplicitClassTests.cs (3)
73IEnumerable<IdentifierNameSyntax> identifiers = tree.GetCompilationUnitRoot().DescendantNodes().OfType<IdentifierNameSyntax>(); 116var namespaceDecl = tree.GetCompilationUnitRoot().DescendantNodes().OfType<NamespaceDeclarationSyntax>().Single(); 117var methodDecl = tree.GetCompilationUnitRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Single();
Symbols\IndexerTests.cs (1)
2844ExpressionSyntax expr = tree.GetCompilationUnitRoot().DescendantNodes().OfType<ElementAccessExpressionSyntax>().FirstOrDefault();
Symbols\LocalFunctionTests.cs (4)
35var localSyntax = tree.GetCompilationUnitRoot().DescendantNodes().OfType<LocalFunctionStatementSyntax>().Single(); 56var localSyntax = tree.GetCompilationUnitRoot().DescendantNodes().OfType<LocalFunctionStatementSyntax>().Single(); 77var localSyntax = tree.GetCompilationUnitRoot().DescendantNodes().OfType<LocalFunctionStatementSyntax>().Single(); 100var localsSyntax = tree.GetCompilationUnitRoot().DescendantNodes().OfType<LocalFunctionStatementSyntax>().ToArray();
Symbols\Metadata\MetadataTypeTests.cs (2)
372var id = newTree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(s => s.ToString() == "StaticModClass").First(); 387id = newTree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(s => s.ToString() == "StaticModClass").First();
Symbols\Metadata\PE\LoadingMethods.cs (5)
138var basicC1_M9 = basicC1.GetMembers("M9").OfType<MethodSymbol>().ToArray(); 176var console = module5.GlobalNamespace.GetMembers("System").OfType<NamespaceSymbol>().Single(). 179Assert.Equal(1, console.GetMembers("WriteLine").OfType<MethodSymbol>().Count(m => m.IsVararg)); 180Assert.True(console.GetMembers("WriteLine").OfType<MethodSymbol>().Single(m => m.IsVararg).IsStatic); 375var byrefReturnMethod = byrefReturn.GlobalNamespace.GetTypeMembers("ByRefReturn").Single().GetMembers("M").OfType<MethodSymbol>().Single();
Symbols\Metadata\PE\NoPia.cs (28)
75test1 = classLocalTypes1.GetMembers("Test1").OfType<MethodSymbol>().Single(); 76test2 = classLocalTypes2.GetMembers("Test2").OfType<MethodSymbol>().Single(); 108test1 = classLocalTypes1.GetMembers("Test1").OfType<MethodSymbol>().Single(); 109test2 = classLocalTypes2.GetMembers("Test2").OfType<MethodSymbol>().Single(); 141test1 = classLocalTypes1.GetMembers("Test1").OfType<MethodSymbol>().Single(); 142test2 = classLocalTypes2.GetMembers("Test2").OfType<MethodSymbol>().Single(); 195test1 = classLocalTypes1.GetMembers("Test1").OfType<MethodSymbol>().Single(); 196test2 = classLocalTypes2.GetMembers("Test2").OfType<MethodSymbol>().Single(); 232test1 = classLocalTypes1.GetMembers("Test1").OfType<MethodSymbol>().Single(); 233test2 = classLocalTypes2.GetMembers("Test2").OfType<MethodSymbol>().Single(); 263test1 = classLocalTypes1.GetMembers("Test1").OfType<MethodSymbol>().Single(); 264test2 = classLocalTypes2.GetMembers("Test2").OfType<MethodSymbol>().Single(); 297test1 = classLocalTypes1.GetMembers("Test1").OfType<MethodSymbol>().Single(); 298test2 = classLocalTypes2.GetMembers("Test2").OfType<MethodSymbol>().Single(); 416test1 = classLocalTypes1.GetMembers("Test1").OfType<MethodSymbol>().Single(); 417test2 = classLocalTypes2.GetMembers("Test2").OfType<MethodSymbol>().Single(); 449test1 = classLocalTypes1.GetMembers("Test1").OfType<MethodSymbol>().Single(); 450test2 = classLocalTypes2.GetMembers("Test2").OfType<MethodSymbol>().Single(); 481test1 = classLocalTypes1.GetMembers("Test1").OfType<MethodSymbol>().Single(); 482test2 = classLocalTypes2.GetMembers("Test2").OfType<MethodSymbol>().Single(); 521test1 = classLocalTypes1.GetMembers("Test1").OfType<MethodSymbol>().Single(); 522test2 = classLocalTypes2.GetMembers("Test2").OfType<MethodSymbol>().Single(); 566test1 = classLocalTypes1.GetMembers("Test1").OfType<MethodSymbol>().Single(); 567test2 = classLocalTypes2.GetMembers("Test2").OfType<MethodSymbol>().Single(); 597test1 = classLocalTypes1.GetMembers("Test1").OfType<MethodSymbol>().Single(); 598test2 = classLocalTypes2.GetMembers("Test2").OfType<MethodSymbol>().Single(); 633test1 = classLocalTypes1.GetMembers("Test1").OfType<MethodSymbol>().Single(); 634test2 = classLocalTypes2.GetMembers("Test2").OfType<MethodSymbol>().Single();
Symbols\Metadata\PE\NoPiaInstantiationOfGenericClassAndStruct.cs (21)
34var localField = classLocalType1.GetMembers("field").OfType<FieldSymbol>().Single(); 53var localField = classLocalType.GetMembers("nested").OfType<FieldSymbol>().Single(); 73var localField = classLocalType.GetMembers("nested").OfType<FieldSymbol>().Single(); 92var localField = classLocalType.GetMembers("nested").OfType<FieldSymbol>().Single(); 116var var1 = classLocalType1.GetMembers("i1").OfType<FieldSymbol>().Single(); 134var localField = classLocalType.GetMembers("inheritsMethods").OfType<FieldSymbol>().Single(); 163var var1 = classLocalType.GetMembers("i1").OfType<FieldSymbol>().Single(); 181var local = classLocalType1.GetMembers("typeRef").OfType<FieldSymbol>().Single(); 200var local = classLocalType1.GetMembers("typeRef").OfType<FieldSymbol>().Single(); 219var local = classLocalType1.GetMembers("typeRef").OfType<FieldSymbol>().Single(); 238var local = classLocalType1.GetMembers("typeRef").OfType<FieldSymbol>().Single(); 257var local = classLocalType.GetMembers("i2").OfType<FieldSymbol>().Single(); 276var local = classLocalType.GetMembers("typeRef").OfType<FieldSymbol>().Single(); 295var local = classLocalType.GetMembers("tr2a").OfType<FieldSymbol>().Single(); 314var local = classLocalType.GetMembers("tr2a").OfType<FieldSymbol>().Single(); 333var local = classLocalType.GetMembers("tr2b").OfType<FieldSymbol>().Single(); 352var var1 = classLocalType.GetMembers("Event2").OfType<EventSymbol>().Single(); 369var var1 = classLocalType.GetMembers("Event3").OfType<FieldSymbol>().Single(); 389var localField = classLocalType.GetMembers("myclass").OfType<FieldSymbol>().Single(); 410var localField = classLocalType.GetMembers("mygeneric").OfType<FieldSymbol>().Single(); 441foreach (MethodSymbol m in classLocalType.GetMembers("Method1").OfType<MethodSymbol>())
Symbols\Metadata\PE\NoPiaLocalHideAndTypeSubstitutionTests.cs (15)
42MethodSymbol methodSymbol = classLocalType.GetMembers("Test1").OfType<MethodSymbol>().Single(); 100MethodSymbol methodSymbol = classLocalType.GetMembers("Test1").OfType<MethodSymbol>().Single(); 136FieldSymbol localFieldSymbol = classLocalType.GetMembers("myOwnVar").OfType<FieldSymbol>().Single(); 139MethodSymbol refMethodSymbol = classRefLocalType.GetMembers("Scen1").OfType<MethodSymbol>().Single(); 196FieldSymbol localFieldSymbol = classLocalType.GetMembers("myOwnRef").OfType<FieldSymbol>().Single(); 199MethodSymbol refMethodSymbol = classRefLocalType.GetMembers("Scen2").OfType<MethodSymbol>().Single(); 232FieldSymbol localFieldSymbol = classLocalType.GetMembers("myLocalType").OfType<FieldSymbol>().Single(); 235MethodSymbol methodSymbol = classRefLocalType.GetMembers("Scen3").OfType<MethodSymbol>().Single(); 267FieldSymbol localFieldSymbol = classLocalType.GetMembers("myLocalType").OfType<FieldSymbol>().Single(); 270var methodSymbol = classRefLocalType.GetMembers("Scen4").OfType<PropertySymbol>().Single(); 300FieldSymbol localFieldSymbol = classLocalType.GetMembers("myLocalType").OfType<FieldSymbol>().Single(); 303var methodSymbol = classRefLocalType.GetMembers("Scen5").OfType<PropertySymbol>().Single(); 326MethodSymbol methodSymbol = classRefLocalType.GetMembers("Foo").OfType<MethodSymbol>().Single(); 348MethodSymbol methodSymbol = classRefLocalType.GetMembers("Foo").OfType<MethodSymbol>().Single(); 370MethodSymbol refMethodSymbol = classRefLocalType.GetMembers("Scen2").OfType<MethodSymbol>().Single();
Symbols\RelaxedShiftOperatorTests.cs (6)
102var shift = tree.GetRoot().DescendantNodes().OfType<BinaryExpressionSyntax>().Single(); 146var shift = tree.GetRoot().DescendantNodes().OfType<BinaryExpressionSyntax>().Single(); 190var shift = tree.GetRoot().DescendantNodes().OfType<BinaryExpressionSyntax>().Single(); 234var shift = tree.GetRoot().DescendantNodes().OfType<BinaryExpressionSyntax>().Single(); 278var shift = tree.GetRoot().DescendantNodes().OfType<BinaryExpressionSyntax>().Single(); 322var shift = tree.GetRoot().DescendantNodes().OfType<BinaryExpressionSyntax>().Single();
Symbols\RequiredMembersTests.cs (1)
7646var tuple = tree.GetRoot().DescendantNodes().OfType<TupleExpressionSyntax>().First();
Symbols\Retargeting\NoPia.cs (42)
385test1 = classLocalTypes1.GetMembers("Test1").OfType<MethodSymbol>().Single(); 386test2 = classLocalTypes2.GetMembers("Test2").OfType<MethodSymbol>().Single(); 418test1 = classLocalTypes1.GetMembers("Test1").OfType<MethodSymbol>().Single(); 419test2 = classLocalTypes2.GetMembers("Test2").OfType<MethodSymbol>().Single(); 449test1 = classLocalTypes1.GetMembers("Test1").OfType<MethodSymbol>().Single(); 450test2 = classLocalTypes2.GetMembers("Test2").OfType<MethodSymbol>().Single(); 501test1 = classLocalTypes1.GetMembers("Test1").OfType<MethodSymbol>().Single(); 502test2 = classLocalTypes2.GetMembers("Test2").OfType<MethodSymbol>().Single(); 536test1 = classLocalTypes1.GetMembers("Test1").OfType<MethodSymbol>().Single(); 537test2 = classLocalTypes2.GetMembers("Test2").OfType<MethodSymbol>().Single(); 566test1 = classLocalTypes1.GetMembers("Test1").OfType<MethodSymbol>().Single(); 567test2 = classLocalTypes2.GetMembers("Test2").OfType<MethodSymbol>().Single(); 599test1 = classLocalTypes1.GetMembers("Test1").OfType<MethodSymbol>().Single(); 600test2 = classLocalTypes2.GetMembers("Test2").OfType<MethodSymbol>().Single(); 686test1 = classLocalTypes1.GetMembers("Test1").OfType<MethodSymbol>().Single(); 687test2 = classLocalTypes2.GetMembers("Test2").OfType<MethodSymbol>().Single(); 719test1 = classLocalTypes1.GetMembers("Test1").OfType<MethodSymbol>().Single(); 720test2 = classLocalTypes2.GetMembers("Test2").OfType<MethodSymbol>().Single(); 750test1 = classLocalTypes1.GetMembers("Test1").OfType<MethodSymbol>().Single(); 751test2 = classLocalTypes2.GetMembers("Test2").OfType<MethodSymbol>().Single(); 802test1 = classLocalTypes1.GetMembers("Test1").OfType<MethodSymbol>().Single(); 803test2 = classLocalTypes2.GetMembers("Test2").OfType<MethodSymbol>().Single(); 837test1 = classLocalTypes1.GetMembers("Test1").OfType<MethodSymbol>().Single(); 838test2 = classLocalTypes2.GetMembers("Test2").OfType<MethodSymbol>().Single(); 867test1 = classLocalTypes1.GetMembers("Test1").OfType<MethodSymbol>().Single(); 868test2 = classLocalTypes2.GetMembers("Test2").OfType<MethodSymbol>().Single(); 900test1 = classLocalTypes1.GetMembers("Test1").OfType<MethodSymbol>().Single(); 901test2 = classLocalTypes2.GetMembers("Test2").OfType<MethodSymbol>().Single(); 990test1 = classLocalTypes1.GetMembers("Test1").OfType<MethodSymbol>().Single(); 991test2 = classLocalTypes2.GetMembers("Test2").OfType<MethodSymbol>().Single(); 1023test1 = classLocalTypes1.GetMembers("Test1").OfType<MethodSymbol>().Single(); 1024test2 = classLocalTypes2.GetMembers("Test2").OfType<MethodSymbol>().Single(); 1054test1 = classLocalTypes1.GetMembers("Test1").OfType<MethodSymbol>().Single(); 1055test2 = classLocalTypes2.GetMembers("Test2").OfType<MethodSymbol>().Single(); 1106test1 = classLocalTypes1.GetMembers("Test1").OfType<MethodSymbol>().Single(); 1107test2 = classLocalTypes2.GetMembers("Test2").OfType<MethodSymbol>().Single(); 1141test1 = classLocalTypes1.GetMembers("Test1").OfType<MethodSymbol>().Single(); 1142test2 = classLocalTypes2.GetMembers("Test2").OfType<MethodSymbol>().Single(); 1171test1 = classLocalTypes1.GetMembers("Test1").OfType<MethodSymbol>().Single(); 1172test2 = classLocalTypes2.GetMembers("Test2").OfType<MethodSymbol>().Single(); 1204test1 = classLocalTypes1.GetMembers("Test1").OfType<MethodSymbol>().Single(); 1205test2 = classLocalTypes2.GetMembers("Test2").OfType<MethodSymbol>().Single();
Symbols\Source\BaseClassTests.cs (2)
1254var n = global.GetMembers("N").OfType<NamespaceSymbol>().Single(); 2031var baseY = tree.GetRoot().DescendantNodes().Where(n => n.ToString() == "y").OfType<ExpressionSyntax>().First();
Symbols\Source\DelegateTests.cs (4)
738var anonymousMethod = root.DescendantNodes().OfType<AnonymousMethodExpressionSyntax>().Single(); 765var anonymousMethod = root.DescendantNodes().OfType<AnonymousMethodExpressionSyntax>().Single(); 827ExpressionSyntax lambdaSyntax = tree.GetCompilationUnitRoot().DescendantNodes().OfType<ParenthesizedLambdaExpressionSyntax>().Single(); 834lambdaSyntax = tree.GetCompilationUnitRoot().DescendantNodes().OfType<AnonymousMethodExpressionSyntax>().Single();
Symbols\Source\EnumTests.cs (2)
979var decls = tree.GetCompilationUnitRoot().DescendantNodes().OfType<EnumDeclarationSyntax>().ToArray(); 1013var fields = symEnum.GetMembers().OfType<FieldSymbol>().Cast<Symbol>().ToList();
Symbols\Source\EventTests.cs (4)
435var lambdaSyntax = tree.GetRoot().DescendantNodes().OfType<SimpleLambdaExpressionSyntax>().First(); 441var parameterSyntax = lambdaSyntax.DescendantNodes().OfType<ParameterSyntax>().First(); 481var lambdaSyntax = tree.GetRoot().DescendantNodes().OfType<SimpleLambdaExpressionSyntax>().First(); 487var parameterSyntax = lambdaSyntax.DescendantNodes().OfType<ParameterSyntax>().First();
Symbols\Source\ExternAliasTests.cs (4)
408var aliasSyntax = tree.GetCompilationUnitRoot().DescendantNodes().OfType<ExternAliasDirectiveSyntax>().Single(); 434var aliasSyntax = tree.GetCompilationUnitRoot().DescendantNodes().OfType<ExternAliasDirectiveSyntax>().Single(); 479var externAliasSyntax = root.DescendantNodes().OfType<ExternAliasDirectiveSyntax>().Single(); 480var usingSyntax = root.DescendantNodes().OfType<UsingDirectiveSyntax>().Single();
Symbols\Source\FileModifierTests.cs (20)
1233var cReference = tree.GetRoot().DescendantNodes().OfType<MemberAccessExpressionSyntax>().Last().Expression; 1367var cReference = tree.GetRoot().DescendantNodes().OfType<MemberAccessExpressionSyntax>().Last().Expression; 1433var cReference = tree.GetRoot().DescendantNodes().OfType<MemberAccessExpressionSyntax>().Last().Expression; 1491var cReference = tree.GetRoot().DescendantNodes().OfType<MemberAccessExpressionSyntax>().Last().Expression; 1805var cReference = tree.GetRoot().DescendantNodes().OfType<MemberAccessExpressionSyntax>().Last(); 1880var cReference = tree.GetRoot().DescendantNodes().OfType<MemberAccessExpressionSyntax>().Last(); 2600var node = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().Last(); 2639var node = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().Last(); 3510var invocation = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().First(); 3559var invocation = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().First(); 3612var invoked = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().Single().Expression; 3641var body = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Last().Body!; 3711var body = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Last().Body!; 3773var body = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Last().Body!; 3814var body = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Last().Body!; 3977var methodNameSyntax = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Single(); 4124var voidTypeSyntax = tree.GetRoot().DescendantNodes().OfType<ParameterSyntax>().Single().Type!; 4410var node = tree.GetRoot().DescendantNodes().OfType<ParameterSyntax>().Single(); 4454var node = tree.GetRoot().DescendantNodes().OfType<ParameterSyntax>().Single(); 4477var node = tree.GetRoot().DescendantNodes().OfType<ParameterSyntax>().Single();
Symbols\Source\LocalTests.cs (1)
60OfType<VisualBasic.Syntax.IdentifierNameSyntax>().Last();
Symbols\Source\MethodTests.cs (7)
236var node = tree.GetRoot().DescendantNodes().OfType<PredefinedTypeSyntax>().Where(n => n.Keyword.Kind() == SyntaxKind.VoidKeyword).First(); 264var node = tree.GetRoot().DescendantNodes().OfType<PredefinedTypeSyntax>().Where(n => n.Keyword.Kind() == SyntaxKind.VoidKeyword).Last(); 289var node = tree.DescendantNodes().OfType<PredefinedTypeSyntax>().Where(n => n.Keyword.Kind() == SyntaxKind.VoidKeyword).Single(); 310var node = tree.DescendantNodes().OfType<PredefinedTypeSyntax>().Where(n => n.Keyword.Kind() == SyntaxKind.VoidKeyword).Single(); 2540var methods = syntax.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().ToArray(); 2571var type = syntax.GetRoot().DescendantNodes().OfType<ClassDeclarationSyntax>().Single(); 2572var methods = syntax.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().ToArray();
Symbols\Source\NullablePublicAPITests.cs (180)
55var arrayAccesses = root.DescendantNodes().OfType<ElementAccessExpressionSyntax>().ToList(); 89var invocations = root.DescendantNodes().OfType<InvocationExpressionSyntax>().ToList(); 570return syntaxTree.GetRoot().DescendantNodes().OfType<CSharp.Syntax.LocalFunctionStatementSyntax>().Select(func => semanticModel.GetDeclaredSymbol(func)).Cast<IMethodSymbol>().ToArray(); 945var invocations = syntaxTree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>(); 1002var variables = syntaxTree.GetRoot().DescendantNodes().OfType<VariableDeclaratorSyntax>(); 1096var invocation = root.DescendantNodes().OfType<InvocationExpressionSyntax>().Last(); 1123_ = model.GetTypeInfoAndVerifyIOperation(root.DescendantNodes().OfType<EqualsValueClauseSyntax>().Single().Value); 1219var dCast = (CastExpressionSyntax)root.DescendantNodes().OfType<EqualsValueClauseSyntax>().Single().Value; 1263var conditional = root.DescendantNodes().OfType<ConditionalExpressionSyntax>().Single(); 1361var ifStatement = root.DescendantNodes().OfType<IfStatementSyntax>().Single(); 1362var conditionalAccessExpression = root.DescendantNodes().OfType<ConditionalAccessExpressionSyntax>().Single(); 1363var ternary = root.DescendantNodes().OfType<ConditionalExpressionSyntax>().Single(); 1441var returnStatement = root.DescendantNodes().OfType<ReturnStatementSyntax>().Single(); 1443var yReference = ((MemberAccessExpressionSyntax)newSource.DescendantNodes().OfType<InvocationExpressionSyntax>().Single().Expression).Expression; 1513var ifStatement = root.DescendantNodes().OfType<IfStatementSyntax>().Single(); 1514var conditionalAccessExpression = root.DescendantNodes().OfType<ConditionalAccessExpressionSyntax>().Single(); 1515var ternary = root.DescendantNodes().OfType<ConditionalExpressionSyntax>().ElementAt(1); 1569var ifStatement = root.DescendantNodes().OfType<IfStatementSyntax>().Single(); 1570var conditionalAccessExpression = root.DescendantNodes().OfType<ConditionalAccessExpressionSyntax>().Single(); 1571var ternary = root.DescendantNodes().OfType<ConditionalExpressionSyntax>().Single(); 1626var lambda = root.DescendantNodes().OfType<LambdaExpressionSyntax>().Single(); 1627var varDecl = lambda.DescendantNodes().OfType<VariableDeclarationSyntax>().Single(); 1669var lambda = root.DescendantNodes().OfType<LambdaExpressionSyntax>().Single(); 1670var varDecl = lambda.DescendantNodes().OfType<VariableDeclarationSyntax>().Single(); 1712var lambda = root.DescendantNodes().OfType<LambdaExpressionSyntax>().Single(); 1713var varDecl = lambda.DescendantNodes().OfType<VariableDeclarationSyntax>().Single(); 1851var invocations = root.DescendantNodes().OfType<InvocationExpressionSyntax>().ToArray(); 1894var invocations = root.DescendantNodes().OfType<InvocationExpressionSyntax>().ToArray(); 1939var declarations = root.DescendantNodes().OfType<VariableDeclaratorSyntax>().ToList(); 1986var declarations = root.DescendantNodes().OfType<VariableDeclaratorSyntax>().ToList(); 2047var declarations = root.DescendantNodes().OfType<AssignmentExpressionSyntax>().ToList(); 2056var symbols = variable.DescendantNodes().OfType<SingleVariableDesignationSyntax>().Select(s => model.GetDeclaredSymbol(s)).Cast<ILocalSymbol>().ToList(); 2090var declarations = root.DescendantNodes().OfType<AssignmentExpressionSyntax>().ToList(); 2099var symbols = variable.DescendantNodes().OfType<SingleVariableDesignationSyntax>().Select(s => model.GetDeclaredSymbol(s)).Cast<ILocalSymbol>().ToList(); 2133var s2Assignment = root.DescendantNodes().OfType<AssignmentExpressionSyntax>().Single(); 2134var lastDeclaration = root.DescendantNodes().OfType<VariableDeclaratorSyntax>().ElementAt(3); 2136var newDeclarator = newDeclaration.DescendantNodes().OfType<VariableDeclaratorSyntax>().Single(); 2176var declarations = root.DescendantNodes().OfType<VariableDeclaratorSyntax>().ToList(); 2218var declaration = root.DescendantNodes().OfType<VariableDeclaratorSyntax>().Single(); 2248var declarations = root.DescendantNodes().OfType<VariableDeclaratorSyntax>().ToList(); 2283var declarations = root.DescendantNodes().OfType<SingleVariableDesignationSyntax>().ToList(); 2327var declarations = root.DescendantNodes().OfType<SingleVariableDesignationSyntax>().ToList(); 2368var declarations = root.DescendantNodes().OfType<SingleVariableDesignationSyntax>().ToList(); 2413var declarations = root.DescendantNodes().OfType<VariableDeclaratorSyntax>().ToList(); 2453var declarations = root.DescendantNodes().OfType<ForEachStatementSyntax>().ToList(); 2501var declarations = root.DescendantNodes().OfType<ForEachStatementSyntax>().ToList(); 2546var declarations = root.DescendantNodes().OfType<SingleVariableDesignationSyntax>().ToList(); 2595var declarations = root.DescendantNodes().OfType<ForEachStatementSyntax>().ToList(); 2629var sRef = root.DescendantNodes().OfType<IdentifierNameSyntax>().Where(n => n.Identifier.ValueText == "s").Single(); 2663var select = root.DescendantNodes().OfType<IdentifierNameSyntax>().Where(i => i.Identifier.ValueText == "Select").Single(); 2701var select = root.DescendantNodes().OfType<IdentifierNameSyntax>().Where(i => i.Identifier.ValueText == "Select").Single(); 2737var memberAccess = root.DescendantNodes().OfType<MemberAccessExpressionSyntax>().ToList(); 2783var memberAccess = root.DescendantNodes().OfType<MemberAccessExpressionSyntax>().ToList(); 2826var memberAccess = root.DescendantNodes().OfType<MemberAccessExpressionSyntax>().ToList(); 2875var memberAccess = root.DescendantNodes().OfType<MemberAccessExpressionSyntax>().ToList(); 2916var memberAccess = root.DescendantNodes().OfType<MemberAccessExpressionSyntax>().ToList(); 2927var lhs = root.DescendantNodes().OfType<AssignmentExpressionSyntax>().Single().Left; 2957var collectionInitializer = root.DescendantNodes().OfType<InitializerExpressionSyntax>().Single(); 2999var collectionInitializer = root.DescendantNodes().OfType<InitializerExpressionSyntax>().Single(); 3041var collectionInitializer = root.DescendantNodes().OfType<InitializerExpressionSyntax>().Single(); 3101var collectionInitializer = root.DescendantNodes().OfType<InitializerExpressionSyntax>().Single(); 3148var collectionInitializer = root.DescendantNodes().OfType<InitializerExpressionSyntax>().First(); 3193var collectionInitializer = root.DescendantNodes().OfType<InitializerExpressionSyntax>().First(); 3258var indexers = root.DescendantNodes().OfType<ElementAccessExpressionSyntax>().ToArray().AsSpan(); 3310var elementAccesses = root.DescendantNodes().OfType<ElementAccessExpressionSyntax>().ToArray().AsSpan(); 3359var elementAccesses = root.DescendantNodes().OfType<ElementAccessExpressionSyntax>().ToArray(); 3405var operators = root.DescendantNodes().OfType<PrefixUnaryExpressionSyntax>().ToList(); 3450var operators = root.DescendantNodes().OfType<BinaryExpressionSyntax>().ToList(); 3488var lambda = root.DescendantNodes().OfType<LambdaExpressionSyntax>().Single(); 3496.OfType<AssignmentExpressionSyntax>() 3499.OfType<IdentifierNameSyntax>() 3507var mDeclaration = root.DescendantNodes().OfType<MethodDeclarationSyntax>().First(m => m.Identifier.ValueText == "M"); 3537var lambda = root.DescendantNodes().OfType<LambdaExpressionSyntax>().First(); 3540var innerLambda = root.DescendantNodes().OfType<LambdaExpressionSyntax>().ElementAt(1); 3550.OfType<AssignmentExpressionSyntax>() 3553.OfType<IdentifierNameSyntax>() 3561.OfType<AssignmentExpressionSyntax>() 3564.OfType<IdentifierNameSyntax>() 3598var lambda = root.DescendantNodes().OfType<LambdaExpressionSyntax>().First(); 3601var innerLambda = root.DescendantNodes().OfType<LambdaExpressionSyntax>().ElementAt(1); 3611.OfType<AssignmentExpressionSyntax>() 3614.OfType<IdentifierNameSyntax>() 3622.OfType<AssignmentExpressionSyntax>() 3625.OfType<IdentifierNameSyntax>() 3661var lambda = root.DescendantNodes().OfType<LambdaExpressionSyntax>().Single(); 3664var localFunction = lambda.DescendantNodes().OfType<LocalFunctionStatementSyntax>().Single(); 3667var o2Reference = localFunction.DescendantNodes().OfType<IdentifierNameSyntax>().Single(id => id.Identifier.ValueText == "o2"); 3697var localFunctionBody = tree.GetRoot().DescendantNodes().OfType<LocalFunctionStatementSyntax>().Single(); 3698var typeInfo = model.GetTypeInfo(localFunctionBody.DescendantNodes().OfType<ReturnStatementSyntax>().Single().Expression!); 3732var localFunctionBody = tree.GetRoot().DescendantNodes().OfType<LambdaExpressionSyntax>().Single(); 3733var typeInfo = model.GetTypeInfo(localFunctionBody.DescendantNodes().OfType<ReturnStatementSyntax>().Single().Expression!); 3769var lambda = root.DescendantNodes().OfType<LambdaExpressionSyntax>().Single(); 3771.OfType<AssignmentExpressionSyntax>() 3774.OfType<IdentifierNameSyntax>() 3808var lambda = root.DescendantNodes().OfType<LambdaExpressionSyntax>().Single(); 3810var parameter = lambda.DescendantNodes().OfType<ParameterSyntax>().Single(); 3854var lambda = root.DescendantNodes().OfType<LambdaExpressionSyntax>().First(); 3856var o2Declaration = lambda.DescendantNodes().OfType<VariableDeclaratorSyntax>().First(); 3862var innerLambda = root.DescendantNodes().OfType<LambdaExpressionSyntax>().ElementAt(1); 3863var innerO2Reference = innerLambda.DescendantNodes().OfType<IdentifierNameSyntax>().Single(id => id.Identifier.ValueText == "o2"); 3868var @foreach = lambda.DescendantNodes().OfType<ForEachStatementSyntax>().Single(); 3871foreach (var singleVarDesignation in lambda.DescendantNodes().OfType<SingleVariableDesignationSyntax>()) 3876var localFunction = lambda.DescendantNodes().OfType<LocalFunctionStatementSyntax>().Single(); 3879var o8Declaration = localFunction.DescendantNodes().OfType<VariableDeclaratorSyntax>().Single(); 3913var fieldLambda = root.DescendantNodes().OfType<LambdaExpressionSyntax>().First(); 3915var o1Reference = fieldLambda.DescendantNodes().OfType<IdentifierNameSyntax>().Single(id => id.Identifier.ValueText == "o1"); 3917var o2Decl = fieldLambda.DescendantNodes().OfType<VariableDeclaratorSyntax>().Single(); 3927var propertyLambda = root.DescendantNodes().OfType<LambdaExpressionSyntax>().ElementAt(1); 3929var o3Reference = propertyLambda.DescendantNodes().OfType<IdentifierNameSyntax>().Single(id => id.Identifier.ValueText == "o3"); 3931var o4Decl = propertyLambda.DescendantNodes().OfType<VariableDeclaratorSyntax>().Single(); 3978var lambda = root.DescendantNodes().OfType<LambdaExpressionSyntax>().First(); 3981var innerLambda1 = root.DescendantNodes().OfType<LambdaExpressionSyntax>().ElementAt(1); 3991var innerLambda2 = root.DescendantNodes().OfType<LambdaExpressionSyntax>().ElementAt(1); 4047var lambda = root.DescendantNodes().OfType<SimpleLambdaExpressionSyntax>().First(); 4050var o2Decl = root.DescendantNodes().OfType<VariableDeclaratorSyntax>().ElementAt(1); 4053var o1Ref = root.DescendantNodes().OfType<AttributeArgumentSyntax>().Last().Expression; 4056var o2Ref = root.DescendantNodes().OfType<ParameterSyntax>().Last().Default.Value; 4062var localFunction = root.DescendantNodes().OfType<LocalFunctionStatementSyntax>().Single(); 4065var speculativeO2Ref = speculativeAttribute.DescendantNodes().OfType<AttributeArgumentSyntax>().Single().Expression; 4114var lambda = root.DescendantNodes().OfType<LambdaExpressionSyntax>().First(); 4116var innerLambda = root.DescendantNodes().OfType<LambdaExpressionSyntax>().ElementAt(1); 4117var localFunction = lambda.DescendantNodes().OfType<LocalFunctionStatementSyntax>().Single(); 4120var position = localFunction.DescendantNodes().OfType<VariableDeclarationSyntax>().Single().Span.End; 4177var lambda = root.DescendantNodes().OfType<LambdaExpressionSyntax>().First(); 4179var localFunction = lambda.DescendantNodes().OfType<LocalFunctionStatementSyntax>().First(); 4181var nestedLocalFunction = (IMethodSymbol)model.GetDeclaredSymbol(lambda.DescendantNodes().OfType<LocalFunctionStatementSyntax>().ElementAt(1)); 4211var attributeUsage = root.DescendantNodes().OfType<AttributeSyntax>().ElementAt(1); 4242var typeOf = syntaxTree.GetRoot().DescendantNodes().OfType<TypeOfExpressionSyntax>().Single(); 4272var default0 = root.DescendantNodes().OfType<EqualsValueClauseSyntax>().ElementAt(0).Value; 4275var default1 = root.DescendantNodes().OfType<EqualsValueClauseSyntax>().ElementAt(1).Value; 4306var default0 = root.DescendantNodes().OfType<AttributeArgumentSyntax>().ElementAt(0).Expression; 4309var default1 = root.DescendantNodes().OfType<AttributeArgumentSyntax>().ElementAt(1).Expression; 4335var exprs = tree.GetRoot().DescendantNodes().OfType<DefaultExpressionSyntax>().ToArray(); 4365var type = tree.GetRoot().DescendantNodes().OfType<DeclarationExpressionSyntax>().Single().Type; 4370var type2 = statement.DescendantNodes().OfType<DeclarationExpressionSyntax>().Single().Type; 4393var type = tree.GetRoot().DescendantNodes().OfType<DeclarationExpressionSyntax>().Single().Type; 4398var type2 = statement.DescendantNodes().OfType<DeclarationExpressionSyntax>().Single().Type; 4421var type = tree.GetRoot().DescendantNodes().OfType<DeclarationExpressionSyntax>().Single().Type; 4428var type2 = statement.DescendantNodes().OfType<DeclarationExpressionSyntax>().Single().Type; 4451var type = tree.GetRoot().DescendantNodes().OfType<DeclarationExpressionSyntax>().Single().Type; 4458var type2 = statement.DescendantNodes().OfType<DeclarationExpressionSyntax>().Single().Type; 4481var type = tree.GetRoot().DescendantNodes().OfType<DeclarationExpressionSyntax>().Single().Type; 4488var type2 = statement.DescendantNodes().OfType<DeclarationExpressionSyntax>().Single().Type; 4511var type = tree.GetRoot().DescendantNodes().OfType<DeclarationExpressionSyntax>().Single().Type; 4520var type2 = methodDeclaration.DescendantNodes().OfType<DeclarationExpressionSyntax>().Single().Type; 4543var type = tree.GetRoot().DescendantNodes().OfType<DeclarationExpressionSyntax>().Single().Type; 4553var type2 = methodDeclaration.DescendantNodes().OfType<DeclarationExpressionSyntax>().Single().Type; 4576var type = tree.GetRoot().DescendantNodes().OfType<DeclarationExpressionSyntax>().Single().Type; 4581var type2 = arrow.DescendantNodes().OfType<DeclarationExpressionSyntax>().Single().Type; 4604var type = tree.GetRoot().DescendantNodes().OfType<DeclarationExpressionSyntax>().Single().Type; 4611var type2 = arrow.DescendantNodes().OfType<DeclarationExpressionSyntax>().Single().Type; 4637var initializer = tree.GetRoot().DescendantNodes().OfType<ConstructorInitializerSyntax>().Single(); 4642var type2 = newInitializer.DescendantNodes().OfType<DeclarationExpressionSyntax>().Single().Type; 4668var initializer = tree.GetRoot().DescendantNodes().OfType<ConstructorInitializerSyntax>().Single(); 4675var type2 = newInitializer.DescendantNodes().OfType<DeclarationExpressionSyntax>().Single().Type; 4699var initializer = tree.GetRoot().DescendantNodes().OfType<DeclarationExpressionSyntax>().Single(); 4730var suppressions = tree.GetRoot().DescendantNodes().OfType<PostfixUnaryExpressionSyntax>().Where(p => p.IsKind(SyntaxKind.SuppressNullableWarningExpression)).ToList(); 4780var invocations = syntaxTree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>(); 4816var memberAccesses = tree.GetRoot().DescendantNodes().OfType<MemberAccessExpressionSyntax>().ToArray(); 4904.OfType<ConstructorDeclarationSyntax>() 4914var newAccess = newBody.DescendantNodes().OfType<MemberAccessExpressionSyntax>().Single(); 4933var localFunction = tree.GetRoot().DescendantNodes().OfType<LocalFunctionStatementSyntax>().Single(); 4966var ternary = tree.GetRoot().DescendantNodes().OfType<ConditionalExpressionSyntax>().Single(); 5010var tupleLiteral = tree.GetRoot().DescendantNodes().OfType<TupleExpressionSyntax>().Single(); 5049var constructor = tree.GetRoot().DescendantNodes().OfType<ObjectCreationExpressionSyntax>().Single(); 5052var assignmentsInLambda = constructor.DescendantNodes().OfType<AssignmentExpressionSyntax>().ToArray(); 5065var switchExpressionInput = tree.GetRoot().DescendantNodes().OfType<SwitchExpressionSyntax>().Single().GoverningExpression; 5102var binaryRight = tree.GetRoot().DescendantNodes().OfType<BinaryExpressionSyntax>().Single().Right; 5134var binaryRight = tree.GetRoot().DescendantNodes().OfType<BinaryExpressionSyntax>().Single().Right; 5162var binaryRightArgument = tree.GetRoot().DescendantNodes().OfType<BinaryExpressionSyntax>().Single().Right.DescendantNodes().OfType<ArgumentSyntax>().Single().Expression; 5197var xUsage = tree.GetRoot().DescendantNodes().OfType<MemberAccessExpressionSyntax>().Single().Expression; 5232var xUsage = tree.GetRoot().DescendantNodes().OfType<MemberAccessExpressionSyntax>().Single().Expression; 5255var collectionExpr = root.DescendantNodes().OfType<CollectionExpressionSyntax>().Single(); 5278var collectionExpr = root.DescendantNodes().OfType<CollectionExpressionSyntax>().Single(); 5310var collectionExpr = root.DescendantNodes().OfType<CollectionExpressionSyntax>().Single(); 5333var collectionExpr = root.DescendantNodes().OfType<CollectionExpressionSyntax>().Single(); 5355var collectionExpr = root.DescendantNodes().OfType<CollectionExpressionSyntax>().Single(); 5400var collectionExprs = root.DescendantNodes().OfType<CollectionExpressionSyntax>().ToArray(); 5457var collectionExprs = root.DescendantNodes().OfType<CollectionExpressionSyntax>().ToArray();
Symbols\Source\PropertyTests.cs (2)
633Assert.Equal(2, type.GetMembers().OfType<MethodSymbol>().Count()); 638Assert.Equal(0, type.GetMembers().OfType<PropertySymbol>().Count());
Symbols\Source\TypeMapTests.cs (1)
155var v1 = c1OfByteChar_c2OfIntInt_c3OfIntByte.GetMembers().OfType<FieldSymbol>().First();
Symbols\Source\UpdatedContainingSymbolAndNullableAnntotationTests.cs (2)
36var varDeclarators = root.DescendantNodes().OfType<VariableDeclaratorSyntax>(); 41Symbol m2 = model.GetDeclaredSymbol(root.DescendantNodes().OfType<MethodDeclarationSyntax>().ElementAt(1)).GetSymbol();
Symbols\Source\UsingAliasTests.cs (2)
697var node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "Short").Skip(1).Single(); 740var node = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "Short").Skip(1).Single();
Symbols\StaticAbstractMembersInInterfacesTests.cs (28)
8453var node = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().First(); 9041var node = postfixOp != "" ? (ExpressionSyntax)tree.GetRoot().DescendantNodes().OfType<PostfixUnaryExpressionSyntax>().First() : tree.GetRoot().DescendantNodes().OfType<PrefixUnaryExpressionSyntax>().First(); 9356var node = tree.GetRoot().DescendantNodes().OfType<ConditionalExpressionSyntax>().First(); 9755var node = tree.GetRoot().DescendantNodes().OfType<BinaryExpressionSyntax>().First(); 10752var node = tree.GetRoot().DescendantNodes().OfType<BinaryExpressionSyntax>().Where(n => n.ToString() == "x " + op + " 1").Single(); 10945var node = tree.GetRoot().DescendantNodes().OfType<BinaryExpressionSyntax>().Where(n => n.ToString() == "x " + op + " 1").Single(); 11135var node = tree.GetRoot().DescendantNodes().OfType<BinaryExpressionSyntax>().Where(n => n.ToString() == "x " + op + " y").Single(); 11329var node1 = tree.GetRoot().DescendantNodes().OfType<BinaryExpressionSyntax>().Where(n => n.ToString() == "x " + op + op + " y").First(); 11583var node1 = tree.GetRoot().DescendantNodes().OfType<BinaryExpressionSyntax>().Where(n => n.ToString() == "x " + op + op + " y").First(); 11960var node = tree.GetRoot().DescendantNodes().OfType<AssignmentExpressionSyntax>().Where(n => n.ToString() == "x " + op + "= 1").Single(); 12139var node = tree.GetRoot().DescendantNodes().OfType<BinaryExpressionSyntax>().First(); 13180var node = tree.GetRoot().DescendantNodes().OfType<AssignmentExpressionSyntax>().First().Right; 13266var node = tree.GetRoot().DescendantNodes().OfType<AssignmentExpressionSyntax>().First().Left; 13388var node = tree.GetRoot().DescendantNodes().OfType<AssignmentExpressionSyntax>().First().Left; 14089var node = tree.GetRoot().DescendantNodes().OfType<AssignmentExpressionSyntax>().First().Left; 14098node = tree.GetRoot().DescendantNodes().OfType<InvocationExpressionSyntax>().First().ArgumentList.Arguments[0].Expression; 14714var node = tree.GetRoot().DescendantNodes().OfType<MemberAccessExpressionSyntax>().First(); 15120var node = tree.GetRoot().DescendantNodes().OfType<MemberAccessExpressionSyntax>().First(); 15388var node = tree.GetRoot().DescendantNodes().OfType<MemberAccessExpressionSyntax>().First(); 19560var node = tree.GetRoot().DescendantNodes().OfType<LiteralExpressionSyntax>().Where(l => l.ToString() == "default").First(); 19643var node = tree.GetRoot().DescendantNodes().OfType<LiteralExpressionSyntax>().Where(l => l.ToString() == "default").First(); 19735var node = tree.GetRoot().DescendantNodes().OfType<LiteralExpressionSyntax>().Where(l => l.ToString() == "default").First(); 19824var node = tree.GetRoot().DescendantNodes().OfType<LiteralExpressionSyntax>().Where(l => l.ToString() == "default").First(); 28773var node = tree.GetRoot().DescendantNodes().OfType<LiteralExpressionSyntax>().Where(l => l.ToString() == "default").First(); 30280var node = tree.GetRoot().DescendantNodes().OfType<ReturnStatementSyntax>().First(); 30471var node = tree.GetRoot().DescendantNodes().OfType<BinaryExpressionSyntax>().First(); 30937var node = tree.GetRoot().DescendantNodes().OfType<ReturnStatementSyntax>().First();
Symbols\SymbolEqualityTests.cs (7)
41var invocations = root.DescendantNodes().OfType<BinaryExpressionSyntax>().ToList(); 84var invocations = root.DescendantNodes().OfType<InvocationExpressionSyntax>().ToList(); 124var invocations = root.DescendantNodes().OfType<InvocationExpressionSyntax>().ToList(); 165var invocations = root.DescendantNodes().OfType<InvocationExpressionSyntax>().ToList(); 935var lambdaSyntax = root.DescendantNodes().OfType<SimpleLambdaExpressionSyntax>().First(); 962OfType<QueryExpressionSyntax>().Single(); 964var lambdas = operation.Descendants().OfType<AnonymousFunctionOperation>().
Symbols\SymbolExtensionTests.cs (5)
101var identifier = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().First(id => id.Identifier.Text == "var"); 119var identifier = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().First(id => id.Identifier.Text == "var"); 137var identifier = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().First(id => id.Identifier.Text == "var"); 156var identifier = tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Last(id => id.Identifier.Text == "var"); 252var method = model.GetSymbolInfo(tree.GetRoot().DescendantNodes().OfType<IdentifierNameSyntax>().Where(id => id.Identifier.ValueText == "Method").Single()).Symbol.GetSymbol<MethodSymbol>();
Symbols\TypeTests.cs (3)
1854var syntax = tree.GetCompilationUnitRoot().DescendantNodes().OfType<ObjectCreationExpressionSyntax>().Single(); 2466var method = typeMembers.OfType<MethodSymbol>().First(m => m is { MethodKind: not MethodKind.Constructor }); 2631var nestedTypes = typeMembers.OfType<TypeSymbol>().ToArray();
Symbols\UnsignedRightShiftTests.cs (13)
123var unsignedShift = tree.GetRoot().DescendantNodes().OfType<BinaryExpressionSyntax>().Where(e => e.Kind() == SyntaxKind.UnsignedRightShiftExpression).First(); 124var shift = tree.GetRoot().DescendantNodes().OfType<BinaryExpressionSyntax>().Where(e => e.Kind() == SyntaxKind.RightShiftExpression).First(); 626var unsignedShift = tree.GetRoot().DescendantNodes().OfType<AssignmentExpressionSyntax>().Where(e => e.Kind() == SyntaxKind.UnsignedRightShiftAssignmentExpression).First(); 627var shift = tree.GetRoot().DescendantNodes().OfType<AssignmentExpressionSyntax>().Where(e => e.Kind() == SyntaxKind.RightShiftAssignmentExpression).First(); 1176var unsignedShift = tree.GetRoot().DescendantNodes().OfType<BinaryExpressionSyntax>().Where(e => e.Kind() == SyntaxKind.UnsignedRightShiftExpression).First(); 1177var shift = tree.GetRoot().DescendantNodes().OfType<BinaryExpressionSyntax>().Where(e => e.Kind() == SyntaxKind.RightShiftExpression).First(); 1584var unsignedShift = tree.GetRoot().DescendantNodes().OfType<AssignmentExpressionSyntax>().Where(e => e.Kind() == SyntaxKind.UnsignedRightShiftAssignmentExpression).First(); 1585var shift = tree.GetRoot().DescendantNodes().OfType<AssignmentExpressionSyntax>().Where(e => e.Kind() == SyntaxKind.RightShiftAssignmentExpression).First(); 1983var unsignedShift = tree.GetRoot().DescendantNodes().OfType<BinaryExpressionSyntax>().Where(e => e.Kind() == SyntaxKind.UnsignedRightShiftExpression).First(); 2235var unsignedShift = tree.GetRoot().DescendantNodes().OfType<BinaryExpressionSyntax>().Where(e => e.Kind() == SyntaxKind.UnsignedRightShiftExpression).First(); 2377var unsignedShift = tree.GetRoot().DescendantNodes().OfType<AssignmentExpressionSyntax>().Where(e => e.Kind() == SyntaxKind.UnsignedRightShiftAssignmentExpression).First(); 2511var unsignedShift = tree.GetRoot().DescendantNodes().OfType<BinaryExpressionSyntax>().Where(e => e.Kind() == SyntaxKind.UnsignedRightShiftExpression).First(); 2608var unsignedShift = tree.GetRoot().DescendantNodes().OfType<AssignmentExpressionSyntax>().Where(e => e.Kind() == SyntaxKind.UnsignedRightShiftAssignmentExpression).First();
Microsoft.CodeAnalysis.CSharp.Syntax.UnitTests (74)
Diagnostics\DiagnosticTest.cs (3)
1985var defineName = nodes.OfType<Syntax.DefineDirectiveTriviaSyntax>().Single().Name; 1986var errorCodeName = nodes.OfType<Syntax.PragmaWarningDirectiveTriviaSyntax>().First() 1987.ErrorCodes.OfType<Syntax.IdentifierNameSyntax>().First().Identifier;
Diagnostics\LineSpanDirectiveTests.cs (1)
463var directives = tree.GetRoot().DescendantNodesAndSelf(descendIntoTrivia: true).OfType<DirectiveTriviaSyntax>();
LexicalAndXml\PreprocessorTests.cs (2)
4567SyntaxToken token = nodes.OfType<NullableDirectiveTriviaSyntax>().Single().SettingToken; 4569token = nodes.OfType<ClassDeclarationSyntax>().Single().Identifier;
Parsing\CrefParsingTests.cs (1)
31var attr = structure.DescendantNodes().OfType<XmlCrefAttributeSyntax>().Single();
Parsing\NameAttributeValueParsingTests.cs (1)
32var attr = structure.DescendantNodes().OfType<XmlNameAttributeSyntax>().Single();
Parsing\ParsingErrorRecoveryTests.cs (10)
7937var classDecl = root.DescendantNodes().OfType<ClassDeclarationSyntax>().Single(); 7941var ns = root.DescendantNodes().OfType<NamespaceDeclarationSyntax>().Single(); 7958var classDecl = root.DescendantNodes().OfType<ClassDeclarationSyntax>().Single(); 7962var ns = root.DescendantNodes().OfType<FileScopedNamespaceDeclarationSyntax>().Single(); 7979var structDecl = root.DescendantNodes().OfType<StructDeclarationSyntax>().Single(); 7982var ns = root.DescendantNodes().OfType<NamespaceDeclarationSyntax>().Single(); 8002var structDecl = root.DescendantNodes().OfType<StructDeclarationSyntax>().Single(); 8006var ns = root.DescendantNodes().OfType<NamespaceDeclarationSyntax>().Single(); 8026var classDecl = root.DescendantNodes().OfType<ClassDeclarationSyntax>().Single(); 8030var ns = root.DescendantNodes().OfType<NamespaceDeclarationSyntax>().Single();
Parsing\StatementParsingTests.cs (1)
3467var filterClause = root.DescendantNodes().OfType<CatchFilterClauseSyntax>().Single();
Parsing\VerbatimCrefParsingTests.cs (1)
31var attr = structure.DescendantNodes().OfType<XmlTextAttributeSyntax>().Single();
Syntax\FieldAndValueKeywordTests.cs (1)
1277var expr = syntaxTree.GetRoot().DescendantNodes().OfType<ArrowExpressionClauseSyntax>().Single().Expression;
Syntax\LambdaUtilitiesTests.cs (1)
57var methodDef = tree.GetRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Where(d => d.Identifier.ValueText == "M").Single();
Syntax\SyntaxListTests.cs (3)
332var node = tree.GetRoot().DescendantNodes().OfType<InitializerExpressionSyntax>().First(); 356var node = tree.GetRoot().DescendantNodes().OfType<InitializerExpressionSyntax>().First(); 402return tree.GetRoot().DescendantNodes().OfType<InitializerExpressionSyntax>().First();
Syntax\SyntaxNodeTests.cs (30)
85var e = expression.DescendantNodes().OfType<IdentifierNameSyntax>().First(n => n.Identifier.Text == "e"); 103var e = expression.DescendantNodes().OfType<IdentifierNameSyntax>().First(n => n.Identifier.Text == "e"); 122var e = expression.DescendantNodes().OfType<IdentifierNameSyntax>().First(n => n.Identifier.Text == "e"); 337var descendantDirectives = expr.DescendantNodesAndSelf(n => n.ContainsDirectives, descendIntoTrivia: true).OfType<DirectiveTriviaSyntax>().ToList(); 516var identifierNodes = expr.DescendantNodes().OfType<IdentifierNameSyntax>().ToList(); 911tree1.GetCompilationUnitRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Single().IsIncrementallyIdenticalTo( 912tree2.GetCompilationUnitRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Single())); 922tree1.GetCompilationUnitRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Single().IsIncrementallyIdenticalTo( 923tree2.GetCompilationUnitRoot().DescendantNodes().OfType<MethodDeclarationSyntax>().Single())); 2115expr.DescendantNodes().OfType<ExpressionSyntax>(), 2725var m = cu.DescendantNodes().OfType<MethodDeclarationSyntax>().FirstOrDefault(); 2759var m = cu.DescendantNodes().OfType<MethodDeclarationSyntax>().FirstOrDefault(); 2794var m = cu.DescendantNodes().OfType<MethodDeclarationSyntax>().FirstOrDefault(); 2832var m = cu.DescendantNodes().OfType<MethodDeclarationSyntax>().FirstOrDefault(); 2872var m = cu.DescendantNodes().OfType<MethodDeclarationSyntax>().FirstOrDefault(); 2904var m = cu.DescendantNodes().OfType<MethodDeclarationSyntax>().FirstOrDefault(); 2921var m = cu.DescendantNodes().OfType<TypeDeclarationSyntax>().LastOrDefault(); 2937var m = cu.DescendantNodes().OfType<TypeDeclarationSyntax>().LastOrDefault(); 2996var m = cu.DescendantNodes().OfType<ParameterSyntax>().FirstOrDefault(); 3037var m = cu.DescendantNodes().OfType<ParameterSyntax>().FirstOrDefault(); 3081var m = cu.DescendantNodes().OfType<ParameterSyntax>().FirstOrDefault(); 3123var m = cu.DescendantNodes().OfType<ParameterSyntax>().FirstOrDefault(); 3165var m = cu.DescendantNodes().OfType<ParameterSyntax>().LastOrDefault(); 3205var m = cu.DescendantNodes().OfType<ParameterSyntax>().LastOrDefault(); 3248var m = cu.DescendantNodes().OfType<ParameterSyntax>().LastOrDefault(); 3289var m = cu.DescendantNodes().OfType<ParameterSyntax>().LastOrDefault(); 3313var m = cu.DescendantNodes().OfType<TypeDeclarationSyntax>().FirstOrDefault(); 3590var method = root.DescendantNodes().OfType<MethodDeclarationSyntax>().Single(); 3880var a = expression.DescendantNodes().OfType<IdentifierNameSyntax>().First(n => n.Identifier.Text == "a"); 3881var e = expression.DescendantNodes().OfType<IdentifierNameSyntax>().First(n => n.Identifier.Text == "e");
Syntax\SyntaxRewriterTests.cs (5)
363var before = root.DescendantNodes().OfType<LiteralExpressionSyntax>().Single(); 382var invocation = root.DescendantNodes().OfType<InvocationExpressionSyntax>().Single(); 401var invocation = root.DescendantNodes().OfType<InvocationExpressionSyntax>().Single(); 601var ifStmt1 = tree1.GetCompilationUnitRoot().DescendantNodes().OfType<IfStatementSyntax>().Single(); 651var xmlNode = oldRoot.DescendantNodes(descendIntoTrivia: true).OfType<XmlEmptyElementSyntax>().Single();
Syntax\TrackNodeTests.cs (14)
24var a = expr.DescendantNodes().OfType<IdentifierNameSyntax>().First(n => n.Identifier.Text == "a"); 35var a = expr.DescendantNodes().OfType<IdentifierNameSyntax>().First(n => n.Identifier.Text == "a"); 47var a = expr.DescendantNodes().OfType<IdentifierNameSyntax>().First(n => n.Identifier.Text == "a"); 56var a = expr.DescendantNodes().OfType<IdentifierNameSyntax>().First(n => n.Identifier.Text == "a"); 66var originalA = expr.DescendantNodes().OfType<IdentifierNameSyntax>().First(n => n.Identifier.Text == "a"); 81var originalA = expr.DescendantNodes().OfType<IdentifierNameSyntax>().First(n => n.Identifier.Text == "a"); 97var originalA = expr.DescendantNodes().OfType<IdentifierNameSyntax>().First(n => n.Identifier.Text == "a"); 109var originalA = expr.DescendantNodes().OfType<IdentifierNameSyntax>().First(n => n.Identifier.Text == "a"); 122var originalA = expr.DescendantNodes().OfType<IdentifierNameSyntax>().First(n => n.Identifier.Text == "a"); 126var replacedExpr = trackedExpr.ReplaceNodes(trackedExpr.DescendantNodes().OfType<IdentifierNameSyntax>(), (original, changed) => currentA); 134var originalA = expr.DescendantNodes().OfType<IdentifierNameSyntax>().First(n => n.Identifier.Text == "a"); 138var replacedExpr = trackedExpr.ReplaceNodes(trackedExpr.DescendantNodes().OfType<IdentifierNameSyntax>(), (original, changed) => currentA); 149var ids = expr.DescendantNodes().OfType<IdentifierNameSyntax>().ToList(); 167var ids = expr.DescendantNodes().OfType<IdentifierNameSyntax>().ToList();
Microsoft.CodeAnalysis.CSharp.Test.Utilities (4)
CompilationTestUtils.cs (1)
464var annotationsByMethod = allAnnotations.GroupBy(annotation => annotation.Expression.Ancestors().OfType<BaseMethodDeclarationSyntax>().First()).ToArray();
CSharpTestBase.cs (3)
774return tree.GetRoot().DescendantNodes().OfType<T>().Where(e => e.ToString() == text); 1337bool hasTopLevelStatements = syntaxTrees.Any(s => s.GetRoot().ChildNodes().OfType<GlobalStatementSyntax>().Any()); 1591foreach (var node in synList.OfType<TNode>())
Microsoft.CodeAnalysis.CSharp.WinRT.UnitTests (1)
CodeGen\WinMdEventTests.cs (1)
671var syntax = tree.GetRoot().DescendantNodes().OfType<AssignmentExpressionSyntax>().Single();
Microsoft.CodeAnalysis.CSharp.Workspaces (24)
CodeGeneration\CSharpSyntaxGenerator.cs (7)
115? [.. declarations.Select(this.AsUsingDirective).OfType<UsingDirectiveSyntax>()] 132? [.. declarations.Select(AsNamespaceMember).OfType<MemberDeclarationSyntax>()] 797? [.. members.Select(AsInterfaceMember).OfType<MemberDeclarationSyntax>()] 1365EnumDeclarationSyntax @enum => @enum.WithMembers(@enum.Members.AddRange(newMembers.OfType<EnumMemberDeclarationSyntax>())), 1375=> members?.Select(m => AsMemberOf(declaration, m)).OfType<MemberDeclarationSyntax>(); 2643return baseList.Types.OfType<SimpleBaseTypeSyntax>().Select(bt => bt.Type).ToReadOnlyCollection(); 3180=> [.. expressions.OfType<ExpressionSyntax>()];
Simplification\CSharpSimplificationService.Expander.cs (1)
789var invocationExpression = originalSimpleName.Ancestors().OfType<InvocationExpressionSyntax>().FirstOrDefault();
Simplification\Reducers\AbstractCSharpReducer.AbstractReductionRewriter.cs (1)
116.OfType<CrefSyntax>()
Simplification\Reducers\CSharpCastReducer.Rewriter.cs (1)
55.OfType<ExpressionSyntax>()
Simplification\Simplifiers\ExpressionSimplifier.cs (1)
393var constructor = memberAccess.Ancestors().OfType<ConstructorDeclarationSyntax>().SingleOrDefault();
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Rules\ElasticTriviaFormattingRule.cs (1)
121if (previousToken.Parent.Ancestors().OfType<TypeParameterConstraintClauseSyntax>().Any())
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Services\SemanticFacts\CSharpSemanticFacts.cs (3)
95var enumDecl = namedTypeSymbol.DeclaringSyntaxReferences.Select(r => r.GetSyntax()).OfType<EnumDeclarationSyntax>().FirstOrDefault(); 140AppendAliasNames(root.Members.OfType<BaseNamespaceDeclarationSyntax>(), builder, cancellationToken); 165AppendAliasNames(@namespace.Members.OfType<BaseNamespaceDeclarationSyntax>(), builder, cancellationToken);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Services\SyntaxFacts\CSharpBlockFacts.cs (1)
43CompilationUnitSyntax compilationUnit => compilationUnit.Members.OfType<GlobalStatementSyntax>().SelectAsArray(globalStatement => globalStatement.Statement),
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Utilities\SpeculationAnalyzer.cs (2)
255var originalIdentifierNodes = originalLambdaBody.DescendantNodes().OfType<IdentifierNameSyntax>().Where(node => paramNames.Contains(node.Identifier.ValueText)); 261var replacedIdentifierNodes = replacedLambdaBody.DescendantNodes().OfType<IdentifierNameSyntax>().Where(node => paramNames.Contains(node.Identifier.ValueText));
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\CSharpCodeGenerationService.cs (1)
547var newStatements = statements.OfType<StatementSyntax>().ToArray();
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\FieldGenerator.cs (3)
28var lastConst = members.OfType<FieldDeclarationSyntax>() 39var lastReadOnly = members.OfType<FieldDeclarationSyntax>() 43var lastNormal = members.OfType<FieldDeclarationSyntax>()
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\StatementGenerator.cs (1)
16=> [.. statements.OfType<StatementSyntax>()];
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\LanguageServices\CSharpTypeInferenceService.TypeInferrer.cs (1)
2214foreach (var descendant in container.DescendantNodesAndSelf().OfType<IdentifierNameSyntax>())
Microsoft.CodeAnalysis.CSharp.Workspaces.UnitTests (10)
CodeGeneration\AddImportsTests.cs (1)
47root = root.ReplaceNodes(root.DescendantNodesAndSelf().OfType<TypeSyntax>(),
CodeGeneration\SyntaxGeneratorTests.cs (5)
2662var summary = cls.DescendantNodes(descendIntoTrivia: true).OfType<XmlElementSyntax>().First(); 2686var summary = cls.DescendantNodes(descendIntoTrivia: true).OfType<XmlElementSyntax>().First(); 2711var text = cls.DescendantNodes(descendIntoTrivia: true).OfType<XmlTextSyntax>().First(); 2734var text = cls.DescendantNodes(descendIntoTrivia: true).OfType<XmlTextSyntax>().First(); 4581var decl = root.DescendantNodes().OfType<ClassDeclarationSyntax>().First();
EmbeddedLanguages\VirtualChars\CSharpVirtualCharServiceTests.cs (1)
35return interpolation.Contents.OfType<InterpolatedStringTextSyntax>().Select(t => t.TextToken);
Formatting\FormattingElasticTriviaTests.cs (1)
111var decl = generator.GetDeclaration(root.DescendantNodes().OfType<VariableDeclaratorSyntax>().First(vd => vd.Identifier.Text == "f2"));
Formatting\FormattingTreeEditTests.cs (2)
43var param = root.DescendantNodes().OfType<ParameterSyntax>().First(); 56var method = root.DescendantNodes().OfType<MethodDeclarationSyntax>().First();
Microsoft.CodeAnalysis.EditorFeatures (2)
Preview\SolutionPreviewResult.cs (1)
83result.OfType<IDisposable>().Do(d => d.Dispose());
Shared\Extensions\IBufferGraphExtensions.cs (1)
116top.SourceBuffers.OfType<IProjectionBufferBase>().Any(b => IsSourceBuffer(b, bottom));
Microsoft.CodeAnalysis.EditorFeatures.Test.Utilities (1)
Diagnostics\DiagnosticTaggerWrapper.cs (1)
67.OfType<TProvider>()
Microsoft.CodeAnalysis.EditorFeatures.UnitTests (8)
CodeFixes\CodeFixServiceTests.cs (1)
1202var variableDeclarations = context.SemanticModel.SyntaxTree.GetRoot().DescendantNodes().OfType<CodeAnalysis.CSharp.Syntax.VariableDeclarationSyntax>();
CodeGeneration\AbstractCodeGenerationTests.cs (2)
94var expression = simplifiedRootNode.DescendantNodes().OfType<EqualsValueClauseSyntax>().First().Value; 115var expression = simplifiedRootNode.DescendantNodes().OfType<EqualsValueSyntax>().First().Value;
CodeGeneration\CodeGenerationTests.cs (1)
920return token.Parent.AncestorsAndSelf().OfType<T>().FirstOrDefault(t => !fullSpanCoverage || t.Span.End >= destSpan.End);
CodeRefactorings\CodeRefactoringServiceTest.cs (1)
104var codeRefactoring = workspace.ExportProvider.GetExportedValues<CodeRefactoringProvider>().OfType<T>().Single();
SuggestedActions\SuggestedActionSourceProviderTests.cs (1)
21.OfType<SuggestedActionPriorityAttribute>()
Utilities\SymbolEquivalenceComparerTests.cs (2)
1891var invocation = method_root.DescendantNodes().OfType<TInvocation>().FirstOrDefault(); 1893invocation ??= method_root.Parent.DescendantNodes().OfType<TInvocation>().First();
Microsoft.CodeAnalysis.ExpressionEvaluator.ExpressionCompiler (1)
DkmUtilities.cs (1)
42OfType<DkmClrModuleInstance>().
Microsoft.CodeAnalysis.ExpressionEvaluator.ResultProvider.Utilities (1)
Debugger\Engine\DkmClrType.cs (1)
157var proxyAttribute = _lazyEvalAttributes.Value.OfType<DkmClrDebuggerTypeProxyAttribute>().FirstOrDefault();
Microsoft.CodeAnalysis.Features (33)
AddImport\AbstractAddImportFeatureService.cs (1)
273seenReferences.AddAll(project.MetadataReferences.OfType<PortableExecutableReference>());
CodeFixes\Suppression\AbstractSuppressionCodeFixProvider.RemoveSuppressionCodeAction.BatchFixer.cs (1)
139var attributeRemoveFixesForTree = removeSuppressionFixesForTree.OfType<AttributeRemoveAction>().ToImmutableArray();
CodeRefactorings\MoveType\AbstractMoveTypeService.cs (2)
178.OfType<TTypeDeclarationSyntax>(); 253.OfType<TTypeDeclarationSyntax>()
Completion\Providers\ImportCompletionProvider\AbstractTypeImportCompletionService.cs (1)
106foreach (var peReference in currentProject.MetadataReferences.OfType<PortableExecutableReference>())
Completion\Providers\ImportCompletionProvider\ExtensionMethodImportCompletionHelper.SymbolComputer.cs (1)
151=> project.MetadataReferences.OfType<PortableExecutableReference>().ToImmutableArray();
ConvertAnonymousType\AbstractConvertAnonymousTypeToClassCodeRefactoringProvider.cs (2)
155var identifiers = containingMember.DescendantNodes().OfType<TIdentifierNameSyntax>(); 197.OfType<TAnonymousObjectCreationExpressionSyntax>();
ConvertIfToSwitch\AbstractConvertIfToSwitchCodeRefactoringProvider.cs (1)
194var ifStatements = editor.OriginalRoot.DescendantNodes().OfType<TIfStatementSyntax>().ToArray();
ConvertTupleToStruct\AbstractConvertTupleToStructCodeRefactoringProvider.cs (2)
644.OfType<TTupleExpressionSyntax>(); 757.OfType<TTupleTypeSyntax>();
EmbeddedLanguages\EmbeddedLanguageCommentDetector.cs (1)
49options = optionGroup.Captures.OfType<Capture>().Select(c => c.Value);
ExtractMethod\MethodExtractor.Analyzer.cs (1)
124.OfType<IParameterSymbol>()
InitializeParameter\AbstractAddParameterCheckCodeRefactoringProvider.cs (1)
195foreach (var coalesceNode in syntax.DescendantNodes().OfType<TBinaryExpressionSyntax>())
InitializeParameter\AbstractInitializeParameterCodeRefactoringProvider.cs (1)
185foreach (var child in condition.Syntax.DescendantNodes().OfType<TExpressionSyntax>())
IntroduceParameter\IntroduceParameterDocumentRewriter.cs (2)
65var variablesInExpression = _expression.DescendantNodes().OfType<TIdentifierNameSyntax>(); 673var matches = from nodeInCurrent in _containerMethod.DescendantNodesAndSelf().OfType<TExpressionSyntax>()
IntroduceVariable\AbstractIntroduceVariableService.cs (1)
307from descendantExpression in startingNode.DescendantNodesAndSelf().OfType<TExpressionSyntax>()
MoveToNamespace\AbstractMoveToNamespaceService.cs (3)
156=> node.AncestorsAndSelf().OfType<TNamespaceDeclarationSyntax>().Count() + node.DescendantNodes().OfType<TNamespaceDeclarationSyntax>().Count(); 159=> node.AncestorsAndSelf().OfType<TNamedTypeDeclarationSyntax>().Count() > 1;
RemoveUnusedVariable\AbstractRemoveUnusedVariableCodeFixProvider.cs (1)
171foreach (var variableDeclarator in nodesToRemove.OfType<TVariableDeclarator>())
SpellCheck\AbstractSpellCheckCodeFixProvider.cs (1)
66foreach (var name in node.DescendantNodesAndSelf(DescendIntoChildren).OfType<TSimpleName>())
src\Analyzers\Core\Analyzers\MatchFolderAndNamespace\AbstractMatchFolderAndNamespaceDiagnosticAnalyzer.cs (2)
98if (namespaceDeclaration.Ancestors().OfType<TNamespaceSyntax>().Any()) 106.OfType<TNamespaceSyntax>().Any();
src\Analyzers\Core\Analyzers\SimplifyInterpolation\AbstractSimplifyInterpolationHelpers.cs (1)
160var interpolatedStringOperation = AncestorsAndSelf(operation).OfType<IInterpolatedStringOperation>().FirstOrDefault();
src\Analyzers\Core\Analyzers\UseAutoProperty\AbstractUseAutoPropertyAnalyzer.cs (1)
237foreach (var identifierName in codeBlock.DescendantNodesAndSelf().OfType<TIdentifierName>())
src\Analyzers\Core\Analyzers\UseCollectionInitializer\UpdateExpressionState.cs (1)
110foreach (var subExpression in expression.DescendantNodesAndSelf().OfType<TExpressionSyntax>())
src\Analyzers\Core\CodeFixes\AddParameter\AddParameterService.cs (1)
222.OfType<IMethodSymbol>()
src\Analyzers\Core\CodeFixes\DocumentationComments\AbstractAddDocCommentNodesCodeFixProvider.cs (2)
127var nodes = docComment.ChildNodes().OfType<TXmlElementSyntax>() 136.OfType<TXmlElementSyntax>()
src\Analyzers\Core\CodeFixes\RemoveAsyncModifier\AbstractRemoveAsyncModifierCodeFixProvider.cs (1)
192var returns = node.DescendantNodes(n => n == node || !IsAsyncSupportingFunctionSyntax(n)).OfType<TReturnStatementSyntax>();
src\Analyzers\Core\CodeFixes\RemoveUnusedParametersAndValues\AbstractRemoveUnusedValuesCodeFixProvider.cs (1)
633foreach (var localDeclarationStatement in containingMemberDeclaration.DescendantNodes().OfType<TLocalDeclarationStatementSyntax>())
Microsoft.CodeAnalysis.Rebuild.UnitTests (2)
DeterministicKeyBuilderTests.cs (2)
57.OfType<JProperty>() 110.OfType<JProperty>()
Microsoft.CodeAnalysis.Test.Utilities (11)
Assert\AssertEx.cs (2)
148expectedAndActual = GetAssertMessage(expectedEnumerable.OfType<object>(), actualEnumerable.OfType<object>(), comparer: null);
Compilation\ControlFlowGraphVerifier.cs (5)
495foreach (IFlowCaptureReferenceOperation reference in lastOperation.DescendantsAndSelf().OfType<IFlowCaptureReferenceOperation>()) 694foreach (ITranslatedQueryOperation query in operation.DescendantsAndSelf().OfType<ITranslatedQueryOperation>()) 773foreach (IFlowCaptureReferenceOperation reference in operation.DescendantsAndSelf().OfType<IFlowCaptureReferenceOperation>()) 1326foreach (IFlowCaptureReferenceOperation reference in operation.DescendantsAndSelf().OfType<IFlowCaptureReferenceOperation>()) 1334foreach (IFlowCaptureReferenceOperation reference in block.BranchValue.DescendantsAndSelf().OfType<IFlowCaptureReferenceOperation>())
Compilation\IRuntimeEnvironment.cs (1)
185foreach (var reference in compilation.References.OfType<CompilationReference>())
Diagnostics\CommonDiagnosticAnalyzers.cs (3)
1425foreach (var operation in operationBlock.DescendantsAndSelf().OfType<IFieldReferenceOperation>()) 2600var fields = context.Tree.GetRoot().DescendantNodes().OfType<CSharp.Syntax.FieldDeclarationSyntax>(); 2850foreach (var localDecl in root.DescendantNodes().OfType<CSharp.Syntax.LocalDeclarationStatementSyntax>())
Microsoft.CodeAnalysis.UnitTests (7)
CommonSyntaxTests.cs (4)
210var exprB = expr.DescendantNodes().OfType<CSharp.Syntax.IdentifierNameSyntax>().First(n => n.Identifier.ToString() == "b"); 216nodes: trackedExpr.DescendantNodes().OfType<CSharp.Syntax.ExpressionSyntax>(), 231var exprB = expr.DescendantNodes().OfType<CSharp.Syntax.IdentifierNameSyntax>().First(n => n.Identifier.ToString() == "b"); 239nodes: trackedExpr.DescendantNodes().OfType<CSharp.Syntax.ExpressionSyntax>(),
Diagnostics\OperationTests.cs (3)
277var methodBodySyntax = tree.GetCompilationUnitRoot().DescendantNodes().OfType<BaseMethodDeclarationSyntax>().Last(); 310var literal = tree.GetRoot().DescendantNodes().OfType<LiteralExpressionSyntax>().Single(); 323var classDecl = tree.GetRoot().DescendantNodes().OfType<ClassDeclarationSyntax>().Single();
Microsoft.CodeAnalysis.VisualBasic (1)
Declarations\SingleNamespaceDeclaration.vb (1)
55Return SyntaxReference.GetSyntax().AncestorsAndSelf().OfType(Of NamespaceBlockSyntax)().FirstOrDefault()
Microsoft.CodeAnalysis.VisualBasic.Semantic.UnitTests (3)
Compilation\SemanticModelGetDeclaredSymbolAPITests.vb (2)
2854Dim nodes = tree.GetCompilationUnitRoot().DescendantNodes().OfType(Of ModifiedIdentifierSyntax)() 2888Dim nodes = tree.GetCompilationUnitRoot().DescendantNodes().OfType(Of PropertyStatementSyntax)()
FlowAnalysis\IterationJumpYieldStatementTests.vb (1)
1345Dim foreachBlock = tree.GetRoot.DescendantNodes.OfType(Of ForEachBlockSyntax).Single
Microsoft.CodeAnalysis.Workspaces (31)
FindSymbols\Declarations\DeclarationFinder_AllDeclarations.cs (1)
115foreach (var peReference in project.MetadataReferences.OfType<PortableExecutableReference>())
FindSymbols\FindReferences\DependentTypeFinder.cs (1)
328seenPEReferences.AddRange(compilation.References.OfType<PortableExecutableReference>());
FindSymbols\SymbolTree\SymbolTreeInfoCacheService.cs (1)
152foreach (var reference in project.MetadataReferences.OfType<PortableExecutableReference>().Distinct())
Shared\Extensions\INamespaceSymbolExtensions.cs (1)
119var matchingChildren = current.GetMembers(namespaceName).OfType<INamespaceSymbol>();
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\ICompilationExtensions.cs (1)
27foreach (var reference in compilation.References.OfType<CompilationReference>())
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\ISymbolExtensions.cs (4)
722if (!members.OfType<IPropertySymbol>().Any(p => p.Name == WellKnownMemberNames.CurrentPropertyName && p.GetMethod != null)) 728if (!members.OfType<IMethodSymbol>().Any(x => 762if (!members.OfType<IPropertySymbol>().Any(p => p.Name == WellKnownMemberNames.CurrentPropertyName && p.GetMethod != null)) 771if (!members.OfType<IMethodSymbol>().Any(x => x.Name == WellKnownMemberNames.MoveNextAsyncMethodName))
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\ITypeSymbolExtensions.cs (1)
410.OfType<IMethodSymbol>()
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\SyntaxNodeExtensions.cs (1)
328=> node.GetAnnotatedNodesAndTokens(syntaxAnnotation).Select(n => n.AsNode()).OfType<T>();
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\SyntaxTokenExtensions.cs (1)
28? token.Parent.AncestorsAndSelf().OfType<T>()
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\SyntaxFacts\AbstractDocumentationCommentService.cs (1)
66documentationComment.ChildNodes().OfType<TXmlElementSyntax>()
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\AnnotationTable.cs (8)
124=> this.GetAnnotations(node).OfType<TSpecificAnnotation>(); 127=> this.GetAnnotations(token).OfType<TSpecificAnnotation>(); 130=> this.GetAnnotations(trivia).OfType<TSpecificAnnotation>(); 133=> this.GetAnnotations(nodeOrToken).OfType<TSpecificAnnotation>(); 148=> this.GetAnnotations(node).OfType<TSpecificAnnotation>().Any(); 151=> this.GetAnnotations(token).OfType<TSpecificAnnotation>().Any(); 154=> this.GetAnnotations(trivia).OfType<TSpecificAnnotation>().Any(); 157=> this.GetAnnotations(nodeOrToken).OfType<TSpecificAnnotation>().Any();
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\EnumValueUtilities.cs (1)
26.OfType<IComparable>()
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\AbstractCodeGenerationService.cs (1)
376var field = members.OfType<IFieldSymbol>().FirstOrDefault();
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeRefactorings\AbstractRefactoringHelpersService.cs (1)
358var nonHiddenExtractedSelectedNodes = ExtractNodesSimple(selectionNode, syntaxFacts).OfType<TSyntaxNode>().Where(n => !n.OverlapsHiddenPosition(cancellationToken));
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\LanguageServices\AddImports\AbstractAddImportsService.cs (4)
145var externAliases = filteredImports.OfType<TExternSyntax>().ToArray(); 146var usingDirectives = filteredImports.OfType<TUsingOrAliasSyntax>().Where(IsSimpleUsing).ToArray(); 147var staticUsingDirectives = filteredImports.OfType<TUsingOrAliasSyntax>().Where(IsStaticUsing).ToArray(); 148var aliasDirectives = filteredImports.OfType<TUsingOrAliasSyntax>().Where(IsAlias).ToArray();
Workspace\ProjectSystem\ProjectSystemProject.cs (2)
686.OfType<PortableExecutableReference>() 1398foreach (var reference in originalMetadataReferences.OfType<PortableExecutableReference>())
Workspace\ProjectSystem\ProjectSystemProjectFactory.cs (1)
822getReferences: static project => project.MetadataReferences.OfType<PortableExecutableReference>(),
Microsoft.CodeAnalysis.Workspaces.MSBuild.UnitTests (15)
SolutionGeneration.cs (6)
65var projectBuilders = inputs.OfType<ProjectBuilder>(); 117var projectReferences = inputs.OfType<ProjectReferenceBuilder>(); 118var documents = inputs.OfType<DocumentBuilder>().ToList(); 119var projectName = inputs.OfType<ProjectNameBuilder>().FirstOrDefault(); 120var properties = inputs.OfType<PropertyBuilder>().ToList(); 121var sign = inputs.OfType<SignBuilder>();
VisualStudioMSBuildWorkspaceTests.cs (9)
184.OfType<PortableExecutableReference>() 189.OfType<PortableExecutableReference>() 231Assert.True(compilation1.References.OfType<CompilationReference>().Any(c => c.Compilation == compilation2) || 232compilation2.References.OfType<CompilationReference>().Any(c => c.Compilation == compilation1)); 322var pref = c2.References.OfType<PortableExecutableReference>().FirstOrDefault(r => r.Display == "CSharpProject"); 340var decl = root.DescendantNodes().OfType<CS.Syntax.ClassDeclarationSyntax>().First(); 349var pref = c2.References.OfType<PortableExecutableReference>().FirstOrDefault(r => r.Display == "EmittedCSharpProject"); 790var csharpLib = refs.OfType<PortableExecutableReference>().FirstOrDefault(r => r.FilePath.Contains("Microsoft.CSharp")); 3222Assert.Single(compilation.References.OfType<CompilationReference>());
Microsoft.CodeAnalysis.Workspaces.UnitTests (38)
CodeCleanup\CodeCleanupTests.cs (3)
302var accessor = root.DescendantNodes().OfType<VisualBasic.Syntax.AccessorBlockSyntax>().Last(); 309var newAccessor = newRoot.DescendantNodes().OfType<VisualBasic.Syntax.AccessorBlockSyntax>().Last(); 312accessor = root.DescendantNodes().OfType<VisualBasic.Syntax.AccessorBlockSyntax>().Last();
CommandLineProject\CommandLineProjectTests.cs (2)
180Assert.Single(info.MetadataReferences.OfType<PortableExecutableReference>(), r => r.FilePath == pathToAssembly); 192Assert.Single(info.MetadataReferences.OfType<PortableExecutableReference>(), r => r.FilePath == pathToAssembly);
FindReferencesTests.cs (4)
183SyntaxNode declareMethod = tree.GetRoot().DescendantNodes().OfType<Microsoft.CodeAnalysis.VisualBasic.Syntax.DeclareStatementSyntax>().FirstOrDefault(); 184SyntaxNode normalMethod = tree.GetRoot().DescendantNodes().OfType<Microsoft.CodeAnalysis.VisualBasic.Syntax.MethodStatementSyntax>().ToList()[1]; 222var propertyStatement = tree.GetRoot().DescendantNodes().OfType<Microsoft.CodeAnalysis.VisualBasic.Syntax.PropertyStatementSyntax>().FirstOrDefault(); 286var methodlist = tree.GetRoot().DescendantNodes().OfType<Microsoft.CodeAnalysis.CSharp.Syntax.MethodDeclarationSyntax>().ToList();
SolutionTests\SolutionTests.cs (2)
3235var classNode = syntaxRoot.DescendantNodes().OfType<CS.Syntax.ClassDeclarationSyntax>().Single(); 3240var classNode = syntaxRoot.DescendantNodes().OfType<VB.Syntax.ClassStatementSyntax>().Single();
SymbolKeyTests.cs (24)
359TestRoundTrip(GetDeclaredSymbols(compilation).OfType<IFieldSymbol>().Select(fs => fs.Type), compilation); 377TestRoundTrip(GetDeclaredSymbols(compilation).OfType<IFieldSymbol>().Select(fs => fs.Type), compilation, s => s.ToDisplayString()); 398TestRoundTrip(GetDeclaredSymbols(compilation).OfType<IMethodSymbol>().SelectMany(ms => ms.Parameters), compilation); 542var symbols = GetDeclaredSymbols(compilation).OfType<IMethodSymbol>().SelectMany(ms => GetInteriorSymbols(ms, compilation).OfType<ILocalSymbol>()).ToList(); 564var symbols = GetDeclaredSymbols(compilation).OfType<IMethodSymbol>().SelectMany(ms => GetInteriorSymbols(ms, compilation).OfType<ILabelSymbol>()).ToList(); 591var symbols = GetDeclaredSymbols(compilation).OfType<IMethodSymbol>().SelectMany(ms => GetInteriorSymbols(ms, compilation).OfType<IRangeVariableSymbol>()).ToList(); 620var symbols = tree.GetRoot().DescendantNodes().OfType<CSharp.Syntax.InvocationExpressionSyntax>().Select(s => model.GetSymbolInfo(s).Symbol).ToList(); 656var symbols = tree.GetRoot().DescendantNodes().OfType<CSharp.Syntax.InvocationExpressionSyntax>().Select(s => model.GetSymbolInfo(s).GetAnySymbol()).ToList(); 679var symbols = tree.GetRoot().DescendantNodes().OfType<CSharp.Syntax.UsingDirectiveSyntax>().Select(s => model.GetDeclaredSymbol(s)).ToList(); 685var refSymbols = GetDeclaredSymbols(compilation).OfType<IFieldSymbol>().Select(f => f.Type).ToList(); 704var symbols = GetDeclaredSymbols(compilation).OfType<IFieldSymbol>().Select(f => f.Type).ToList(); 722var method = GetDeclaredSymbols(compilation).OfType<IMethodSymbol>().First(); 740var type = GetDeclaredSymbols(compilation).OfType<INamedTypeSymbol>().First(); 760var outer = GetDeclaredSymbols(compilation).OfType<INamedTypeSymbol>().First(s => s.Name == "A"); 783var a = GetDeclaredSymbols(compilation).OfType<INamedTypeSymbol>().Single(s => s.Name == "A"); 826var typeParameter = GetDeclaredSymbols(compilation).OfType<INamedTypeSymbol>().Where(n => !n.IsImplicitlyDeclared).Single().TypeParameters.Single(); 839var typeParameter = GetDeclaredSymbols(compilation).OfType<INamedTypeSymbol>() 955var methods = GetDeclaredSymbols(compilation1).OfType<IMethodSymbol>(); 1257var fields = GetDeclaredSymbols(comp).OfType<IFieldSymbol>().Select(f => f.Type); 1275var node = root.DescendantNodes().OfType<CSharp.Syntax.GenericNameSyntax>().Single(); 1403var methods = GetDeclaredSymbols(compilation).OfType<IMethodSymbol>();
SyntaxNodeTests.cs (3)
32var node = root.DescendantNodes().OfType<VariableDeclaratorSyntax>().Single(); 95var classDecl = root.DescendantNodes().OfType<ClassDeclarationSyntax>().First(); 96var methodDecl = classDecl.DescendantNodes().OfType<MethodDeclarationSyntax>().First();
Microsoft.DotNet.Arcade.Sdk (1)
src\SaveItems.cs (1)
39metadataPairs = metadata.Keys.OfType<string>().Select(key => new KeyValuePair<string, string>(key, metadata[key] as string));
Microsoft.DotNet.AsmDiff (5)
AssemblySet.cs (4)
56var queue = new Queue<IAssemblyReference>(metadataHost.LoadedUnits.OfType<IAssemblyReference>()); 135var newAssemblies = assemblyPaths.Select(p => newAssemblySet.Host.LoadUnitFrom(p)).OfType<IAssembly>(); 144: Host.LoadedUnits.OfType<IAssembly>(); 181var loadedAssemblies = host.LoadedUnits.OfType<IAssembly>()
DiffCSharpWriter.cs (1)
290style = _syntaxWriter.StartStyle(SyntaxStyle.NotCompatible, element.Differences.OfType<IncompatibleDifference>());
Microsoft.DotNet.GenFacades (2)
TypeParser.cs (2)
59var allPublicTypes = root.DescendantNodes().OfType<BaseTypeDeclarationSyntax>() 73var allPublicTypes = root.DescendantNodes().OfType<DelegateDeclarationSyntax>()
Microsoft.DotNet.SignCheckLibrary (3)
Verification\VsixVerifier.cs (1)
54XmlNode encodedTimeNode = element.SelectNodes("//ds:TimeStamp/ds:EncodedTime", namespaceManager).OfType<XmlNode>().FirstOrDefault();
Verification\XmlVerifier.cs (2)
58if (signedXml.Signature.KeyInfo.OfType<KeyInfoX509Data>().Count() == 0) 63ArrayList certificates = signedXml.Signature.KeyInfo.OfType<KeyInfoX509Data>().First().Certificates;
Microsoft.DotNet.SourceBuild.Tasks (1)
src\UsageReport\WriteUsageReports.cs (1)
254x.Nodes().OfType<XText>().First().Value))
Microsoft.DotNet.SwaggerGenerator.CodeGenerator (1)
Modeler\ServiceClientModelFactory.cs (1)
274IList<string> enumeration = schema.Enum.OfType<OpenApiString>().Select(s => s.Value).ToList();
Microsoft.DotNet.VersionTools (12)
Dependencies\BuildManifest\OrchestratedBuildIdentityMatch.cs (1)
18.OfType<OrchestratedBuildDependencyInfo>()
Dependencies\BuildOutput\FilePackageUpdater.cs (1)
17foreach (BuildDependencyInfo info in dependencyInfos.OfType<BuildDependencyInfo>())
Dependencies\BuildOutput\FileRegexPackageUpdater.cs (1)
19.OfType<BuildDependencyInfo>()
Dependencies\BuildOutput\FileRegexReleaseUpdater.cs (1)
19.OfType<BuildDependencyInfo>()
Dependencies\BuildOutput\OrchestratedBuild\FileOrchestratedBuildCustomUpdater.cs (1)
20.OfType<OrchestratedBuildDependencyInfo>()
Dependencies\BuildOutput\OrchestratedBuild\FileRegexOrchestratedBuildCustomUpdater.cs (1)
23.OfType<OrchestratedBuildDependencyInfo>()
Dependencies\BuildOutput\ProjectJsonUpdater.cs (2)
28.OfType<BuildDependencyInfo>() 151.OfType<JProperty>()
Dependencies\BuildOutput\ToolVersionsUpdater.cs (1)
20.OfType<BuildDependencyInfo>()
Dependencies\Submodule\IndicatorPackageSubmoduleUpdater.cs (1)
46foreach (var info in dependencyInfos.OfType<BuildDependencyInfo>())
Dependencies\Submodule\LatestCommitSubmoduleUpdater.cs (2)
46.OfType<SubmoduleDependencyInfo>() 53int allSubmoduleInfoCount = dependencyInfos.OfType<SubmoduleDependencyInfo>().Count();
Microsoft.DotNet.XliffTasks (1)
Model\XamlRuleDocument.cs (1)
196foreach (XComment comment in element.Nodes().OfType<XComment>())
Microsoft.DotNet.XUnitExtensions (1)
XunitParallelTheoryTestCaseRunner.cs (1)
90_toDispose.AddRange(dataRow.OfType<IDisposable>());
Microsoft.Extensions.AI (6)
ChatCompletion\FunctionInvokingChatClient.cs (3)
234FunctionCallContent[] functionCallContents = response.Message.Contents.OfType<FunctionCallContent>().ToArray(); 330functionCallContents.AddRange(update.Contents.OfType<FunctionCallContent>()); 530AIFunction? function = options.Tools!.OfType<AIFunction>().FirstOrDefault(t => t.Metadata.Name == functionCallContent.Name);
ChatCompletion\OpenTelemetryChatClient.cs (3)
450foreach (FunctionResultContent frc in message.Contents.OfType<FunctionResultContent>()) 511var toolCalls = message.Contents.OfType<FunctionCallContent>().Select(fc => new ToolCall 534string content = string.Concat(message.Contents.OfType<TextContent>());
Microsoft.Extensions.AI.Abstractions.Tests (1)
ChatCompletion\StreamingChatCompletionUpdateExtensionsTests.cs (1)
184TextContent[] contents = message.Contents.OfType<TextContent>().ToArray();
Microsoft.Extensions.AI.Integration.Tests (2)
ChatClientIntegrationTests.cs (1)
131UsageContent usage = chunks.SelectMany(c => c.Contents).OfType<UsageContent>().Single();
PromptBasedFunctionCallingChatClient.cs (1)
161var toolDescriptorsJson = JsonSerializer.Serialize(tools.OfType<AIFunction>().Select(ToToolDescriptor), _jsonOptions);
Microsoft.Extensions.AI.Ollama (1)
OllamaChatClient.cs (1)
286Tools = options?.Tools is { Count: > 0 } tools ? tools.OfType<AIFunction>().Select(ToOllamaTool) : null,
Microsoft.Extensions.AI.OpenAI.Tests (2)
OpenAIChatClientTests.cs (2)
280UsageContent usage = updates.SelectMany(u => u.Contents).OfType<UsageContent>().Single(); 875UsageContent usage = updates.SelectMany(u => u.Contents).OfType<UsageContent>().Single();
Microsoft.Extensions.Diagnostics.HealthChecks.Tests (1)
HealthCheckPublisherHostedServiceTest.cs (1)
785return services.GetServices<IHostedService>().OfType<HealthCheckPublisherHostedService>().Single();
Microsoft.Extensions.Http.Resilience.Tests (2)
Hedging\HedgingTests.cs (2)
226RequestContexts.Distinct().OfType<ResilienceContext>().Should().HaveCount(3); 252RequestContexts.Distinct().OfType<ResilienceContext>().Should().HaveCount(3);
Microsoft.Gen.ContextualOptions (1)
ContextualOptionsGenerator.cs (1)
37var typeDeclarations = nodes.OfType<TypeDeclarationSyntax>()
Microsoft.Gen.ContextualOptions.Unit.Tests (9)
EmitterTests.cs (9)
29.OfType<TypeDeclarationSyntax>() 38syntaxTree.GetRoot().DescendantNodes().OfType<StructDeclarationSyntax>().Single().Members.Single().Modifiers, 48.OfType<TypeDeclarationSyntax>() 52.OfType<TypeDeclarationSyntax>()) 64.OfType<MethodDeclarationSyntax>() 80.OfType<TypeDeclarationSyntax>() 93.OfType<MethodDeclarationSyntax>() 108.OfType<TypeDeclarationSyntax>() 121.OfType<NamespaceDeclarationSyntax>()
Microsoft.Gen.Metrics (1)
MetricsGenerator.cs (1)
35var metricClasses = p.GetMetricClasses(nodes.OfType<TypeDeclarationSyntax>());
Microsoft.Interop.ComInterfaceGenerator (2)
ComInterfaceGenerator.cs (2)
496.OfType<GeneratedStubCodeContext>() 510.OfType<GeneratedStubCodeContext>()
Microsoft.Interop.SourceGeneration (1)
Marshalling\AttributedMarshallingModelGeneratorResolver.cs (1)
414originalTypeSyntax.DescendantNodesAndSelf().OfType<TypeSyntax>().Where(t => t.IsEquivalentTo(marshalInfo.PlaceholderTypeParameter.Syntax)),
Microsoft.Maui (2)
LifecycleEvents\LifecycleEventService.cs (1)
35 return delegates.OfType<TDelegate>();
VisualDiagnostics\VisualDiagnosticsOverlay.cs (1)
198 .OfType<IScrollView>()
Microsoft.Maui.Controls (8)
Compatibility\Handlers\NavigationPage\iOS\NavigationRenderer.cs (1)
402 var flyoutDetail = parentPages.OfType<FlyoutPage>().FirstOrDefault();
GestureElement.cs (3)
23 foreach (IElementDefinition item in args.NewItems.OfType<IElementDefinition>()) 32 foreach (IElementDefinition item in args.OldItems.OfType<IElementDefinition>()) 49 foreach (IElementDefinition item in _gestureRecognizers.OfType<IElementDefinition>())
Menu\MenuItemTracker.cs (1)
271 page.Descendants().OfType<Page>().ForEach(UnregisterChildPage);
NavigationPage\NavigationPage.Legacy.cs (1)
176 PoppedToRoot?.Invoke(this, new PoppedToRootEventArgs(RootPage, childrenToRemove.OfType<Page>().ToList()));
Shell\BaseShellItem.cs (2)
329 flyoutItemCell.Children.OfType<Label>().First() 331 flyoutItemCell.Children.OfType<Image>().First()
Microsoft.Maui.Controls.BindingSourceGen (1)
BindingCodeWriter.cs (1)
135 .OfType<InaccessibleMemberAccess>();
Microsoft.Maui.Controls.Build.Tasks (2)
DebugXamlCTask.cs (1)
44 foreach (var resource in module.Resources.OfType<EmbeddedResource>())
XamlCTask.cs (1)
234 foreach (var resource in module.Resources.OfType<EmbeddedResource>())
Microsoft.Maui.Controls.Compatibility (4)
Tizen\Renderers\ViewRenderer.cs (4)
74 GestureDetector.AddGestures(e.NewItems.OfType<IGestureRecognizer>()); 78 GestureDetector.RemoveGestures(e.OldItems.OfType<IGestureRecognizer>()); 79 GestureDetector.AddGestures(e.NewItems.OfType<IGestureRecognizer>()); 83 GestureDetector.RemoveGestures(e.OldItems.OfType<IGestureRecognizer>());
Microsoft.ML.AutoML (5)
API\BinaryClassificationExperiment.cs (1)
50Trainers = Enum.GetValues(typeof(BinaryClassificationTrainer)).OfType<BinaryClassificationTrainer>().ToList();
API\MulticlassClassificationExperiment.cs (1)
45Trainers = Enum.GetValues(typeof(MulticlassClassificationTrainer)).OfType<MulticlassClassificationTrainer>().ToList();
API\RankingExperiment.cs (1)
44Trainers = Enum.GetValues(typeof(RankingTrainer)).OfType<RankingTrainer>().ToList();
API\RecommendationExperiment.cs (1)
35Trainers = Enum.GetValues(typeof(RecommendationTrainer)).OfType<RecommendationTrainer>().ToList();
API\RegressionExperiment.cs (1)
45Trainers = Enum.GetValues(typeof(RegressionTrainer)).OfType<RegressionTrainer>().ToList();
Microsoft.TestUtilities (2)
XUnit\TestMethodExtensions.cs (2)
22.OfType<ReflectionAttributeInfo>() 25foreach (ITestCondition condition in conditionAttributes.OfType<ITestCondition>())
Microsoft.VisualStudio.LanguageServices (15)
ChangeSignature\ChangeSignatureDialogViewModel.cs (2)
481!_parametersWithoutDefaultValues.OfType<ExistingParameterViewModel>().Select(p => p.ParameterSymbol).SequenceEqual(_originalParameterConfiguration.ParametersWithoutDefaultValues.Cast<ExistingParameter>().Select(p => p.Symbol)) || 482!_parametersWithDefaultValues.OfType<ExistingParameterViewModel>().Select(p => p.ParameterSymbol).SequenceEqual(_originalParameterConfiguration.RemainingEditableParameters.Cast<ExistingParameter>().Select(p => p.Symbol));
PickMembers\PickMembersDialog.xaml.cs (1)
141var selectedItems = Members.SelectedItems.OfType<MemberSymbolViewModel>().ToArray();
Preview\TopLevelChange.cs (4)
51var firstChild = Children.Changes.OfType<FileChange>().First(); 57var firstChild = Children.Changes.OfType<FileChange>().First(); 63var solution = ApplyFileChanges(_newSolution, Children.Changes.OfType<FileChange>(), applyingChanges); 66solution = ApplyReferenceChanges(solution, Children.Changes.OfType<ReferenceChange>());
ProjectSystem\Extensions\ProjectItemsExtensions.cs (1)
17=> items.OfType<ProjectItem>().FirstOrDefault(p => comparer.Compare(p.Name, itemName) == 0);
ProjectSystem\VisualStudioProjectManagementService.cs (1)
74projectItems.OfType<ProjectItem>().Where(n => n.IsFolder()).Do(n => projectItemsStack.Push(Tuple.Create(n, "\\")));
ProjectSystem\VisualStudioWorkspaceImpl.AddMetadataReferenceUndoUnit.cs (1)
35var reference = fromProject.MetadataReferences.OfType<PortableExecutableReference>()
ProjectSystem\VisualStudioWorkspaceImpl.cs (1)
839var items = projectItems.OfType<ProjectItem>();
ProjectSystem\VisualStudioWorkspaceImpl.RemoveMetadataReferenceUndoUnit.cs (1)
34var reference = fromProject.MetadataReferences.OfType<PortableExecutableReference>()
Utilities\AutomationDelegatingListView.cs (3)
89checkBoxItem = this.GetChildren()?.OfType<CheckBoxAutomationPeer>().SingleOrDefault(); 98radioButtonItem = this.GetChildren()?.OfType<RadioButtonAutomationPeer>().SingleOrDefault(); 107textBlockItem = this.GetChildren()?.OfType<TextBlockAutomationPeer>().FirstOrDefault();
Microsoft.VisualStudio.LanguageServices.CSharp (1)
Snippets\CSharpSnippetExpansionLanguageHelper.cs (1)
129var candidateUsing = SyntaxFactory.ParseCompilationUnit("using " + namespaceToImport + ";").DescendantNodes().OfType<UsingDirectiveSyntax>().FirstOrDefault();
Microsoft.VisualStudio.LanguageServices.CSharp.UnitTests (1)
CodeModel\FileCodeClassTests.cs (1)
308var l = from p in testObject.Members.OfType<CodeProperty>() where vsCMAccess.vsCMAccessPublic == p.Access && p.Getter != null && !p.Getter.IsShared && vsCMAccess.vsCMAccessPublic == p.Getter.Access select p;
Mvc.Api.Analyzers.Test (3)
ActualApiResponseMetadataFactoryTest.cs (3)
78var returnStatement = methodSyntax.DescendantNodes().OfType<ReturnStatementSyntax>().First(); 395var returnStatement = methodSyntax.DescendantNodes().OfType<ReturnStatementSyntax>().First(); 414var returnStatement = methodSyntax.DescendantNodes().OfType<ReturnStatementSyntax>().First();
Mvc.RoutingWebSite (1)
StartupForRouteGroupsWithMetadata.cs (1)
22var old = builder.PartManager.FeatureProviders.OfType<IApplicationFeatureProvider<ControllerFeature>>().FirstOrDefault();
PresentationBuildTasks (1)
src\Microsoft.DotNet.Wpf\src\PresentationFramework\System\Windows\Markup\XmlnsCache.cs (1)
91foreach(string assemblyName in _assemblyPathTable.Keys.OfType<string>().OrderBy(s => s, StringComparer.Ordinal))
Roslyn.VisualStudio.DiagnosticsWindow (4)
OptionPages\InternalOptionsControl.cs (4)
46foreach (var item in optionsPanel.Children.OfType<CheckBox>()) 68clearButton.Click += (o, a) => optionsPanel.Children.OfType<CheckBox>().Do(c => c.Visibility = Visibility.Visible); 83checkAllButton.Click += (o, a) => optionsPanel.Children.OfType<CheckBox>().Where(c => c.Visibility == Visibility.Visible).Do(c => c.IsChecked = true); 86uncheckAllButton.Click += (o, a) => optionsPanel.Children.OfType<CheckBox>().Where(c => c.Visibility == Visibility.Visible).Do(c => c.IsChecked = false);
RoutingSandbox (1)
UseEndpointRoutingStartup.cs (1)
39foreach (var endpoint in dataSource.Endpoints.OfType<RouteEndpoint>().OrderBy(e => e.RoutePattern.RawText, StringComparer.OrdinalIgnoreCase))
RoutingWebSite (1)
UseEndpointRoutingStartup.cs (1)
45foreach (var endpoint in dataSource.Endpoints.OfType<RouteEndpoint>().OrderBy(e => e.RoutePattern.RawText, StringComparer.OrdinalIgnoreCase))
Stress.AppHost (1)
TestResource.cs (1)
55foreach (var resource in appModel.Resources.OfType<TestResource>())
System.Collections.Immutable (1)
System\Collections\Immutable\ImmutableArray_1.cs (1)
875return self.array.OfType<TResult>();
System.ComponentModel.Annotations (3)
System\ComponentModel\DataAnnotations\AssociatedMetadataTypeTypeDescriptor.cs (1)
87Attribute[] newAttributes = TypeDescriptor.GetAttributes(AssociatedMetadataType).OfType<Attribute>().ToArray();
System\ComponentModel\DataAnnotations\ValidationAttributeStore.cs (2)
152ValidationAttributes = attributes.OfType<ValidationAttribute>(); 153DisplayAttribute = attributes.OfType<DisplayAttribute>().SingleOrDefault();
System.ComponentModel.Composition (3)
System\ComponentModel\Composition\ReflectionModel\ReflectionComposablePart.cs (1)
315ReflectionParameterImportDefinition[] parameterImports = ImportDefinitions.OfType<ReflectionParameterImportDefinition>().ToArray();
System\ComponentModel\Composition\ReflectionModel\ReflectionModelServices.cs (2)
361.OfType<ReflectionParameterImportDefinition>() 363.OfType<ConstructorInfo>()
System.Composition.TypedParts (5)
System\Composition\Convention\AttributedModelProviderExtensions.cs (5)
16return convention.GetCustomAttributes(reflectedType, member).OfType<TAttribute>().SingleOrDefault(); 26return convention.GetCustomAttributes(reflectedType, member).OfType<TAttribute>().ToArray(); 31return convention.GetCustomAttributes(reflectedType, parameter).OfType<TAttribute>().SingleOrDefault(); 36return convention.GetCustomAttributes(reflectedType, parameter).OfType<Attribute>().ToArray(); 41return convention.GetCustomAttributes(reflectedType, parameter).OfType<TAttribute>().ToArray();
System.Private.Windows.Core.TestUtilities (1)
NoAssertContext.cs (1)
50if (Trace.Listeners.OfType<ThrowingTraceListener>().FirstOrDefault() is { } throwingTraceListener)
System.Security.Cryptography.Pkcs (1)
System\Security\Cryptography\Pkcs\SignedCms.cs (1)
571var certs = new HashSet<X509Certificate2>(Certificates.OfType<X509Certificate2>());
System.Text.RegularExpressions.Generator (3)
UpgradeToGeneratedRegexCodeFixer.cs (3)
102SyntaxNode? typeDeclarationOrCompilationUnit = nodeToFix.Ancestors().OfType<TypeDeclarationSyntax>().FirstOrDefault(); 127nodeToFix.Ancestors().OfType<TypeDeclarationSyntax>(), 148nodeToFix.Ancestors().OfType<TypeDeclarationSyntax>().FirstOrDefault() :
System.Windows.Forms.Analyzers.CodeFixes.CSharp (4)
System\Windows\Forms\CSharp\CodeFixes\AddDesignerSerializationVisibility\AddDesignerSerializationVisibilityCodeFixProvider.cs (4)
45.OfType<PropertyDeclarationSyntax>() 102.OfType<UsingDirectiveSyntax>() 111.OfType<UsingDirectiveSyntax>() 117.OfType<CompilationUnitSyntax>()
System.Windows.Forms.Design (5)
System\ComponentModel\Design\ComponentDesigner.cs (3)
200foreach (IComponent comp in comps.OfType<IComponent>()) 269foreach (IComponent comp in components.OfType<IComponent>()) 319foreach (string compatibleMethod in methods.OfType<string>())
System\Drawing\Design\ToolboxItem.cs (1)
786return col?.OfType<ToolboxItemFilterAttribute>().ToArray() ?? [];
System\Windows\Forms\Design\FlowLayoutPanelDesigner .cs (1)
760_dragControls = data.GetSortedDragControls(out int primaryIndex).OfType<Control>().ToList();
System.Windows.Forms.Design.Tests (8)
System\ComponentModel\Design\ByteViewerTests.cs (4)
803TextBox textBox = control.Controls.OfType<TextBox>().Single(); 804ScrollBar scrollBar = control.Controls.OfType<ScrollBar>().Single(); 833TextBox textBox = control.Controls.OfType<TextBox>().Single(); 834ScrollBar scrollBar = control.Controls.OfType<ScrollBar>().Single();
System\Windows\Forms\Design\BaseContextMenuStripTests.cs (1)
30foreach (var item in contextMenuStrip.Items.OfType<ToolStripMenuItem>())
System\Windows\Forms\Design\ToolStripActionListTests.cs (2)
167List<DesignerActionMethodItem> methodItems = itemList.OfType<DesignerActionMethodItem>().ToList(); 168List<DesignerActionPropertyItem> propertyItems = itemList.OfType<DesignerActionPropertyItem>().ToList();
System\Windows\Forms\Design\ToolStripContainerDesignerTests.cs (1)
52var toolStripContainerActionList = _designer.ActionLists.OfType<ToolStripContainerActionList>().Single();
System.Windows.Forms.Tests (11)
System\Windows\Forms\PowerStatusTests.cs (1)
33.OfType<BatteryChargeStatus>()
System\Windows\Forms\PropertyGridTests.cs (10)
291Assert.Equal(expected, control.Controls.OfType<ToolStrip>().Single().BackColor); 297Assert.Equal(expected, control.Controls.OfType<ToolStrip>().Single().BackColor); 322Assert.Equal(expected, control.Controls.OfType<ToolStrip>().Single().BackColor); 331Assert.Equal(expected, control.Controls.OfType<ToolStrip>().Single().BackColor); 3100Assert.Equal(visible && value, control.Controls.OfType<ToolStrip>().Single().Visible); 3108Assert.Equal(visible && value, control.Controls.OfType<ToolStrip>().Single().Visible); 3116Assert.Equal(visible && !value, control.Controls.OfType<ToolStrip>().Single().Visible); 3146Assert.Equal(visible && value, control.Controls.OfType<ToolStrip>().Single().Visible); 3157Assert.Equal(visible && value, control.Controls.OfType<ToolStrip>().Single().Visible); 3168Assert.Equal(visible && !value, control.Controls.OfType<ToolStrip>().Single().Visible);
Templates.Blazor.Tests (7)
src\Shared\CertificateGeneration\CertificateManager.cs (6)
71foreach (var extension in certificate.Extensions.OfType<X509Extension>()) 147certificate.Extensions.OfType<X509Extension>() 152var byteArray = c.Extensions.OfType<X509Extension>() 178certificates.AddRange(store.Certificates.OfType<X509Certificate2>()); 838.OfType<X509Certificate2>() 889foreach (var candidate in certificatesWithSubjectName.OfType<X509Certificate2>())
src\Shared\CertificateGeneration\MacOSCertificateManager.cs (1)
299var hashes = matches.OfType<Match>().Select(m => m.Groups[1].Value).ToList();
Templates.Blazor.WebAssembly.Auth.Tests (7)
src\Shared\CertificateGeneration\CertificateManager.cs (6)
71foreach (var extension in certificate.Extensions.OfType<X509Extension>()) 147certificate.Extensions.OfType<X509Extension>() 152var byteArray = c.Extensions.OfType<X509Extension>() 178certificates.AddRange(store.Certificates.OfType<X509Certificate2>()); 838.OfType<X509Certificate2>() 889foreach (var candidate in certificatesWithSubjectName.OfType<X509Certificate2>())
src\Shared\CertificateGeneration\MacOSCertificateManager.cs (1)
299var hashes = matches.OfType<Match>().Select(m => m.Groups[1].Value).ToList();
Templates.Blazor.WebAssembly.Tests (7)
src\Shared\CertificateGeneration\CertificateManager.cs (6)
71foreach (var extension in certificate.Extensions.OfType<X509Extension>()) 147certificate.Extensions.OfType<X509Extension>() 152var byteArray = c.Extensions.OfType<X509Extension>() 178certificates.AddRange(store.Certificates.OfType<X509Certificate2>()); 838.OfType<X509Certificate2>() 889foreach (var candidate in certificatesWithSubjectName.OfType<X509Certificate2>())
src\Shared\CertificateGeneration\MacOSCertificateManager.cs (1)
299var hashes = matches.OfType<Match>().Select(m => m.Groups[1].Value).ToList();
Templates.Mvc.Tests (7)
src\Shared\CertificateGeneration\CertificateManager.cs (6)
71foreach (var extension in certificate.Extensions.OfType<X509Extension>()) 147certificate.Extensions.OfType<X509Extension>() 152var byteArray = c.Extensions.OfType<X509Extension>() 178certificates.AddRange(store.Certificates.OfType<X509Certificate2>()); 838.OfType<X509Certificate2>() 889foreach (var candidate in certificatesWithSubjectName.OfType<X509Certificate2>())
src\Shared\CertificateGeneration\MacOSCertificateManager.cs (1)
299var hashes = matches.OfType<Match>().Select(m => m.Groups[1].Value).ToList();
Templates.Tests (7)
src\Shared\CertificateGeneration\CertificateManager.cs (6)
71foreach (var extension in certificate.Extensions.OfType<X509Extension>()) 147certificate.Extensions.OfType<X509Extension>() 152var byteArray = c.Extensions.OfType<X509Extension>() 178certificates.AddRange(store.Certificates.OfType<X509Certificate2>()); 838.OfType<X509Certificate2>() 889foreach (var candidate in certificatesWithSubjectName.OfType<X509Certificate2>())
src\Shared\CertificateGeneration\MacOSCertificateManager.cs (1)
299var hashes = matches.OfType<Match>().Select(m => m.Groups[1].Value).ToList();
TestProject.AppHost (2)
TestProgram.cs (2)
147foreach (var project in appModel.Resources.OfType<ProjectResource>()) 155foreach (var endpoint in project.Annotations.OfType<EndpointAnnotation>())
XmlFormattersWebSite (2)
Controllers\XmlDataContractApiController.cs (1)
27var xmlFormatter = mvcOptions.Value.OutputFormatters.OfType<XmlDataContractSerializerOutputFormatter>().First();
Controllers\XmlSerializedApiController.cs (1)
27var xmlFormatter = mvcOptions.Value.OutputFormatters.OfType<XmlSerializerOutputFormatter>().First();
Xunit.NetCore.Extensions (3)
AssemblyFixtureSupport\XunitTestAssemblyRunnerWithAssemblyFixture.cs (1)
55foreach (var disposable in assemblyFixtureMappings.Values.OfType<IDisposable>())
AssemblyFixtureSupport\XunitTestClassRunnerWithAssemblyFixture.cs (1)
47foreach (var disposable in assemblyFixtureMappings.Values.OfType<IDisposable>())
AssemblyFixtureSupport\XunitTestMethodRunnerWithAssemblyFixture.cs (1)
52foreach (var disposable in assemblyFixtureMappings.Values.OfType<IDisposable>())