13717 references to Func
Analyzer.Utilities.UnitTests (2)
AnalyzerRunner (3)
aspire (21)
Backchannel\ExtensionBackchannel.cs (4)
34Task<T> PromptForSelectionAsync<T>(string promptText, IEnumerable<T> choices, Func<T, string> choiceFormatter, CancellationToken cancellationToken) where T : notnull;
36Task<string> PromptForStringAsync(string promptText, string? defaultValue, Func<string, ValidationResult>? validator, bool required, CancellationToken cancellationToken);
408public async Task<T> PromptForSelectionAsync<T>(string promptText, IEnumerable<T> choices, Func<T, string> choiceFormatter,
462public async Task<string> PromptForStringAsync(string promptText, string? defaultValue, Func<string, ValidationResult>? validator, bool required, CancellationToken cancellationToken)
Interaction\ConsoleInteractionService.cs (2)
59public async Task<string> PromptForStringAsync(string promptText, string? defaultValue = null, Func<string, ValidationResult>? validator = null, bool isSecret = false, bool required = false, CancellationToken cancellationToken = default)
83public async Task<T> PromptForSelectionAsync<T>(string promptText, IEnumerable<T> choices, Func<T, string> choiceFormatter, CancellationToken cancellationToken = default) where T : notnull
Interaction\ExtensionInteractionService.cs (2)
85public async Task<string> PromptForStringAsync(string promptText, string? defaultValue = null, Func<string, ValidationResult>? validator = null, bool isSecret = false, bool required = false, CancellationToken cancellationToken = default)
140public async Task<T> PromptForSelectionAsync<T>(string promptText, IEnumerable<T> choices, Func<T, string> choiceFormatter,
Interaction\IInteractionService.cs (2)
13Task<string> PromptForStringAsync(string promptText, string? defaultValue = null, Func<string, ValidationResult>? validator = null, bool isSecret = false, bool required = false, CancellationToken cancellationToken = default);
15Task<T> PromptForSelectionAsync<T>(string promptText, IEnumerable<T> choices, Func<T, string> choiceFormatter, CancellationToken cancellationToken = default) where T : notnull;
NuGet\NuGetPackageCache.cs (3)
20Task<IEnumerable<NuGetPackage>> GetPackagesAsync(DirectoryInfo workingDirectory, string packageId, Func<string, bool>? filter, bool prerelease, FileInfo? nugetConfigFile, bool useCache, CancellationToken cancellationToken);
77public async Task<IEnumerable<NuGetPackage>> GetPackagesAsync(DirectoryInfo workingDirectory, string query, Func<string, bool>? filter, bool prerelease, FileInfo? nugetConfigFile, bool useCache, CancellationToken cancellationToken)
127var effectiveFilter = (NuGetPackage p) =>
Aspire.Azure.Messaging.EventHubs.Tests (2)
Aspire.Azure.Security.KeyVault.Tests (2)
Aspire.Cli.Tests (77)
Commands\AddCommandTests.cs (2)
544public Func<IEnumerable<(string FriendlyName, NuGetPackage Package, PackageChannel Channel)>, (string FriendlyName, NuGetPackage Package, PackageChannel Channel)>? PromptForIntegrationCallback { get; set; }
545public Func<IEnumerable<(string FriendlyName, NuGetPackage Package, PackageChannel Channel)>, (string FriendlyName, NuGetPackage Package, PackageChannel Channel)>? PromptForIntegrationVersionCallback { get; set; }
Commands\NewCommandTests.cs (6)
584public Func<IEnumerable<(NuGetPackage Package, PackageChannel Channel)>, (NuGetPackage Package, PackageChannel Channel)>? PromptForTemplatesVersionCallback { get; set; }
585public Func<ITemplate[], ITemplate>? PromptForTemplateCallback { get; set; }
586public Func<string, string>? PromptForProjectNameCallback { get; set; }
587public Func<string, string>? PromptForOutputPathCallback { get; set; }
638public Task<string> PromptForStringAsync(string promptText, string? defaultValue = null, Func<string, ValidationResult>? validator = null, bool isSecret = false, bool required = false, CancellationToken cancellationToken = default)
643public Task<T> PromptForSelectionAsync<T>(string promptText, IEnumerable<T> choices, Func<T, string> choiceFormatter, CancellationToken cancellationToken = default) where T : notnull
Commands\PublishCommandPromptingIntegrationTests.cs (3)
779public Task<string> PromptForStringAsync(string promptText, string? defaultValue = null, Func<string, ValidationResult>? validator = null, bool isSecret = false, bool required = false, CancellationToken cancellationToken = default)
796public Task<T> PromptForSelectionAsync<T>(string promptText, IEnumerable<T> choices, Func<T, string> choiceFormatter, CancellationToken cancellationToken = default) where T : notnull
874internal sealed record SelectionPromptCall<T>(string PromptText, IEnumerable<T> Choices, Func<T, string> ChoiceFormatter);
TestServices\TestConsoleInteractionService.cs (2)
29public Task<string> PromptForStringAsync(string promptText, string? defaultValue = null, Func<string, ValidationResult>? validator = null, bool isSecret = false, bool required = false, CancellationToken cancellationToken = default)
34public Task<T> PromptForSelectionAsync<T>(string promptText, IEnumerable<T> choices, Func<T, string> choiceFormatter, CancellationToken cancellationToken = default) where T : notnull
TestServices\TestExtensionBackchannel.cs (12)
19public Func<string, Task>? DisplaySuccessAsyncCallback { get; set; }
22public Func<string, Task>? DisplaySubtleMessageAsyncCallback { get; set; }
25public Func<string, Task>? DisplayErrorAsyncCallback { get; set; }
37public Func<IEnumerable<DisplayLineState>, Task>? DisplayLinesAsyncCallback { get; set; }
40public Func<DashboardUrlsState, Task>? DisplayDashboardUrlsAsyncCallback { get; set; }
43public Func<string?, Task>? ShowStatusAsyncCallback { get; set; }
51public Func<string, string?, Func<string, ValidationResult>?, bool, Task<string>>? PromptForStringAsyncCallback { get; set; }
54public Func<string, Task>? OpenEditorAsyncCallback { get; set; }
60public Func<CancellationToken, Task<string[]>>? GetCapabilitiesAsyncCallback { get; set; }
74public Func<string, Task>? DisplayPlainTextAsyncCallback { get; set; }
143public Task<T> PromptForSelectionAsync<T>(string promptText, IEnumerable<T> choices, Func<T, string> choiceFormatter, CancellationToken cancellationToken) where T : notnull
163public Task<string> PromptForStringAsync(string promptText, string? defaultValue = null, Func<string, ValidationResult>? validator = null, bool isSecret = false, CancellationToken cancellationToken = default)
TestServices\TestExtensionInteractionService.cs (2)
34public Task<string> PromptForStringAsync(string promptText, string? defaultValue = null, Func<string, ValidationResult>? validator = null, bool isSecret = false, bool required = false, CancellationToken cancellationToken = default)
39public Task<T> PromptForSelectionAsync<T>(string promptText, IEnumerable<T> choices, Func<T, string> choiceFormatter, CancellationToken cancellationToken = default) where T : notnull
Utils\CliTestHelper.cs (22)
141public Func<IServiceProvider, IAnsiConsole> AnsiConsoleFactory => (IServiceProvider serviceProvider) =>
154public Func<IServiceProvider, INewCommandPrompter> NewCommandPrompterFactory { get; set; } = (IServiceProvider serviceProvider) =>
160public Func<IServiceProvider, ICliUpdateNotifier> CliUpdateNotifierFactory { get; set; } = (IServiceProvider serviceProvider) =>
168public Func<IServiceProvider, IAddCommandPrompter> AddCommandPrompterFactory { get; set; } = (IServiceProvider serviceProvider) =>
174public Func<IServiceProvider, IPublishCommandPrompter> PublishCommandPrompterFactory { get; set; } = (IServiceProvider serviceProvider) =>
180public Func<IServiceProvider, IConfigurationService> ConfigurationServiceFactory { get; set; }
195public Func<IServiceProvider, IProjectLocator> ProjectLocatorFactory { get; set; }
196public Func<IServiceProvider, CliExecutionContext> CliExecutionContextFactory { get; set; }
210public Func<IServiceProvider, AspireCliTelemetry> TelemetryFactory { get; set; } = (IServiceProvider serviceProvider) =>
215public Func<IServiceProvider, IProjectUpdater> ProjectUpdaterFactory { get; set; } = (IServiceProvider serviceProvider) =>
226public Func<IServiceProvider, IInteractionService> InteractionServiceFactory { get; set; } = (IServiceProvider serviceProvider) =>
233public Func<IServiceProvider, ICertificateService> CertificateServiceFactory { get; set; } = (IServiceProvider serviceProvider) =>
240public Func<IServiceProvider, IDotNetCliRunner> DotNetCliRunnerFactory { get; set; } = (IServiceProvider serviceProvider) =>
253public Func<IServiceProvider, IDotNetSdkInstaller> DotNetSdkInstallerFactory { get; set; } = (IServiceProvider serviceProvider) =>
258public Func<IServiceProvider, INuGetPackageCache> NuGetPackageCacheFactory { get; set; } = (IServiceProvider serviceProvider) =>
268public Func<IServiceProvider, IAppHostBackchannel> AppHostBackchannelFactory { get; set; } = (IServiceProvider serviceProvider) =>
275public Func<IServiceProvider, IExtensionRpcTarget> ExtensionRpcTargetFactory { get; set; } = (IServiceProvider serviceProvider) =>
281public Func<IServiceProvider, IExtensionBackchannel> ExtensionBackchannelFactory { get; set; } = serviceProvider =>
289public Func<IServiceProvider, IFeatures> FeatureFlagsFactory { get; set; } = (IServiceProvider serviceProvider) =>
295public Func<IServiceProvider, ITemplateProvider> TemplateProviderFactory { get; set; } = (IServiceProvider serviceProvider) =>
308public Func<IServiceProvider, IPackagingService> PackagingServiceFactory { get; set; } = (IServiceProvider serviceProvider) =>
315public Func<IServiceProvider, IDiskCache> DiskCacheFactory { get; set; } = (IServiceProvider serviceProvider) => new NullDiskCache();
Aspire.Confluent.Kafka (3)
Aspire.Dashboard (49)
Otlp\Model\OtlpHelpers.cs (2)
203public static KeyValuePair<string, string>[] ToKeyValuePairs(this RepeatedField<KeyValue> attributes, OtlpContext context, Func<KeyValue, bool> filter)
424public static PagedResult<TResult> GetItems<TSource, TResult>(IEnumerable<TSource> results, int startIndex, int count, bool isFull, Func<TSource, TResult>? select)
Telemetry\DashboardTelemetrySender.cs (4)
18private readonly Channel<(OperationContext, Func<HttpClient, Func<OperationContextProperty, object>, Task>)> _channel;
22internal Func<HttpClientHandler, HttpMessageHandler>? CreateHandler { get; set; }
38_channel = Channel.CreateBounded<(OperationContext, Func<HttpClient, Func<OperationContextProperty, object>, Task>)>(channelOptions);
162public void QueueRequest(OperationContext context, Func<HttpClient, Func<OperationContextProperty, object>, Task> requestFunc)
Utils\MaxItemCountHelper.cs (6)
19private static readonly Func<Virtualize<TItem>, int>? s_getMaxItemCount =
25private static Func<Virtualize<TItem>, int>? CreateGetter()
38return Expression.Lambda<Func<Virtualize<TItem>, int>>(body, instance).Compile();
77private static readonly Func<FluentDataGrid<TGridItem>, Virtualize<(int, TGridItem)>>? s_getVirtualize =
80private static Func<FluentDataGrid<TGridItem>, Virtualize<(int, TGridItem)>>? CreateGetter()
93return Expression.Lambda<Func<FluentDataGrid<TGridItem>, Virtualize<(int, TGridItem)>>> (body, instance).Compile();
Aspire.Dashboard.Components.Tests (24)
Shared\TestDialogService.cs (9)
36public EventCallback<DialogResult> CreateDialogCallback(object receiver, Func<DialogResult, Task> callback)
41public void ShowConfirmation(object receiver, Func<DialogResult, Task> callback, string message, string primaryText = "Yes", string secondaryText = "No", string? title = null)
46public Task<IDialogReference> ShowConfirmationAsync(object receiver, Func<DialogResult, Task> callback, string message, string primaryText = "Yes", string secondaryText = "No", string? title = null)
175public void ShowSplashScreen(object receiver, Func<DialogResult, Task> callback, DialogParameters<SplashScreenContent> parameters)
180public void ShowSplashScreen<T>(object receiver, Func<DialogResult, Task> callback, DialogParameters<SplashScreenContent> parameters) where T : IDialogContentComponent<SplashScreenContent>
185public void ShowSplashScreen(Type component, object receiver, Func<DialogResult, Task> callback, DialogParameters<SplashScreenContent> parameters)
190public Task<IDialogReference> ShowSplashScreenAsync(object receiver, Func<DialogResult, Task> callback, DialogParameters<SplashScreenContent> parameters)
200public Task<IDialogReference> ShowSplashScreenAsync<T>(object receiver, Func<DialogResult, Task> callback, DialogParameters<SplashScreenContent> parameters) where T : IDialogContentComponent<SplashScreenContent>
210public Task<IDialogReference> ShowSplashScreenAsync(Type component, object receiver, Func<DialogResult, Task> callback, DialogParameters<SplashScreenContent> parameters)
Aspire.Dashboard.Tests (15)
Aspire.Hosting (71)
ApplicationModel\ResourceNotificationService.cs (4)
437public async Task<ResourceEvent> WaitForResourceAsync(string resourceName, Func<ResourceEvent, bool> predicate, CancellationToken cancellationToken = default)
446private async Task<ResourceEvent> WaitForResourceCoreAsync(string resourceName, Func<ResourceEvent, bool> predicate, CancellationToken cancellationToken = default)
587public Task PublishUpdateAsync(IResource resource, string resourceId, Func<CustomResourceSnapshot, CustomResourceSnapshot> stateFactory)
785public async Task PublishUpdateAsync(IResource resource, Func<CustomResourceSnapshot, CustomResourceSnapshot> stateFactory)
Dcp\DcpExecutorEvents.cs (4)
13internal record OnResourceChangedContext(CancellationToken CancellationToken, string ResourceType, IResource Resource, string DcpResourceName, ResourceStatus Status, Func<CustomResourceSnapshot, CustomResourceSnapshot> UpdateSnapshot);
18private readonly ConcurrentDictionary<Type, Func<object, Task>> _eventSubscriptionListLookup = new();
20public void Subscribe<T>(Func<T, Task> callback) where T : notnull
31if (_eventSubscriptionListLookup.TryGetValue(typeof(T), out var callback))
ResourceBuilderExtensions.cs (10)
128public static IResourceBuilder<T> WithEnvironment<T>(this IResourceBuilder<T> builder, Func<EnvironmentCallbackContext, Task> callback) where T : IResourceWithEnvironment
335public static IResourceBuilder<T> WithArgs<T>(this IResourceBuilder<T> builder, Func<CommandLineArgsCallbackContext, Task> callback) where T : IResourceWithArgs
367public static IResourceBuilder<T> WithPublishingCallback<T>(this IResourceBuilder<T> builder, Func<PublishingContext, Task> callback) where T : IResource
383public static IResourceBuilder<T> WithManifestPublishingCallback<T>(this IResourceBuilder<T> builder, Func<ManifestPublishingContext, Task> callback) where T : IResource
908public static IResourceBuilder<T> WithUrls<T>(this IResourceBuilder<T> builder, Func<ResourceUrlsCallbackContext, Task> callback)
1034/// To add another URL for an endpoint, use <see cref="WithUrlForEndpoint{T}(IResourceBuilder{T}, string, Func{EndpointReference, ResourceUrlAnnotation})"/>.
1107public static IResourceBuilder<T> WithUrlForEndpoint<T>(this IResourceBuilder<T> builder, string endpointName, Func<EndpointReference, ResourceUrlAnnotation> callback)
1668Func<ExecuteCommandContext, Task<ExecuteCommandResult>> executeCommand,
1729Func<ExecuteCommandContext, Task<ExecuteCommandResult>> executeCommand,
1730Func<UpdateCommandStateContext, ResourceCommandState>? updateState = null,
Aspire.Hosting.Analyzers (1)
Aspire.Hosting.Azure (3)
Aspire.Hosting.Azure.AIFoundry (3)
src\Shared\AzureRoleAssignmentUtils.cs (3)
10internal static IResourceBuilder<T> WithRoleAssignments<T, TTarget, TBuiltInRole>(this IResourceBuilder<T> builder, IResourceBuilder<TTarget> target, Func<TBuiltInRole, string> getName, TBuiltInRole[] roles)
18internal static IResourceBuilder<T> WithDefaultRoleAssignments<T, TBuiltInRole>(this IResourceBuilder<T> builder, Func<TBuiltInRole, string> getName, params TBuiltInRole[] roles)
25private static HashSet<RoleDefinition> CreateRoleDefinitions<TBuiltInRole>(IReadOnlyList<TBuiltInRole> roles, Func<TBuiltInRole, string> getName)
Aspire.Hosting.Azure.AppConfiguration (3)
src\Shared\AzureRoleAssignmentUtils.cs (3)
10internal static IResourceBuilder<T> WithRoleAssignments<T, TTarget, TBuiltInRole>(this IResourceBuilder<T> builder, IResourceBuilder<TTarget> target, Func<TBuiltInRole, string> getName, TBuiltInRole[] roles)
18internal static IResourceBuilder<T> WithDefaultRoleAssignments<T, TBuiltInRole>(this IResourceBuilder<T> builder, Func<TBuiltInRole, string> getName, params TBuiltInRole[] roles)
25private static HashSet<RoleDefinition> CreateRoleDefinitions<TBuiltInRole>(IReadOnlyList<TBuiltInRole> roles, Func<TBuiltInRole, string> getName)
Aspire.Hosting.Azure.CognitiveServices (3)
src\Shared\AzureRoleAssignmentUtils.cs (3)
10internal static IResourceBuilder<T> WithRoleAssignments<T, TTarget, TBuiltInRole>(this IResourceBuilder<T> builder, IResourceBuilder<TTarget> target, Func<TBuiltInRole, string> getName, TBuiltInRole[] roles)
18internal static IResourceBuilder<T> WithDefaultRoleAssignments<T, TBuiltInRole>(this IResourceBuilder<T> builder, Func<TBuiltInRole, string> getName, params TBuiltInRole[] roles)
25private static HashSet<RoleDefinition> CreateRoleDefinitions<TBuiltInRole>(IReadOnlyList<TBuiltInRole> roles, Func<TBuiltInRole, string> getName)
Aspire.Hosting.Azure.ContainerRegistry (3)
src\Shared\AzureRoleAssignmentUtils.cs (3)
10internal static IResourceBuilder<T> WithRoleAssignments<T, TTarget, TBuiltInRole>(this IResourceBuilder<T> builder, IResourceBuilder<TTarget> target, Func<TBuiltInRole, string> getName, TBuiltInRole[] roles)
18internal static IResourceBuilder<T> WithDefaultRoleAssignments<T, TBuiltInRole>(this IResourceBuilder<T> builder, Func<TBuiltInRole, string> getName, params TBuiltInRole[] roles)
25private static HashSet<RoleDefinition> CreateRoleDefinitions<TBuiltInRole>(IReadOnlyList<TBuiltInRole> roles, Func<TBuiltInRole, string> getName)
Aspire.Hosting.Azure.EventHubs (3)
src\Shared\AzureRoleAssignmentUtils.cs (3)
10internal static IResourceBuilder<T> WithRoleAssignments<T, TTarget, TBuiltInRole>(this IResourceBuilder<T> builder, IResourceBuilder<TTarget> target, Func<TBuiltInRole, string> getName, TBuiltInRole[] roles)
18internal static IResourceBuilder<T> WithDefaultRoleAssignments<T, TBuiltInRole>(this IResourceBuilder<T> builder, Func<TBuiltInRole, string> getName, params TBuiltInRole[] roles)
25private static HashSet<RoleDefinition> CreateRoleDefinitions<TBuiltInRole>(IReadOnlyList<TBuiltInRole> roles, Func<TBuiltInRole, string> getName)
Aspire.Hosting.Azure.Functions (3)
src\Shared\AzureRoleAssignmentUtils.cs (3)
10internal static IResourceBuilder<T> WithRoleAssignments<T, TTarget, TBuiltInRole>(this IResourceBuilder<T> builder, IResourceBuilder<TTarget> target, Func<TBuiltInRole, string> getName, TBuiltInRole[] roles)
18internal static IResourceBuilder<T> WithDefaultRoleAssignments<T, TBuiltInRole>(this IResourceBuilder<T> builder, Func<TBuiltInRole, string> getName, params TBuiltInRole[] roles)
25private static HashSet<RoleDefinition> CreateRoleDefinitions<TBuiltInRole>(IReadOnlyList<TBuiltInRole> roles, Func<TBuiltInRole, string> getName)
Aspire.Hosting.Azure.KeyVault (3)
src\Shared\AzureRoleAssignmentUtils.cs (3)
10internal static IResourceBuilder<T> WithRoleAssignments<T, TTarget, TBuiltInRole>(this IResourceBuilder<T> builder, IResourceBuilder<TTarget> target, Func<TBuiltInRole, string> getName, TBuiltInRole[] roles)
18internal static IResourceBuilder<T> WithDefaultRoleAssignments<T, TBuiltInRole>(this IResourceBuilder<T> builder, Func<TBuiltInRole, string> getName, params TBuiltInRole[] roles)
25private static HashSet<RoleDefinition> CreateRoleDefinitions<TBuiltInRole>(IReadOnlyList<TBuiltInRole> roles, Func<TBuiltInRole, string> getName)
Aspire.Hosting.Azure.Kusto (1)
Aspire.Hosting.Azure.Search (3)
src\Shared\AzureRoleAssignmentUtils.cs (3)
10internal static IResourceBuilder<T> WithRoleAssignments<T, TTarget, TBuiltInRole>(this IResourceBuilder<T> builder, IResourceBuilder<TTarget> target, Func<TBuiltInRole, string> getName, TBuiltInRole[] roles)
18internal static IResourceBuilder<T> WithDefaultRoleAssignments<T, TBuiltInRole>(this IResourceBuilder<T> builder, Func<TBuiltInRole, string> getName, params TBuiltInRole[] roles)
25private static HashSet<RoleDefinition> CreateRoleDefinitions<TBuiltInRole>(IReadOnlyList<TBuiltInRole> roles, Func<TBuiltInRole, string> getName)
Aspire.Hosting.Azure.ServiceBus (3)
src\Shared\AzureRoleAssignmentUtils.cs (3)
10internal static IResourceBuilder<T> WithRoleAssignments<T, TTarget, TBuiltInRole>(this IResourceBuilder<T> builder, IResourceBuilder<TTarget> target, Func<TBuiltInRole, string> getName, TBuiltInRole[] roles)
18internal static IResourceBuilder<T> WithDefaultRoleAssignments<T, TBuiltInRole>(this IResourceBuilder<T> builder, Func<TBuiltInRole, string> getName, params TBuiltInRole[] roles)
25private static HashSet<RoleDefinition> CreateRoleDefinitions<TBuiltInRole>(IReadOnlyList<TBuiltInRole> roles, Func<TBuiltInRole, string> getName)
Aspire.Hosting.Azure.SignalR (3)
src\Shared\AzureRoleAssignmentUtils.cs (3)
10internal static IResourceBuilder<T> WithRoleAssignments<T, TTarget, TBuiltInRole>(this IResourceBuilder<T> builder, IResourceBuilder<TTarget> target, Func<TBuiltInRole, string> getName, TBuiltInRole[] roles)
18internal static IResourceBuilder<T> WithDefaultRoleAssignments<T, TBuiltInRole>(this IResourceBuilder<T> builder, Func<TBuiltInRole, string> getName, params TBuiltInRole[] roles)
25private static HashSet<RoleDefinition> CreateRoleDefinitions<TBuiltInRole>(IReadOnlyList<TBuiltInRole> roles, Func<TBuiltInRole, string> getName)
Aspire.Hosting.Azure.Storage (3)
src\Shared\AzureRoleAssignmentUtils.cs (3)
10internal static IResourceBuilder<T> WithRoleAssignments<T, TTarget, TBuiltInRole>(this IResourceBuilder<T> builder, IResourceBuilder<TTarget> target, Func<TBuiltInRole, string> getName, TBuiltInRole[] roles)
18internal static IResourceBuilder<T> WithDefaultRoleAssignments<T, TBuiltInRole>(this IResourceBuilder<T> builder, Func<TBuiltInRole, string> getName, params TBuiltInRole[] roles)
25private static HashSet<RoleDefinition> CreateRoleDefinitions<TBuiltInRole>(IReadOnlyList<TBuiltInRole> roles, Func<TBuiltInRole, string> getName)
Aspire.Hosting.Azure.Tests (23)
ProvisioningTestHelpers.cs (15)
62public static IArmClientProvider CreateArmClientProvider(Func<string, Dictionary<string, object>> deploymentOutputsProvider) => new TestArmClientProvider(deploymentOutputsProvider);
182private readonly Func<string, Dictionary<string, object>>? _deploymentOutputsProvider;
189public TestArmClient(Func<string, Dictionary<string, object>> deploymentOutputsProvider)
240private readonly Func<string, Dictionary<string, object>>? _deploymentOutputsProvider;
247public TestSubscriptionResource(Func<string, Dictionary<string, object>> deploymentOutputsProvider)
285private readonly Func<string, Dictionary<string, object>>? _deploymentOutputsProvider;
292public TestResourceGroupCollection(Func<string, Dictionary<string, object>> deploymentOutputsProvider)
337private readonly Func<string, Dictionary<string, object>>? _deploymentOutputsProvider;
346public TestResourceGroupResource(string name, Func<string, Dictionary<string, object>> deploymentOutputsProvider)
375private readonly Func<string, Dictionary<string, object>>? _deploymentOutputsProvider;
382public TestArmDeploymentCollection(Func<string, Dictionary<string, object>> deploymentOutputsProvider)
446private readonly Func<string, Dictionary<string, object>>? _deploymentDataProvider;
454public TestArmDeploymentResource(string name, Func<string, Dictionary<string, object>> deploymentDataProvider)
510private readonly Func<string, Dictionary<string, object>>? _deploymentOutputsProvider;
517public TestArmClientProvider(Func<string, Dictionary<string, object>> deploymentOutputsProvider)
Aspire.Hosting.Azure.WebPubSub (3)
src\Shared\AzureRoleAssignmentUtils.cs (3)
10internal static IResourceBuilder<T> WithRoleAssignments<T, TTarget, TBuiltInRole>(this IResourceBuilder<T> builder, IResourceBuilder<TTarget> target, Func<TBuiltInRole, string> getName, TBuiltInRole[] roles)
18internal static IResourceBuilder<T> WithDefaultRoleAssignments<T, TBuiltInRole>(this IResourceBuilder<T> builder, Func<TBuiltInRole, string> getName, params TBuiltInRole[] roles)
25private static HashSet<RoleDefinition> CreateRoleDefinitions<TBuiltInRole>(IReadOnlyList<TBuiltInRole> roles, Func<TBuiltInRole, string> getName)
Aspire.Hosting.Testing.Tests (8)
Aspire.Hosting.Tests (18)
Aspire.Hosting.Yarp (3)
Aspire.Microsoft.Data.SqlClient (8)
Aspire.Microsoft.EntityFrameworkCore.SqlServer (8)
Aspire.NATS.Net (5)
AspireNatsClientExtensions.cs (5)
33public static void AddNatsClient(this IHostApplicationBuilder builder, string connectionName, Func<NatsOpts, NatsOpts>? configureOptions)
41public static void AddNatsClient(this IHostApplicationBuilder builder, string connectionName, Action<NatsClientSettings>? configureSettings, Func<NatsOpts, NatsOpts>? configureOptions)
76public static void AddKeyedNatsClient(this IHostApplicationBuilder builder, string name, Func<NatsOpts, NatsOpts>? configureOptions)
92public static void AddKeyedNatsClient(this IHostApplicationBuilder builder, string name, Action<NatsClientSettings>? configureSettings, Func<NatsOpts, NatsOpts>? configureOptions)
206private static Func<IServiceProvider, NatsOpts, NatsOpts>? Wrap(Func<NatsOpts, NatsOpts>? func)
Aspire.NATS.Net.Tests (4)
Aspire.Playground.Tests (11)
Aspire.StackExchange.Redis (9)
Aspire.Templates.Tests (1)
Aspire.TestUtilities (2)
BasicWebSite (2)
BoundTreeGenerator (4)
BuildActionTelemetryTable (1)
BuildBoss (1)
CodeGenerator (2)
CodeStyleConfigFileGenerator (1)
csc (2)
CustomEncryptorSample (1)
dotnet-svcutil-lib (10)
GenerateDocumentationAndConfigFiles (428)
src\Compilers\Core\Portable\FileSystem\FileUtilities.cs (4)
47Func<string, bool> fileExists)
322public static T RethrowExceptionsAsIOException<T, TArg>(Func<TArg, T> operation, TArg arg)
339public static async Task<T> RethrowExceptionsAsIOExceptionAsync<T, TArg>(Func<TArg, Task<T>> operation, TArg arg)
355internal static Stream CreateFileStreamChecked(Func<string, Stream> factory, string path, string? paramName = null)
src\Compilers\Core\Portable\InternalUtilities\InterlockedOperations.cs (5)
46public static T Initialize<T, TArg>([NotNull] ref T? target, Func<TArg, T> valueFactory, TArg arg)
66public static int Initialize<TArg>(ref int target, int uninitializedValue, Func<TArg, int> valueFactory, TArg arg)
103public static T? Initialize<T, TArg>([NotNull] ref StrongBox<T?>? target, Func<TArg, T?> valueFactory, TArg arg)
183public static ImmutableArray<T> Initialize<T, TArg>(ref ImmutableArray<T> target, Func<TArg, ImmutableArray<T>> createArray, TArg arg)
193private static ImmutableArray<T> Initialize_Slow<T, TArg>(ref ImmutableArray<T> target, Func<TArg, ImmutableArray<T>> createArray, TArg arg)
src\Compilers\Core\Portable\SourceGeneration\GeneratedCodeUtilities.cs (4)
49SyntaxTree tree, Func<SyntaxTrivia, bool> isComment, CancellationToken cancellationToken)
55internal static bool IsGeneratedCode(string? filePath, SyntaxNode root, Func<SyntaxTrivia, bool> isComment)
88private static bool BeginsWithAutoGeneratedComment(SyntaxNode root, Func<SyntaxTrivia, bool> isComment)
118SyntaxTree tree, Func<SyntaxTrivia, bool> isComment, CancellationToken cancellationToken)
src\Dependencies\Collections\Extensions\IEnumerableExtensions.cs (30)
164public static T? FirstOrNull<T>(this IEnumerable<T> source, Func<T, bool> predicate)
182public static T? SingleOrNull<T>(this IEnumerable<T> source, Func<T, bool> predicate)
261public static bool HasDuplicates<TItem, TValue>(this IEnumerable<TItem> source, Func<TItem, TValue> selector)
271/// <seealso cref="Microsoft.CodeAnalysis.ImmutableArrayExtensions.HasDuplicates{TItem, TValue}(ImmutableArray{TItem}, Func{TItem, TValue}, IEqualityComparer{TValue})"/>
273public static bool HasDuplicates<TItem, TValue>(this IEnumerable<TItem> source, Func<TItem, TValue> selector, IEqualityComparer<TValue> comparer)
321private static readonly Func<object, bool> s_notNullTest = x => x != null;
331return source.Where((Func<T?, bool>)s_notNullTest)!;
376public static ImmutableArray<T> WhereAsArray<T>(this IEnumerable<T> values, Func<T, bool> predicate)
407public static ImmutableArray<TResult> SelectAsArray<TSource, TResult>(this IEnumerable<TSource>? source, Func<TSource, TResult> selector)
417public static ImmutableArray<TResult> SelectAsArray<TItem, TResult>(this IEnumerable<TItem>? source, Func<TItem, bool> predicate, Func<TItem, TResult> selector)
461public static ImmutableArray<TResult> SelectAsArray<TSource, TResult>(this IReadOnlyCollection<TSource>? source, Func<TSource, TResult> selector)
485public static ImmutableArray<TResult> SelectManyAsArray<TSource, TResult>(this IEnumerable<TSource>? source, Func<TSource, IEnumerable<TResult>> selector)
507public static ImmutableArray<TResult> SelectManyAsArray<TItem, TResult>(this IReadOnlyCollection<TItem>? source, Func<TItem, IEnumerable<TResult>> selector)
533public static ImmutableArray<TResult> SelectManyAsArray<TSource, TResult>(this IEnumerable<TSource>? source, Func<TSource, OneOrMany<TResult>> selector)
547public static async ValueTask<ImmutableArray<TResult>> SelectAsArrayAsync<TItem, TResult>(this IEnumerable<TItem> source, Func<TItem, ValueTask<TResult>> selector)
764internal static Dictionary<K, ImmutableArray<T>> ToMultiDictionary<K, T>(this IEnumerable<T> data, Func<T, K> keySelector, IEqualityComparer<K>? comparer = null)
815public static readonly Func<T, T> Identity = t => t;
816public static readonly Func<T, bool> True = t => true;
840/// Alias for <see cref="System.Linq.Enumerable.Any{TSource}(IEnumerable{TSource}, Func{TSource, bool})"/>
842public static bool Contains<T>(this IEnumerable<T> sequence, Func<T, bool> predicate)
846/// Variant of <see cref="System.Linq.Enumerable.Count{TSource}(IEnumerable{TSource}, Func{TSource, bool})"/>
861/// Variant of <see cref="System.Linq.Enumerable.FirstOrDefault{TSource}(IEnumerable{TSource}, Func{TSource, bool})"/>
875/// Variant of <see cref="System.Linq.Enumerable.Any{TSource}(IEnumerable{TSource}, Func{TSource, bool})"/>
889/// Variant of <see cref="System.Linq.Enumerable.OrderBy{TSource, TKey}(IEnumerable{TSource}, Func{TSource, TKey}, IComparer{TKey}?)"/>
895/// Variant of <see cref="System.Linq.Enumerable.OrderByDescending{TSource, TKey}(IEnumerable{TSource}, Func{TSource, TKey}, IComparer{TKey}?)"/>
901/// Variant of <see cref="System.Linq.Enumerable.OrderBy{TSource, TKey}(IEnumerable{TSource}, Func{TSource, TKey}, IComparer{TKey}?)"/>
907/// Variant of <see cref="System.Linq.Enumerable.OrderByDescending{TSource, TKey}(IEnumerable{TSource}, Func{TSource, TKey}, IComparer{TKey}?)"/>
913/// Variant of <see cref="System.Linq.Enumerable.ThenBy{TSource, TKey}(IOrderedEnumerable{TSource}, Func{TSource, TKey}, IComparer{TKey}?)"/>
919/// Variant of <see cref="System.Linq.Enumerable.ThenBy{TSource, TKey}(IOrderedEnumerable{TSource}, Func{TSource, TKey}, IComparer{TKey}?)"/>
src\Dependencies\Collections\Extensions\IListExtensions.cs (4)
21public static bool HasDuplicates<TItem, TValue>(this IReadOnlyList<TItem> list, Func<TItem, TValue> selector)
31/// <seealso cref="ImmutableArrayExtensions.HasDuplicates{TItem, TValue}(System.Collections.Immutable.ImmutableArray{TItem}, Func{TItem, TValue}, IEqualityComparer{TValue})"/>
32/// <seealso cref="Roslyn.Utilities.EnumerableExtensions.HasDuplicates{TItem, TValue}(IEnumerable{TItem}, Func{TItem, TValue}, IEqualityComparer{TValue})"/>
34internal static bool HasDuplicates<TItem, TValue>(this IReadOnlyList<TItem> list, Func<TItem, TValue> selector, IEqualityComparer<TValue> comparer)
src\Dependencies\Collections\Extensions\ImmutableArrayExtensions.cs (27)
138public static ImmutableArray<TResult> SelectAsArray<TItem, TResult>(this ImmutableArray<TItem> items, Func<TItem, TResult> map)
198public static ImmutableArray<TResult> SelectAsArray<TItem, TResult>(this ImmutableArray<TItem> array, Func<TItem, bool> predicate, Func<TItem, TResult> selector)
247public static ImmutableArray<TResult> SelectManyAsArray<TItem, TResult>(this ImmutableArray<TItem> array, Func<TItem, IEnumerable<TResult>> selector)
267public static ImmutableArray<TResult> SelectManyAsArray<TItem, TResult>(this ImmutableArray<TItem> array, Func<TItem, ImmutableArray<TResult>> selector)
287public static ImmutableArray<TResult> SelectManyAsArray<TItem, TResult>(this ImmutableArray<TItem> array, Func<TItem, OneOrMany<TResult>> selector)
308public static ImmutableArray<TResult> SelectManyAsArray<TItem, TResult>(this ImmutableArray<TItem> array, Func<TItem, bool> predicate, Func<TItem, IEnumerable<TResult>> selector)
332public static ImmutableArray<TResult> SelectManyAsArray<TItem, TResult>(this ImmutableArray<TItem> array, Func<TItem, bool> predicate, Func<TItem, ImmutableArray<TResult>> selector)
356public static ImmutableArray<TResult> SelectManyAsArray<TItem, TResult>(this ImmutableArray<TItem> array, Func<TItem, bool> predicate, Func<TItem, OneOrMany<TResult>> selector)
493public static ImmutableArray<T> WhereAsArray<T>(this ImmutableArray<T> array, Func<T, bool> predicate)
504private static ImmutableArray<T> WhereAsArrayImpl<T, TArg>(ImmutableArray<T> array, Func<T, bool>? predicateWithoutArg, Func<T, TArg, bool>? predicateWithArg, TArg arg)
573public static async Task<bool> AnyAsync<T>(this ImmutableArray<T> array, Func<T, Task<bool>> predicateAsync)
595public static async ValueTask<T?> FirstOrDefaultAsync<T>(this ImmutableArray<T> array, Func<T, Task<bool>> predicateAsync)
757public static bool HasDuplicates<TItem, TValue>(this ImmutableArray<TItem> array, Func<TItem, TValue> selector)
767/// <seealso cref="Roslyn.Utilities.EnumerableExtensions.HasDuplicates{TItem, TValue}(IEnumerable{TItem}, Func{TItem, TValue}, IEqualityComparer{TValue})"/>
769internal static bool HasDuplicates<TItem, TValue>(this ImmutableArray<TItem> array, Func<TItem, TValue> selector, IEqualityComparer<TValue> comparer)
990/// Variant of <see cref="System.Linq.ImmutableArrayExtensions.FirstOrDefault{T}(ImmutableArray{T}, Func{T, bool})"/>
1004/// Variant of <see cref="System.Linq.ImmutableArrayExtensions.Single{T}(ImmutableArray{T}, Func{T, bool})"/>
1066/// Specialization of <see cref="System.Linq.Enumerable.Count{TSource}(IEnumerable{TSource}, Func{TSource, bool})"/> for <see cref="ImmutableArray{T}"/>.
1068public static int Count<T>(this ImmutableArray<T> items, Func<T, bool> predicate)
1086public static int Sum<T>(this ImmutableArray<T> items, Func<T, int> selector)
1213/// Variant of <see cref="System.Linq.ImmutableArrayExtensions.Any{T}(ImmutableArray{T}, Func{T, bool})"/>.
1227/// Variant of <see cref="System.Linq.ImmutableArrayExtensions.All{T}(ImmutableArray{T}, Func{T, bool})"/>.
1257public static bool Contains<T>(this ImmutableArray<T> array, Func<T, bool> predicate)
src\Dependencies\Collections\RoslynImmutableInterlocked.cs (7)
33public static bool Update<T>(ref ImmutableSegmentedList<T> location, Func<ImmutableSegmentedList<T>, ImmutableSegmentedList<T>> transformer)
154public static bool Update<T>(ref ImmutableSegmentedHashSet<T> location, Func<ImmutableSegmentedHashSet<T>, ImmutableSegmentedHashSet<T>> transformer)
276public static bool Update<TKey, TValue>(ref ImmutableSegmentedDictionary<TKey, TValue> location, Func<ImmutableSegmentedDictionary<TKey, TValue>, ImmutableSegmentedDictionary<TKey, TValue>> transformer)
410/// <inheritdoc cref="ImmutableInterlocked.GetOrAdd{TKey, TValue}(ref ImmutableDictionary{TKey, TValue}, TKey, Func{TKey, TValue})"/>
411public static TValue GetOrAdd<TKey, TValue>(ref ImmutableSegmentedDictionary<TKey, TValue> location, TKey key, Func<TKey, TValue> valueFactory)
458/// <inheritdoc cref="ImmutableInterlocked.AddOrUpdate{TKey, TValue}(ref ImmutableDictionary{TKey, TValue}, TKey, Func{TKey, TValue}, Func{TKey, TValue, TValue})"/>
459public static TValue AddOrUpdate<TKey, TValue>(ref ImmutableSegmentedDictionary<TKey, TValue> location, TKey key, Func<TKey, TValue> addValueFactory, Func<TKey, TValue, TValue> updateValueFactory)
src\Dependencies\Collections\Segmented\ImmutableSegmentedDictionary.cs (6)
68public static ImmutableSegmentedDictionary<TKey, TValue> ToImmutableSegmentedDictionary<TSource, TKey, TValue>(this IEnumerable<TSource> source, Func<TSource, TKey> keySelector, Func<TSource, TValue> elementSelector)
72public static ImmutableSegmentedDictionary<TKey, TValue> ToImmutableSegmentedDictionary<TSource, TKey, TValue>(this IEnumerable<TSource> source, Func<TSource, TKey> keySelector, Func<TSource, TValue> elementSelector, IEqualityComparer<TKey>? keyComparer)
86public static ImmutableSegmentedDictionary<TKey, TSource> ToImmutableSegmentedDictionary<TSource, TKey>(this IEnumerable<TSource> source, Func<TSource, TKey> keySelector)
90public static ImmutableSegmentedDictionary<TKey, TSource> ToImmutableSegmentedDictionary<TSource, TKey>(this IEnumerable<TSource> source, Func<TSource, TKey> keySelector, IEqualityComparer<TKey>? keyComparer)
src\Dependencies\PooledObjects\ArrayBuilder.cs (7)
457public void FreeAll(Func<T, ArrayBuilder<T>?> getNested)
560internal Dictionary<K, ImmutableArray<T>> ToDictionary<K>(Func<T, K> keySelector, IEqualityComparer<K>? comparer = null)
608public void AddRange<U>(ArrayBuilder<U> items, Func<U, T> selector)
745public ImmutableArray<S> SelectDistinct<S>(Func<T, S> selector)
763public bool Any(Func<T, bool> predicate)
787public bool All(Func<T, bool> predicate)
817public ImmutableArray<TResult> SelectAsArray<TResult>(Func<T, TResult> map)
src\Dependencies\PooledObjects\PooledDelegates.cs (9)
200public static Releaser GetPooledFunction<TArg, TResult>(Func<TArg, TResult> unboundFunction, TArg argument, out Func<TResult> boundFunction)
201=> GetPooledDelegate<FuncWithBoundArgument<TArg, TResult>, TArg, Func<TArg, TResult>, Func<TResult>>(unboundFunction, argument, out boundFunction);
204/// Equivalent to <see cref="GetPooledFunction{TArg, TResult}(Func{TArg, TResult}, TArg, out Func{TResult})"/>,
216/// Gets a <see cref="Func{T, TResult}"/> delegate, which calls <paramref name="unboundFunction"/> with the
246public static Releaser GetPooledFunction<T1, TArg, TResult>(Func<T1, TArg, TResult> unboundFunction, TArg argument, out Func<T1, TResult> boundFunction)
247=> GetPooledDelegate<FuncWithBoundArgument<T1, TArg, TResult>, TArg, Func<T1, TArg, TResult>, Func<T1, TResult>>(unboundFunction, argument, out boundFunction);
412: AbstractDelegateWithBoundArgument<FuncWithBoundArgument<TArg, TResult>, TArg, Func<TArg, TResult>, Func<TResult>>
432: AbstractDelegateWithBoundArgument<FuncWithBoundArgument<T1, TArg, TResult>, TArg, Func<T1, TArg, TResult>, Func<T1, TResult>>
434protected override Func<T1, TResult> Bind()
src\RoslynAnalyzers\Utilities\Compiler\Lightup\LightupHelpers.cs (6)
19internal static Func<TOperation, TProperty> CreateOperationPropertyAccessor<TOperation, TProperty>(Type? type, string propertyName, TProperty fallbackResult)
23internal static Func<TSyntax, TProperty> CreateSyntaxPropertyAccessor<TSyntax, TProperty>(Type? type, string propertyName, TProperty fallbackResult)
27internal static Func<TSymbol, TProperty> CreateSymbolPropertyAccessor<TSymbol, TProperty>(Type? type, string propertyName, TProperty fallbackResult)
31private static Func<T, TProperty> CreatePropertyAccessor<T, TProperty>(Type? type, string parameterName, string propertyName, TProperty fallbackResult)
50Expression<Func<T, TProperty>> expression = Expression.Lambda<Func<T, TProperty>>(result, parameter);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\ObjectExtensions.TypeSwitch.cs (161)
11public static TResult? TypeSwitch<TBaseType, TDerivedType1, TDerivedType2, TDerivedType3, TResult>(this TBaseType obj, Func<TDerivedType1, TResult> matchFunc1, Func<TDerivedType2, TResult> matchFunc2, Func<TDerivedType3, TResult> matchFunc3, Func<TBaseType, TResult>? defaultFunc = null)
25public static TResult? TypeSwitch<TBaseType, TDerivedType1, TDerivedType2, TDerivedType3, TDerivedType4, TResult>(this TBaseType obj, Func<TDerivedType1, TResult> matchFunc1, Func<TDerivedType2, TResult> matchFunc2, Func<TDerivedType3, TResult> matchFunc3, Func<TDerivedType4, TResult> matchFunc4, Func<TBaseType, TResult>? defaultFunc = null)
41public static TResult? TypeSwitch<TBaseType, TDerivedType1, TDerivedType2, TDerivedType3, TDerivedType4, TDerivedType5, TResult>(this TBaseType obj, Func<TDerivedType1, TResult> matchFunc1, Func<TDerivedType2, TResult> matchFunc2, Func<TDerivedType3, TResult> matchFunc3, Func<TDerivedType4, TResult> matchFunc4, Func<TDerivedType5, TResult> matchFunc5, Func<TBaseType, TResult>? defaultFunc = null)
59public static TResult? TypeSwitch<TBaseType, TDerivedType1, TDerivedType2, TDerivedType3, TDerivedType4, TDerivedType5, TDerivedType6, TResult>(this TBaseType obj, Func<TDerivedType1, TResult> matchFunc1, Func<TDerivedType2, TResult> matchFunc2, Func<TDerivedType3, TResult> matchFunc3, Func<TDerivedType4, TResult> matchFunc4, Func<TDerivedType5, TResult> matchFunc5, Func<TDerivedType6, TResult> matchFunc6, Func<TBaseType, TResult>? defaultFunc = null)
79public static TResult? TypeSwitch<TBaseType, TDerivedType1, TDerivedType2, TDerivedType3, TDerivedType4, TDerivedType5, TDerivedType6, TDerivedType7, TDerivedType8, TDerivedType9, TDerivedType10, TDerivedType11, TDerivedType12, TDerivedType13, TDerivedType14, TDerivedType15, TDerivedType16, TResult>(this TBaseType obj, Func<TDerivedType1, TResult> matchFunc1, Func<TDerivedType2, TResult> matchFunc2, Func<TDerivedType3, TResult> matchFunc3, Func<TDerivedType4, TResult> matchFunc4, Func<TDerivedType5, TResult> matchFunc5, Func<TDerivedType6, TResult> matchFunc6, Func<TDerivedType7, TResult> matchFunc7, Func<TDerivedType8, TResult> matchFunc8, Func<TDerivedType9, TResult> matchFunc9, Func<TDerivedType10, TResult> matchFunc10, Func<TDerivedType11, TResult> matchFunc11, Func<TDerivedType12, TResult> matchFunc12, Func<TDerivedType13, TResult> matchFunc13, Func<TDerivedType14, TResult> matchFunc14, Func<TDerivedType15, TResult> matchFunc15, Func<TDerivedType16, TResult> matchFunc16, Func<TBaseType, TResult>? defaultFunc = null)
119public static TResult? TypeSwitch<TBaseType, TDerivedType1, TDerivedType2, TDerivedType3, TDerivedType4, TDerivedType5, TDerivedType6, TDerivedType7, TDerivedType8, TDerivedType9, TDerivedType10, TDerivedType11, TDerivedType12, TDerivedType13, TDerivedType14, TDerivedType15, TDerivedType16, TDerivedType17, TResult>(this TBaseType obj, Func<TDerivedType1, TResult> matchFunc1, Func<TDerivedType2, TResult> matchFunc2, Func<TDerivedType3, TResult> matchFunc3, Func<TDerivedType4, TResult> matchFunc4, Func<TDerivedType5, TResult> matchFunc5, Func<TDerivedType6, TResult> matchFunc6, Func<TDerivedType7, TResult> matchFunc7, Func<TDerivedType8, TResult> matchFunc8, Func<TDerivedType9, TResult> matchFunc9, Func<TDerivedType10, TResult> matchFunc10, Func<TDerivedType11, TResult> matchFunc11, Func<TDerivedType12, TResult> matchFunc12, Func<TDerivedType13, TResult> matchFunc13, Func<TDerivedType14, TResult> matchFunc14, Func<TDerivedType15, TResult> matchFunc15, Func<TDerivedType16, TResult> matchFunc16, Func<TDerivedType17, TResult> matchFunc17, Func<TBaseType, TResult>? defaultFunc = null)
161public static TResult? TypeSwitch<TBaseType, TDerivedType1, TDerivedType2, TDerivedType3, TDerivedType4, TDerivedType5, TDerivedType6, TDerivedType7, TDerivedType8, TDerivedType9, TDerivedType10, TDerivedType11, TDerivedType12, TDerivedType13, TDerivedType14, TDerivedType15, TDerivedType16, TDerivedType17, TDerivedType18, TDerivedType19, TDerivedType20, TDerivedType21, TDerivedType22, TResult>(this TBaseType obj, Func<TDerivedType1, TResult> matchFunc1, Func<TDerivedType2, TResult> matchFunc2, Func<TDerivedType3, TResult> matchFunc3, Func<TDerivedType4, TResult> matchFunc4, Func<TDerivedType5, TResult> matchFunc5, Func<TDerivedType6, TResult> matchFunc6, Func<TDerivedType7, TResult> matchFunc7, Func<TDerivedType8, TResult> matchFunc8, Func<TDerivedType9, TResult> matchFunc9, Func<TDerivedType10, TResult> matchFunc10, Func<TDerivedType11, TResult> matchFunc11, Func<TDerivedType12, TResult> matchFunc12, Func<TDerivedType13, TResult> matchFunc13, Func<TDerivedType14, TResult> matchFunc14, Func<TDerivedType15, TResult> matchFunc15, Func<TDerivedType16, TResult> matchFunc16, Func<TDerivedType17, TResult> matchFunc17, Func<TDerivedType18, TResult> matchFunc18, Func<TDerivedType19, TResult> matchFunc19, Func<TDerivedType20, TResult> matchFunc20, Func<TDerivedType21, TResult> matchFunc21, Func<TDerivedType22, TResult> matchFunc22, Func<TBaseType, TResult>? defaultFunc = null)
213public static TResult? TypeSwitch<TBaseType, TDerivedType1, TDerivedType2, TDerivedType3, TDerivedType4, TDerivedType5, TDerivedType6, TDerivedType7, TDerivedType8, TDerivedType9, TDerivedType10, TDerivedType11, TDerivedType12, TDerivedType13, TDerivedType14, TDerivedType15, TDerivedType16, TDerivedType17, TDerivedType18, TDerivedType19, TDerivedType20, TDerivedType21, TDerivedType22, TDerivedType23, TDerivedType24, TDerivedType25, TDerivedType26, TDerivedType27, TDerivedType28, TDerivedType29, TDerivedType30, TDerivedType31, TDerivedType32, TDerivedType33, TDerivedType34, TDerivedType35, TDerivedType36, TDerivedType37, TDerivedType38, TDerivedType39, TResult>(this TBaseType obj, Func<TDerivedType1, TResult> matchFunc1, Func<TDerivedType2, TResult> matchFunc2, Func<TDerivedType3, TResult> matchFunc3, Func<TDerivedType4, TResult> matchFunc4, Func<TDerivedType5, TResult> matchFunc5, Func<TDerivedType6, TResult> matchFunc6, Func<TDerivedType7, TResult> matchFunc7, Func<TDerivedType8, TResult> matchFunc8, Func<TDerivedType9, TResult> matchFunc9, Func<TDerivedType10, TResult> matchFunc10, Func<TDerivedType11, TResult> matchFunc11, Func<TDerivedType12, TResult> matchFunc12, Func<TDerivedType13, TResult> matchFunc13, Func<TDerivedType14, TResult> matchFunc14, Func<TDerivedType15, TResult> matchFunc15, Func<TDerivedType16, TResult> matchFunc16, Func<TDerivedType17, TResult> matchFunc17, Func<TDerivedType18, TResult> matchFunc18, Func<TDerivedType19, TResult> matchFunc19, Func<TDerivedType20, TResult> matchFunc20, Func<TDerivedType21, TResult> matchFunc21, Func<TDerivedType22, TResult> matchFunc22, Func<TDerivedType23, TResult> matchFunc23, Func<TDerivedType24, TResult> matchFunc24, Func<TDerivedType25, TResult> matchFunc25, Func<TDerivedType26, TResult> matchFunc26, Func<TDerivedType27, TResult> matchFunc27, Func<TDerivedType28, TResult> matchFunc28, Func<TDerivedType29, TResult> matchFunc29, Func<TDerivedType30, TResult> matchFunc30, Func<TDerivedType31, TResult> matchFunc31, Func<TDerivedType32, TResult> matchFunc32, Func<TDerivedType33, TResult> matchFunc33, Func<TDerivedType34, TResult> matchFunc34, Func<TDerivedType35, TResult> matchFunc35, Func<TDerivedType36, TResult> matchFunc36, Func<TDerivedType37, TResult> matchFunc37, Func<TDerivedType38, TResult> matchFunc38, Func<TDerivedType39, TResult> matchFunc39, Func<TBaseType, TResult>? defaultFunc = null)
299public static TResult? TypeSwitch<TBaseType, TDerivedType1, TDerivedType2, TDerivedType3, TDerivedType4, TDerivedType5, TDerivedType6, TDerivedType7, TDerivedType8, TDerivedType9, TDerivedType10, TDerivedType11, TDerivedType12, TDerivedType13, TDerivedType14, TDerivedType15, TDerivedType16, TDerivedType17, TDerivedType18, TDerivedType19, TDerivedType20, TDerivedType21, TDerivedType22, TDerivedType23, TDerivedType24, TDerivedType25, TDerivedType26, TDerivedType27, TDerivedType28, TDerivedType29, TDerivedType30, TDerivedType31, TDerivedType32, TDerivedType33, TDerivedType34, TDerivedType35, TDerivedType36, TDerivedType37, TDerivedType38, TDerivedType39, TDerivedType40, TResult>(this TBaseType obj, Func<TDerivedType1, TResult> matchFunc1, Func<TDerivedType2, TResult> matchFunc2, Func<TDerivedType3, TResult> matchFunc3, Func<TDerivedType4, TResult> matchFunc4, Func<TDerivedType5, TResult> matchFunc5, Func<TDerivedType6, TResult> matchFunc6, Func<TDerivedType7, TResult> matchFunc7, Func<TDerivedType8, TResult> matchFunc8, Func<TDerivedType9, TResult> matchFunc9, Func<TDerivedType10, TResult> matchFunc10, Func<TDerivedType11, TResult> matchFunc11, Func<TDerivedType12, TResult> matchFunc12, Func<TDerivedType13, TResult> matchFunc13, Func<TDerivedType14, TResult> matchFunc14, Func<TDerivedType15, TResult> matchFunc15, Func<TDerivedType16, TResult> matchFunc16, Func<TDerivedType17, TResult> matchFunc17, Func<TDerivedType18, TResult> matchFunc18, Func<TDerivedType19, TResult> matchFunc19, Func<TDerivedType20, TResult> matchFunc20, Func<TDerivedType21, TResult> matchFunc21, Func<TDerivedType22, TResult> matchFunc22, Func<TDerivedType23, TResult> matchFunc23, Func<TDerivedType24, TResult> matchFunc24, Func<TDerivedType25, TResult> matchFunc25, Func<TDerivedType26, TResult> matchFunc26, Func<TDerivedType27, TResult> matchFunc27, Func<TDerivedType28, TResult> matchFunc28, Func<TDerivedType29, TResult> matchFunc29, Func<TDerivedType30, TResult> matchFunc30, Func<TDerivedType31, TResult> matchFunc31, Func<TDerivedType32, TResult> matchFunc32, Func<TDerivedType33, TResult> matchFunc33, Func<TDerivedType34, TResult> matchFunc34, Func<TDerivedType35, TResult> matchFunc35, Func<TDerivedType36, TResult> matchFunc36, Func<TDerivedType37, TResult> matchFunc37, Func<TDerivedType38, TResult> matchFunc38, Func<TDerivedType39, TResult> matchFunc39, Func<TDerivedType40, TResult> matchFunc40, Func<TBaseType, TResult>? defaultFunc = null)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\SyntaxNodeExtensions.cs (6)
104this SyntaxNode node, TextSpan searchSpan, Func<SyntaxNode, bool> predicate)
129public static bool CheckParent<T>([NotNullWhen(returnValue: true)] this SyntaxNode? node, Func<T, bool> valueChecker) where T : SyntaxNode
145public static bool IsChildNode<TParent>(this SyntaxNode node, Func<TParent, SyntaxNode?> childGetter)
162public static bool IsFoundUnder<TParent>(this SyntaxNode node, Func<TParent, SyntaxNode?> childGetter)
201public static SyntaxNode? FindInnermostCommonNode(this IEnumerable<SyntaxNode> nodes, Func<SyntaxNode, bool> predicate)
806public static TNode? FirstAncestorOrSelfUntil<TNode>(this SyntaxNode? node, Func<SyntaxNode, bool> predicate)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\SyntaxTokenExtensions.cs (5)
15public static SyntaxNode? GetAncestor(this SyntaxToken token, Func<SyntaxNode, bool>? predicate)
18public static T? GetAncestor<T>(this SyntaxToken token, Func<T, bool>? predicate = null) where T : SyntaxNode
21public static T GetRequiredAncestor<T>(this SyntaxToken token, Func<T, bool>? predicate = null) where T : SyntaxNode
32public static IEnumerable<SyntaxNode> GetAncestors(this SyntaxToken token, Func<SyntaxNode, bool> predicate)
42public static bool CheckParent<T>(this SyntaxToken token, Func<T, bool> valueChecker) where T : SyntaxNode
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Options\PublicOptionFactory.cs (4)
17public static Option2<T> WithPublicOption<T, TPublicValue>(this Option2<T> option, string feature, string name, Func<T, TPublicValue> toPublicValue, Func<TPublicValue, T> toInternalValue)
20public static PerLanguageOption2<T> WithPublicOption<T, TPublicValue>(this PerLanguageOption2<T> option, string feature, string name, Func<T, TPublicValue> toPublicValue, Func<TPublicValue, T> toInternalValue)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\TopologicalSorter.cs (8)
13public static IEnumerable<T> TopologicalSort<T>(this IEnumerable<T> items, Func<T, IEnumerable<T>> itemsBefore)
26public static IEnumerable<T> TopologicalSort<T>(this IEnumerable<T> items, Func<T, IEnumerable<T>> itemsBefore, Func<T, IEnumerable<T>> itemsAfter)
29var combinedItemsBefore = CreateCombinedItemsBefore(items, itemsBefore, itemsAfter);
35Func<T, IEnumerable<T>> itemsBefore,
50private static Func<T, IEnumerable<T>> CreateCombinedItemsBefore<T>(IEnumerable<T> items, Func<T, IEnumerable<T>> itemsBefore, Func<T, IEnumerable<T>> itemsAfter)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Extensions\SyntaxEditorExtensions.cs (4)
29Func<TType, (TNode semanticNode, IEnumerable<TNode> additionalNodes)> selector,
52Func<TType, TNode> selector,
96Func<TType, (TNode semanticNode, IEnumerable<TNode> additionalNodes)> selector,
153Func<TType, (TNode semanticNode, IEnumerable<TNode> additionalNodes)> selector,
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Simplification\AbstractSimplificationService.cs (6)
35protected static readonly Func<SyntaxNode, bool> s_containsAnnotations = n => n.ContainsAnnotations;
36protected static readonly Func<SyntaxNodeOrToken, bool> s_hasSimplifierAnnotation = n => n.HasAnnotation(Simplifier.Annotation);
40protected abstract ImmutableArray<NodeOrTokenToReduce> GetNodesAndTokensToReduce(SyntaxNode root, Func<SyntaxNodeOrToken, bool> isNodeOrTokenOutsideSimplifySpans);
51public abstract SyntaxNode Expand(SyntaxNode node, SemanticModel semanticModel, SyntaxAnnotation? annotationForReplacedAliasIdentifier, Func<SyntaxNode, bool>? expandInsideNode, bool expandParameter, CancellationToken cancellationToken);
52public abstract SyntaxToken Expand(SyntaxToken token, SemanticModel semanticModel, Func<SyntaxNode, bool>? expandInsideNode, CancellationToken cancellationToken);
275Func<SyntaxNodeOrToken, bool> isNodeOrTokenOutsideSimplifySpan)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Utilities\NameGenerator.cs (6)
43Func<string, bool>? canUse = null,
63Func<string, bool>? canUse = null,
86Func<string, bool>? canUse = null,
134public static string GenerateUniqueName(string baseName, Func<string, bool> canUse)
140public static string GenerateUniqueName(string baseName, string extension, Func<string, bool> canUse)
160public static string GenerateUniqueName(IEnumerable<string> baseNames, Func<string, bool> canUse)
GetDocument.Insider (11)
.packages\microsoft.extensions.hostfactoryresolver.sources\10.0.0-rc.1.25420.121\contentFiles\cs\netstandard2.0\HostFactoryResolver.cs (10)
41public static Func<string[], TWebHost>? ResolveWebHostFactory<TWebHost>(Assembly assembly)
46public static Func<string[], TWebHostBuilder>? ResolveWebHostBuilderFactory<TWebHostBuilder>(Assembly assembly)
51public static Func<string[], THostBuilder>? ResolveHostBuilderFactory<THostBuilder>(Assembly assembly)
62public static Func<string[], object>? ResolveHostFactory(Assembly assembly,
95private static Func<string[], T>? ResolveFactory<T>(Assembly assembly, string name)
122public static Func<string[], IServiceProvider?>? ResolveServiceProviderFactory(Assembly assembly, TimeSpan? waitTimeout = null)
125var webHostFactory = ResolveWebHostFactory<object>(assembly);
135var webHostBuilderFactory = ResolveWebHostBuilderFactory<object>(assembly);
146var hostBuilderFactory = ResolveHostBuilderFactory<object>(assembly);
157var hostFactory = ResolveHostFactory(assembly, waitTimeout: waitTimeout);
http2cat (5)
HttpStress (3)
IIS.FunctionalTests (7)
IIS.LongTests (15)
src\Servers\IIS\IIS\test\Common.LongTests\StartupTests.cs (8)
592private static Dictionary<string, Func<IISDeploymentParameters, string>> PortableConfigTransformations = InitPortableWebConfigTransformations();
599var action = PortableConfigTransformations[scenario];
606public static Dictionary<string, Func<IISDeploymentParameters, string>> InitPortableWebConfigTransformations()
608var dictionary = new Dictionary<string, Func<IISDeploymentParameters, string>>();
661private static Dictionary<string, Func<IISDeploymentParameters, string>> StandaloneConfigTransformations = InitStandaloneConfigTransformations();
669var action = StandaloneConfigTransformations[scenario];
677public static Dictionary<string, Func<IISDeploymentParameters, string>> InitStandaloneConfigTransformations()
679var dictionary = new Dictionary<string, Func<IISDeploymentParameters, string>>();
IIS.NewHandler.FunctionalTests (15)
src\Servers\IIS\IIS\test\Common.LongTests\StartupTests.cs (8)
592private static Dictionary<string, Func<IISDeploymentParameters, string>> PortableConfigTransformations = InitPortableWebConfigTransformations();
599var action = PortableConfigTransformations[scenario];
606public static Dictionary<string, Func<IISDeploymentParameters, string>> InitPortableWebConfigTransformations()
608var dictionary = new Dictionary<string, Func<IISDeploymentParameters, string>>();
661private static Dictionary<string, Func<IISDeploymentParameters, string>> StandaloneConfigTransformations = InitStandaloneConfigTransformations();
669var action = StandaloneConfigTransformations[scenario];
677public static Dictionary<string, Func<IISDeploymentParameters, string>> InitStandaloneConfigTransformations()
679var dictionary = new Dictionary<string, Func<IISDeploymentParameters, string>>();
IIS.NewShim.FunctionalTests (15)
src\Servers\IIS\IIS\test\Common.LongTests\StartupTests.cs (8)
592private static Dictionary<string, Func<IISDeploymentParameters, string>> PortableConfigTransformations = InitPortableWebConfigTransformations();
599var action = PortableConfigTransformations[scenario];
606public static Dictionary<string, Func<IISDeploymentParameters, string>> InitPortableWebConfigTransformations()
608var dictionary = new Dictionary<string, Func<IISDeploymentParameters, string>>();
661private static Dictionary<string, Func<IISDeploymentParameters, string>> StandaloneConfigTransformations = InitStandaloneConfigTransformations();
669var action = StandaloneConfigTransformations[scenario];
677public static Dictionary<string, Func<IISDeploymentParameters, string>> InitStandaloneConfigTransformations()
679var dictionary = new Dictionary<string, Func<IISDeploymentParameters, string>>();
IIS.ShadowCopy.Tests (5)
IISExpress.FunctionalTests (15)
src\Servers\IIS\IIS\test\Common.LongTests\StartupTests.cs (8)
592private static Dictionary<string, Func<IISDeploymentParameters, string>> PortableConfigTransformations = InitPortableWebConfigTransformations();
599var action = PortableConfigTransformations[scenario];
606public static Dictionary<string, Func<IISDeploymentParameters, string>> InitPortableWebConfigTransformations()
608var dictionary = new Dictionary<string, Func<IISDeploymentParameters, string>>();
661private static Dictionary<string, Func<IISDeploymentParameters, string>> StandaloneConfigTransformations = InitStandaloneConfigTransformations();
669var action = StandaloneConfigTransformations[scenario];
677public static Dictionary<string, Func<IISDeploymentParameters, string>> InitStandaloneConfigTransformations()
679var dictionary = new Dictionary<string, Func<IISDeploymentParameters, string>>();
illink (18)
Linker.Dataflow\DynamicallyAccessedMembersBinder.cs (7)
139public static IEnumerable<MethodDefinition> GetConstructorsOnType(this TypeDefinition type, Func<MethodDefinition, bool>? filter, BindingFlags? bindingFlags = null)
165public static IEnumerable<MethodDefinition> GetMethodsOnTypeHierarchy(this TypeReference thisType, LinkContext context, Func<MethodDefinition, bool>? filter, BindingFlags? bindingFlags = null)
211public static IEnumerable<FieldDefinition> GetFieldsOnTypeHierarchy(this TypeDefinition thisType, LinkContext context, Func<FieldDefinition, bool>? filter, BindingFlags? bindingFlags = BindingFlags.Default)
253public static IEnumerable<TypeDefinition> GetNestedTypesOnType(this TypeReference typeRef, LinkContext context, Func<TypeDefinition, bool>? filter, BindingFlags? bindingFlags = BindingFlags.Default)
279public static IEnumerable<PropertyDefinition> GetPropertiesOnTypeHierarchy(this TypeDefinition thisType, LinkContext context, Func<PropertyDefinition, bool>? filter, BindingFlags? bindingFlags = BindingFlags.Default)
334public static IEnumerable<EventDefinition> GetEventsOnTypeHierarchy(this TypeDefinition thisType, LinkContext context, Func<EventDefinition, bool>? filter, BindingFlags? bindingFlags = BindingFlags.Default)
487private static IEnumerable<T> ApplyIncludeInherited<T>(this TypeDefinition thisType, LinkContext context, Func<TypeDefinition, IEnumerable<T>> selector, bool includeBases)
Linker.Dataflow\ReflectionMarker.cs (4)
163internal void MarkConstructorsOnType(in MessageOrigin origin, TypeReference typeRef, Func<MethodDefinition, bool>? filter, BindingFlags? bindingFlags = null)
175internal void MarkFieldsOnTypeHierarchy(in MessageOrigin origin, TypeReference typeRef, Func<FieldDefinition, bool> filter, BindingFlags? bindingFlags = BindingFlags.Default)
187internal void MarkPropertiesOnTypeHierarchy(in MessageOrigin origin, TypeReference typeRef, Func<PropertyDefinition, bool> filter, BindingFlags? bindingFlags = BindingFlags.Default)
199internal void MarkEventsOnTypeHierarchy(in MessageOrigin origin, TypeReference typeRef, Func<EventDefinition, bool> filter, BindingFlags? bindingFlags = BindingFlags.Default)
src\tools\illink\src\ILLink.Shared\TrimAnalysis\IntrinsicId.cs (3)
69/// <item><see cref="System.Type.GetType(string, System.Func{System.Reflection.AssemblyName, System.Reflection.Assembly?}?, System.Func{System.Reflection.Assembly?, string, bool, System.Type?}?)"/></item>
70/// <item><see cref="System.Type.GetType(string, System.Func{System.Reflection.AssemblyName, System.Reflection.Assembly?}?, System.Func{System.Reflection.Assembly?, string, bool, System.Type?}?, bool)"/></item>
71/// <item><see cref="System.Type.GetType(string, System.Func{System.Reflection.AssemblyName, System.Reflection.Assembly?}?, System.Func{System.Reflection.Assembly?, string, bool, System.Type?}?, bool, bool)"/></item>
ILLink.RoslynAnalyzer (10)
DataFlow\DynamicallyAccessedMembersBinder.cs (7)
137public static IEnumerable<IMethodSymbol> GetConstructorsOnType(this ITypeSymbol type, Func<IMethodSymbol, bool>? filter, BindingFlags? bindingFlags = null)
164public static IEnumerable<IMethodSymbol> GetMethodsOnTypeHierarchy(this ITypeSymbol thisType, Func<IMethodSymbol, bool>? filter, BindingFlags? bindingFlags = null)
209public static IEnumerable<IFieldSymbol> GetFieldsOnTypeHierarchy(this ITypeSymbol thisType, Func<IFieldSymbol, bool>? filter, BindingFlags? bindingFlags = BindingFlags.Default)
250public static IEnumerable<ITypeSymbol> GetNestedTypesOnType(this ITypeSymbol type, Func<ITypeSymbol, bool>? filter, BindingFlags? bindingFlags = BindingFlags.Default)
273public static IEnumerable<IPropertySymbol> GetPropertiesOnTypeHierarchy(this ITypeSymbol thisType, Func<IPropertySymbol, bool>? filter, BindingFlags? bindingFlags = BindingFlags.Default)
328public static IEnumerable<IEventSymbol> GetEventsOnTypeHierarchy(this ITypeSymbol thisType, Func<IEventSymbol, bool>? filter, BindingFlags? bindingFlags = BindingFlags.Default)
470private static IEnumerable<T> ApplyIncludeInherited<T>(this ITypeSymbol thisType, Func<ITypeSymbol, IEnumerable<T>> selector, bool includeBases)
src\tools\illink\src\ILLink.Shared\TrimAnalysis\IntrinsicId.cs (3)
69/// <item><see cref="System.Type.GetType(string, System.Func{System.Reflection.AssemblyName, System.Reflection.Assembly?}?, System.Func{System.Reflection.Assembly?, string, bool, System.Type?}?)"/></item>
70/// <item><see cref="System.Type.GetType(string, System.Func{System.Reflection.AssemblyName, System.Reflection.Assembly?}?, System.Func{System.Reflection.Assembly?, string, bool, System.Type?}?, bool)"/></item>
71/// <item><see cref="System.Type.GetType(string, System.Func{System.Reflection.AssemblyName, System.Reflection.Assembly?}?, System.Func{System.Reflection.Assembly?, string, bool, System.Type?}?, bool, bool)"/></item>
InMemory.FunctionalTests (10)
src\Servers\Kestrel\shared\ConnectionCompletion.cs (3)
12public static Task FireOnCompletedAsync(ILogger logger, Stack<KeyValuePair<Func<object, Task>, object>>? onCompleted)
22private static Task CompleteAsyncMayAwait(ILogger logger, Stack<KeyValuePair<Func<object, Task>, object>> onCompleted)
43private static async Task CompleteAsyncAwaited(Task currentTask, ILogger logger, Stack<KeyValuePair<Func<object, Task>, object>> onCompleted)
InteractiveHost32 (1)
InteractiveHost64 (1)
Interop.FunctionalTests (3)
InteropClient (1)
InteropWebsite (1)
Metrics (408)
src\Compilers\Core\Portable\FileSystem\FileUtilities.cs (4)
47Func<string, bool> fileExists)
322public static T RethrowExceptionsAsIOException<T, TArg>(Func<TArg, T> operation, TArg arg)
339public static async Task<T> RethrowExceptionsAsIOExceptionAsync<T, TArg>(Func<TArg, Task<T>> operation, TArg arg)
355internal static Stream CreateFileStreamChecked(Func<string, Stream> factory, string path, string? paramName = null)
src\Compilers\Core\Portable\InternalUtilities\InterlockedOperations.cs (5)
46public static T Initialize<T, TArg>([NotNull] ref T? target, Func<TArg, T> valueFactory, TArg arg)
66public static int Initialize<TArg>(ref int target, int uninitializedValue, Func<TArg, int> valueFactory, TArg arg)
103public static T? Initialize<T, TArg>([NotNull] ref StrongBox<T?>? target, Func<TArg, T?> valueFactory, TArg arg)
183public static ImmutableArray<T> Initialize<T, TArg>(ref ImmutableArray<T> target, Func<TArg, ImmutableArray<T>> createArray, TArg arg)
193private static ImmutableArray<T> Initialize_Slow<T, TArg>(ref ImmutableArray<T> target, Func<TArg, ImmutableArray<T>> createArray, TArg arg)
src\Compilers\Core\Portable\SourceGeneration\GeneratedCodeUtilities.cs (4)
49SyntaxTree tree, Func<SyntaxTrivia, bool> isComment, CancellationToken cancellationToken)
55internal static bool IsGeneratedCode(string? filePath, SyntaxNode root, Func<SyntaxTrivia, bool> isComment)
88private static bool BeginsWithAutoGeneratedComment(SyntaxNode root, Func<SyntaxTrivia, bool> isComment)
118SyntaxTree tree, Func<SyntaxTrivia, bool> isComment, CancellationToken cancellationToken)
src\Dependencies\Collections\Extensions\IEnumerableExtensions.cs (30)
164public static T? FirstOrNull<T>(this IEnumerable<T> source, Func<T, bool> predicate)
182public static T? SingleOrNull<T>(this IEnumerable<T> source, Func<T, bool> predicate)
261public static bool HasDuplicates<TItem, TValue>(this IEnumerable<TItem> source, Func<TItem, TValue> selector)
271/// <seealso cref="Microsoft.CodeAnalysis.ImmutableArrayExtensions.HasDuplicates{TItem, TValue}(ImmutableArray{TItem}, Func{TItem, TValue}, IEqualityComparer{TValue})"/>
273public static bool HasDuplicates<TItem, TValue>(this IEnumerable<TItem> source, Func<TItem, TValue> selector, IEqualityComparer<TValue> comparer)
321private static readonly Func<object, bool> s_notNullTest = x => x != null;
331return source.Where((Func<T?, bool>)s_notNullTest)!;
376public static ImmutableArray<T> WhereAsArray<T>(this IEnumerable<T> values, Func<T, bool> predicate)
407public static ImmutableArray<TResult> SelectAsArray<TSource, TResult>(this IEnumerable<TSource>? source, Func<TSource, TResult> selector)
417public static ImmutableArray<TResult> SelectAsArray<TItem, TResult>(this IEnumerable<TItem>? source, Func<TItem, bool> predicate, Func<TItem, TResult> selector)
461public static ImmutableArray<TResult> SelectAsArray<TSource, TResult>(this IReadOnlyCollection<TSource>? source, Func<TSource, TResult> selector)
485public static ImmutableArray<TResult> SelectManyAsArray<TSource, TResult>(this IEnumerable<TSource>? source, Func<TSource, IEnumerable<TResult>> selector)
507public static ImmutableArray<TResult> SelectManyAsArray<TItem, TResult>(this IReadOnlyCollection<TItem>? source, Func<TItem, IEnumerable<TResult>> selector)
533public static ImmutableArray<TResult> SelectManyAsArray<TSource, TResult>(this IEnumerable<TSource>? source, Func<TSource, OneOrMany<TResult>> selector)
547public static async ValueTask<ImmutableArray<TResult>> SelectAsArrayAsync<TItem, TResult>(this IEnumerable<TItem> source, Func<TItem, ValueTask<TResult>> selector)
764internal static Dictionary<K, ImmutableArray<T>> ToMultiDictionary<K, T>(this IEnumerable<T> data, Func<T, K> keySelector, IEqualityComparer<K>? comparer = null)
815public static readonly Func<T, T> Identity = t => t;
816public static readonly Func<T, bool> True = t => true;
840/// Alias for <see cref="System.Linq.Enumerable.Any{TSource}(IEnumerable{TSource}, Func{TSource, bool})"/>
842public static bool Contains<T>(this IEnumerable<T> sequence, Func<T, bool> predicate)
846/// Variant of <see cref="System.Linq.Enumerable.Count{TSource}(IEnumerable{TSource}, Func{TSource, bool})"/>
861/// Variant of <see cref="System.Linq.Enumerable.FirstOrDefault{TSource}(IEnumerable{TSource}, Func{TSource, bool})"/>
875/// Variant of <see cref="System.Linq.Enumerable.Any{TSource}(IEnumerable{TSource}, Func{TSource, bool})"/>
889/// Variant of <see cref="System.Linq.Enumerable.OrderBy{TSource, TKey}(IEnumerable{TSource}, Func{TSource, TKey}, IComparer{TKey}?)"/>
895/// Variant of <see cref="System.Linq.Enumerable.OrderByDescending{TSource, TKey}(IEnumerable{TSource}, Func{TSource, TKey}, IComparer{TKey}?)"/>
901/// Variant of <see cref="System.Linq.Enumerable.OrderBy{TSource, TKey}(IEnumerable{TSource}, Func{TSource, TKey}, IComparer{TKey}?)"/>
907/// Variant of <see cref="System.Linq.Enumerable.OrderByDescending{TSource, TKey}(IEnumerable{TSource}, Func{TSource, TKey}, IComparer{TKey}?)"/>
913/// Variant of <see cref="System.Linq.Enumerable.ThenBy{TSource, TKey}(IOrderedEnumerable{TSource}, Func{TSource, TKey}, IComparer{TKey}?)"/>
919/// Variant of <see cref="System.Linq.Enumerable.ThenBy{TSource, TKey}(IOrderedEnumerable{TSource}, Func{TSource, TKey}, IComparer{TKey}?)"/>
src\Dependencies\Collections\Extensions\IListExtensions.cs (4)
21public static bool HasDuplicates<TItem, TValue>(this IReadOnlyList<TItem> list, Func<TItem, TValue> selector)
31/// <seealso cref="ImmutableArrayExtensions.HasDuplicates{TItem, TValue}(System.Collections.Immutable.ImmutableArray{TItem}, Func{TItem, TValue}, IEqualityComparer{TValue})"/>
32/// <seealso cref="Roslyn.Utilities.EnumerableExtensions.HasDuplicates{TItem, TValue}(IEnumerable{TItem}, Func{TItem, TValue}, IEqualityComparer{TValue})"/>
34internal static bool HasDuplicates<TItem, TValue>(this IReadOnlyList<TItem> list, Func<TItem, TValue> selector, IEqualityComparer<TValue> comparer)
src\Dependencies\Collections\Extensions\ImmutableArrayExtensions.cs (27)
138public static ImmutableArray<TResult> SelectAsArray<TItem, TResult>(this ImmutableArray<TItem> items, Func<TItem, TResult> map)
198public static ImmutableArray<TResult> SelectAsArray<TItem, TResult>(this ImmutableArray<TItem> array, Func<TItem, bool> predicate, Func<TItem, TResult> selector)
247public static ImmutableArray<TResult> SelectManyAsArray<TItem, TResult>(this ImmutableArray<TItem> array, Func<TItem, IEnumerable<TResult>> selector)
267public static ImmutableArray<TResult> SelectManyAsArray<TItem, TResult>(this ImmutableArray<TItem> array, Func<TItem, ImmutableArray<TResult>> selector)
287public static ImmutableArray<TResult> SelectManyAsArray<TItem, TResult>(this ImmutableArray<TItem> array, Func<TItem, OneOrMany<TResult>> selector)
308public static ImmutableArray<TResult> SelectManyAsArray<TItem, TResult>(this ImmutableArray<TItem> array, Func<TItem, bool> predicate, Func<TItem, IEnumerable<TResult>> selector)
332public static ImmutableArray<TResult> SelectManyAsArray<TItem, TResult>(this ImmutableArray<TItem> array, Func<TItem, bool> predicate, Func<TItem, ImmutableArray<TResult>> selector)
356public static ImmutableArray<TResult> SelectManyAsArray<TItem, TResult>(this ImmutableArray<TItem> array, Func<TItem, bool> predicate, Func<TItem, OneOrMany<TResult>> selector)
493public static ImmutableArray<T> WhereAsArray<T>(this ImmutableArray<T> array, Func<T, bool> predicate)
504private static ImmutableArray<T> WhereAsArrayImpl<T, TArg>(ImmutableArray<T> array, Func<T, bool>? predicateWithoutArg, Func<T, TArg, bool>? predicateWithArg, TArg arg)
573public static async Task<bool> AnyAsync<T>(this ImmutableArray<T> array, Func<T, Task<bool>> predicateAsync)
595public static async ValueTask<T?> FirstOrDefaultAsync<T>(this ImmutableArray<T> array, Func<T, Task<bool>> predicateAsync)
757public static bool HasDuplicates<TItem, TValue>(this ImmutableArray<TItem> array, Func<TItem, TValue> selector)
767/// <seealso cref="Roslyn.Utilities.EnumerableExtensions.HasDuplicates{TItem, TValue}(IEnumerable{TItem}, Func{TItem, TValue}, IEqualityComparer{TValue})"/>
769internal static bool HasDuplicates<TItem, TValue>(this ImmutableArray<TItem> array, Func<TItem, TValue> selector, IEqualityComparer<TValue> comparer)
990/// Variant of <see cref="System.Linq.ImmutableArrayExtensions.FirstOrDefault{T}(ImmutableArray{T}, Func{T, bool})"/>
1004/// Variant of <see cref="System.Linq.ImmutableArrayExtensions.Single{T}(ImmutableArray{T}, Func{T, bool})"/>
1066/// Specialization of <see cref="System.Linq.Enumerable.Count{TSource}(IEnumerable{TSource}, Func{TSource, bool})"/> for <see cref="ImmutableArray{T}"/>.
1068public static int Count<T>(this ImmutableArray<T> items, Func<T, bool> predicate)
1086public static int Sum<T>(this ImmutableArray<T> items, Func<T, int> selector)
1213/// Variant of <see cref="System.Linq.ImmutableArrayExtensions.Any{T}(ImmutableArray{T}, Func{T, bool})"/>.
1227/// Variant of <see cref="System.Linq.ImmutableArrayExtensions.All{T}(ImmutableArray{T}, Func{T, bool})"/>.
1257public static bool Contains<T>(this ImmutableArray<T> array, Func<T, bool> predicate)
src\Dependencies\Collections\RoslynImmutableInterlocked.cs (7)
33public static bool Update<T>(ref ImmutableSegmentedList<T> location, Func<ImmutableSegmentedList<T>, ImmutableSegmentedList<T>> transformer)
154public static bool Update<T>(ref ImmutableSegmentedHashSet<T> location, Func<ImmutableSegmentedHashSet<T>, ImmutableSegmentedHashSet<T>> transformer)
276public static bool Update<TKey, TValue>(ref ImmutableSegmentedDictionary<TKey, TValue> location, Func<ImmutableSegmentedDictionary<TKey, TValue>, ImmutableSegmentedDictionary<TKey, TValue>> transformer)
410/// <inheritdoc cref="ImmutableInterlocked.GetOrAdd{TKey, TValue}(ref ImmutableDictionary{TKey, TValue}, TKey, Func{TKey, TValue})"/>
411public static TValue GetOrAdd<TKey, TValue>(ref ImmutableSegmentedDictionary<TKey, TValue> location, TKey key, Func<TKey, TValue> valueFactory)
458/// <inheritdoc cref="ImmutableInterlocked.AddOrUpdate{TKey, TValue}(ref ImmutableDictionary{TKey, TValue}, TKey, Func{TKey, TValue}, Func{TKey, TValue, TValue})"/>
459public static TValue AddOrUpdate<TKey, TValue>(ref ImmutableSegmentedDictionary<TKey, TValue> location, TKey key, Func<TKey, TValue> addValueFactory, Func<TKey, TValue, TValue> updateValueFactory)
src\Dependencies\Collections\Segmented\ImmutableSegmentedDictionary.cs (6)
68public static ImmutableSegmentedDictionary<TKey, TValue> ToImmutableSegmentedDictionary<TSource, TKey, TValue>(this IEnumerable<TSource> source, Func<TSource, TKey> keySelector, Func<TSource, TValue> elementSelector)
72public static ImmutableSegmentedDictionary<TKey, TValue> ToImmutableSegmentedDictionary<TSource, TKey, TValue>(this IEnumerable<TSource> source, Func<TSource, TKey> keySelector, Func<TSource, TValue> elementSelector, IEqualityComparer<TKey>? keyComparer)
86public static ImmutableSegmentedDictionary<TKey, TSource> ToImmutableSegmentedDictionary<TSource, TKey>(this IEnumerable<TSource> source, Func<TSource, TKey> keySelector)
90public static ImmutableSegmentedDictionary<TKey, TSource> ToImmutableSegmentedDictionary<TSource, TKey>(this IEnumerable<TSource> source, Func<TSource, TKey> keySelector, IEqualityComparer<TKey>? keyComparer)
src\Dependencies\PooledObjects\ArrayBuilder.cs (7)
457public void FreeAll(Func<T, ArrayBuilder<T>?> getNested)
560internal Dictionary<K, ImmutableArray<T>> ToDictionary<K>(Func<T, K> keySelector, IEqualityComparer<K>? comparer = null)
608public void AddRange<U>(ArrayBuilder<U> items, Func<U, T> selector)
745public ImmutableArray<S> SelectDistinct<S>(Func<T, S> selector)
763public bool Any(Func<T, bool> predicate)
787public bool All(Func<T, bool> predicate)
817public ImmutableArray<TResult> SelectAsArray<TResult>(Func<T, TResult> map)
src\Dependencies\PooledObjects\PooledDelegates.cs (9)
200public static Releaser GetPooledFunction<TArg, TResult>(Func<TArg, TResult> unboundFunction, TArg argument, out Func<TResult> boundFunction)
201=> GetPooledDelegate<FuncWithBoundArgument<TArg, TResult>, TArg, Func<TArg, TResult>, Func<TResult>>(unboundFunction, argument, out boundFunction);
204/// Equivalent to <see cref="GetPooledFunction{TArg, TResult}(Func{TArg, TResult}, TArg, out Func{TResult})"/>,
216/// Gets a <see cref="Func{T, TResult}"/> delegate, which calls <paramref name="unboundFunction"/> with the
246public static Releaser GetPooledFunction<T1, TArg, TResult>(Func<T1, TArg, TResult> unboundFunction, TArg argument, out Func<T1, TResult> boundFunction)
247=> GetPooledDelegate<FuncWithBoundArgument<T1, TArg, TResult>, TArg, Func<T1, TArg, TResult>, Func<T1, TResult>>(unboundFunction, argument, out boundFunction);
412: AbstractDelegateWithBoundArgument<FuncWithBoundArgument<TArg, TResult>, TArg, Func<TArg, TResult>, Func<TResult>>
432: AbstractDelegateWithBoundArgument<FuncWithBoundArgument<T1, TArg, TResult>, TArg, Func<T1, TArg, TResult>, Func<T1, TResult>>
434protected override Func<T1, TResult> Bind()
src\Dependencies\Threading\ParallelExtensions.NetFramework.cs (7)
122Func<object, Task> taskBody = static async o =>
287Func<object, Task> taskBody = static async o =>
395private readonly Func<object, Task> _taskBody;
418protected ForEachAsyncState(Func<object, Task> taskBody, bool needsLock, int dop, TaskScheduler scheduler, CancellationToken cancellationToken, Func<TSource, CancellationToken, ValueTask> body)
584IEnumerable<TSource> source, Func<object, Task> taskBody,
610IAsyncEnumerable<TSource> source, Func<object, Task> taskBody,
637T fromExclusive, T toExclusive, Func<object, Task> taskBody,
src\RoslynAnalyzers\Utilities\Compiler\Lightup\LightupHelpers.cs (6)
19internal static Func<TOperation, TProperty> CreateOperationPropertyAccessor<TOperation, TProperty>(Type? type, string propertyName, TProperty fallbackResult)
23internal static Func<TSyntax, TProperty> CreateSyntaxPropertyAccessor<TSyntax, TProperty>(Type? type, string propertyName, TProperty fallbackResult)
27internal static Func<TSymbol, TProperty> CreateSymbolPropertyAccessor<TSymbol, TProperty>(Type? type, string propertyName, TProperty fallbackResult)
31private static Func<T, TProperty> CreatePropertyAccessor<T, TProperty>(Type? type, string parameterName, string propertyName, TProperty fallbackResult)
50Expression<Func<T, TProperty>> expression = Expression.Lambda<Func<T, TProperty>>(result, parameter);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\ObjectExtensions.TypeSwitch.cs (161)
11public static TResult? TypeSwitch<TBaseType, TDerivedType1, TDerivedType2, TDerivedType3, TResult>(this TBaseType obj, Func<TDerivedType1, TResult> matchFunc1, Func<TDerivedType2, TResult> matchFunc2, Func<TDerivedType3, TResult> matchFunc3, Func<TBaseType, TResult>? defaultFunc = null)
25public static TResult? TypeSwitch<TBaseType, TDerivedType1, TDerivedType2, TDerivedType3, TDerivedType4, TResult>(this TBaseType obj, Func<TDerivedType1, TResult> matchFunc1, Func<TDerivedType2, TResult> matchFunc2, Func<TDerivedType3, TResult> matchFunc3, Func<TDerivedType4, TResult> matchFunc4, Func<TBaseType, TResult>? defaultFunc = null)
41public static TResult? TypeSwitch<TBaseType, TDerivedType1, TDerivedType2, TDerivedType3, TDerivedType4, TDerivedType5, TResult>(this TBaseType obj, Func<TDerivedType1, TResult> matchFunc1, Func<TDerivedType2, TResult> matchFunc2, Func<TDerivedType3, TResult> matchFunc3, Func<TDerivedType4, TResult> matchFunc4, Func<TDerivedType5, TResult> matchFunc5, Func<TBaseType, TResult>? defaultFunc = null)
59public static TResult? TypeSwitch<TBaseType, TDerivedType1, TDerivedType2, TDerivedType3, TDerivedType4, TDerivedType5, TDerivedType6, TResult>(this TBaseType obj, Func<TDerivedType1, TResult> matchFunc1, Func<TDerivedType2, TResult> matchFunc2, Func<TDerivedType3, TResult> matchFunc3, Func<TDerivedType4, TResult> matchFunc4, Func<TDerivedType5, TResult> matchFunc5, Func<TDerivedType6, TResult> matchFunc6, Func<TBaseType, TResult>? defaultFunc = null)
79public static TResult? TypeSwitch<TBaseType, TDerivedType1, TDerivedType2, TDerivedType3, TDerivedType4, TDerivedType5, TDerivedType6, TDerivedType7, TDerivedType8, TDerivedType9, TDerivedType10, TDerivedType11, TDerivedType12, TDerivedType13, TDerivedType14, TDerivedType15, TDerivedType16, TResult>(this TBaseType obj, Func<TDerivedType1, TResult> matchFunc1, Func<TDerivedType2, TResult> matchFunc2, Func<TDerivedType3, TResult> matchFunc3, Func<TDerivedType4, TResult> matchFunc4, Func<TDerivedType5, TResult> matchFunc5, Func<TDerivedType6, TResult> matchFunc6, Func<TDerivedType7, TResult> matchFunc7, Func<TDerivedType8, TResult> matchFunc8, Func<TDerivedType9, TResult> matchFunc9, Func<TDerivedType10, TResult> matchFunc10, Func<TDerivedType11, TResult> matchFunc11, Func<TDerivedType12, TResult> matchFunc12, Func<TDerivedType13, TResult> matchFunc13, Func<TDerivedType14, TResult> matchFunc14, Func<TDerivedType15, TResult> matchFunc15, Func<TDerivedType16, TResult> matchFunc16, Func<TBaseType, TResult>? defaultFunc = null)
119public static TResult? TypeSwitch<TBaseType, TDerivedType1, TDerivedType2, TDerivedType3, TDerivedType4, TDerivedType5, TDerivedType6, TDerivedType7, TDerivedType8, TDerivedType9, TDerivedType10, TDerivedType11, TDerivedType12, TDerivedType13, TDerivedType14, TDerivedType15, TDerivedType16, TDerivedType17, TResult>(this TBaseType obj, Func<TDerivedType1, TResult> matchFunc1, Func<TDerivedType2, TResult> matchFunc2, Func<TDerivedType3, TResult> matchFunc3, Func<TDerivedType4, TResult> matchFunc4, Func<TDerivedType5, TResult> matchFunc5, Func<TDerivedType6, TResult> matchFunc6, Func<TDerivedType7, TResult> matchFunc7, Func<TDerivedType8, TResult> matchFunc8, Func<TDerivedType9, TResult> matchFunc9, Func<TDerivedType10, TResult> matchFunc10, Func<TDerivedType11, TResult> matchFunc11, Func<TDerivedType12, TResult> matchFunc12, Func<TDerivedType13, TResult> matchFunc13, Func<TDerivedType14, TResult> matchFunc14, Func<TDerivedType15, TResult> matchFunc15, Func<TDerivedType16, TResult> matchFunc16, Func<TDerivedType17, TResult> matchFunc17, Func<TBaseType, TResult>? defaultFunc = null)
161public static TResult? TypeSwitch<TBaseType, TDerivedType1, TDerivedType2, TDerivedType3, TDerivedType4, TDerivedType5, TDerivedType6, TDerivedType7, TDerivedType8, TDerivedType9, TDerivedType10, TDerivedType11, TDerivedType12, TDerivedType13, TDerivedType14, TDerivedType15, TDerivedType16, TDerivedType17, TDerivedType18, TDerivedType19, TDerivedType20, TDerivedType21, TDerivedType22, TResult>(this TBaseType obj, Func<TDerivedType1, TResult> matchFunc1, Func<TDerivedType2, TResult> matchFunc2, Func<TDerivedType3, TResult> matchFunc3, Func<TDerivedType4, TResult> matchFunc4, Func<TDerivedType5, TResult> matchFunc5, Func<TDerivedType6, TResult> matchFunc6, Func<TDerivedType7, TResult> matchFunc7, Func<TDerivedType8, TResult> matchFunc8, Func<TDerivedType9, TResult> matchFunc9, Func<TDerivedType10, TResult> matchFunc10, Func<TDerivedType11, TResult> matchFunc11, Func<TDerivedType12, TResult> matchFunc12, Func<TDerivedType13, TResult> matchFunc13, Func<TDerivedType14, TResult> matchFunc14, Func<TDerivedType15, TResult> matchFunc15, Func<TDerivedType16, TResult> matchFunc16, Func<TDerivedType17, TResult> matchFunc17, Func<TDerivedType18, TResult> matchFunc18, Func<TDerivedType19, TResult> matchFunc19, Func<TDerivedType20, TResult> matchFunc20, Func<TDerivedType21, TResult> matchFunc21, Func<TDerivedType22, TResult> matchFunc22, Func<TBaseType, TResult>? defaultFunc = null)
213public static TResult? TypeSwitch<TBaseType, TDerivedType1, TDerivedType2, TDerivedType3, TDerivedType4, TDerivedType5, TDerivedType6, TDerivedType7, TDerivedType8, TDerivedType9, TDerivedType10, TDerivedType11, TDerivedType12, TDerivedType13, TDerivedType14, TDerivedType15, TDerivedType16, TDerivedType17, TDerivedType18, TDerivedType19, TDerivedType20, TDerivedType21, TDerivedType22, TDerivedType23, TDerivedType24, TDerivedType25, TDerivedType26, TDerivedType27, TDerivedType28, TDerivedType29, TDerivedType30, TDerivedType31, TDerivedType32, TDerivedType33, TDerivedType34, TDerivedType35, TDerivedType36, TDerivedType37, TDerivedType38, TDerivedType39, TResult>(this TBaseType obj, Func<TDerivedType1, TResult> matchFunc1, Func<TDerivedType2, TResult> matchFunc2, Func<TDerivedType3, TResult> matchFunc3, Func<TDerivedType4, TResult> matchFunc4, Func<TDerivedType5, TResult> matchFunc5, Func<TDerivedType6, TResult> matchFunc6, Func<TDerivedType7, TResult> matchFunc7, Func<TDerivedType8, TResult> matchFunc8, Func<TDerivedType9, TResult> matchFunc9, Func<TDerivedType10, TResult> matchFunc10, Func<TDerivedType11, TResult> matchFunc11, Func<TDerivedType12, TResult> matchFunc12, Func<TDerivedType13, TResult> matchFunc13, Func<TDerivedType14, TResult> matchFunc14, Func<TDerivedType15, TResult> matchFunc15, Func<TDerivedType16, TResult> matchFunc16, Func<TDerivedType17, TResult> matchFunc17, Func<TDerivedType18, TResult> matchFunc18, Func<TDerivedType19, TResult> matchFunc19, Func<TDerivedType20, TResult> matchFunc20, Func<TDerivedType21, TResult> matchFunc21, Func<TDerivedType22, TResult> matchFunc22, Func<TDerivedType23, TResult> matchFunc23, Func<TDerivedType24, TResult> matchFunc24, Func<TDerivedType25, TResult> matchFunc25, Func<TDerivedType26, TResult> matchFunc26, Func<TDerivedType27, TResult> matchFunc27, Func<TDerivedType28, TResult> matchFunc28, Func<TDerivedType29, TResult> matchFunc29, Func<TDerivedType30, TResult> matchFunc30, Func<TDerivedType31, TResult> matchFunc31, Func<TDerivedType32, TResult> matchFunc32, Func<TDerivedType33, TResult> matchFunc33, Func<TDerivedType34, TResult> matchFunc34, Func<TDerivedType35, TResult> matchFunc35, Func<TDerivedType36, TResult> matchFunc36, Func<TDerivedType37, TResult> matchFunc37, Func<TDerivedType38, TResult> matchFunc38, Func<TDerivedType39, TResult> matchFunc39, Func<TBaseType, TResult>? defaultFunc = null)
299public static TResult? TypeSwitch<TBaseType, TDerivedType1, TDerivedType2, TDerivedType3, TDerivedType4, TDerivedType5, TDerivedType6, TDerivedType7, TDerivedType8, TDerivedType9, TDerivedType10, TDerivedType11, TDerivedType12, TDerivedType13, TDerivedType14, TDerivedType15, TDerivedType16, TDerivedType17, TDerivedType18, TDerivedType19, TDerivedType20, TDerivedType21, TDerivedType22, TDerivedType23, TDerivedType24, TDerivedType25, TDerivedType26, TDerivedType27, TDerivedType28, TDerivedType29, TDerivedType30, TDerivedType31, TDerivedType32, TDerivedType33, TDerivedType34, TDerivedType35, TDerivedType36, TDerivedType37, TDerivedType38, TDerivedType39, TDerivedType40, TResult>(this TBaseType obj, Func<TDerivedType1, TResult> matchFunc1, Func<TDerivedType2, TResult> matchFunc2, Func<TDerivedType3, TResult> matchFunc3, Func<TDerivedType4, TResult> matchFunc4, Func<TDerivedType5, TResult> matchFunc5, Func<TDerivedType6, TResult> matchFunc6, Func<TDerivedType7, TResult> matchFunc7, Func<TDerivedType8, TResult> matchFunc8, Func<TDerivedType9, TResult> matchFunc9, Func<TDerivedType10, TResult> matchFunc10, Func<TDerivedType11, TResult> matchFunc11, Func<TDerivedType12, TResult> matchFunc12, Func<TDerivedType13, TResult> matchFunc13, Func<TDerivedType14, TResult> matchFunc14, Func<TDerivedType15, TResult> matchFunc15, Func<TDerivedType16, TResult> matchFunc16, Func<TDerivedType17, TResult> matchFunc17, Func<TDerivedType18, TResult> matchFunc18, Func<TDerivedType19, TResult> matchFunc19, Func<TDerivedType20, TResult> matchFunc20, Func<TDerivedType21, TResult> matchFunc21, Func<TDerivedType22, TResult> matchFunc22, Func<TDerivedType23, TResult> matchFunc23, Func<TDerivedType24, TResult> matchFunc24, Func<TDerivedType25, TResult> matchFunc25, Func<TDerivedType26, TResult> matchFunc26, Func<TDerivedType27, TResult> matchFunc27, Func<TDerivedType28, TResult> matchFunc28, Func<TDerivedType29, TResult> matchFunc29, Func<TDerivedType30, TResult> matchFunc30, Func<TDerivedType31, TResult> matchFunc31, Func<TDerivedType32, TResult> matchFunc32, Func<TDerivedType33, TResult> matchFunc33, Func<TDerivedType34, TResult> matchFunc34, Func<TDerivedType35, TResult> matchFunc35, Func<TDerivedType36, TResult> matchFunc36, Func<TDerivedType37, TResult> matchFunc37, Func<TDerivedType38, TResult> matchFunc38, Func<TDerivedType39, TResult> matchFunc39, Func<TDerivedType40, TResult> matchFunc40, Func<TBaseType, TResult>? defaultFunc = null)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\SyntaxNodeExtensions.cs (6)
104this SyntaxNode node, TextSpan searchSpan, Func<SyntaxNode, bool> predicate)
129public static bool CheckParent<T>([NotNullWhen(returnValue: true)] this SyntaxNode? node, Func<T, bool> valueChecker) where T : SyntaxNode
145public static bool IsChildNode<TParent>(this SyntaxNode node, Func<TParent, SyntaxNode?> childGetter)
162public static bool IsFoundUnder<TParent>(this SyntaxNode node, Func<TParent, SyntaxNode?> childGetter)
201public static SyntaxNode? FindInnermostCommonNode(this IEnumerable<SyntaxNode> nodes, Func<SyntaxNode, bool> predicate)
806public static TNode? FirstAncestorOrSelfUntil<TNode>(this SyntaxNode? node, Func<SyntaxNode, bool> predicate)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\SyntaxTokenExtensions.cs (5)
15public static SyntaxNode? GetAncestor(this SyntaxToken token, Func<SyntaxNode, bool>? predicate)
18public static T? GetAncestor<T>(this SyntaxToken token, Func<T, bool>? predicate = null) where T : SyntaxNode
21public static T GetRequiredAncestor<T>(this SyntaxToken token, Func<T, bool>? predicate = null) where T : SyntaxNode
32public static IEnumerable<SyntaxNode> GetAncestors(this SyntaxToken token, Func<SyntaxNode, bool> predicate)
42public static bool CheckParent<T>(this SyntaxToken token, Func<T, bool> valueChecker) where T : SyntaxNode
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Options\PublicOptionFactory.cs (4)
17public static Option2<T> WithPublicOption<T, TPublicValue>(this Option2<T> option, string feature, string name, Func<T, TPublicValue> toPublicValue, Func<TPublicValue, T> toInternalValue)
20public static PerLanguageOption2<T> WithPublicOption<T, TPublicValue>(this PerLanguageOption2<T> option, string feature, string name, Func<T, TPublicValue> toPublicValue, Func<TPublicValue, T> toInternalValue)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\TopologicalSorter.cs (8)
13public static IEnumerable<T> TopologicalSort<T>(this IEnumerable<T> items, Func<T, IEnumerable<T>> itemsBefore)
26public static IEnumerable<T> TopologicalSort<T>(this IEnumerable<T> items, Func<T, IEnumerable<T>> itemsBefore, Func<T, IEnumerable<T>> itemsAfter)
29var combinedItemsBefore = CreateCombinedItemsBefore(items, itemsBefore, itemsAfter);
35Func<T, IEnumerable<T>> itemsBefore,
50private static Func<T, IEnumerable<T>> CreateCombinedItemsBefore<T>(IEnumerable<T> items, Func<T, IEnumerable<T>> itemsBefore, Func<T, IEnumerable<T>> itemsAfter)
Metrics.Legacy (408)
src\Compilers\Core\Portable\FileSystem\FileUtilities.cs (4)
47Func<string, bool> fileExists)
322public static T RethrowExceptionsAsIOException<T, TArg>(Func<TArg, T> operation, TArg arg)
339public static async Task<T> RethrowExceptionsAsIOExceptionAsync<T, TArg>(Func<TArg, Task<T>> operation, TArg arg)
355internal static Stream CreateFileStreamChecked(Func<string, Stream> factory, string path, string? paramName = null)
src\Compilers\Core\Portable\InternalUtilities\InterlockedOperations.cs (5)
46public static T Initialize<T, TArg>([NotNull] ref T? target, Func<TArg, T> valueFactory, TArg arg)
66public static int Initialize<TArg>(ref int target, int uninitializedValue, Func<TArg, int> valueFactory, TArg arg)
103public static T? Initialize<T, TArg>([NotNull] ref StrongBox<T?>? target, Func<TArg, T?> valueFactory, TArg arg)
183public static ImmutableArray<T> Initialize<T, TArg>(ref ImmutableArray<T> target, Func<TArg, ImmutableArray<T>> createArray, TArg arg)
193private static ImmutableArray<T> Initialize_Slow<T, TArg>(ref ImmutableArray<T> target, Func<TArg, ImmutableArray<T>> createArray, TArg arg)
src\Compilers\Core\Portable\SourceGeneration\GeneratedCodeUtilities.cs (4)
49SyntaxTree tree, Func<SyntaxTrivia, bool> isComment, CancellationToken cancellationToken)
55internal static bool IsGeneratedCode(string? filePath, SyntaxNode root, Func<SyntaxTrivia, bool> isComment)
88private static bool BeginsWithAutoGeneratedComment(SyntaxNode root, Func<SyntaxTrivia, bool> isComment)
118SyntaxTree tree, Func<SyntaxTrivia, bool> isComment, CancellationToken cancellationToken)
src\Dependencies\Collections\Extensions\IEnumerableExtensions.cs (30)
164public static T? FirstOrNull<T>(this IEnumerable<T> source, Func<T, bool> predicate)
182public static T? SingleOrNull<T>(this IEnumerable<T> source, Func<T, bool> predicate)
261public static bool HasDuplicates<TItem, TValue>(this IEnumerable<TItem> source, Func<TItem, TValue> selector)
271/// <seealso cref="Microsoft.CodeAnalysis.ImmutableArrayExtensions.HasDuplicates{TItem, TValue}(ImmutableArray{TItem}, Func{TItem, TValue}, IEqualityComparer{TValue})"/>
273public static bool HasDuplicates<TItem, TValue>(this IEnumerable<TItem> source, Func<TItem, TValue> selector, IEqualityComparer<TValue> comparer)
321private static readonly Func<object, bool> s_notNullTest = x => x != null;
331return source.Where((Func<T?, bool>)s_notNullTest)!;
376public static ImmutableArray<T> WhereAsArray<T>(this IEnumerable<T> values, Func<T, bool> predicate)
407public static ImmutableArray<TResult> SelectAsArray<TSource, TResult>(this IEnumerable<TSource>? source, Func<TSource, TResult> selector)
417public static ImmutableArray<TResult> SelectAsArray<TItem, TResult>(this IEnumerable<TItem>? source, Func<TItem, bool> predicate, Func<TItem, TResult> selector)
461public static ImmutableArray<TResult> SelectAsArray<TSource, TResult>(this IReadOnlyCollection<TSource>? source, Func<TSource, TResult> selector)
485public static ImmutableArray<TResult> SelectManyAsArray<TSource, TResult>(this IEnumerable<TSource>? source, Func<TSource, IEnumerable<TResult>> selector)
507public static ImmutableArray<TResult> SelectManyAsArray<TItem, TResult>(this IReadOnlyCollection<TItem>? source, Func<TItem, IEnumerable<TResult>> selector)
533public static ImmutableArray<TResult> SelectManyAsArray<TSource, TResult>(this IEnumerable<TSource>? source, Func<TSource, OneOrMany<TResult>> selector)
547public static async ValueTask<ImmutableArray<TResult>> SelectAsArrayAsync<TItem, TResult>(this IEnumerable<TItem> source, Func<TItem, ValueTask<TResult>> selector)
764internal static Dictionary<K, ImmutableArray<T>> ToMultiDictionary<K, T>(this IEnumerable<T> data, Func<T, K> keySelector, IEqualityComparer<K>? comparer = null)
815public static readonly Func<T, T> Identity = t => t;
816public static readonly Func<T, bool> True = t => true;
840/// Alias for <see cref="System.Linq.Enumerable.Any{TSource}(IEnumerable{TSource}, Func{TSource, bool})"/>
842public static bool Contains<T>(this IEnumerable<T> sequence, Func<T, bool> predicate)
846/// Variant of <see cref="System.Linq.Enumerable.Count{TSource}(IEnumerable{TSource}, Func{TSource, bool})"/>
861/// Variant of <see cref="System.Linq.Enumerable.FirstOrDefault{TSource}(IEnumerable{TSource}, Func{TSource, bool})"/>
875/// Variant of <see cref="System.Linq.Enumerable.Any{TSource}(IEnumerable{TSource}, Func{TSource, bool})"/>
889/// Variant of <see cref="System.Linq.Enumerable.OrderBy{TSource, TKey}(IEnumerable{TSource}, Func{TSource, TKey}, IComparer{TKey}?)"/>
895/// Variant of <see cref="System.Linq.Enumerable.OrderByDescending{TSource, TKey}(IEnumerable{TSource}, Func{TSource, TKey}, IComparer{TKey}?)"/>
901/// Variant of <see cref="System.Linq.Enumerable.OrderBy{TSource, TKey}(IEnumerable{TSource}, Func{TSource, TKey}, IComparer{TKey}?)"/>
907/// Variant of <see cref="System.Linq.Enumerable.OrderByDescending{TSource, TKey}(IEnumerable{TSource}, Func{TSource, TKey}, IComparer{TKey}?)"/>
913/// Variant of <see cref="System.Linq.Enumerable.ThenBy{TSource, TKey}(IOrderedEnumerable{TSource}, Func{TSource, TKey}, IComparer{TKey}?)"/>
919/// Variant of <see cref="System.Linq.Enumerable.ThenBy{TSource, TKey}(IOrderedEnumerable{TSource}, Func{TSource, TKey}, IComparer{TKey}?)"/>
src\Dependencies\Collections\Extensions\IListExtensions.cs (4)
21public static bool HasDuplicates<TItem, TValue>(this IReadOnlyList<TItem> list, Func<TItem, TValue> selector)
31/// <seealso cref="ImmutableArrayExtensions.HasDuplicates{TItem, TValue}(System.Collections.Immutable.ImmutableArray{TItem}, Func{TItem, TValue}, IEqualityComparer{TValue})"/>
32/// <seealso cref="Roslyn.Utilities.EnumerableExtensions.HasDuplicates{TItem, TValue}(IEnumerable{TItem}, Func{TItem, TValue}, IEqualityComparer{TValue})"/>
34internal static bool HasDuplicates<TItem, TValue>(this IReadOnlyList<TItem> list, Func<TItem, TValue> selector, IEqualityComparer<TValue> comparer)
src\Dependencies\Collections\Extensions\ImmutableArrayExtensions.cs (27)
138public static ImmutableArray<TResult> SelectAsArray<TItem, TResult>(this ImmutableArray<TItem> items, Func<TItem, TResult> map)
198public static ImmutableArray<TResult> SelectAsArray<TItem, TResult>(this ImmutableArray<TItem> array, Func<TItem, bool> predicate, Func<TItem, TResult> selector)
247public static ImmutableArray<TResult> SelectManyAsArray<TItem, TResult>(this ImmutableArray<TItem> array, Func<TItem, IEnumerable<TResult>> selector)
267public static ImmutableArray<TResult> SelectManyAsArray<TItem, TResult>(this ImmutableArray<TItem> array, Func<TItem, ImmutableArray<TResult>> selector)
287public static ImmutableArray<TResult> SelectManyAsArray<TItem, TResult>(this ImmutableArray<TItem> array, Func<TItem, OneOrMany<TResult>> selector)
308public static ImmutableArray<TResult> SelectManyAsArray<TItem, TResult>(this ImmutableArray<TItem> array, Func<TItem, bool> predicate, Func<TItem, IEnumerable<TResult>> selector)
332public static ImmutableArray<TResult> SelectManyAsArray<TItem, TResult>(this ImmutableArray<TItem> array, Func<TItem, bool> predicate, Func<TItem, ImmutableArray<TResult>> selector)
356public static ImmutableArray<TResult> SelectManyAsArray<TItem, TResult>(this ImmutableArray<TItem> array, Func<TItem, bool> predicate, Func<TItem, OneOrMany<TResult>> selector)
493public static ImmutableArray<T> WhereAsArray<T>(this ImmutableArray<T> array, Func<T, bool> predicate)
504private static ImmutableArray<T> WhereAsArrayImpl<T, TArg>(ImmutableArray<T> array, Func<T, bool>? predicateWithoutArg, Func<T, TArg, bool>? predicateWithArg, TArg arg)
573public static async Task<bool> AnyAsync<T>(this ImmutableArray<T> array, Func<T, Task<bool>> predicateAsync)
595public static async ValueTask<T?> FirstOrDefaultAsync<T>(this ImmutableArray<T> array, Func<T, Task<bool>> predicateAsync)
757public static bool HasDuplicates<TItem, TValue>(this ImmutableArray<TItem> array, Func<TItem, TValue> selector)
767/// <seealso cref="Roslyn.Utilities.EnumerableExtensions.HasDuplicates{TItem, TValue}(IEnumerable{TItem}, Func{TItem, TValue}, IEqualityComparer{TValue})"/>
769internal static bool HasDuplicates<TItem, TValue>(this ImmutableArray<TItem> array, Func<TItem, TValue> selector, IEqualityComparer<TValue> comparer)
990/// Variant of <see cref="System.Linq.ImmutableArrayExtensions.FirstOrDefault{T}(ImmutableArray{T}, Func{T, bool})"/>
1004/// Variant of <see cref="System.Linq.ImmutableArrayExtensions.Single{T}(ImmutableArray{T}, Func{T, bool})"/>
1066/// Specialization of <see cref="System.Linq.Enumerable.Count{TSource}(IEnumerable{TSource}, Func{TSource, bool})"/> for <see cref="ImmutableArray{T}"/>.
1068public static int Count<T>(this ImmutableArray<T> items, Func<T, bool> predicate)
1086public static int Sum<T>(this ImmutableArray<T> items, Func<T, int> selector)
1213/// Variant of <see cref="System.Linq.ImmutableArrayExtensions.Any{T}(ImmutableArray{T}, Func{T, bool})"/>.
1227/// Variant of <see cref="System.Linq.ImmutableArrayExtensions.All{T}(ImmutableArray{T}, Func{T, bool})"/>.
1257public static bool Contains<T>(this ImmutableArray<T> array, Func<T, bool> predicate)
src\Dependencies\Collections\RoslynImmutableInterlocked.cs (7)
33public static bool Update<T>(ref ImmutableSegmentedList<T> location, Func<ImmutableSegmentedList<T>, ImmutableSegmentedList<T>> transformer)
154public static bool Update<T>(ref ImmutableSegmentedHashSet<T> location, Func<ImmutableSegmentedHashSet<T>, ImmutableSegmentedHashSet<T>> transformer)
276public static bool Update<TKey, TValue>(ref ImmutableSegmentedDictionary<TKey, TValue> location, Func<ImmutableSegmentedDictionary<TKey, TValue>, ImmutableSegmentedDictionary<TKey, TValue>> transformer)
410/// <inheritdoc cref="ImmutableInterlocked.GetOrAdd{TKey, TValue}(ref ImmutableDictionary{TKey, TValue}, TKey, Func{TKey, TValue})"/>
411public static TValue GetOrAdd<TKey, TValue>(ref ImmutableSegmentedDictionary<TKey, TValue> location, TKey key, Func<TKey, TValue> valueFactory)
458/// <inheritdoc cref="ImmutableInterlocked.AddOrUpdate{TKey, TValue}(ref ImmutableDictionary{TKey, TValue}, TKey, Func{TKey, TValue}, Func{TKey, TValue, TValue})"/>
459public static TValue AddOrUpdate<TKey, TValue>(ref ImmutableSegmentedDictionary<TKey, TValue> location, TKey key, Func<TKey, TValue> addValueFactory, Func<TKey, TValue, TValue> updateValueFactory)
src\Dependencies\Collections\Segmented\ImmutableSegmentedDictionary.cs (6)
68public static ImmutableSegmentedDictionary<TKey, TValue> ToImmutableSegmentedDictionary<TSource, TKey, TValue>(this IEnumerable<TSource> source, Func<TSource, TKey> keySelector, Func<TSource, TValue> elementSelector)
72public static ImmutableSegmentedDictionary<TKey, TValue> ToImmutableSegmentedDictionary<TSource, TKey, TValue>(this IEnumerable<TSource> source, Func<TSource, TKey> keySelector, Func<TSource, TValue> elementSelector, IEqualityComparer<TKey>? keyComparer)
86public static ImmutableSegmentedDictionary<TKey, TSource> ToImmutableSegmentedDictionary<TSource, TKey>(this IEnumerable<TSource> source, Func<TSource, TKey> keySelector)
90public static ImmutableSegmentedDictionary<TKey, TSource> ToImmutableSegmentedDictionary<TSource, TKey>(this IEnumerable<TSource> source, Func<TSource, TKey> keySelector, IEqualityComparer<TKey>? keyComparer)
src\Dependencies\PooledObjects\ArrayBuilder.cs (7)
457public void FreeAll(Func<T, ArrayBuilder<T>?> getNested)
560internal Dictionary<K, ImmutableArray<T>> ToDictionary<K>(Func<T, K> keySelector, IEqualityComparer<K>? comparer = null)
608public void AddRange<U>(ArrayBuilder<U> items, Func<U, T> selector)
745public ImmutableArray<S> SelectDistinct<S>(Func<T, S> selector)
763public bool Any(Func<T, bool> predicate)
787public bool All(Func<T, bool> predicate)
817public ImmutableArray<TResult> SelectAsArray<TResult>(Func<T, TResult> map)
src\Dependencies\PooledObjects\PooledDelegates.cs (9)
200public static Releaser GetPooledFunction<TArg, TResult>(Func<TArg, TResult> unboundFunction, TArg argument, out Func<TResult> boundFunction)
201=> GetPooledDelegate<FuncWithBoundArgument<TArg, TResult>, TArg, Func<TArg, TResult>, Func<TResult>>(unboundFunction, argument, out boundFunction);
204/// Equivalent to <see cref="GetPooledFunction{TArg, TResult}(Func{TArg, TResult}, TArg, out Func{TResult})"/>,
216/// Gets a <see cref="Func{T, TResult}"/> delegate, which calls <paramref name="unboundFunction"/> with the
246public static Releaser GetPooledFunction<T1, TArg, TResult>(Func<T1, TArg, TResult> unboundFunction, TArg argument, out Func<T1, TResult> boundFunction)
247=> GetPooledDelegate<FuncWithBoundArgument<T1, TArg, TResult>, TArg, Func<T1, TArg, TResult>, Func<T1, TResult>>(unboundFunction, argument, out boundFunction);
412: AbstractDelegateWithBoundArgument<FuncWithBoundArgument<TArg, TResult>, TArg, Func<TArg, TResult>, Func<TResult>>
432: AbstractDelegateWithBoundArgument<FuncWithBoundArgument<T1, TArg, TResult>, TArg, Func<T1, TArg, TResult>, Func<T1, TResult>>
434protected override Func<T1, TResult> Bind()
src\Dependencies\Threading\ParallelExtensions.NetFramework.cs (7)
122Func<object, Task> taskBody = static async o =>
287Func<object, Task> taskBody = static async o =>
395private readonly Func<object, Task> _taskBody;
418protected ForEachAsyncState(Func<object, Task> taskBody, bool needsLock, int dop, TaskScheduler scheduler, CancellationToken cancellationToken, Func<TSource, CancellationToken, ValueTask> body)
584IEnumerable<TSource> source, Func<object, Task> taskBody,
610IAsyncEnumerable<TSource> source, Func<object, Task> taskBody,
637T fromExclusive, T toExclusive, Func<object, Task> taskBody,
src\RoslynAnalyzers\Utilities\Compiler\Lightup\LightupHelpers.cs (6)
19internal static Func<TOperation, TProperty> CreateOperationPropertyAccessor<TOperation, TProperty>(Type? type, string propertyName, TProperty fallbackResult)
23internal static Func<TSyntax, TProperty> CreateSyntaxPropertyAccessor<TSyntax, TProperty>(Type? type, string propertyName, TProperty fallbackResult)
27internal static Func<TSymbol, TProperty> CreateSymbolPropertyAccessor<TSymbol, TProperty>(Type? type, string propertyName, TProperty fallbackResult)
31private static Func<T, TProperty> CreatePropertyAccessor<T, TProperty>(Type? type, string parameterName, string propertyName, TProperty fallbackResult)
50Expression<Func<T, TProperty>> expression = Expression.Lambda<Func<T, TProperty>>(result, parameter);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\ObjectExtensions.TypeSwitch.cs (161)
11public static TResult? TypeSwitch<TBaseType, TDerivedType1, TDerivedType2, TDerivedType3, TResult>(this TBaseType obj, Func<TDerivedType1, TResult> matchFunc1, Func<TDerivedType2, TResult> matchFunc2, Func<TDerivedType3, TResult> matchFunc3, Func<TBaseType, TResult>? defaultFunc = null)
25public static TResult? TypeSwitch<TBaseType, TDerivedType1, TDerivedType2, TDerivedType3, TDerivedType4, TResult>(this TBaseType obj, Func<TDerivedType1, TResult> matchFunc1, Func<TDerivedType2, TResult> matchFunc2, Func<TDerivedType3, TResult> matchFunc3, Func<TDerivedType4, TResult> matchFunc4, Func<TBaseType, TResult>? defaultFunc = null)
41public static TResult? TypeSwitch<TBaseType, TDerivedType1, TDerivedType2, TDerivedType3, TDerivedType4, TDerivedType5, TResult>(this TBaseType obj, Func<TDerivedType1, TResult> matchFunc1, Func<TDerivedType2, TResult> matchFunc2, Func<TDerivedType3, TResult> matchFunc3, Func<TDerivedType4, TResult> matchFunc4, Func<TDerivedType5, TResult> matchFunc5, Func<TBaseType, TResult>? defaultFunc = null)
59public static TResult? TypeSwitch<TBaseType, TDerivedType1, TDerivedType2, TDerivedType3, TDerivedType4, TDerivedType5, TDerivedType6, TResult>(this TBaseType obj, Func<TDerivedType1, TResult> matchFunc1, Func<TDerivedType2, TResult> matchFunc2, Func<TDerivedType3, TResult> matchFunc3, Func<TDerivedType4, TResult> matchFunc4, Func<TDerivedType5, TResult> matchFunc5, Func<TDerivedType6, TResult> matchFunc6, Func<TBaseType, TResult>? defaultFunc = null)
79public static TResult? TypeSwitch<TBaseType, TDerivedType1, TDerivedType2, TDerivedType3, TDerivedType4, TDerivedType5, TDerivedType6, TDerivedType7, TDerivedType8, TDerivedType9, TDerivedType10, TDerivedType11, TDerivedType12, TDerivedType13, TDerivedType14, TDerivedType15, TDerivedType16, TResult>(this TBaseType obj, Func<TDerivedType1, TResult> matchFunc1, Func<TDerivedType2, TResult> matchFunc2, Func<TDerivedType3, TResult> matchFunc3, Func<TDerivedType4, TResult> matchFunc4, Func<TDerivedType5, TResult> matchFunc5, Func<TDerivedType6, TResult> matchFunc6, Func<TDerivedType7, TResult> matchFunc7, Func<TDerivedType8, TResult> matchFunc8, Func<TDerivedType9, TResult> matchFunc9, Func<TDerivedType10, TResult> matchFunc10, Func<TDerivedType11, TResult> matchFunc11, Func<TDerivedType12, TResult> matchFunc12, Func<TDerivedType13, TResult> matchFunc13, Func<TDerivedType14, TResult> matchFunc14, Func<TDerivedType15, TResult> matchFunc15, Func<TDerivedType16, TResult> matchFunc16, Func<TBaseType, TResult>? defaultFunc = null)
119public static TResult? TypeSwitch<TBaseType, TDerivedType1, TDerivedType2, TDerivedType3, TDerivedType4, TDerivedType5, TDerivedType6, TDerivedType7, TDerivedType8, TDerivedType9, TDerivedType10, TDerivedType11, TDerivedType12, TDerivedType13, TDerivedType14, TDerivedType15, TDerivedType16, TDerivedType17, TResult>(this TBaseType obj, Func<TDerivedType1, TResult> matchFunc1, Func<TDerivedType2, TResult> matchFunc2, Func<TDerivedType3, TResult> matchFunc3, Func<TDerivedType4, TResult> matchFunc4, Func<TDerivedType5, TResult> matchFunc5, Func<TDerivedType6, TResult> matchFunc6, Func<TDerivedType7, TResult> matchFunc7, Func<TDerivedType8, TResult> matchFunc8, Func<TDerivedType9, TResult> matchFunc9, Func<TDerivedType10, TResult> matchFunc10, Func<TDerivedType11, TResult> matchFunc11, Func<TDerivedType12, TResult> matchFunc12, Func<TDerivedType13, TResult> matchFunc13, Func<TDerivedType14, TResult> matchFunc14, Func<TDerivedType15, TResult> matchFunc15, Func<TDerivedType16, TResult> matchFunc16, Func<TDerivedType17, TResult> matchFunc17, Func<TBaseType, TResult>? defaultFunc = null)
161public static TResult? TypeSwitch<TBaseType, TDerivedType1, TDerivedType2, TDerivedType3, TDerivedType4, TDerivedType5, TDerivedType6, TDerivedType7, TDerivedType8, TDerivedType9, TDerivedType10, TDerivedType11, TDerivedType12, TDerivedType13, TDerivedType14, TDerivedType15, TDerivedType16, TDerivedType17, TDerivedType18, TDerivedType19, TDerivedType20, TDerivedType21, TDerivedType22, TResult>(this TBaseType obj, Func<TDerivedType1, TResult> matchFunc1, Func<TDerivedType2, TResult> matchFunc2, Func<TDerivedType3, TResult> matchFunc3, Func<TDerivedType4, TResult> matchFunc4, Func<TDerivedType5, TResult> matchFunc5, Func<TDerivedType6, TResult> matchFunc6, Func<TDerivedType7, TResult> matchFunc7, Func<TDerivedType8, TResult> matchFunc8, Func<TDerivedType9, TResult> matchFunc9, Func<TDerivedType10, TResult> matchFunc10, Func<TDerivedType11, TResult> matchFunc11, Func<TDerivedType12, TResult> matchFunc12, Func<TDerivedType13, TResult> matchFunc13, Func<TDerivedType14, TResult> matchFunc14, Func<TDerivedType15, TResult> matchFunc15, Func<TDerivedType16, TResult> matchFunc16, Func<TDerivedType17, TResult> matchFunc17, Func<TDerivedType18, TResult> matchFunc18, Func<TDerivedType19, TResult> matchFunc19, Func<TDerivedType20, TResult> matchFunc20, Func<TDerivedType21, TResult> matchFunc21, Func<TDerivedType22, TResult> matchFunc22, Func<TBaseType, TResult>? defaultFunc = null)
213public static TResult? TypeSwitch<TBaseType, TDerivedType1, TDerivedType2, TDerivedType3, TDerivedType4, TDerivedType5, TDerivedType6, TDerivedType7, TDerivedType8, TDerivedType9, TDerivedType10, TDerivedType11, TDerivedType12, TDerivedType13, TDerivedType14, TDerivedType15, TDerivedType16, TDerivedType17, TDerivedType18, TDerivedType19, TDerivedType20, TDerivedType21, TDerivedType22, TDerivedType23, TDerivedType24, TDerivedType25, TDerivedType26, TDerivedType27, TDerivedType28, TDerivedType29, TDerivedType30, TDerivedType31, TDerivedType32, TDerivedType33, TDerivedType34, TDerivedType35, TDerivedType36, TDerivedType37, TDerivedType38, TDerivedType39, TResult>(this TBaseType obj, Func<TDerivedType1, TResult> matchFunc1, Func<TDerivedType2, TResult> matchFunc2, Func<TDerivedType3, TResult> matchFunc3, Func<TDerivedType4, TResult> matchFunc4, Func<TDerivedType5, TResult> matchFunc5, Func<TDerivedType6, TResult> matchFunc6, Func<TDerivedType7, TResult> matchFunc7, Func<TDerivedType8, TResult> matchFunc8, Func<TDerivedType9, TResult> matchFunc9, Func<TDerivedType10, TResult> matchFunc10, Func<TDerivedType11, TResult> matchFunc11, Func<TDerivedType12, TResult> matchFunc12, Func<TDerivedType13, TResult> matchFunc13, Func<TDerivedType14, TResult> matchFunc14, Func<TDerivedType15, TResult> matchFunc15, Func<TDerivedType16, TResult> matchFunc16, Func<TDerivedType17, TResult> matchFunc17, Func<TDerivedType18, TResult> matchFunc18, Func<TDerivedType19, TResult> matchFunc19, Func<TDerivedType20, TResult> matchFunc20, Func<TDerivedType21, TResult> matchFunc21, Func<TDerivedType22, TResult> matchFunc22, Func<TDerivedType23, TResult> matchFunc23, Func<TDerivedType24, TResult> matchFunc24, Func<TDerivedType25, TResult> matchFunc25, Func<TDerivedType26, TResult> matchFunc26, Func<TDerivedType27, TResult> matchFunc27, Func<TDerivedType28, TResult> matchFunc28, Func<TDerivedType29, TResult> matchFunc29, Func<TDerivedType30, TResult> matchFunc30, Func<TDerivedType31, TResult> matchFunc31, Func<TDerivedType32, TResult> matchFunc32, Func<TDerivedType33, TResult> matchFunc33, Func<TDerivedType34, TResult> matchFunc34, Func<TDerivedType35, TResult> matchFunc35, Func<TDerivedType36, TResult> matchFunc36, Func<TDerivedType37, TResult> matchFunc37, Func<TDerivedType38, TResult> matchFunc38, Func<TDerivedType39, TResult> matchFunc39, Func<TBaseType, TResult>? defaultFunc = null)
299public static TResult? TypeSwitch<TBaseType, TDerivedType1, TDerivedType2, TDerivedType3, TDerivedType4, TDerivedType5, TDerivedType6, TDerivedType7, TDerivedType8, TDerivedType9, TDerivedType10, TDerivedType11, TDerivedType12, TDerivedType13, TDerivedType14, TDerivedType15, TDerivedType16, TDerivedType17, TDerivedType18, TDerivedType19, TDerivedType20, TDerivedType21, TDerivedType22, TDerivedType23, TDerivedType24, TDerivedType25, TDerivedType26, TDerivedType27, TDerivedType28, TDerivedType29, TDerivedType30, TDerivedType31, TDerivedType32, TDerivedType33, TDerivedType34, TDerivedType35, TDerivedType36, TDerivedType37, TDerivedType38, TDerivedType39, TDerivedType40, TResult>(this TBaseType obj, Func<TDerivedType1, TResult> matchFunc1, Func<TDerivedType2, TResult> matchFunc2, Func<TDerivedType3, TResult> matchFunc3, Func<TDerivedType4, TResult> matchFunc4, Func<TDerivedType5, TResult> matchFunc5, Func<TDerivedType6, TResult> matchFunc6, Func<TDerivedType7, TResult> matchFunc7, Func<TDerivedType8, TResult> matchFunc8, Func<TDerivedType9, TResult> matchFunc9, Func<TDerivedType10, TResult> matchFunc10, Func<TDerivedType11, TResult> matchFunc11, Func<TDerivedType12, TResult> matchFunc12, Func<TDerivedType13, TResult> matchFunc13, Func<TDerivedType14, TResult> matchFunc14, Func<TDerivedType15, TResult> matchFunc15, Func<TDerivedType16, TResult> matchFunc16, Func<TDerivedType17, TResult> matchFunc17, Func<TDerivedType18, TResult> matchFunc18, Func<TDerivedType19, TResult> matchFunc19, Func<TDerivedType20, TResult> matchFunc20, Func<TDerivedType21, TResult> matchFunc21, Func<TDerivedType22, TResult> matchFunc22, Func<TDerivedType23, TResult> matchFunc23, Func<TDerivedType24, TResult> matchFunc24, Func<TDerivedType25, TResult> matchFunc25, Func<TDerivedType26, TResult> matchFunc26, Func<TDerivedType27, TResult> matchFunc27, Func<TDerivedType28, TResult> matchFunc28, Func<TDerivedType29, TResult> matchFunc29, Func<TDerivedType30, TResult> matchFunc30, Func<TDerivedType31, TResult> matchFunc31, Func<TDerivedType32, TResult> matchFunc32, Func<TDerivedType33, TResult> matchFunc33, Func<TDerivedType34, TResult> matchFunc34, Func<TDerivedType35, TResult> matchFunc35, Func<TDerivedType36, TResult> matchFunc36, Func<TDerivedType37, TResult> matchFunc37, Func<TDerivedType38, TResult> matchFunc38, Func<TDerivedType39, TResult> matchFunc39, Func<TDerivedType40, TResult> matchFunc40, Func<TBaseType, TResult>? defaultFunc = null)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\SyntaxNodeExtensions.cs (6)
104this SyntaxNode node, TextSpan searchSpan, Func<SyntaxNode, bool> predicate)
129public static bool CheckParent<T>([NotNullWhen(returnValue: true)] this SyntaxNode? node, Func<T, bool> valueChecker) where T : SyntaxNode
145public static bool IsChildNode<TParent>(this SyntaxNode node, Func<TParent, SyntaxNode?> childGetter)
162public static bool IsFoundUnder<TParent>(this SyntaxNode node, Func<TParent, SyntaxNode?> childGetter)
201public static SyntaxNode? FindInnermostCommonNode(this IEnumerable<SyntaxNode> nodes, Func<SyntaxNode, bool> predicate)
806public static TNode? FirstAncestorOrSelfUntil<TNode>(this SyntaxNode? node, Func<SyntaxNode, bool> predicate)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\SyntaxTokenExtensions.cs (5)
15public static SyntaxNode? GetAncestor(this SyntaxToken token, Func<SyntaxNode, bool>? predicate)
18public static T? GetAncestor<T>(this SyntaxToken token, Func<T, bool>? predicate = null) where T : SyntaxNode
21public static T GetRequiredAncestor<T>(this SyntaxToken token, Func<T, bool>? predicate = null) where T : SyntaxNode
32public static IEnumerable<SyntaxNode> GetAncestors(this SyntaxToken token, Func<SyntaxNode, bool> predicate)
42public static bool CheckParent<T>(this SyntaxToken token, Func<T, bool> valueChecker) where T : SyntaxNode
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Options\PublicOptionFactory.cs (4)
17public static Option2<T> WithPublicOption<T, TPublicValue>(this Option2<T> option, string feature, string name, Func<T, TPublicValue> toPublicValue, Func<TPublicValue, T> toInternalValue)
20public static PerLanguageOption2<T> WithPublicOption<T, TPublicValue>(this PerLanguageOption2<T> option, string feature, string name, Func<T, TPublicValue> toPublicValue, Func<TPublicValue, T> toInternalValue)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\TopologicalSorter.cs (8)
13public static IEnumerable<T> TopologicalSort<T>(this IEnumerable<T> items, Func<T, IEnumerable<T>> itemsBefore)
26public static IEnumerable<T> TopologicalSort<T>(this IEnumerable<T> items, Func<T, IEnumerable<T>> itemsBefore, Func<T, IEnumerable<T>> itemsAfter)
29var combinedItemsBefore = CreateCombinedItemsBefore(items, itemsBefore, itemsAfter);
35Func<T, IEnumerable<T>> itemsBefore,
50private static Func<T, IEnumerable<T>> CreateCombinedItemsBefore<T>(IEnumerable<T> items, Func<T, IEnumerable<T>> itemsBefore, Func<T, IEnumerable<T>> itemsAfter)
Microsoft.Arcade.Common (4)
Microsoft.Arcade.Test.Common (9)
AssertEx.cs (7)
182string itemSeparator = null, Func<T, string> itemInspector = null)
263public static void None<T>(IEnumerable<T> actual, Func<T, bool> predicate)
275public static void Any<T>(IEnumerable<T> actual, Func<T, bool> predicate)
281public static void All<T>(IEnumerable<T> actual, Func<T, bool> predicate)
297public static string ToString<T>(IEnumerable<T> list, string separator = ", ", Func<T, string> itemInspector = null)
425Func<T, string> itemInspector = escapeQuotes ? new Func<T, string>(t => t.ToString().Replace("\"", "\"\"")) : null;
433Func<T, string> itemInspector = null,
DiffUtil.cs (2)
52public IEnumerable<string> CalculateDiff(IList<T> sequenceA, IList<T> sequenceB, Func<T, string> toString)
74public static string DiffReport<T>(IEnumerable<T> expected, IEnumerable<T> actual, Func<T, T, bool> comparer = null, Func<T, string> toString = null, string separator = ",\r\n")
Microsoft.AspNetCore (4)
Microsoft.AspNetCore.App.Analyzers (6)
Microsoft.AspNetCore.App.Analyzers.Test (1)
Microsoft.AspNetCore.Authentication (4)
Microsoft.AspNetCore.Authentication.BearerToken (1)
Microsoft.AspNetCore.Authentication.Certificate (3)
Microsoft.AspNetCore.Authentication.Cookies (11)
Microsoft.AspNetCore.Authentication.Google (1)
Microsoft.AspNetCore.Authentication.JwtBearer (7)
Microsoft.AspNetCore.Authentication.MicrosoftAccount (1)
Microsoft.AspNetCore.Authentication.Negotiate (4)
Microsoft.AspNetCore.Authentication.Negotiate.Test (2)
Microsoft.AspNetCore.Authentication.OAuth (6)
Microsoft.AspNetCore.Authentication.OpenIdConnect (14)
Events\OpenIdConnectEvents.cs (11)
14public Func<AuthenticationFailedContext, Task> OnAuthenticationFailed { get; set; } = context => Task.CompletedTask;
19public Func<AuthorizationCodeReceivedContext, Task> OnAuthorizationCodeReceived { get; set; } = context => Task.CompletedTask;
24public Func<MessageReceivedContext, Task> OnMessageReceived { get; set; } = context => Task.CompletedTask;
31public Func<RedirectContext, Task> OnRedirectToIdentityProvider { get; set; } = context => Task.CompletedTask;
36public Func<RedirectContext, Task> OnRedirectToIdentityProviderForSignOut { get; set; } = context => Task.CompletedTask;
41public Func<RemoteSignOutContext, Task> OnSignedOutCallbackRedirect { get; set; } = context => Task.CompletedTask;
46public Func<RemoteSignOutContext, Task> OnRemoteSignOut { get; set; } = context => Task.CompletedTask;
51public Func<TokenResponseReceivedContext, Task> OnTokenResponseReceived { get; set; } = context => Task.CompletedTask;
57public Func<TokenValidatedContext, Task> OnTokenValidated { get; set; } = context => Task.CompletedTask;
62public Func<UserInformationReceivedContext, Task> OnUserInformationReceived { get; set; } = context => Task.CompletedTask;
67public Func<PushedAuthorizationContext, Task> OnPushAuthorization { get; set; } = context => Task.CompletedTask;
Microsoft.AspNetCore.Authentication.Test (12)
Microsoft.AspNetCore.Authentication.Twitter (2)
Microsoft.AspNetCore.Authentication.WsFederation (6)
Microsoft.AspNetCore.Authorization (5)
Microsoft.AspNetCore.Authorization.Policy (2)
Microsoft.AspNetCore.BrowserTesting (1)
Microsoft.AspNetCore.Components (66)
CascadingValueServiceCollectionExtensions.cs (6)
23this IServiceCollection serviceCollection, Func<IServiceProvider, TValue> initialValueFactory)
36this IServiceCollection serviceCollection, string name, Func<IServiceProvider, TValue> initialValueFactory)
52this IServiceCollection serviceCollection, Func<IServiceProvider, CascadingValueSource<TValue>> sourceFactory)
65this IServiceCollection serviceCollection, Func<IServiceProvider, TValue> valueFactory)
83this IServiceCollection serviceCollection, string name, Func<IServiceProvider, TValue> valueFactory)
104this IServiceCollection serviceCollection, Func<IServiceProvider, CascadingValueSource<TValue>> sourceFactory)
EventCallbackFactoryBinderExtensions.cs (36)
58Func<string?, Task> setter,
98Func<bool, Task> setter,
138Func<bool?, Task> setter,
178Func<int, Task> setter,
218Func<int?, Task> setter,
258Func<long, Task> setter,
298Func<short, Task> setter,
338Func<long?, Task> setter,
378Func<short?, Task> setter,
418Func<float, Task> setter,
458Func<float?, Task> setter,
498Func<double, Task> setter,
538Func<double?, Task> setter,
578Func<decimal, Task> setter,
618Func<decimal?, Task> setter,
658Func<DateTime, Task> setter,
701Func<DateTime, Task> setter,
742Func<DateTime?, Task> setter,
785Func<DateTime?, Task> setter,
826Func<DateTimeOffset, Task> setter,
869Func<DateTimeOffset, Task> setter,
910Func<DateTimeOffset?, Task> setter,
953Func<DateTimeOffset?, Task> setter,
994Func<DateOnly, Task> setter,
1037Func<DateOnly, Task> setter,
1078Func<DateOnly?, Task> setter,
1121Func<DateOnly?, Task> setter,
1162Func<TimeOnly, Task> setter,
1205Func<TimeOnly, Task> setter,
1246Func<TimeOnly?, Task> setter,
1289Func<TimeOnly?, Task> setter,
1332Func<T, Task> setter,
1385Func<T, Task> setter,
1389Func<ChangeEventArgs, Task> callback = async e =>
1472Func<T, Task> setter,
1477Func<ChangeEventArgs, Task> callback = async e =>
NavigationManager.cs (8)
34private readonly List<Func<LocationChangingContext, ValueTask>> _locationChangingHandlers = new();
404var locationChangingHandlersCopy = ArrayPool<Func<LocationChangingContext, ValueTask>>.Shared.Rent(handlerCount);
450ArrayPool<Func<LocationChangingContext, ValueTask>>.Shared.Return(locationChangingHandlersCopy);
479private async ValueTask InvokeLocationChangingHandlerAsync(Func<LocationChangingContext, ValueTask> handler, LocationChangingContext context)
517public IDisposable RegisterLocationChangingHandler(Func<LocationChangingContext, ValueTask> locationChangingHandler)
533private void RemoveLocationChangingHandler(Func<LocationChangingContext, ValueTask> locationChangingHandler)
600private readonly Func<LocationChangingContext, ValueTask> _handler;
603public LocationChangingRegistration(Func<LocationChangingContext, ValueTask> handler, NavigationManager navigationManager)
Microsoft.AspNetCore.Components.Analyzers (4)
Microsoft.AspNetCore.Components.Endpoints (14)
src\Shared\PropertyHelper\PropertyHelper.cs (11)
46private Func<object, object?>? _valueGetter;
71public Func<object, object?> ValueGetter
159public static Func<object, object?> MakeFastPropertyGetter(PropertyInfo propertyInfo)
179public static Func<object, object?> MakeNullSafeFastPropertyGetter(PropertyInfo propertyInfo)
190private static Func<object, object?> MakeFastPropertyGetter(
230typeof(Func<,>),
243private static Func<object, object?> MakeFastPropertyGetter(
256typeof(Func<object, object?>),
259return (Func<object, object?>)accessorDelegate;
344Func<TDeclaringType, TValue> getter,
361Func<TDeclaringType, TValue> getter,
Microsoft.AspNetCore.Components.Forms (12)
Microsoft.AspNetCore.Components.Forms.Tests (1)
Microsoft.AspNetCore.Components.QuickGrid (10)
Microsoft.AspNetCore.Components.QuickGrid.Tests (12)
GridSortTest.cs (11)
31Expression<Func<TestEntity, string>> expression = x => x.Name;
47Expression<Func<TestEntity, DateTime?>> expression = x => x.NullableDate;
63Expression<Func<TestEntity, int?>> expression = x => x.NullableInt;
79Expression<Func<TestEntity, string>> expression = x => x.Child.ChildName;
95Expression<Func<TestEntity, DateTime?>> expression = x => x.Child.ChildNullableDate;
111Expression<Func<TestEntity, DateTime?>> expression = x => x.NullableDate;
127Expression<Func<TestEntity, string>> firstExpression = x => x.Name;
128Expression<Func<TestEntity, DateTime?>> secondExpression = x => x.NullableDate;
151Expression<Func<TestEntity, string>> invalidExpression = x => x.Name.ToUpper(CultureInfo.InvariantCulture);
163Expression<Func<TestEntity, string>> invalidExpression = x => x.Name.Substring(0, 1);
175Expression<Func<TestEntity, string>> invalidExpression = x => "constant";
Microsoft.AspNetCore.Components.SdkAnalyzers (4)
Microsoft.AspNetCore.Components.Server (9)
Microsoft.AspNetCore.Components.Server.Tests (10)
Circuits\CircuitHostTest.cs (10)
349.Setup(h => h.CreateInboundActivityHandler(It.IsAny<Func<CircuitInboundActivityContext, Task>>()))
350.Returns((Func<CircuitInboundActivityContext, Task> next) => async (CircuitInboundActivityContext context) =>
359.Setup(h => h.CreateInboundActivityHandler(It.IsAny<Func<CircuitInboundActivityContext, Task>>()))
360.Returns((Func<CircuitInboundActivityContext, Task> next) => next)
365.Setup(h => h.CreateInboundActivityHandler(It.IsAny<Func<CircuitInboundActivityContext, Task>>()))
366.Returns((Func<CircuitInboundActivityContext, Task> next) => async (CircuitInboundActivityContext context) =>
855.Setup(h => h.CreateInboundActivityHandler(It.IsAny<Func<CircuitInboundActivityContext, Task>>()))
856.Returns((Func<CircuitInboundActivityContext, Task> next) => next)
864.Setup(h => h.CreateInboundActivityHandler(It.IsAny<Func<CircuitInboundActivityContext, Task>>()))
865.Returns((Func<CircuitInboundActivityContext, Task> next) => next)
Microsoft.AspNetCore.Components.Tests (46)
EventCallbackFactoryTest.cs (16)
218var @delegate = (Func<string, Task>)component.SomeFuncTTask;
249var @delegate = (Func<string, Task>)component.SomeFuncTTask;
267var @delegate = (Func<string, Task>)((s) => Task.CompletedTask);
287var callback = EventCallback.Factory.Create(component, (Func<string, Task>)null);
520var @delegate = (Func<string, Task>)component.SomeFuncTTask;
536var @delegate = (Func<string, Task>)component.SomeFuncTTask;
554var @delegate = (Func<string, Task>)((s) => Task.CompletedTask);
574var callback = EventCallback.Factory.Create<string>(component, (Func<string, Task>)null);
603var @delegate = (Func<string, Task>)((s) => Task.CompletedTask);
EventCallbackTest.cs (6)
208var callback = new EventCallback(component, (Func<EventArgs, Task>)((e) => { arg = e; runCount++; return Task.CompletedTask; }));
227var callback = new EventCallback(component, (Func<EventArgs, Task>)((e) => { arg = e; runCount++; return Task.CompletedTask; }));
246var callback = new EventCallback(component, (Func<int, Task>)((e) => { arg = e; runCount++; return Task.CompletedTask; }));
265var callback = new EventCallback(component, (Func<EventArgs, Task>)((e) => { arg = e; runCount++; return Task.CompletedTask; }));
406var callback = new EventCallback<EventArgs>(component, (Func<EventArgs, Task>)((e) => { arg = e; runCount++; return Task.CompletedTask; }));
425var callback = new EventCallback<EventArgs>(component, (Func<EventArgs, Task>)((e) => { arg = e; runCount++; return Task.CompletedTask; }));
RendererTest.cs (22)
257[WhatToRenderName] = new Dictionary<int, Func<NestedAsyncComponent, RenderFragment>>
416[WhatToRenderName] = new Dictionary<int, Func<NestedAsyncComponent, RenderFragment>>
460[WhatToRenderName] = new Dictionary<int, Func<NestedAsyncComponent, RenderFragment>>
518[WhatToRenderName] = new Dictionary<int, Func<NestedAsyncComponent, RenderFragment>>
606OnArbitraryDelegateEvent = (Func<DerivedEventArgs, Task>)(args => Task.CompletedTask),
3565[nameof(NestedAsyncComponent.WhatToRender)] = new Dictionary<int, Func<NestedAsyncComponent, RenderFragment>>
3598[nameof(NestedAsyncComponent.WhatToRender)] = new Dictionary<int, Func<NestedAsyncComponent, RenderFragment>>
3631[nameof(NestedAsyncComponent.WhatToRender)] = new Dictionary<int, Func<NestedAsyncComponent, RenderFragment>>
3669[nameof(NestedAsyncComponent.WhatToRender)] = new Dictionary<int, Func<NestedAsyncComponent, RenderFragment>>
3779[nameof(NestedAsyncComponent.WhatToRender)] = new Dictionary<int, Func<NestedAsyncComponent, RenderFragment>>
3835[nameof(NestedAsyncComponent.WhatToRender)] = new Dictionary<int, Func<NestedAsyncComponent, RenderFragment>>
3890[nameof(NestedAsyncComponent.WhatToRender)] = new Dictionary<int, Func<NestedAsyncComponent, RenderFragment>>
3946[nameof(NestedAsyncComponent.WhatToRender)] = new Dictionary<int, Func<NestedAsyncComponent, RenderFragment>>
4059[nameof(NestedAsyncComponent.WhatToRender)] = new Dictionary<int, Func<NestedAsyncComponent, RenderFragment>>
4093[nameof(NestedAsyncComponent.WhatToRender)] = new Dictionary<int, Func<NestedAsyncComponent, RenderFragment>>
4135[nameof(NestedAsyncComponent.WhatToRender)] = new Dictionary<int, Func<NestedAsyncComponent, RenderFragment>>
5280public Func<EventArgs, Task> OnTestAsync { get; set; }
5286public Func<DerivedEventArgs, Task> OnClickAsync { get; set; }
5673private Func<NestedAsyncComponent, RenderFragment> CreateRenderFactory(int[] childrenToRender)
5703[Parameter] public IDictionary<int, Func<NestedAsyncComponent, RenderFragment>> WhatToRender { get; set; }
5762var renderFactory = WhatToRender[TestId];
5866public Func<RenderBatch, Task> OnUpdateDisplayAsync { get; set; }
Microsoft.AspNetCore.Components.Web (17)
Web\WebEventCallbackFactoryEventArgsExtensions.cs (10)
36public static EventCallback<ClipboardEventArgs> Create(this EventCallbackFactory factory, object receiver, Func<ClipboardEventArgs, Task> callback)
68public static EventCallback<DragEventArgs> Create(this EventCallbackFactory factory, object receiver, Func<DragEventArgs, Task> callback)
100public static EventCallback<ErrorEventArgs> Create(this EventCallbackFactory factory, object receiver, Func<ErrorEventArgs, Task> callback)
132public static EventCallback<FocusEventArgs> Create(this EventCallbackFactory factory, object receiver, Func<FocusEventArgs, Task> callback)
164public static EventCallback<KeyboardEventArgs> Create(this EventCallbackFactory factory, object receiver, Func<KeyboardEventArgs, Task> callback)
196public static EventCallback<MouseEventArgs> Create(this EventCallbackFactory factory, object receiver, Func<MouseEventArgs, Task> callback)
227public static EventCallback<PointerEventArgs> Create(this EventCallbackFactory factory, object receiver, Func<PointerEventArgs, Task> callback)
259public static EventCallback<ProgressEventArgs> Create(this EventCallbackFactory factory, object receiver, Func<ProgressEventArgs, Task> callback)
291public static EventCallback<TouchEventArgs> Create(this EventCallbackFactory factory, object receiver, Func<TouchEventArgs, Task> callback)
323public static EventCallback<WheelEventArgs> Create(this EventCallbackFactory factory, object receiver, Func<WheelEventArgs, Task> callback)
Microsoft.AspNetCore.Components.Web.Tests (1)
Microsoft.AspNetCore.Components.WebAssembly.Server (2)
Microsoft.AspNetCore.Components.WebView (1)
Microsoft.AspNetCore.ConcurrencyLimiter.Tests (3)
Microsoft.AspNetCore.Connections.Abstractions (15)
Microsoft.AspNetCore.CookiePolicy (1)
Microsoft.AspNetCore.CookiePolicy.Test (2)
Microsoft.AspNetCore.Cors (4)
Microsoft.AspNetCore.Cors.Test (2)
Microsoft.AspNetCore.DataProtection (3)
Microsoft.AspNetCore.DataProtection.Tests (1)
Microsoft.AspNetCore.Diagnostics (10)
Microsoft.AspNetCore.Diagnostics.Abstractions (1)
Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore (1)
Microsoft.AspNetCore.Diagnostics.HealthChecks (2)
Microsoft.AspNetCore.Diagnostics.Middleware.Tests (7)
Latency\RequestLatencyTelemetryMiddlewareTests.cs (5)
191public override void OnStarting(Func<object, Task> callback, object state)
196public override void OnCompleted(Func<object, Task> callback, object state)
201private void ChainCallback(Func<object, Task> callback, object state)
219feature.Setup(m => m.OnCompleted(It.IsAny<Func<object, Task>>(), It.IsAny<object>()))
220.Callback<Func<object, Task>, object>((c, o) => c(o));
Microsoft.AspNetCore.Diagnostics.Tests (7)
DeveloperExceptionPageMiddlewareTest.cs (5)
651public Task HandleExceptionAsync(ErrorContext context, Func<ErrorContext, Task> next)
659public Task HandleExceptionAsync(ErrorContext context, Func<ErrorContext, Task> next)
667public Task HandleExceptionAsync(ErrorContext context, Func<ErrorContext, Task> next)
675public Task HandleExceptionAsync(ErrorContext context, Func<ErrorContext, Task> next)
683public Task HandleExceptionAsync(ErrorContext context, Func<ErrorContext, Task> next)
Microsoft.AspNetCore.FunctionalTests (1)
Microsoft.AspNetCore.Grpc.Swagger (1)
Microsoft.AspNetCore.HeaderPropagation (4)
Microsoft.AspNetCore.Hosting (22)
Microsoft.AspNetCore.Hosting.Tests (10)
Microsoft.AspNetCore.Http (30)
Microsoft.AspNetCore.Http.Abstractions (23)
src\Shared\PropertyHelper\PropertyHelper.cs (11)
46private Func<object, object?>? _valueGetter;
71public Func<object, object?> ValueGetter
159public static Func<object, object?> MakeFastPropertyGetter(PropertyInfo propertyInfo)
179public static Func<object, object?> MakeNullSafeFastPropertyGetter(PropertyInfo propertyInfo)
190private static Func<object, object?> MakeFastPropertyGetter(
230typeof(Func<,>),
243private static Func<object, object?> MakeFastPropertyGetter(
256typeof(Func<object, object?>),
259return (Func<object, object?>)accessorDelegate;
344Func<TDeclaringType, TValue> getter,
361Func<TDeclaringType, TValue> getter,
Microsoft.AspNetCore.Http.Abstractions.Tests (7)
Microsoft.AspNetCore.Http.Connections (4)
Microsoft.AspNetCore.Http.Connections.Client (4)
Microsoft.AspNetCore.Http.Connections.Tests (2)
Microsoft.AspNetCore.Http.Extensions (32)
RequestDelegateFactory.cs (8)
189Expression<Func<HttpContext, object?>> targetFactory = (httpContext) => handler.Target;
210public static RequestDelegateResult Create(MethodInfo methodInfo, Func<HttpContext, object>? targetFactory, RequestDelegateFactoryOptions? options)
229public static RequestDelegateResult Create(MethodInfo methodInfo, Func<HttpContext, object>? targetFactory = null, RequestDelegateFactoryOptions? options = null, RequestDelegateMetadataResult? metadataResult = null)
318Expression<Func<HttpContext, object?>>? targetFactory = null)
358Expression<Func<EndpointFilterInvocationContext, ValueTask<object?>>> invokePipeline = (context) => filterPipeline(context);
421private static EndpointFilterDelegate? CreateFilterPipeline(MethodInfo methodInfo, Expression? targetExpression, RequestDelegateFactoryContext factoryContext, Expression<Func<HttpContext, object?>>? targetFactory)
2031var bindAsyncDelegate = Expression.Lambda<Func<HttpContext, ValueTask<object?>>>(bindAsyncMethod.Expression, HttpContextExpr).Compile();
src\Shared\ObjectMethodExecutor\ObjectMethodExecutor.cs (10)
23typeof(Func<object, object>), // getAwaiterMethod
24typeof(Func<object, bool>), // isCompletedMethod
25typeof(Func<object, object>), // getResultMethod
282var getAwaiterFunc = Expression.Lambda<Func<object, object>>(
293var isCompletedFunc = Expression.Lambda<Func<object, bool>>(
300Func<object, object> getResultFunc;
308getResultFunc = Expression.Lambda<Func<object, object>>(
321getResultFunc = Expression.Lambda<Func<object, object>>(
src\Shared\ObjectMethodExecutor\ObjectMethodExecutorAwaitable.cs (10)
19private readonly Func<object, object> _getAwaiterMethod;
20private readonly Func<object, bool> _isCompletedMethod;
21private readonly Func<object, object> _getResultMethod;
45Func<object, object> getAwaiterMethod,
46Func<object, bool> isCompletedMethod,
47Func<object, object> getResultMethod,
68private readonly Func<object, bool> _isCompletedMethod;
69private readonly Func<object, object> _getResultMethod;
75Func<object, bool> isCompletedMethod,
76Func<object, object> getResultMethod,
Microsoft.AspNetCore.Http.Extensions.Tests (91)
ParameterBindingMethodCacheTests.cs (16)
209var parseEnum = Expression.Lambda<Func<string, Choice>>(Expression.Block(new[] { parsedValue },
231var parseHttpContext = Expression.Lambda<Func<HttpContext, ValueTask<object>>>(
262var parseHttpContext = Expression.Lambda<Func<HttpContext, ValueTask<object>>>(
388var parseHttpContext = Expression.Lambda<Func<HttpContext, ValueTask<object?>>>(methodFound.Expression!,
406var parseHttpContext = Expression.Lambda<Func<HttpContext, ValueTask<object?>>>(methodFound.Expression!,
424var parseHttpContext = Expression.Lambda<Func<HttpContext, ValueTask<object>>>(methodFound.Expression!,
440var parseHttpContext = Expression.Lambda<Func<HttpContext, ValueTask<object>>>(methodFound.Expression!,
456var parseHttpContext = Expression.Lambda<Func<HttpContext, ValueTask<object>>>(methodFound.Expression!,
RequestDelegateFactoryTests.cs (43)
91new object[] { (Func<HttpContext, Task>)TaskTestAction },
92new object[] { (Func<HttpContext, ValueTask>)ValueTaskTestAction },
94new object[] { (Func<HttpContext, Task>)StaticTaskTestAction },
95new object[] { (Func<HttpContext, ValueTask>)StaticValueTaskTestAction },
1565new object?[] { (Func<string, string>)requiredRouteParam, "name", null, true, null},
1566new object?[] { (Func<string, string>)requiredRouteParam, "name", "TestName", false, "Hello TestName!" },
1567new object?[] { (Func<string, string>)defaultValueRouteParam, "name", null, false, "Hello DefaultName!" },
1568new object?[] { (Func<string, string>)defaultValueRouteParam, "name", "TestName", false, "Hello TestName!" },
1569new object?[] { (Func<string?, string>)nullableRouteParam, "name", null, false, "Hello !" },
1570new object?[] { (Func<string?, string>)nullableRouteParam, "name", "TestName", false, "Hello TestName!" },
1572new object?[] { (Func<int, string>)requiredParseableRouteParam, "age", null, true, null},
1573new object?[] { (Func<int, string>)requiredParseableRouteParam, "age", "42", false, "Age: 42" },
1574new object?[] { (Func<int, string>)defaultValueParseableRouteParam, "age", null, false, "Age: 12" },
1575new object?[] { (Func<int, string>)defaultValueParseableRouteParam, "age", "42", false, "Age: 42" },
1576new object?[] { (Func<int?, string>)nullableParseableRouteParam, "age", null, false, "Age: " },
1577new object?[] { (Func<int?, string>)nullableParseableRouteParam, "age", "42", false, "Age: 42"},
1746new object?[] { (Func<MyService, string>)requiredExplicitService, false, true},
1747new object?[] { (Func<MyService, string>)requiredExplicitService, true, false},
1749new object?[] { (Func<MyService, string>)defaultValueExplicitServiceParam, false, false},
1750new object?[] { (Func<MyService, string>)defaultValueExplicitServiceParam, true, false},
1752new object?[] { (Func<MyService?, string>)nullableExplicitServiceParam, false, false},
1753new object?[] { (Func<MyService?, string>)nullableExplicitServiceParam, true, false},
1917new object?[] { (Func<Uri, string>)uriParsing, "https://example.org", "Uri: https://example.org" },
1918new object?[] { (Func<Uri, string>)uriParsing, "https://example.org/path/to/file?name=value1&name=value2", "Uri: https://example.org/path/to/file?name=value1&name=value2" },
1919new object?[] { (Func<Uri, string>)uriParsing, "/path/to/file?name=value1&name=value2", "Uri: /path/to/file?name=value1&name=value2" },
1920new object?[] { (Func<Uri, string>)uriParsing, "?name=value1&name=value2", "Uri: ?name=value1&name=value2" },
2231Func<HttpContext, object> targetFactory = (context) =>
2792var @delegate = (AddsCustomParameterMetadata param1) => "Hello";
2813var @delegate = (AddsCustomParameterMetadata param1) => "Hello";
2834var @delegate = [Attribute1, Attribute2] (AddsCustomParameterMetadata param1) => new CountsDefaultEndpointMetadataPoco();
2892var @delegate = [Attribute1, Attribute2] (AddsCustomParameterMetadata param1) =>
2969var @delegate = (Todo todo) => new RemovesAcceptsMetadataResult();
2982var @delegate = (Todo todo) => Task.FromResult(new RemovesAcceptsMetadataResult());
2995var @delegate = (Todo todo) => ValueTask.FromResult(new RemovesAcceptsMetadataResult());
3008var @delegate = (Todo todo) => FSharp.Core.ExtraTopLevelOperators.DefaultAsyncBuilder.Return(new RemovesAcceptsMetadataResult());
3021var @delegate = (RemovesAcceptsParameterMetadata param1) => "Hello";
3034var @delegate = (RemovesAcceptsParameterMetadata param1) => "Hello";
3048var @delegate = (Todo todo) => new AccessesServicesMetadataResult();
3063var @delegate = (AccessesServicesMetadataBinder parameter1) => "Test";
3308var @delegate = (string task) => new Todo();
3328var @delegate = (string task) => new Todo();
3853public void OnStarting(Func<object, Task> callback, object state)
3857public void OnCompleted(Func<object, Task> callback, object state)
RequestDelegateFactoryTests.EndpointFilters.cs (26)
13[(Func<HttpContext, int>)((HttpContext httpContext) => 42)],
14[(Func<HttpContext, char>)((HttpContext httpContext) => 'b')],
15[(Func<HttpContext, bool>)((HttpContext httpContext) => true)],
16[(Func<HttpContext, float>)((HttpContext httpContext) => 4.2f)],
17[(Func<HttpContext, double>)((HttpContext httpContext) => 4.2)],
18[(Func<HttpContext, decimal>)((HttpContext httpContext) => 4.2m)],
19[(Func<HttpContext, long>)((HttpContext httpContext) => 42)],
20[(Func<HttpContext, short>)((HttpContext httpContext) => 42)],
21[(Func<HttpContext, byte>)((HttpContext httpContext) => 42)],
22[(Func<HttpContext, uint>)((HttpContext httpContext) => 42)],
23[(Func<HttpContext, ulong>)((HttpContext httpContext) => 42)],
24[(Func<HttpContext, ushort>)((HttpContext httpContext) => 42)],
25[(Func<HttpContext, sbyte>)((HttpContext httpContext) => 42)]
57[(Func<HttpContext, int?>)((HttpContext httpContext) => 42)],
58[(Func<HttpContext, char?>)((HttpContext httpContext) => 'b')],
59[(Func<HttpContext, bool?>)((HttpContext httpContext) => true)],
60[(Func<HttpContext, float?>)((HttpContext httpContext) => 4.2f)],
61[(Func<HttpContext, double?>)((HttpContext httpContext) => 4.2)],
62[(Func<HttpContext, decimal?>)((HttpContext httpContext) => 4.2m)],
63[(Func<HttpContext, long?>)((HttpContext httpContext) => 42)],
64[(Func<HttpContext, short?>)((HttpContext httpContext) => 42)],
65[(Func<HttpContext, byte?>)((HttpContext httpContext) => 42)],
66[(Func<HttpContext, uint?>)((HttpContext httpContext) => 42)],
67[(Func<HttpContext, ulong?>)((HttpContext httpContext) => 42)],
68[(Func<HttpContext, ushort?>)((HttpContext httpContext) => 42)],
69[(Func<HttpContext, sbyte?>)((HttpContext httpContext) => 42)]
Microsoft.AspNetCore.Http.Features (3)
Microsoft.AspNetCore.Http.Microbenchmarks (3)
Microsoft.AspNetCore.Http.RequestDelegateGenerator (2)
Microsoft.AspNetCore.Http.Results (8)
Microsoft.AspNetCore.Http.Results.Tests (4)
Microsoft.AspNetCore.Http.Tests (14)
Microsoft.AspNetCore.HttpOverrides (1)
Microsoft.AspNetCore.Identity (4)
Microsoft.AspNetCore.Identity.EntityFrameworkCore.Test (15)
Microsoft.AspNetCore.Identity.InMemory.Test (8)
Microsoft.AspNetCore.Identity.Specification.Tests (5)
Microsoft.AspNetCore.Identity.Test (3)
Microsoft.AspNetCore.InternalTesting (8)
Microsoft.AspNetCore.InternalTesting.Tests (4)
Microsoft.AspNetCore.JsonPatch (39)
JsonPatchDocumentOfT.cs (39)
63public JsonPatchDocument<TModel> Add<TProp>(Expression<Func<TModel, TProp>> path, TProp value)
85Expression<Func<TModel, IList<TProp>>> path,
107public JsonPatchDocument<TModel> Add<TProp>(Expression<Func<TModel, IList<TProp>>> path, TProp value)
126public JsonPatchDocument<TModel> Remove<TProp>(Expression<Func<TModel, TProp>> path)
142public JsonPatchDocument<TModel> Remove<TProp>(Expression<Func<TModel, IList<TProp>>> path, int position)
160public JsonPatchDocument<TModel> Remove<TProp>(Expression<Func<TModel, IList<TProp>>> path)
179public JsonPatchDocument<TModel> Replace<TProp>(Expression<Func<TModel, TProp>> path, TProp value)
200public JsonPatchDocument<TModel> Replace<TProp>(Expression<Func<TModel, IList<TProp>>> path,
221public JsonPatchDocument<TModel> Replace<TProp>(Expression<Func<TModel, IList<TProp>>> path, TProp value)
241public JsonPatchDocument<TModel> Test<TProp>(Expression<Func<TModel, TProp>> path, TProp value)
262public JsonPatchDocument<TModel> Test<TProp>(Expression<Func<TModel, IList<TProp>>> path,
283public JsonPatchDocument<TModel> Test<TProp>(Expression<Func<TModel, IList<TProp>>> path, TProp value)
304Expression<Func<TModel, TProp>> from,
305Expression<Func<TModel, TProp>> path)
327Expression<Func<TModel, IList<TProp>>> from,
329Expression<Func<TModel, TProp>> path)
351Expression<Func<TModel, TProp>> from,
352Expression<Func<TModel, IList<TProp>>> path,
376Expression<Func<TModel, IList<TProp>>> from,
378Expression<Func<TModel, IList<TProp>>> path,
401Expression<Func<TModel, IList<TProp>>> from,
403Expression<Func<TModel, IList<TProp>>> path)
424Expression<Func<TModel, TProp>> from,
425Expression<Func<TModel, IList<TProp>>> path)
446Expression<Func<TModel, TProp>> from,
447Expression<Func<TModel, TProp>> path)
469Expression<Func<TModel, IList<TProp>>> from,
471Expression<Func<TModel, TProp>> path)
493Expression<Func<TModel, TProp>> from,
494Expression<Func<TModel, IList<TProp>>> path,
518Expression<Func<TModel, IList<TProp>>> from,
520Expression<Func<TModel, IList<TProp>>> path,
543Expression<Func<TModel, IList<TProp>>> from,
545Expression<Func<TModel, IList<TProp>>> path)
566Expression<Func<TModel, TProp>> from,
567Expression<Func<TModel, IList<TProp>>> path)
681internal string GetPath<TProp>(Expression<Func<TModel, TProp>> expr, string position)
753var lambda = Expression.Lambda<Func<object, object>>(converted, fakeParameter);
754var func = lambda.Compile();
Microsoft.AspNetCore.JsonPatch.SystemTextJson (39)
JsonPatchDocumentOfT.cs (39)
56public JsonPatchDocument<TModel> Add<TProp>(Expression<Func<TModel, TProp>> path, TProp value)
78Expression<Func<TModel, IList<TProp>>> path,
100public JsonPatchDocument<TModel> Add<TProp>(Expression<Func<TModel, IList<TProp>>> path, TProp value)
119public JsonPatchDocument<TModel> Remove<TProp>(Expression<Func<TModel, TProp>> path)
135public JsonPatchDocument<TModel> Remove<TProp>(Expression<Func<TModel, IList<TProp>>> path, int position)
153public JsonPatchDocument<TModel> Remove<TProp>(Expression<Func<TModel, IList<TProp>>> path)
172public JsonPatchDocument<TModel> Replace<TProp>(Expression<Func<TModel, TProp>> path, TProp value)
193public JsonPatchDocument<TModel> Replace<TProp>(Expression<Func<TModel, IList<TProp>>> path,
214public JsonPatchDocument<TModel> Replace<TProp>(Expression<Func<TModel, IList<TProp>>> path, TProp value)
234public JsonPatchDocument<TModel> Test<TProp>(Expression<Func<TModel, TProp>> path, TProp value)
255public JsonPatchDocument<TModel> Test<TProp>(Expression<Func<TModel, IList<TProp>>> path,
276public JsonPatchDocument<TModel> Test<TProp>(Expression<Func<TModel, IList<TProp>>> path, TProp value)
297Expression<Func<TModel, TProp>> from,
298Expression<Func<TModel, TProp>> path)
320Expression<Func<TModel, IList<TProp>>> from,
322Expression<Func<TModel, TProp>> path)
344Expression<Func<TModel, TProp>> from,
345Expression<Func<TModel, IList<TProp>>> path,
369Expression<Func<TModel, IList<TProp>>> from,
371Expression<Func<TModel, IList<TProp>>> path,
394Expression<Func<TModel, IList<TProp>>> from,
396Expression<Func<TModel, IList<TProp>>> path)
417Expression<Func<TModel, TProp>> from,
418Expression<Func<TModel, IList<TProp>>> path)
439Expression<Func<TModel, TProp>> from,
440Expression<Func<TModel, TProp>> path)
462Expression<Func<TModel, IList<TProp>>> from,
464Expression<Func<TModel, TProp>> path)
486Expression<Func<TModel, TProp>> from,
487Expression<Func<TModel, IList<TProp>>> path,
511Expression<Func<TModel, IList<TProp>>> from,
513Expression<Func<TModel, IList<TProp>>> path,
536Expression<Func<TModel, IList<TProp>>> from,
538Expression<Func<TModel, IList<TProp>>> path)
559Expression<Func<TModel, TProp>> from,
560Expression<Func<TModel, IList<TProp>>> path)
672internal string GetPath<TProp>(Expression<Func<TModel, TProp>> expr, string position)
747var lambda = Expression.Lambda<Func<object, object>>(converted, fakeParameter);
748var func = lambda.Compile();
Microsoft.AspNetCore.Localization (2)
Microsoft.AspNetCore.MiddlewareAnalysis (1)
Microsoft.AspNetCore.Mvc.Abstractions (18)
Microsoft.AspNetCore.Mvc.Abstractions.Test (2)
Microsoft.AspNetCore.Mvc.ApiExplorer (1)
Microsoft.AspNetCore.Mvc.Core (124)
ModelBinding\Metadata\DefaultModelBindingMessageProvider.cs (18)
16private Func<string, string> _missingBindRequiredValueAccessor;
19private Func<string, string> _valueMustNotBeNullAccessor;
21private Func<string, string> _nonPropertyAttemptedValueIsInvalidAccessor;
22private Func<string, string> _unknownValueIsInvalidAccessor;
24private Func<string, string> _valueIsInvalidAccessor;
25private Func<string, string> _valueMustBeANumberAccessor;
69public override Func<string, string> MissingBindRequiredValueAccessor => _missingBindRequiredValueAccessor;
76public void SetMissingBindRequiredValueAccessor(Func<string, string> missingBindRequiredValueAccessor)
114public override Func<string, string> ValueMustNotBeNullAccessor => _valueMustNotBeNullAccessor;
121public void SetValueMustNotBeNullAccessor(Func<string, string> valueMustNotBeNullAccessor)
144public override Func<string, string> NonPropertyAttemptedValueIsInvalidAccessor => _nonPropertyAttemptedValueIsInvalidAccessor;
152Func<string, string> nonPropertyAttemptedValueIsInvalidAccessor)
160public override Func<string, string> UnknownValueIsInvalidAccessor => _unknownValueIsInvalidAccessor;
167public void SetUnknownValueIsInvalidAccessor(Func<string, string> unknownValueIsInvalidAccessor)
190public override Func<string, string> ValueIsInvalidAccessor => _valueIsInvalidAccessor;
197public void SetValueIsInvalidAccessor(Func<string, string> valueIsInvalidAccessor)
205public override Func<string, string> ValueMustBeANumberAccessor => _valueMustBeANumberAccessor;
212public void SetValueMustBeANumberAccessor(Func<string, string> valueMustBeANumberAccessor)
src\Shared\ObjectMethodExecutor\ObjectMethodExecutor.cs (10)
23typeof(Func<object, object>), // getAwaiterMethod
24typeof(Func<object, bool>), // isCompletedMethod
25typeof(Func<object, object>), // getResultMethod
282var getAwaiterFunc = Expression.Lambda<Func<object, object>>(
293var isCompletedFunc = Expression.Lambda<Func<object, bool>>(
300Func<object, object> getResultFunc;
308getResultFunc = Expression.Lambda<Func<object, object>>(
321getResultFunc = Expression.Lambda<Func<object, object>>(
src\Shared\ObjectMethodExecutor\ObjectMethodExecutorAwaitable.cs (10)
19private readonly Func<object, object> _getAwaiterMethod;
20private readonly Func<object, bool> _isCompletedMethod;
21private readonly Func<object, object> _getResultMethod;
45Func<object, object> getAwaiterMethod,
46Func<object, bool> isCompletedMethod,
47Func<object, object> getResultMethod,
68private readonly Func<object, bool> _isCompletedMethod;
69private readonly Func<object, object> _getResultMethod;
75Func<object, bool> isCompletedMethod,
76Func<object, object> getResultMethod,
src\Shared\PropertyHelper\PropertyHelper.cs (11)
46private Func<object, object?>? _valueGetter;
71public Func<object, object?> ValueGetter
159public static Func<object, object?> MakeFastPropertyGetter(PropertyInfo propertyInfo)
179public static Func<object, object?> MakeNullSafeFastPropertyGetter(PropertyInfo propertyInfo)
190private static Func<object, object?> MakeFastPropertyGetter(
230typeof(Func<,>),
243private static Func<object, object?> MakeFastPropertyGetter(
256typeof(Func<object, object?>),
259return (Func<object, object?>)accessorDelegate;
344Func<TDeclaringType, TValue> getter,
361Func<TDeclaringType, TValue> getter,
Microsoft.AspNetCore.Mvc.Core.Test (53)
Controllers\ControllerBinderDelegateProviderTest.cs (4)
903public static TheoryData<string, Type, Func<object, object>, object, object> SkippedPropertyData
907return new TheoryData<string, Type, Func<object, object>, object, object>
946Func<object, object> propertyAccessor,
1270Func<object, int> method = foo => 1;
ModelBinding\ModelBindingHelperTest.cs (12)
134Func<ModelMetadata, bool> propertyFilter = (m) => true;
183Func<ModelMetadata, bool> propertyFilter = (m) =>
339Expression<Func<User, object>> expression = m => m.Address;
352Expression<Func<User, object>> expression = m => m.Address.Street;
370Expression<Func<User, object>> expression = m => new Func<User>(() => m);
393public void GetPropertyName_ExpressionsOtherThanMemberAccess_Throws(Expression<Func<User, object>> expression)
412Expression<Func<User, object>> expression = m => someUser.Address;
428Expression<Func<List<User>, object>> expression = m => m[0];
444Expression<Func<User, object>> expression = m => m._userId;
463Func<ModelMetadata, bool> propertyFilter = (m) => true;
513Func<ModelMetadata, bool> propertyFilter = (m) =>
612Func<ModelMetadata, bool> propertyFilter = (m) => true;
Microsoft.AspNetCore.Mvc.DataAnnotations.Test (10)
ModelMetadataProviderTest.cs (7)
32var propertyFilter = metadata.PropertyFilterProvider.PropertyFilter;
172public static TheoryData<object, Func<ModelMetadata, string>> ExpectedAttributeDataStrings
176return new TheoryData<object, Func<ModelMetadata, string>>
224public void AttributesOverrideMetadataStrings(object attribute, Func<ModelMetadata, string> accessor)
255public static TheoryData<Attribute, Func<ModelMetadata, bool>, bool> ExpectedAttributeDataBooleans
259return new TheoryData<Attribute, Func<ModelMetadata, bool>, bool>
342Func<ModelMetadata, bool> accessor,
Microsoft.AspNetCore.Mvc.Formatters.Xml (2)
Microsoft.AspNetCore.Mvc.Formatters.Xml.Test (2)
Microsoft.AspNetCore.Mvc.NewtonsoftJson (11)
BsonTempDataSerializer.cs (10)
26private static readonly ConcurrentDictionary<Type, Func<JArray, object>> _arrayConverters =
27new ConcurrentDictionary<Type, Func<JArray, object>>();
28private static readonly ConcurrentDictionary<Type, Func<JObject, object>> _dictionaryConverters =
29new ConcurrentDictionary<Type, Func<JObject, object>>();
67var arrayConverter = _arrayConverters.GetOrAdd(returnType, type =>
69return (Func<JArray, object>)_convertArrayMethodInfo
71.CreateDelegate(typeof(Func<JArray, object>));
94var dictionaryConverter = _dictionaryConverters.GetOrAdd(valueType, type =>
96return (Func<JObject, object>)_convertDictionaryMethodInfo
98.CreateDelegate(typeof(Func<JObject, object>));
Microsoft.AspNetCore.Mvc.NewtonsoftJson.Test (2)
Microsoft.AspNetCore.Mvc.Razor (15)
Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation (1)
Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation.Test (2)
Microsoft.AspNetCore.Mvc.Razor.Test (3)
Microsoft.AspNetCore.Mvc.RazorPages (24)
Microsoft.AspNetCore.Mvc.RazorPages.Test (12)
Microsoft.AspNetCore.Mvc.TagHelpers (1)
Microsoft.AspNetCore.Mvc.TagHelpers.Test (7)
Microsoft.AspNetCore.Mvc.Testing (20)
.packages\microsoft.extensions.hostfactoryresolver.sources\10.0.0-rc.1.25420.121\contentFiles\cs\netstandard2.0\HostFactoryResolver.cs (10)
41public static Func<string[], TWebHost>? ResolveWebHostFactory<TWebHost>(Assembly assembly)
46public static Func<string[], TWebHostBuilder>? ResolveWebHostBuilderFactory<TWebHostBuilder>(Assembly assembly)
51public static Func<string[], THostBuilder>? ResolveHostBuilderFactory<THostBuilder>(Assembly assembly)
62public static Func<string[], object>? ResolveHostFactory(Assembly assembly,
95private static Func<string[], T>? ResolveFactory<T>(Assembly assembly, string name)
122public static Func<string[], IServiceProvider?>? ResolveServiceProviderFactory(Assembly assembly, TimeSpan? waitTimeout = null)
125var webHostFactory = ResolveWebHostFactory<object>(assembly);
135var webHostBuilderFactory = ResolveWebHostBuilderFactory<object>(assembly);
146var hostBuilderFactory = ResolveHostBuilderFactory<object>(assembly);
157var hostFactory = ResolveHostFactory(assembly, waitTimeout: waitTimeout);
Microsoft.AspNetCore.Mvc.ViewFeatures (135)
CachedExpressionCompiler.cs (31)
22public static Func<TModel, object> Process<TModel, TResult>(
23Expression<Func<TModel, TResult>> expression)
32private static Func<TModel, object> _identityFunc;
34private static readonly ConcurrentDictionary<MemberInfo, Func<TModel, object>> _simpleMemberAccessCache =
35new ConcurrentDictionary<MemberInfo, Func<TModel, object>>();
37private static readonly ConcurrentDictionary<MemberExpressionCacheKey, Func<TModel, object>> _chainedMemberAccessCache =
38new ConcurrentDictionary<MemberExpressionCacheKey, Func<TModel, object>>(MemberExpressionCacheKeyComparer.Instance);
40private static readonly ConcurrentDictionary<MemberInfo, Func<object, TResult>> _constMemberAccessCache =
41new ConcurrentDictionary<MemberInfo, Func<object, TResult>>();
43public static Func<TModel, object> Compile(Expression<Func<TModel, TResult>> expression)
98private static Func<TModel, object> CompileFromConstLookup(
106private static Func<TModel, object> CompileFromIdentityFunc(
107Expression<Func<TModel, TResult>> expression)
113var identityFuncCore = expression.Compile();
120private static Func<TModel, object> CompileFromStaticMemberAccess(
121Expression<Func<TModel, TResult>> expression,
125if (_simpleMemberAccessCache.TryGetValue(memberExpression.Member, out var result))
130var func = expression.Compile();
137private static Func<TModel, object> CompileFromSimpleMemberAccess(
138Expression<Func<TModel, TResult>> expression,
143if (_simpleMemberAccessCache.TryGetValue(memberExpression.Member, out var result))
152private static Func<TModel, object> CompileForChainedMemberAccess(
153Expression<Func<TModel, TResult>> expression,
159if (_chainedMemberAccessCache.TryGetValue(key, out var result))
169private static Func<TModel, object> CompileCapturedConstant(MemberExpression memberExpression, ConstantExpression constantExpression)
172if (!_constMemberAccessCache.TryGetValue(memberExpression.Member, out var result))
179var replacementExpression = Expression.Lambda<Func<object, TResult>>(
191private static Func<TModel, object> Rewrite(
192Expression<Func<TModel, TResult>> expression,
230var rewrittenExpression = Expression.Lambda<Func<TModel, object>>(body, expression.Parameters);
HtmlHelperOfT.cs (21)
92Expression<Func<TModel, bool>> expression,
107Expression<Func<TModel, TResult>> expression,
125Expression<Func<TModel, TResult>> expression,
141public string DisplayNameFor<TResult>(Expression<Func<TModel, TResult>> expression)
151Expression<Func<TModelItem, TResult>> expression)
163public string DisplayTextFor<TResult>(Expression<Func<TModel, TResult>> expression)
172Expression<Func<TModel, TResult>> expression,
189Expression<Func<TModel, TResult>> expression,
204public string IdFor<TResult>(Expression<Func<TModel, TResult>> expression)
213Expression<Func<TModel, TResult>> expression,
225Expression<Func<TModel, TResult>> expression,
238public string NameFor<TResult>(Expression<Func<TModel, TResult>> expression)
248Expression<Func<TModel, TResult>> expression,
263Expression<Func<TModel, TResult>> expression,
281Expression<Func<TModel, TResult>> expression,
294Expression<Func<TModel, TResult>> expression,
309private ModelExpression GetModelExpression<TResult>(Expression<Func<TModel, TResult>> expression)
319protected string GetExpressionName<TResult>(Expression<Func<TModel, TResult>> expression)
332protected ModelExplorer GetModelExplorer<TResult>(Expression<Func<TModel, TResult>> expression)
342Expression<Func<TModel, TResult>> expression,
359public string ValueFor<TResult>(Expression<Func<TModel, TResult>> expression, string format)
ModelExplorer.cs (8)
19private Func<object, object> _modelAccessor;
52Func<object, object> modelAccessor)
260public ModelExplorer GetExplorerForProperty(string name, Func<object, object> modelAccessor)
357/// <see cref="GetExplorerForExpression(Type, Func{object, object})"/>
365public ModelExplorer GetExplorerForExpression(Type modelType, Func<object, object> modelAccessor)
382/// <see cref="GetExplorerForExpression(ModelMetadata, Func{object, object})"/>
390public ModelExplorer GetExplorerForExpression(ModelMetadata metadata, Func<object, object> modelAccessor)
419var modelAccessor = new Func<object, object>((c) =>
Rendering\HtmlHelperInputExtensions.cs (9)
118Expression<Func<TModel, bool>> expression)
196Expression<Func<TModel, TResult>> expression)
262Expression<Func<TModel, TResult>> expression)
403Expression<Func<TModel, TResult>> expression,
551Expression<Func<TModel, TResult>> expression)
582Expression<Func<TModel, TResult>> expression,
616Expression<Func<TModel, TResult>> expression,
762Expression<Func<TModel, TResult>> expression)
794Expression<Func<TModel, TResult>> expression,
Rendering\IHtmlHelperOfT.cs (18)
44IHtmlContent CheckBoxFor(Expression<Func<TModel, bool>> expression, object htmlAttributes);
77Expression<Func<TModel, TResult>> expression,
88string DisplayNameFor<TResult>(Expression<Func<TModel, TResult>> expression);
99Expression<Func<TModelItem, TResult>> expression);
111string DisplayTextFor<TResult>(Expression<Func<TModel, TResult>> expression);
143Expression<Func<TModel, TResult>> expression,
177Expression<Func<TModel, TResult>> expression,
208Expression<Func<TModel, TResult>> expression,
217string IdFor<TResult>(Expression<Func<TModel, TResult>> expression);
231Expression<Func<TModel, TResult>> expression,
262Expression<Func<TModel, TResult>> expression,
274string NameFor<TResult>(Expression<Func<TModel, TResult>> expression);
294Expression<Func<TModel, TResult>> expression,
327Expression<Func<TModel, TResult>> expression,
359Expression<Func<TModel, TResult>> expression,
389Expression<Func<TModel, TResult>> expression,
417Expression<Func<TModel, TResult>> expression,
441Expression<Func<TModel, TResult>> expression,
TemplateRenderer.cs (6)
22private static readonly Dictionary<string, Func<IHtmlHelper, IHtmlContent>> _defaultDisplayActions =
23new Dictionary<string, Func<IHtmlHelper, IHtmlContent>>(StringComparer.OrdinalIgnoreCase)
37private static readonly Dictionary<string, Func<IHtmlHelper, IHtmlContent>> _defaultEditorActions =
38new Dictionary<string, Func<IHtmlHelper, IHtmlContent>>(StringComparer.OrdinalIgnoreCase)
130if (defaultActions.TryGetValue(viewName, out var defaultAction))
140private Dictionary<string, Func<IHtmlHelper, IHtmlContent>> GetDefaultActions()
Microsoft.AspNetCore.Mvc.ViewFeatures.Test (212)
ExpressionHelperTest.cs (102)
28(Expression<Func<TestModel, Category>>)(model => model.SelectedCategory),
32(Expression<Func<TestModel, CategoryName>>)(model => model.SelectedCategory.CategoryName),
36(Expression<Func<TestModel, int>>)(testModel => testModel.SelectedCategory.CategoryId),
40(Expression<Func<LowerModel, int>>)(testModel => testModel.selectedcategory.CategoryId),
44(Expression<Func<TestModel, string>>)(model => model.SelectedCategory.CategoryName.MainCategory),
48(Expression<Func<TestModel, TestModel>>)(model => model),
52(Expression<Func<TestModel, string>>)(model => value),
56(Expression<Func<TestModel, int>>)(model => models[0].SelectedCategory.CategoryId),
60(Expression<Func<TestModel, string>>)(model => modelTest.Name),
64(Expression<Func<TestModel, Type>>)(model => modelType),
68(Expression<Func<IList<TestModel>, Category>>)(model => model[2].SelectedCategory),
72(Expression<Func<IList<TestModel>, Category>>)(model => model[i].SelectedCategory),
76(Expression<Func<IList<LowerModel>, Category>>)(model => model[i].selectedcategory),
80(Expression<Func<IDictionary<string, TestModel>, string>>)(model => model[key].SelectedCategory.CategoryName.MainCategory),
84(Expression<Func<TestModel, int>>)(model => model.PreferredCategories[i].CategoryId),
88(Expression<Func<IList<TestModel>, Category>>)(model => myModels[i].SelectedCategory),
92(Expression<Func<IList<TestModel>, int>>)(model => model[2].PreferredCategories[i].CategoryId),
96(Expression<Func<IList<LowerModel>, int>>)(model => model[2].preferredcategories[i].CategoryId),
100(Expression<Func<IList<TestModel>, string>>)(model => model.FirstOrDefault().Name),
104(Expression<Func<IList<LowerModel>, string>>)(model => model.FirstOrDefault().name),
108(Expression<Func<IList<TestModel>, string>>)(model => model.FirstOrDefault().Model),
112(Expression<Func<IList<TestModel>, int>>)(model => model.FirstOrDefault().SelectedCategory.CategoryId),
116(Expression<Func<IList<TestModel>, string>>)(model => model.FirstOrDefault().SelectedCategory.CategoryName.MainCategory),
120(Expression<Func<IList<TestModel>, int>>)(model => model.FirstOrDefault().PreferredCategories.Count),
124(Expression<Func<IList<TestModel>, int>>)(model => model.FirstOrDefault().PreferredCategories.FirstOrDefault().CategoryId),
130(Expression<Func<TestModel, int>>)(m => Microsoft.AspNetCore.Mvc.ViewFeatures.Model.Constants.WoodstockYear),
135(Expression<Func<TestModel, int>>)(m => Model.Constants.WoodstockYear),
142(Expression<Func<TestModel, string>>)(m => Model.Constants.Model.Name),
146(Expression<Func<TestModel, string>>)(m => AStaticClass.Model),
150(Expression<Func<TestModel, string>>)(m => AStaticClass.Test),
154(Expression<Func<TestModel, string>>)(m => AnotherStaticClass.Model.Name),
158(Expression<Func<TestModel, string>>)(m => AnotherStaticClass.Test.Name),
166data.Add((Expression<Func<TestModel, string>>)(m => model), string.Empty);
172data.Add((Expression<Func<TestModel, TestModel>>)(m => Model), string.Empty);
173data.Add((Expression<Func<TestModel, TestModel>>)(model => Model), string.Empty);
174data.Add((Expression<Func<TestModel, Category>>)(m => Model.SelectedCategory), "SelectedCategory");
190(Expression<Func<TestModel, Category>>)(model => model.SelectedCategory),
191(Expression<Func<TestModel, CategoryName>>)(model => model.SelectedCategory.CategoryName),
192(Expression<Func<TestModel, int>>)(testModel => testModel.SelectedCategory.CategoryId),
193(Expression<Func<TestModel, string>>)(model => model.SelectedCategory.CategoryName.MainCategory),
194(Expression<Func<TestModel, string>>)(testModel => key),
195(Expression<Func<TestModel, TestModel>>)(m => m),
196(Expression<Func<TestModel, Category>>)(m => myModel.SelectedCategory),
211(Expression<Func<IList<TestModel>, Category>>)(model => model[2].SelectedCategory),
212(Expression<Func<IList<TestModel>, Category>>)(model => myModels[i].SelectedCategory),
213(Expression<Func<IList<TestModel>, CategoryName>>)(testModel => testModel[i].SelectedCategory.CategoryName),
214(Expression<Func<TestModel, int>>)(model => model.PreferredCategories[i].CategoryId),
215(Expression<Func<IDictionary<string, TestModel>, string>>)(model => model[key].SelectedCategory.CategoryName.MainCategory),
230(Expression<Func<TestModel[][], string>>)(model => model[23][3].Name),
231(Expression<Func<TestModel[][], string>>)(model => model[i][3].Name),
232(Expression<Func<TestModel[][], string>>)(model => model[23][j].Name),
233(Expression<Func<TestModel[][], string>>)(model => model[i][j].Name),
235(Expression<Func<IList<TestModel>, string>>)(model => model.FirstOrDefault().Name),
236(Expression<Func<IList<TestModel>, string>>)(model => model.FirstOrDefault().SelectedCategory.CategoryName.MainCategory),
237(Expression<Func<IList<TestModel>, int>>)(model => model.FirstOrDefault().PreferredCategories.FirstOrDefault().CategoryId),
252(Expression<Func<TestModel, Category>>)(model => model.SelectedCategory),
253(Expression<Func<TestModel, Category>>)(model => model.SelectedCategory)
256(Expression<Func<TestModel, CategoryName>>)(model => model.SelectedCategory.CategoryName),
257(Expression<Func<TestModel, CategoryName>>)(model => model.SelectedCategory.CategoryName)
260(Expression<Func<TestModel, int>>)(testModel => testModel.SelectedCategory.CategoryId),
261(Expression<Func<TestModel, int>>)(testModel => testModel.SelectedCategory.CategoryId)
264(Expression<Func<TestModel, string>>)(model => model.SelectedCategory.CategoryName.MainCategory),
265(Expression<Func<TestModel, string>>)(model => model.SelectedCategory.CategoryName.MainCategory)
268(Expression<Func<TestModel, TestModel>>)(model => model),
269(Expression<Func<TestModel, TestModel>>)(m => m)
272(Expression<Func<TestModel, string>>)(model => value),
273(Expression<Func<TestModel, string>>)(m => value)
279(Expression<Func<TestModel, string>>)(m => Model),
280(Expression<Func<TestModel, TestModel>>)(m => m)
298(Expression<Func<TestModel, Category>>)(model => model.SelectedCategory),
299(Expression<Func<TestModel, CategoryName>>)(model => model.SelectedCategory.CategoryName)
302(Expression<Func<TestModel, CategoryName>>)(model => model.SelectedCategory.CategoryName),
303(Expression<Func<LowerModel, CategoryName>>)(model => model.selectedcategory.CategoryName)
306(Expression<Func<TestModel, string>>)(model => model.Model),
307(Expression<Func<TestModel, string>>)(model => model.Name)
310(Expression<Func<TestModel, string>>)(model => model.Model),
311(Expression<Func<LowerModel, string>>)(model => model.model)
314(Expression<Func<TestModel, string>>)(model => model.Name),
315(Expression<Func<LowerModel, string>>)(model => model.name)
318(Expression<Func<TestModel, CategoryName>>)(model => model.SelectedCategory.CategoryName),
319(Expression<Func<TestModel, string>>)(model => value)
322(Expression<Func<TestModel, string>>)(testModel => testModel.SelectedCategory.CategoryName.MainCategory),
323(Expression<Func<TestModel, string>>)(testModel => value)
326(Expression<Func<IList<TestModel>, Category>>)(model => model[2].SelectedCategory),
327(Expression<Func<TestModel, string>>)(model => model.SelectedCategory.CategoryName.MainCategory)
330(Expression<Func<IList<TestModel>, Category>>)(model => model[2].SelectedCategory),
331(Expression<Func<IList<LowerModel>, Category>>)(model => model[2].selectedcategory)
334(Expression<Func<TestModel, int>>)(testModel => testModel.SelectedCategory.CategoryId),
335(Expression<Func<TestModel, Category>>)(model => model.SelectedCategory)
338(Expression<Func<IDictionary<string, TestModel>, string>>)(model => model[key].SelectedCategory.CategoryName.MainCategory),
339(Expression<Func<TestModel, Category>>)(model => model.SelectedCategory)
342(Expression<Func<IDictionary<string, TestModel>, string>>)(model => model[key].SelectedCategory.CategoryName.MainCategory),
343(Expression<Func<IDictionary<string, LowerModel>, string>>)(model => model[key].selectedcategory.CategoryName.MainCategory)
346(Expression<Func<TestModel, string>>)(m => Model),
347(Expression<Func<TestModel, string>>)(m => m.Model)
350(Expression<Func<TestModel, TestModel>>)(m => m),
351(Expression<Func<TestModel, string>>)(m => m.Model)
354(Expression<Func<TestModel, string>>)(m => myModel.Name),
355(Expression<Func<TestModel, string>>)(m => m.Name)
358(Expression<Func<TestModel, string>>)(m => key),
359(Expression<Func<TestModel, string>>)(m => value)
448(Expression<Func<List<TestModel>, int>>)(m => collection[i].SelectedCategory.CategoryId),
Rendering\HtmlHelperHiddenTest.cs (6)
761public static TheoryData<Expression<Func<HiddenModel, string>>, string> HiddenFor_UsesPropertyValueIfModelStateDoesNotContainValueData
767return new TheoryData<Expression<Func<HiddenModel, string>>, string>
796Expression<Func<HiddenModel, string>> expression,
822public static TheoryData<Expression<Func<HiddenModel, string>>, string> HiddenFor_UsesModelStateValueForComplexExpressionsData
826return new TheoryData<Expression<Func<HiddenModel, string>>, string>
850Expression<Func<HiddenModel, string>> expression,
Rendering\HtmlHelperNameExtensionsTest.cs (4)
248public static TheoryData<Expression<Func<List<OuterClass>, string>>, string, string> StaticExpressionNamesData
259private TheoryData<Expression<Func<List<OuterClass>, string>>, string, string> ExpressionNamesData
269return new TheoryData<Expression<Func<List<OuterClass>, string>>, string, string>
307Expression<Func<List<OuterClass>, string>> expression,
Rendering\HtmlHelperPartialExtensionsTest.cs (11)
15public static TheoryData<Func<IHtmlHelper, IHtmlContent>, object, ViewDataDictionary> PartialExtensionMethods
21return new TheoryData<Func<IHtmlHelper, IHtmlContent>, object, ViewDataDictionary>
34Func<IHtmlHelper, IHtmlContent> partialMethod,
67Func<IHtmlHelper, IHtmlContent> partialMethod,
90public static TheoryData<Func<IHtmlHelper, Task<IHtmlContent>>, object, ViewDataDictionary> PartialAsyncExtensionMethods
96return new TheoryData<Func<IHtmlHelper, Task<IHtmlContent>>, object, ViewDataDictionary>
108Func<IHtmlHelper, Task<IHtmlContent>> partialAsyncMethod,
183Func<IHtmlHelper, Task> renderPartialAsyncMethod,
213public static TheoryData<Func<IHtmlHelper, Task>, object, ViewDataDictionary> RenderPartialAsyncExtensionMethods
219return new TheoryData<Func<IHtmlHelper, Task>, object, ViewDataDictionary>
231Func<IHtmlHelper, Task> renderPartialAsyncMethod,
Rendering\HtmlHelperPasswordTest.cs (6)
323public static TheoryData<Expression<Func<PasswordModel, string>>, string> PasswordFor_WithComplexExpressionsData
327return new TheoryData<Expression<Func<PasswordModel, string>>, string>
351Expression<Func<PasswordModel, string>> expression,
471public static TheoryData<Expression<Func<PasswordModel, string>>, string> PasswordFor_IgnoresExpressionValueForComplexExpressionsData
475return new TheoryData<Expression<Func<PasswordModel, string>>, string>
499Expression<Func<PasswordModel, string>> expression,
Rendering\HtmlHelperTextAreaTest.cs (6)
41public static TheoryData<Expression<Func<ComplexModel, string>>, string> TextAreaFor_UsesModelValueForComplexExpressionsData
45return new TheoryData<Expression<Func<ComplexModel, string>>, string>
69Expression<Func<ComplexModel, string>> expression,
88public static TheoryData<Expression<Func<ComplexModel, string>>, string> TextAreaFor_UsesModelStateValueForComplexExpressionsData
92return new TheoryData<Expression<Func<ComplexModel, string>>, string>
116Expression<Func<ComplexModel, string>> expression,
Rendering\HtmlHelperTextBoxTest.cs (6)
59public static TheoryData<Expression<Func<ComplexModel, string>>, string> TextBoxFor_UsesModelValueForComplexExpressionsData
63return new TheoryData<Expression<Func<ComplexModel, string>>, string>
87Expression<Func<ComplexModel, string>> expression,
106public static TheoryData<Expression<Func<ComplexModel, string>>, string> TextBoxFor_UsesModelStateValueForComplexExpressionsData
110return new TheoryData<Expression<Func<ComplexModel, string>>, string>
134Expression<Func<ComplexModel, string>> expression,
Microsoft.AspNetCore.OpenApi (32)
src\Shared\ObjectMethodExecutor\ObjectMethodExecutor.cs (10)
23typeof(Func<object, object>), // getAwaiterMethod
24typeof(Func<object, bool>), // isCompletedMethod
25typeof(Func<object, object>), // getResultMethod
282var getAwaiterFunc = Expression.Lambda<Func<object, object>>(
293var isCompletedFunc = Expression.Lambda<Func<object, bool>>(
300Func<object, object> getResultFunc;
308getResultFunc = Expression.Lambda<Func<object, object>>(
321getResultFunc = Expression.Lambda<Func<object, object>>(
src\Shared\ObjectMethodExecutor\ObjectMethodExecutorAwaitable.cs (10)
19private readonly Func<object, object> _getAwaiterMethod;
20private readonly Func<object, bool> _isCompletedMethod;
21private readonly Func<object, object> _getResultMethod;
45Func<object, object> getAwaiterMethod,
46Func<object, bool> isCompletedMethod,
47Func<object, object> getResultMethod,
68private readonly Func<object, bool> _isCompletedMethod;
69private readonly Func<object, object> _getResultMethod;
75Func<object, bool> isCompletedMethod,
76Func<object, object> getResultMethod,
Microsoft.AspNetCore.OpenApi.SourceGenerators (1)
Microsoft.AspNetCore.OpenApi.SourceGenerators.Tests (11)
SnapshotTestHelper.cs (11)
174var factory = HostFactoryResolver.ResolveHostFactory(assembly,
250public static Func<string[], TWebHost> ResolveWebHostFactory<TWebHost>(Assembly assembly)
255public static Func<string[], TWebHostBuilder> ResolveWebHostBuilderFactory<TWebHostBuilder>(Assembly assembly)
260public static Func<string[], THostBuilder> ResolveHostBuilderFactory<THostBuilder>(Assembly assembly)
271public static Func<string[], object> ResolveHostFactory(Assembly assembly,
285private static Func<string[], T> ResolveFactory<T>(Assembly assembly, string name)
312public static Func<string[], IServiceProvider> ResolveServiceProviderFactory(Assembly assembly, TimeSpan waitTimeout = default)
315var webHostFactory = ResolveWebHostFactory<object>(assembly);
325var webHostBuilderFactory = ResolveWebHostBuilderFactory<object>(assembly);
336var hostBuilderFactory = ResolveHostBuilderFactory<object>(assembly);
347var hostFactory = ResolveHostFactory(assembly, waitTimeout: waitTimeout);
Microsoft.AspNetCore.OpenApi.Tests (1)
Microsoft.AspNetCore.OutputCaching (6)
Microsoft.AspNetCore.OutputCaching.Tests (1)
Microsoft.AspNetCore.Owin (45)
OwinEnvironment.cs (12)
21Func
240public FeatureMap(Type featureInterface, Func<object, object> getter)
251public FeatureMap(Type featureInterface, Func<object, object> getter, Func<object> defaultFactory)
262public FeatureMap(Type featureInterface, Func<object, object> getter, Action<object, object> setter)
274public FeatureMap(Type featureInterface, Func<object, object> getter, Func<object> defaultFactory, Action<object, object> setter)
287public FeatureMap(Type featureInterface, Func<object, object> getter, Func<object> defaultFactory, Action<object, object> setter, Func<object> featureFactory)
297private Func<object, object> Getter { get; set; }
355public FeatureMap(Func<TFeature, object> getter)
365public FeatureMap(Func<TFeature, object> getter, Func<object> defaultFactory)
375public FeatureMap(Func<TFeature, object> getter, Action<TFeature, object> setter)
386public FeatureMap(Func<TFeature, object> getter, Func<object> defaultFactory, Action<TFeature, object> setter)
398public FeatureMap(Func<TFeature, object> getter, Func<object> defaultFactory, Action<TFeature, object> setter, Func<TFeature> featureFactory)
OwinExtensions.cs (13)
10using AddMiddleware = Action<Func<
11Func<IDictionary<string, object>, Task>,
12Func<IDictionary<string, object>, Task>
14using AppFunc = Func<IDictionary<string, object>, Task>;
15using CreateMiddleware = Func<
16Func<IDictionary<string, object>, Task>,
17Func<IDictionary<string, object>, Task>
36Func<RequestDelegate, RequestDelegate> middleware1 = next1 =>
38AppFunc exitMiddleware = env =>
42var app = middleware(exitMiddleware);
113var middleware = CreateMiddlewareFactory(exit =>
123private static CreateMiddleware CreateMiddlewareFactory(Func<RequestDelegate, RequestDelegate> middleware, IServiceProvider services)
Microsoft.AspNetCore.Owin.Tests (11)
OwinExtensionTests.cs (11)
10using AddMiddleware = Action<Func<
11Func<IDictionary<string, object>, Task>,
12Func<IDictionary<string, object>, Task>
14using AppFunc = Func<IDictionary<string, object>, Task>;
15using CreateMiddleware = Func<
16Func<IDictionary<string, object>, Task>,
17Func<IDictionary<string, object>, Task>
22static readonly AppFunc notFound = env => new Task(() => { env["owin.ResponseStatusCode"] = 404; });
27var list = new List<CreateMiddleware>();
56var list = new List<CreateMiddleware>();
91var list = new List<CreateMiddleware>();
Microsoft.AspNetCore.RateLimiting (9)
RateLimiterOptions.cs (7)
19internal Dictionary<string, Func<IServiceProvider, DefaultRateLimiterPolicy>> UnactivatedPolicyMap { get; }
20= new Dictionary<string, Func<IServiceProvider, DefaultRateLimiterPolicy>>(StringComparer.Ordinal);
48public RateLimiterOptions AddPolicy<TPartitionKey>(string policyName, Func<HttpContext, RateLimitPartition<TPartitionKey>> partitioner)
76Func<IServiceProvider, DefaultRateLimiterPolicy> policyFunc = serviceProvider =>
109internal static Func<HttpContext, RateLimitPartition<DefaultKeyType>> ConvertPartitioner<TPartitionKey>(string? policyName, Func<HttpContext, RateLimitPartition<TPartitionKey>> partitioner)
115return new RateLimitPartition<DefaultKeyType>(partitionKey, static key => ((Func<TPartitionKey, RateLimiter>)key.Factory!)((TPartitionKey)key.Key!));
Microsoft.AspNetCore.RequestDecompression.Tests (1)
Microsoft.AspNetCore.ResponseCaching.Tests (1)
Microsoft.AspNetCore.Rewrite (1)
Microsoft.AspNetCore.Routing (16)
src\Shared\PropertyHelper\PropertyHelper.cs (11)
46private Func<object, object?>? _valueGetter;
71public Func<object, object?> ValueGetter
159public static Func<object, object?> MakeFastPropertyGetter(PropertyInfo propertyInfo)
179public static Func<object, object?> MakeNullSafeFastPropertyGetter(PropertyInfo propertyInfo)
190private static Func<object, object?> MakeFastPropertyGetter(
230typeof(Func<,>),
243private static Func<object, object?> MakeFastPropertyGetter(
256typeof(Func<object, object?>),
259return (Func<object, object?>)accessorDelegate;
344Func<TDeclaringType, TValue> getter,
361Func<TDeclaringType, TValue> getter,
Microsoft.AspNetCore.Routing.Abstractions (11)
src\Shared\PropertyHelper\PropertyHelper.cs (11)
46private Func<object, object?>? _valueGetter;
71public Func<object, object?> ValueGetter
159public static Func<object, object?> MakeFastPropertyGetter(PropertyInfo propertyInfo)
179public static Func<object, object?> MakeNullSafeFastPropertyGetter(PropertyInfo propertyInfo)
190private static Func<object, object?> MakeFastPropertyGetter(
230typeof(Func<,>),
243private static Func<object, object?> MakeFastPropertyGetter(
256typeof(Func<object, object?>),
259return (Func<object, object?>)accessorDelegate;
344Func<TDeclaringType, TValue> getter,
361Func<TDeclaringType, TValue> getter,
Microsoft.AspNetCore.Routing.FunctionalTests (1)
Microsoft.AspNetCore.Routing.Tests (5)
Microsoft.AspNetCore.Server.HttpSys (11)
RequestProcessing\RequestContext.FeatureCollection.cs (8)
72private List<Tuple<Func<object, Task>, object>>? _onStartingActions = new List<Tuple<Func<object, Task>, object>>();
73private List<Tuple<Func<object, Task>, object>>? _onCompletedActions = new List<Tuple<Func<object, Task>, object>>();
454void IHttpResponseFeature.OnStarting(Func<object, Task> callback, object state)
462_onStartingActions.Add(new Tuple<Func<object, Task>, object>(callback, state));
465void IHttpResponseFeature.OnCompleted(Func<object, Task> callback, object state)
473_onCompletedActions.Add(new Tuple<Func<object, Task>, object>(callback, state));
Microsoft.AspNetCore.Server.HttpSys.FunctionalTests (5)
Microsoft.AspNetCore.Server.IIS (15)
Core\IISHttpContext.cs (10)
48protected Stack<KeyValuePair<Func<object, Task>, object>>? _onStarting;
49protected Stack<KeyValuePair<Func<object, Task>, object>>? _onCompleted;
673public void OnStarting(Func<object, Task> callback, object state)
684_onStarting = new Stack<KeyValuePair<Func<object, Task>, object>>();
686_onStarting.Push(new KeyValuePair<Func<object, Task>, object>(callback, state));
690public void OnCompleted(Func<object, Task> callback, object state)
696_onCompleted = new Stack<KeyValuePair<Func<object, Task>, object>>();
698_onCompleted.Push(new KeyValuePair<Func<object, Task>, object>(callback, state));
704Stack<KeyValuePair<Func<object, Task>, object>>? onStarting = null;
728Stack<KeyValuePair<Func<object, Task>, object>>? onCompleted = null;
Microsoft.AspNetCore.Server.IISIntegration (1)
Microsoft.AspNetCore.Server.IntegrationTesting (4)
Microsoft.AspNetCore.Server.Kestrel.Core (66)
Internal\AddressBinder.cs (5)
19public static Task BindAsync(ListenOptions[] listenOptions, AddressBindContext context, Func<ListenOptions, ListenOptions> useHttps, CancellationToken cancellationToken)
35private static IStrategy CreateStrategy(ListenOptions[] listenOptions, string[] addresses, bool preferAddresses, Func<ListenOptions, ListenOptions> useHttps)
190public OverrideWithAddressesStrategy(IReadOnlyCollection<string> addresses, Func<ListenOptions, ListenOptions> useHttps)
249private readonly Func<ListenOptions, ListenOptions> _useHttps;
251public AddressesStrategy(IReadOnlyCollection<string> addresses, Func<ListenOptions, ListenOptions> useHttps)
Internal\Http\HttpProtocol.cs (10)
43private Stack<KeyValuePair<Func<object, Task>, object>>? _onStarting;
44private Stack<KeyValuePair<Func<object, Task>, object>>? _onCompleted;
787public void OnStarting(Func<object, Task> callback, object state)
796_onStarting = new Stack<KeyValuePair<Func<object, Task>, object>>();
798_onStarting.Push(new KeyValuePair<Func<object, Task>, object>(callback, state));
801public void OnCompleted(Func<object, Task> callback, object state)
805_onCompleted = new Stack<KeyValuePair<Func<object, Task>, object>>();
807_onCompleted.Push(new KeyValuePair<Func<object, Task>, object>(callback, state));
820static async Task ProcessEvents(HttpProtocol protocol, Stack<KeyValuePair<Func<object, Task>, object>> events)
848static async Task ProcessEvents(HttpProtocol protocol, Stack<KeyValuePair<Func<object, Task>, object>> events)
Internal\Infrastructure\KestrelConnection.cs (6)
15private Stack<KeyValuePair<Func<object, Task>, object>>? _onCompleted;
75void IConnectionCompleteFeature.OnCompleted(Func<object, Task> callback, object state)
84_onCompleted = new Stack<KeyValuePair<Func<object, Task>, object>>();
86_onCompleted.Push(new KeyValuePair<Func<object, Task>, object>(callback, state));
107private Task CompleteAsyncMayAwait(Stack<KeyValuePair<Func<object, Task>, object>> onCompleted)
128private async Task CompleteAsyncAwaited(Task currentTask, Stack<KeyValuePair<Func<object, Task>, object>> onCompleted)
Microsoft.AspNetCore.Server.Kestrel.Core.Tests (15)
Microsoft.AspNetCore.Server.Kestrel.Microbenchmarks (12)
src\Servers\Kestrel\shared\ConnectionCompletion.cs (3)
12public static Task FireOnCompletedAsync(ILogger logger, Stack<KeyValuePair<Func<object, Task>, object>>? onCompleted)
22private static Task CompleteAsyncMayAwait(ILogger logger, Stack<KeyValuePair<Func<object, Task>, object>> onCompleted)
43private static async Task CompleteAsyncAwaited(Task currentTask, ILogger logger, Stack<KeyValuePair<Func<object, Task>, object>> onCompleted)
Microsoft.AspNetCore.Server.Kestrel.Transport.NamedPipes (1)
Microsoft.AspNetCore.Server.Kestrel.Transport.Quic (3)
src\Servers\Kestrel\shared\ConnectionCompletion.cs (3)
12public static Task FireOnCompletedAsync(ILogger logger, Stack<KeyValuePair<Func<object, Task>, object>>? onCompleted)
22private static Task CompleteAsyncMayAwait(ILogger logger, Stack<KeyValuePair<Func<object, Task>, object>> onCompleted)
43private static async Task CompleteAsyncAwaited(Task currentTask, ILogger logger, Stack<KeyValuePair<Func<object, Task>, object>> onCompleted)
Microsoft.AspNetCore.Server.Kestrel.Transport.Quic.Tests (4)
Microsoft.AspNetCore.Server.Kestrel.Transport.Sockets (1)
Microsoft.AspNetCore.Shared.Tests (44)
src\Shared\ObjectMethodExecutor\ObjectMethodExecutor.cs (10)
23typeof(Func<object, object>), // getAwaiterMethod
24typeof(Func<object, bool>), // isCompletedMethod
25typeof(Func<object, object>), // getResultMethod
282var getAwaiterFunc = Expression.Lambda<Func<object, object>>(
293var isCompletedFunc = Expression.Lambda<Func<object, bool>>(
300Func<object, object> getResultFunc;
308getResultFunc = Expression.Lambda<Func<object, object>>(
321getResultFunc = Expression.Lambda<Func<object, object>>(
src\Shared\ObjectMethodExecutor\ObjectMethodExecutorAwaitable.cs (10)
19private readonly Func<object, object> _getAwaiterMethod;
20private readonly Func<object, bool> _isCompletedMethod;
21private readonly Func<object, object> _getResultMethod;
45Func<object, object> getAwaiterMethod,
46Func<object, bool> isCompletedMethod,
47Func<object, object> getResultMethod,
68private readonly Func<object, bool> _isCompletedMethod;
69private readonly Func<object, object> _getResultMethod;
75Func<object, bool> isCompletedMethod,
76Func<object, object> getResultMethod,
src\Shared\PropertyHelper\PropertyHelper.cs (11)
46private Func<object, object?>? _valueGetter;
71public Func<object, object?> ValueGetter
159public static Func<object, object?> MakeFastPropertyGetter(PropertyInfo propertyInfo)
179public static Func<object, object?> MakeNullSafeFastPropertyGetter(PropertyInfo propertyInfo)
190private static Func<object, object?> MakeFastPropertyGetter(
230typeof(Func<,>),
243private static Func<object, object?> MakeFastPropertyGetter(
256typeof(Func<object, object?>),
259return (Func<object, object?>)accessorDelegate;
344Func<TDeclaringType, TValue> getter,
361Func<TDeclaringType, TValue> getter,
Microsoft.AspNetCore.SignalR.Client.Core (18)
HubConnectionExtensions.OnResult.cs (8)
18private static IDisposable On<TResult>(this HubConnection hubConnection, string methodName, Type[] parameterTypes, Func<object?[], TResult> handler)
22var currentHandler = (Func<object?[], TResult>)state;
37public static IDisposable On<TResult>(this HubConnection hubConnection, string methodName, Type[] parameterTypes, Func<object?[], Task<TResult>> handler)
41var currentHandler = (Func<object?[], Task<TResult>>)state;
88public static IDisposable On<T1, TResult>(this HubConnection hubConnection, string methodName, Func<T1, TResult> handler)
268public static IDisposable On<T1, TResult>(this HubConnection hubConnection, string methodName, Func<T1, Task<TResult>> handler)
Microsoft.AspNetCore.SignalR.Client.FunctionalTests (1)
Microsoft.AspNetCore.SignalR.Client.Tests (17)
Microsoft.AspNetCore.SignalR.Core (36)
src\Shared\ObjectMethodExecutor\ObjectMethodExecutor.cs (10)
23typeof(Func<object, object>), // getAwaiterMethod
24typeof(Func<object, bool>), // isCompletedMethod
25typeof(Func<object, object>), // getResultMethod
282var getAwaiterFunc = Expression.Lambda<Func<object, object>>(
293var isCompletedFunc = Expression.Lambda<Func<object, bool>>(
300Func<object, object> getResultFunc;
308getResultFunc = Expression.Lambda<Func<object, object>>(
321getResultFunc = Expression.Lambda<Func<object, object>>(
src\Shared\ObjectMethodExecutor\ObjectMethodExecutorAwaitable.cs (10)
19private readonly Func<object, object> _getAwaiterMethod;
20private readonly Func<object, bool> _isCompletedMethod;
21private readonly Func<object, object> _getResultMethod;
45Func<object, object> getAwaiterMethod,
46Func<object, bool> isCompletedMethod,
47Func<object, object> getResultMethod,
68private readonly Func<object, bool> _isCompletedMethod;
69private readonly Func<object, object> _getResultMethod;
75Func<object, bool> isCompletedMethod,
76Func<object, object> getResultMethod,
Microsoft.AspNetCore.SignalR.StackExchangeRedis (2)
Microsoft.AspNetCore.SignalR.Tests (19)
TestFilters.cs (13)
19public async Task OnConnectedAsync(HubLifetimeContext context, Func<HubLifetimeContext, Task> next)
26public async ValueTask<object> InvokeMethodAsync(HubInvocationContext invocationContext, Func<HubInvocationContext, ValueTask<object>> next)
52public async Task OnConnectedAsync(HubLifetimeContext context, Func<HubLifetimeContext, Task> next)
58public async ValueTask<object> InvokeMethodAsync(HubInvocationContext invocationContext, Func<HubInvocationContext, ValueTask<object>> next)
91public Task OnConnectedAsync(HubLifetimeContext context, Func<HubLifetimeContext, Task> next)
103public ValueTask<object> InvokeMethodAsync(HubInvocationContext invocationContext, Func<HubInvocationContext, ValueTask<object>> next)
112public async Task OnConnectedAsync(HubLifetimeContext context, Func<HubLifetimeContext, Task> next)
130public async ValueTask<object> InvokeMethodAsync(HubInvocationContext invocationContext, Func<HubInvocationContext, ValueTask<object>> next)
155public Task OnConnectedAsync(HubLifetimeContext context, Func<HubLifetimeContext, Task> next)
175public ValueTask<object> InvokeMethodAsync(HubInvocationContext invocationContext, Func<HubInvocationContext, ValueTask<object>> next)
200public ValueTask<object> InvokeMethodAsync(HubInvocationContext invocationContext, Func<HubInvocationContext, ValueTask<object>> next)
221public ValueTask<object> InvokeMethodAsync(HubInvocationContext invocationContext, Func<HubInvocationContext, ValueTask<object>> next)
229public ValueTask<object> InvokeMethodAsync(HubInvocationContext invocationContext, Func<HubInvocationContext, ValueTask<object>> next)
Microsoft.AspNetCore.SignalR.Tests.Utils (10)
Microsoft.AspNetCore.SpaServices.Extensions.Tests (2)
Microsoft.AspNetCore.StaticFiles (2)
Microsoft.AspNetCore.TestHost (15)
.packages\microsoft.extensions.hostfactoryresolver.sources\10.0.0-rc.1.25420.121\contentFiles\cs\netstandard2.0\HostFactoryResolver.cs (10)
41public static Func<string[], TWebHost>? ResolveWebHostFactory<TWebHost>(Assembly assembly)
46public static Func<string[], TWebHostBuilder>? ResolveWebHostBuilderFactory<TWebHostBuilder>(Assembly assembly)
51public static Func<string[], THostBuilder>? ResolveHostBuilderFactory<THostBuilder>(Assembly assembly)
62public static Func<string[], object>? ResolveHostFactory(Assembly assembly,
95private static Func<string[], T>? ResolveFactory<T>(Assembly assembly, string name)
122public static Func<string[], IServiceProvider?>? ResolveServiceProviderFactory(Assembly assembly, TimeSpan? waitTimeout = null)
125var webHostFactory = ResolveWebHostFactory<object>(assembly);
135var webHostBuilderFactory = ResolveWebHostBuilderFactory<object>(assembly);
146var hostBuilderFactory = ResolveHostBuilderFactory<object>(assembly);
157var hostFactory = ResolveHostFactory(assembly, waitTimeout: waitTimeout);
Microsoft.AspNetCore.TestHost.Tests (2)
Microsoft.AspNetCore.Testing (2)
Microsoft.AspNetCore.WebSockets.Tests (1)
Microsoft.AspNetCore.WebUtilities.Tests (8)
Microsoft.Build.Framework (5)
Microsoft.Build.Tasks.CodeAnalysis (3)
Microsoft.Build.Tasks.CodeAnalysis.Sdk (5)
Microsoft.Cci.Extensions (13)
Microsoft.CodeAnalysis (396)
Binding\BindingDiagnosticBag.cs (4)
223internal bool AddDiagnostics<TData>(CompoundUseSiteInfo<TAssemblySymbol> useSiteInfo, Func<TData, Location> getLocation, TData data)
259internal bool Add<TData>(CompoundUseSiteInfo<TAssemblySymbol> useSiteInfo, Func<TData, Location> getLocation, TData data)
282internal bool Add<TData>(UseSiteInfo<TAssemblySymbol> info, Func<TData, Location> getLocation, TData data)
296internal bool ReportUseSiteDiagnostic<TData>(DiagnosticInfo? info, Func<TData, Location> getLocation, TData data)
Collections\CachingFactory.cs (8)
45private readonly Func<TKey, TValue> _valueFactory;
46private readonly Func<TKey, int> _keyHash;
50Func<TKey, TValue> valueFactory,
51Func<TKey, int> keyHash,
131private readonly Func<TKey, TValue> _valueFactory;
140public CachingIdentityFactory(int size, Func<TKey, TValue> valueFactory) :
146public CachingIdentityFactory(int size, Func<TKey, TValue> valueFactory, ObjectPool<CachingIdentityFactory<TKey, TValue>> pool) :
196public static ObjectPool<CachingIdentityFactory<TKey, TValue>> CreatePool(int size, Func<TKey, TValue> valueFactory)
Compilation\Compilation.cs (11)
3064Func<ISymbol, bool> isAddedSymbol,
3091Func<ISymbol, bool> isAddedSymbol,
3108Func<ISymbol, bool> isAddedSymbol,
3155Func<ISymbol, bool> isAddedSymbol,
3231Func<ISymWriterMetadataProvider, SymUnmanagedWriter>? testSymWriterFactory,
3512Func<ISymWriterMetadataProvider, SymUnmanagedWriter>? testSymWriterFactory,
3631private static readonly Func<SyntaxTree, SmallConcurrentSetOfInts> s_createSetCallback = t => new SmallConcurrentSetOfInts();
3772public abstract bool ContainsSymbolsWithName(Func<string, bool> predicate, SymbolFilter filter = SymbolFilter.TypeAndMember, CancellationToken cancellationToken = default(CancellationToken));
3777public abstract IEnumerable<ISymbol> GetSymbolsWithName(Func<string, bool> predicate, SymbolFilter filter = SymbolFilter.TypeAndMember, CancellationToken cancellationToken = default(CancellationToken));
3782/// This may be faster than <see cref="ContainsSymbolsWithName(Func{string, bool},
3790/// faster than <see cref="GetSymbolsWithName(Func{string, bool}, SymbolFilter,
DiagnosticAnalyzer\AnalysisResultBuilder.cs (5)
188public void ApplySuppressionsAndStoreAnalysisResult(AnalysisScope analysisScope, AnalyzerDriver driver, Compilation compilation, Func<DiagnosticAnalyzer, AnalyzerActionCounts> getAnalyzerActionCounts, CancellationToken cancellationToken)
331Func<Diagnostic, TKey?> getKeyFunc,
510Func<Diagnostic, bool> shouldInclude = analysisScope.ShouldInclude;
526Func<Diagnostic, bool> shouldInclude,
562Func<Diagnostic, bool> shouldInclude,
DiagnosticAnalyzer\AnalyzerDriver.cs (8)
35private static readonly Func<DiagnosticAnalyzer, bool> s_IsCompilerAnalyzerFunc = IsCompilerAnalyzer;
374protected AnalyzerDriver(ImmutableArray<DiagnosticAnalyzer> analyzers, AnalyzerManager analyzerManager, SeverityFilter severityFilter, Func<SyntaxTrivia, bool> isComment)
837Func<Exception, bool>? nullFilter = null;
848Func<Exception, bool>? analyzerExceptionFilter,
2420private readonly Func<SyntaxNode, TLanguageKindEnum> _getKind;
2431internal AnalyzerDriver(ImmutableArray<DiagnosticAnalyzer> analyzers, Func<SyntaxNode, TLanguageKindEnum> getKind, AnalyzerManager analyzerManager, SeverityFilter severityFilter, Func<SyntaxTrivia, bool> isComment)
2920Func<SyntaxNode, bool>? additionalFilter = semanticModel.GetSyntaxNodesToAnalyzeFilter(declaredNode, declaredSymbol);
DiagnosticAnalyzer\AnalyzerExecutor.cs (26)
38private readonly Func<Exception, bool>? _analyzerExceptionFilter;
40private readonly Func<DiagnosticAnalyzer, bool> _isCompilerAnalyzer;
41private readonly Func<DiagnosticAnalyzer, object?> _getAnalyzerGate;
42private readonly Func<SyntaxTree, SemanticModel> _getSemanticModel;
43private readonly Func<DiagnosticAnalyzer, bool> _shouldSkipAnalysisOnGeneratedCode;
65private Func<IOperation, ControlFlowGraph>? _lazyGetControlFlowGraph;
69private Func<IOperation, ControlFlowGraph> GetControlFlowGraph
118Func<Exception, bool>? analyzerExceptionFilter,
119Func<DiagnosticAnalyzer, bool> isCompilerAnalyzer,
121Func<DiagnosticAnalyzer, AnalyzerConfigOptionsProvider>? getAnalyzerConfigOptionsProvider,
123Func<DiagnosticAnalyzer, bool> shouldSkipAnalysisOnGeneratedCode,
127Func<DiagnosticAnalyzer, object?> getAnalyzerGate,
128Func<SyntaxTree, SemanticModel> getSemanticModel,
152Func<Exception, bool>? analyzerExceptionFilter,
153Func<DiagnosticAnalyzer, bool> isCompilerAnalyzer,
155Func<DiagnosticAnalyzer, AnalyzerConfigOptionsProvider>? getAnalyzerConfigOptionsProvider,
157Func<DiagnosticAnalyzer, bool> shouldSkipAnalysisOnGeneratedCode,
161Func<DiagnosticAnalyzer, object?> getAnalyzerGate,
162Func<SyntaxTree, SemanticModel> getSemanticModel,
376out Func<SuppressionDescriptor, bool> isSupportedSuppression);
828Func<SyntaxNode, TLanguageKindEnum> getKind,
875var filter = executionData.SemanticModel.GetSyntaxNodesToAnalyzeFilter(block, executionData.DeclaredSymbol);
1091Func<SyntaxNode, TLanguageKindEnum> getKind,
1127Func<SyntaxNode, TLanguageKindEnum> getKind,
1348Func<Exception, bool>? analyzerExceptionFilter,
1369static bool exceptionFilter(Exception ex, Func<Exception, bool>? analyzerExceptionFilter, CancellationToken cancellationToken)
DiagnosticAnalyzer\AnalyzerFileReference.cs (4)
190internal void AddAnalyzers(ImmutableArray<DiagnosticAnalyzer>.Builder builder, string language, Func<DiagnosticAnalyzer, bool>? shouldInclude = null)
376private readonly Func<object?, TExtension?>? _coerceFunction;
381internal Extensions(AnalyzerFileReference reference, Type attributeType, AttributeLanguagesFunc languagesFunc, bool allowNetFramework, Func<object?, TExtension?>? coerceFunction = null)
513internal void AddExtensions(ImmutableArray<TExtension>.Builder builder, string language, Func<TExtension, bool>? shouldInclude = null)
DiagnosticAnalyzer\AnalyzerManager.cs (8)
274internal bool IsSupportedDiagnostic(DiagnosticAnalyzer analyzer, Diagnostic diagnostic, Func<DiagnosticAnalyzer, bool> isCompilerAnalyzer, AnalyzerExecutor analyzerExecutor, CancellationToken cancellationToken)
302Func<DiagnosticAnalyzer, bool> isCompilerAnalyzer,
308Func<DiagnosticAnalyzer, ImmutableArray<DiagnosticDescriptor>> getSupportedDiagnosticDescriptors =
310Func<DiagnosticSuppressor, ImmutableArray<SuppressionDescriptor>> getSupportedSuppressionDescriptors =
344Func<DiagnosticAnalyzer, bool> isCompilerAnalyzer,
346Func<DiagnosticDescriptor, bool> isEnabledWithAnalyzerConfigOptions,
347Func<DiagnosticAnalyzer, ImmutableArray<DiagnosticDescriptor>> getSupportedDiagnosticDescriptors,
348Func<DiagnosticSuppressor, ImmutableArray<SuppressionDescriptor>> getSupportedSuppressionDescriptors,
DiagnosticAnalyzer\CompilationWithAnalyzersOptions.cs (7)
16private readonly Func<Exception, bool>? _analyzerExceptionFilter;
34public Func<Exception, bool>? AnalyzerExceptionFilter => _analyzerExceptionFilter;
56internal readonly Func<DiagnosticAnalyzer, AnalyzerConfigOptionsProvider>? GetAnalyzerConfigOptionsProvider;
107Func<Exception, bool>? analyzerExceptionFilter)
112/// <inheritdoc cref="CompilationWithAnalyzersOptions.CompilationWithAnalyzersOptions(AnalyzerOptions?, Action{Exception, DiagnosticAnalyzer, Diagnostic}?, bool, bool, bool, Func{Exception, bool}?)"/>
123Func<Exception, bool>? analyzerExceptionFilter,
124Func<DiagnosticAnalyzer, AnalyzerConfigOptionsProvider>? getAnalyzerConfigOptionsProvider)
DiagnosticAnalyzer\DiagnosticAnalysisContext.cs (19)
583public CompilationAnalysisContext(Compilation compilation, AnalyzerOptions options, Action<Diagnostic> reportDiagnostic, Func<Diagnostic, bool> isSupportedDiagnostic, CancellationToken cancellationToken)
722public SemanticModelAnalysisContext(SemanticModel semanticModel, AnalyzerOptions options, Action<Diagnostic> reportDiagnostic, Func<Diagnostic, bool> isSupportedDiagnostic, CancellationToken cancellationToken)
815public SymbolAnalysisContext(ISymbol symbol, Compilation compilation, AnalyzerOptions options, Action<Diagnostic> reportDiagnostic, Func<Diagnostic, bool> isSupportedDiagnostic, CancellationToken cancellationToken)
1179public CodeBlockAnalysisContext(SyntaxNode codeBlock, ISymbol owningSymbol, SemanticModel semanticModel, AnalyzerOptions options, Action<Diagnostic> reportDiagnostic, Func<Diagnostic, bool> isSupportedDiagnostic, CancellationToken cancellationToken)
1240private readonly Func<IOperation, ControlFlowGraph>? _getControlFlowGraph;
1305Func<IOperation, ControlFlowGraph>? getControlFlowGraph,
1382private readonly Func<IOperation, ControlFlowGraph>? _getControlFlowGraph;
1437Func<Diagnostic, bool> isSupportedDiagnostic,
1451Func<IOperation, ControlFlowGraph>? getControlFlowGraph,
1546public SyntaxTreeAnalysisContext(SyntaxTree tree, AnalyzerOptions options, Action<Diagnostic> reportDiagnostic, Func<Diagnostic, bool> isSupportedDiagnostic, CancellationToken cancellationToken)
1716public SyntaxNodeAnalysisContext(SyntaxNode node, ISymbol? containingSymbol, SemanticModel semanticModel, AnalyzerOptions options, Action<Diagnostic> reportDiagnostic, Func<Diagnostic, bool> isSupportedDiagnostic, CancellationToken cancellationToken)
1722public SyntaxNodeAnalysisContext(SyntaxNode node, SemanticModel semanticModel, AnalyzerOptions options, Action<Diagnostic> reportDiagnostic, Func<Diagnostic, bool> isSupportedDiagnostic, CancellationToken cancellationToken)
1776private readonly Func<IOperation, ControlFlowGraph>? _getControlFlowGraph;
1828Func<Diagnostic, bool> isSupportedDiagnostic,
1841Func<IOperation, ControlFlowGraph>? getControlFlowGraph,
1884private readonly Func<SuppressionDescriptor, bool> _isSupportedSuppressionDescriptor;
1885private readonly Func<SyntaxTree, SemanticModel> _getSemanticModel;
1919Func<SuppressionDescriptor, bool> isSupportedSuppressionDescriptor,
1920Func<SyntaxTree, SemanticModel> getSemanticModel,
Emit\EditAndContinue\EmitBaseline.cs (11)
84public static EmitBaseline CreateInitialBaseline(ModuleMetadata module, Func<MethodDefinitionHandle, EditAndContinueMethodDebugInformation> debugInformationProvider)
91Func<MethodDefinitionHandle, EditAndContinueMethodDebugInformation> debugInformationProvider,
92Func<MethodDefinitionHandle, StandaloneSignatureHandle> localSignatureProvider,
141Func<MethodDefinitionHandle, EditAndContinueMethodDebugInformation> debugInformationProvider,
142Func<MethodDefinitionHandle, StandaloneSignatureHandle> localSignatureProvider,
269internal readonly Func<MethodDefinitionHandle, EditAndContinueMethodDebugInformation> DebugInformationProvider;
278internal readonly Func<MethodDefinitionHandle, StandaloneSignatureHandle> LocalSignatureProvider;
317Func<MethodDefinitionHandle, EditAndContinueMethodDebugInformation> debugInformationProvider,
318Func<MethodDefinitionHandle, StandaloneSignatureHandle> localSignatureProvider,
416Func<MethodDefinitionHandle, EditAndContinueMethodDebugInformation> debugInformationProvider,
417Func<MethodDefinitionHandle, StandaloneSignatureHandle> localSignatureProvider)
Emit\SemanticEdit.cs (7)
47public Func<SyntaxNode, SyntaxNode?>? SyntaxMap { get; }
53public Func<SyntaxNode, RuntimeRudeEdit?>? RuntimeRudeEdit { get; }
65public SemanticEdit(SemanticEditKind kind, ISymbol? oldSymbol, ISymbol? newSymbol, Func<SyntaxNode, SyntaxNode?>? syntaxMap, bool preserveLocalVariables)
74public SemanticEdit(SemanticEditKind kind, ISymbol? oldSymbol, ISymbol? newSymbol, Func<SyntaxNode, SyntaxNode?>? syntaxMap, bool preserveLocalVariables, MethodInstrumentation instrumentation)
104public SemanticEdit(SemanticEditKind kind, ISymbol? oldSymbol, ISymbol? newSymbol, Func<SyntaxNode, SyntaxNode?>? syntaxMap = null, Func<SyntaxNode, RuntimeRudeEdit?>? runtimeRudeEdit = null, MethodInstrumentation instrumentation = default)
215internal static SemanticEdit Create(SemanticEditKind kind, ISymbolInternal oldSymbol, ISymbolInternal newSymbol, Func<SyntaxNode, SyntaxNode>? syntaxMap = null)
FileSystem\FileUtilities.cs (4)
47Func<string, bool> fileExists)
322public static T RethrowExceptionsAsIOException<T, TArg>(Func<TArg, T> operation, TArg arg)
339public static async Task<T> RethrowExceptionsAsIOExceptionAsync<T, TArg>(Func<TArg, Task<T>> operation, TArg arg)
355internal static Stream CreateFileStreamChecked(Func<string, Stream> factory, string path, string? paramName = null)
InternalUtilities\InterlockedOperations.cs (5)
46public static T Initialize<T, TArg>([NotNull] ref T? target, Func<TArg, T> valueFactory, TArg arg)
66public static int Initialize<TArg>(ref int target, int uninitializedValue, Func<TArg, int> valueFactory, TArg arg)
103public static T? Initialize<T, TArg>([NotNull] ref StrongBox<T?>? target, Func<TArg, T?> valueFactory, TArg arg)
183public static ImmutableArray<T> Initialize<T, TArg>(ref ImmutableArray<T> target, Func<TArg, ImmutableArray<T>> createArray, TArg arg)
193private static ImmutableArray<T> Initialize_Slow<T, TArg>(ref ImmutableArray<T> target, Func<TArg, ImmutableArray<T>> createArray, TArg arg)
SourceGeneration\GeneratedCodeUtilities.cs (4)
49SyntaxTree tree, Func<SyntaxTrivia, bool> isComment, CancellationToken cancellationToken)
55internal static bool IsGeneratedCode(string? filePath, SyntaxNode root, Func<SyntaxTrivia, bool> isComment)
88private static bool BeginsWithAutoGeneratedComment(SyntaxNode root, Func<SyntaxTrivia, bool> isComment)
118SyntaxTree tree, Func<SyntaxTrivia, bool> isComment, CancellationToken cancellationToken)
src\Dependencies\Collections\Extensions\IEnumerableExtensions.cs (30)
164public static T? FirstOrNull<T>(this IEnumerable<T> source, Func<T, bool> predicate)
182public static T? SingleOrNull<T>(this IEnumerable<T> source, Func<T, bool> predicate)
261public static bool HasDuplicates<TItem, TValue>(this IEnumerable<TItem> source, Func<TItem, TValue> selector)
271/// <seealso cref="Microsoft.CodeAnalysis.ImmutableArrayExtensions.HasDuplicates{TItem, TValue}(ImmutableArray{TItem}, Func{TItem, TValue}, IEqualityComparer{TValue})"/>
273public static bool HasDuplicates<TItem, TValue>(this IEnumerable<TItem> source, Func<TItem, TValue> selector, IEqualityComparer<TValue> comparer)
321private static readonly Func<object, bool> s_notNullTest = x => x != null;
331return source.Where((Func<T?, bool>)s_notNullTest)!;
376public static ImmutableArray<T> WhereAsArray<T>(this IEnumerable<T> values, Func<T, bool> predicate)
407public static ImmutableArray<TResult> SelectAsArray<TSource, TResult>(this IEnumerable<TSource>? source, Func<TSource, TResult> selector)
417public static ImmutableArray<TResult> SelectAsArray<TItem, TResult>(this IEnumerable<TItem>? source, Func<TItem, bool> predicate, Func<TItem, TResult> selector)
461public static ImmutableArray<TResult> SelectAsArray<TSource, TResult>(this IReadOnlyCollection<TSource>? source, Func<TSource, TResult> selector)
485public static ImmutableArray<TResult> SelectManyAsArray<TSource, TResult>(this IEnumerable<TSource>? source, Func<TSource, IEnumerable<TResult>> selector)
507public static ImmutableArray<TResult> SelectManyAsArray<TItem, TResult>(this IReadOnlyCollection<TItem>? source, Func<TItem, IEnumerable<TResult>> selector)
533public static ImmutableArray<TResult> SelectManyAsArray<TSource, TResult>(this IEnumerable<TSource>? source, Func<TSource, OneOrMany<TResult>> selector)
547public static async ValueTask<ImmutableArray<TResult>> SelectAsArrayAsync<TItem, TResult>(this IEnumerable<TItem> source, Func<TItem, ValueTask<TResult>> selector)
764internal static Dictionary<K, ImmutableArray<T>> ToMultiDictionary<K, T>(this IEnumerable<T> data, Func<T, K> keySelector, IEqualityComparer<K>? comparer = null)
815public static readonly Func<T, T> Identity = t => t;
816public static readonly Func<T, bool> True = t => true;
840/// Alias for <see cref="System.Linq.Enumerable.Any{TSource}(IEnumerable{TSource}, Func{TSource, bool})"/>
842public static bool Contains<T>(this IEnumerable<T> sequence, Func<T, bool> predicate)
846/// Variant of <see cref="System.Linq.Enumerable.Count{TSource}(IEnumerable{TSource}, Func{TSource, bool})"/>
861/// Variant of <see cref="System.Linq.Enumerable.FirstOrDefault{TSource}(IEnumerable{TSource}, Func{TSource, bool})"/>
875/// Variant of <see cref="System.Linq.Enumerable.Any{TSource}(IEnumerable{TSource}, Func{TSource, bool})"/>
889/// Variant of <see cref="System.Linq.Enumerable.OrderBy{TSource, TKey}(IEnumerable{TSource}, Func{TSource, TKey}, IComparer{TKey}?)"/>
895/// Variant of <see cref="System.Linq.Enumerable.OrderByDescending{TSource, TKey}(IEnumerable{TSource}, Func{TSource, TKey}, IComparer{TKey}?)"/>
901/// Variant of <see cref="System.Linq.Enumerable.OrderBy{TSource, TKey}(IEnumerable{TSource}, Func{TSource, TKey}, IComparer{TKey}?)"/>
907/// Variant of <see cref="System.Linq.Enumerable.OrderByDescending{TSource, TKey}(IEnumerable{TSource}, Func{TSource, TKey}, IComparer{TKey}?)"/>
913/// Variant of <see cref="System.Linq.Enumerable.ThenBy{TSource, TKey}(IOrderedEnumerable{TSource}, Func{TSource, TKey}, IComparer{TKey}?)"/>
919/// Variant of <see cref="System.Linq.Enumerable.ThenBy{TSource, TKey}(IOrderedEnumerable{TSource}, Func{TSource, TKey}, IComparer{TKey}?)"/>
src\Dependencies\Collections\Extensions\IListExtensions.cs (4)
21public static bool HasDuplicates<TItem, TValue>(this IReadOnlyList<TItem> list, Func<TItem, TValue> selector)
31/// <seealso cref="ImmutableArrayExtensions.HasDuplicates{TItem, TValue}(System.Collections.Immutable.ImmutableArray{TItem}, Func{TItem, TValue}, IEqualityComparer{TValue})"/>
32/// <seealso cref="Roslyn.Utilities.EnumerableExtensions.HasDuplicates{TItem, TValue}(IEnumerable{TItem}, Func{TItem, TValue}, IEqualityComparer{TValue})"/>
34internal static bool HasDuplicates<TItem, TValue>(this IReadOnlyList<TItem> list, Func<TItem, TValue> selector, IEqualityComparer<TValue> comparer)
src\Dependencies\Collections\Extensions\ImmutableArrayExtensions.cs (27)
138public static ImmutableArray<TResult> SelectAsArray<TItem, TResult>(this ImmutableArray<TItem> items, Func<TItem, TResult> map)
198public static ImmutableArray<TResult> SelectAsArray<TItem, TResult>(this ImmutableArray<TItem> array, Func<TItem, bool> predicate, Func<TItem, TResult> selector)
247public static ImmutableArray<TResult> SelectManyAsArray<TItem, TResult>(this ImmutableArray<TItem> array, Func<TItem, IEnumerable<TResult>> selector)
267public static ImmutableArray<TResult> SelectManyAsArray<TItem, TResult>(this ImmutableArray<TItem> array, Func<TItem, ImmutableArray<TResult>> selector)
287public static ImmutableArray<TResult> SelectManyAsArray<TItem, TResult>(this ImmutableArray<TItem> array, Func<TItem, OneOrMany<TResult>> selector)
308public static ImmutableArray<TResult> SelectManyAsArray<TItem, TResult>(this ImmutableArray<TItem> array, Func<TItem, bool> predicate, Func<TItem, IEnumerable<TResult>> selector)
332public static ImmutableArray<TResult> SelectManyAsArray<TItem, TResult>(this ImmutableArray<TItem> array, Func<TItem, bool> predicate, Func<TItem, ImmutableArray<TResult>> selector)
356public static ImmutableArray<TResult> SelectManyAsArray<TItem, TResult>(this ImmutableArray<TItem> array, Func<TItem, bool> predicate, Func<TItem, OneOrMany<TResult>> selector)
493public static ImmutableArray<T> WhereAsArray<T>(this ImmutableArray<T> array, Func<T, bool> predicate)
504private static ImmutableArray<T> WhereAsArrayImpl<T, TArg>(ImmutableArray<T> array, Func<T, bool>? predicateWithoutArg, Func<T, TArg, bool>? predicateWithArg, TArg arg)
573public static async Task<bool> AnyAsync<T>(this ImmutableArray<T> array, Func<T, Task<bool>> predicateAsync)
595public static async ValueTask<T?> FirstOrDefaultAsync<T>(this ImmutableArray<T> array, Func<T, Task<bool>> predicateAsync)
757public static bool HasDuplicates<TItem, TValue>(this ImmutableArray<TItem> array, Func<TItem, TValue> selector)
767/// <seealso cref="Roslyn.Utilities.EnumerableExtensions.HasDuplicates{TItem, TValue}(IEnumerable{TItem}, Func{TItem, TValue}, IEqualityComparer{TValue})"/>
769internal static bool HasDuplicates<TItem, TValue>(this ImmutableArray<TItem> array, Func<TItem, TValue> selector, IEqualityComparer<TValue> comparer)
990/// Variant of <see cref="System.Linq.ImmutableArrayExtensions.FirstOrDefault{T}(ImmutableArray{T}, Func{T, bool})"/>
1004/// Variant of <see cref="System.Linq.ImmutableArrayExtensions.Single{T}(ImmutableArray{T}, Func{T, bool})"/>
1066/// Specialization of <see cref="System.Linq.Enumerable.Count{TSource}(IEnumerable{TSource}, Func{TSource, bool})"/> for <see cref="ImmutableArray{T}"/>.
1068public static int Count<T>(this ImmutableArray<T> items, Func<T, bool> predicate)
1086public static int Sum<T>(this ImmutableArray<T> items, Func<T, int> selector)
1213/// Variant of <see cref="System.Linq.ImmutableArrayExtensions.Any{T}(ImmutableArray{T}, Func{T, bool})"/>.
1227/// Variant of <see cref="System.Linq.ImmutableArrayExtensions.All{T}(ImmutableArray{T}, Func{T, bool})"/>.
1257public static bool Contains<T>(this ImmutableArray<T> array, Func<T, bool> predicate)
src\Dependencies\Collections\RoslynImmutableInterlocked.cs (7)
33public static bool Update<T>(ref ImmutableSegmentedList<T> location, Func<ImmutableSegmentedList<T>, ImmutableSegmentedList<T>> transformer)
154public static bool Update<T>(ref ImmutableSegmentedHashSet<T> location, Func<ImmutableSegmentedHashSet<T>, ImmutableSegmentedHashSet<T>> transformer)
276public static bool Update<TKey, TValue>(ref ImmutableSegmentedDictionary<TKey, TValue> location, Func<ImmutableSegmentedDictionary<TKey, TValue>, ImmutableSegmentedDictionary<TKey, TValue>> transformer)
410/// <inheritdoc cref="ImmutableInterlocked.GetOrAdd{TKey, TValue}(ref ImmutableDictionary{TKey, TValue}, TKey, Func{TKey, TValue})"/>
411public static TValue GetOrAdd<TKey, TValue>(ref ImmutableSegmentedDictionary<TKey, TValue> location, TKey key, Func<TKey, TValue> valueFactory)
458/// <inheritdoc cref="ImmutableInterlocked.AddOrUpdate{TKey, TValue}(ref ImmutableDictionary{TKey, TValue}, TKey, Func{TKey, TValue}, Func{TKey, TValue, TValue})"/>
459public static TValue AddOrUpdate<TKey, TValue>(ref ImmutableSegmentedDictionary<TKey, TValue> location, TKey key, Func<TKey, TValue> addValueFactory, Func<TKey, TValue, TValue> updateValueFactory)
src\Dependencies\Collections\Segmented\ImmutableSegmentedDictionary.cs (6)
68public static ImmutableSegmentedDictionary<TKey, TValue> ToImmutableSegmentedDictionary<TSource, TKey, TValue>(this IEnumerable<TSource> source, Func<TSource, TKey> keySelector, Func<TSource, TValue> elementSelector)
72public static ImmutableSegmentedDictionary<TKey, TValue> ToImmutableSegmentedDictionary<TSource, TKey, TValue>(this IEnumerable<TSource> source, Func<TSource, TKey> keySelector, Func<TSource, TValue> elementSelector, IEqualityComparer<TKey>? keyComparer)
86public static ImmutableSegmentedDictionary<TKey, TSource> ToImmutableSegmentedDictionary<TSource, TKey>(this IEnumerable<TSource> source, Func<TSource, TKey> keySelector)
90public static ImmutableSegmentedDictionary<TKey, TSource> ToImmutableSegmentedDictionary<TSource, TKey>(this IEnumerable<TSource> source, Func<TSource, TKey> keySelector, IEqualityComparer<TKey>? keyComparer)
src\Dependencies\PooledObjects\ArrayBuilder.cs (7)
457public void FreeAll(Func<T, ArrayBuilder<T>?> getNested)
560internal Dictionary<K, ImmutableArray<T>> ToDictionary<K>(Func<T, K> keySelector, IEqualityComparer<K>? comparer = null)
608public void AddRange<U>(ArrayBuilder<U> items, Func<U, T> selector)
745public ImmutableArray<S> SelectDistinct<S>(Func<T, S> selector)
763public bool Any(Func<T, bool> predicate)
787public bool All(Func<T, bool> predicate)
817public ImmutableArray<TResult> SelectAsArray<TResult>(Func<T, TResult> map)
src\Dependencies\PooledObjects\PooledDelegates.cs (9)
200public static Releaser GetPooledFunction<TArg, TResult>(Func<TArg, TResult> unboundFunction, TArg argument, out Func<TResult> boundFunction)
201=> GetPooledDelegate<FuncWithBoundArgument<TArg, TResult>, TArg, Func<TArg, TResult>, Func<TResult>>(unboundFunction, argument, out boundFunction);
204/// Equivalent to <see cref="GetPooledFunction{TArg, TResult}(Func{TArg, TResult}, TArg, out Func{TResult})"/>,
216/// Gets a <see cref="Func{T, TResult}"/> delegate, which calls <paramref name="unboundFunction"/> with the
246public static Releaser GetPooledFunction<T1, TArg, TResult>(Func<T1, TArg, TResult> unboundFunction, TArg argument, out Func<T1, TResult> boundFunction)
247=> GetPooledDelegate<FuncWithBoundArgument<T1, TArg, TResult>, TArg, Func<T1, TArg, TResult>, Func<T1, TResult>>(unboundFunction, argument, out boundFunction);
412: AbstractDelegateWithBoundArgument<FuncWithBoundArgument<TArg, TResult>, TArg, Func<TArg, TResult>, Func<TResult>>
432: AbstractDelegateWithBoundArgument<FuncWithBoundArgument<T1, TArg, TResult>, TArg, Func<T1, TArg, TResult>, Func<T1, TResult>>
434protected override Func<T1, TResult> Bind()
Syntax\SyntaxNavigator.cs (39)
31private static readonly Func<SyntaxTrivia, bool>?[] s_stepIntoFunctions = new Func<SyntaxTrivia, bool>?[]
43private static Func<SyntaxTrivia, bool>? GetStepIntoFunction(
52private static Func<SyntaxToken, bool> GetPredicateFunction(bool includeZeroWidth)
57private static bool Matches(Func<SyntaxToken, bool>? predicate, SyntaxToken token)
82internal SyntaxToken GetPreviousToken(in SyntaxToken current, Func<SyntaxToken, bool> predicate, Func<SyntaxTrivia, bool>? stepInto)
87internal SyntaxToken GetNextToken(in SyntaxToken current, Func<SyntaxToken, bool> predicate, Func<SyntaxTrivia, bool>? stepInto)
95internal SyntaxToken GetFirstToken(SyntaxNode current, Func<SyntaxToken, bool>? predicate, Func<SyntaxTrivia, bool>? stepInto)
141internal SyntaxToken GetLastToken(SyntaxNode current, Func<SyntaxToken, bool> predicate, Func<SyntaxTrivia, bool>? stepInto)
187Func<SyntaxToken, bool>? predicate,
188Func<SyntaxTrivia, bool> stepInto)
208Func<SyntaxToken, bool> predicate,
209Func<SyntaxTrivia, bool> stepInto)
227Func<SyntaxToken, bool> predicate,
228Func<SyntaxTrivia, bool>? stepInto,
245Func<SyntaxToken, bool>? predicate,
246Func<SyntaxTrivia, bool>? stepInto)
279Func<SyntaxToken, bool> predicate,
280Func<SyntaxTrivia, bool>? stepInto)
313Func<SyntaxToken, bool>? predicate,
314Func<SyntaxTrivia, bool>? stepInto)
345Func<SyntaxToken, bool> predicate,
346Func<SyntaxTrivia, bool>? stepInto)
378Func<SyntaxToken, bool>? predicate,
379Func<SyntaxTrivia, bool>? stepInto,
407Func<SyntaxToken, bool> predicate,
408Func<SyntaxTrivia, bool>? stepInto,
432Func<SyntaxToken, bool>? predicate,
433Func<SyntaxTrivia, bool>? stepInto)
482Func<SyntaxToken, bool> predicate,
483Func<SyntaxTrivia, bool>? stepInto)
530internal SyntaxToken GetNextToken(in SyntaxToken current, Func<SyntaxToken, bool>? predicate, bool searchInsideCurrentTokenTrailingTrivia, Func<SyntaxTrivia, bool>? stepInto)
583internal SyntaxToken GetPreviousToken(in SyntaxToken current, Func<SyntaxToken, bool> predicate, bool searchInsideCurrentTokenLeadingTrivia,
584Func<SyntaxTrivia, bool>? stepInto)
Syntax\SyntaxNode.cs (17)
836public TNode? FirstAncestorOrSelf<TNode>(Func<TNode, bool>? predicate = null, bool ascendOutOfTrivia = true)
874public IEnumerable<SyntaxNode> DescendantNodes(Func<SyntaxNode, bool>? descendIntoChildren = null, bool descendIntoTrivia = false)
885public IEnumerable<SyntaxNode> DescendantNodes(TextSpan span, Func<SyntaxNode, bool>? descendIntoChildren = null, bool descendIntoTrivia = false)
895public IEnumerable<SyntaxNode> DescendantNodesAndSelf(Func<SyntaxNode, bool>? descendIntoChildren = null, bool descendIntoTrivia = false)
906public IEnumerable<SyntaxNode> DescendantNodesAndSelf(TextSpan span, Func<SyntaxNode, bool>? descendIntoChildren = null, bool descendIntoTrivia = false)
916public IEnumerable<SyntaxNodeOrToken> DescendantNodesAndTokens(Func<SyntaxNode, bool>? descendIntoChildren = null, bool descendIntoTrivia = false)
927public IEnumerable<SyntaxNodeOrToken> DescendantNodesAndTokens(TextSpan span, Func<SyntaxNode, bool>? descendIntoChildren = null, bool descendIntoTrivia = false)
937public IEnumerable<SyntaxNodeOrToken> DescendantNodesAndTokensAndSelf(Func<SyntaxNode, bool>? descendIntoChildren = null, bool descendIntoTrivia = false)
948public IEnumerable<SyntaxNodeOrToken> DescendantNodesAndTokensAndSelf(TextSpan span, Func<SyntaxNode, bool>? descendIntoChildren = null, bool descendIntoTrivia = false)
1045public IEnumerable<SyntaxToken> DescendantTokens(Func<SyntaxNode, bool>? descendIntoChildren = null, bool descendIntoTrivia = false)
1053public IEnumerable<SyntaxToken> DescendantTokens(TextSpan span, Func<SyntaxNode, bool>? descendIntoChildren = null, bool descendIntoTrivia = false)
1101public SyntaxTrivia FindTrivia(int position, Func<SyntaxTrivia, bool>? stepInto)
1111internal static SyntaxTrivia FindTriviaByOffset(SyntaxNode node, int textOffset, Func<SyntaxTrivia, bool>? stepInto = null)
1182public IEnumerable<SyntaxTrivia> DescendantTrivia(Func<SyntaxNode, bool>? descendIntoChildren = null, bool descendIntoTrivia = false)
1190public IEnumerable<SyntaxTrivia> DescendantTrivia(TextSpan span, Func<SyntaxNode, bool>? descendIntoChildren = null, bool descendIntoTrivia = false)
1503private SyntaxToken FindToken(int position, Func<SyntaxTrivia, bool> findInsideTrivia)
1516protected virtual SyntaxToken FindTokenCore(int position, Func<SyntaxTrivia, bool> stepInto)
Syntax\SyntaxNode.Iterators.cs (14)
17private IEnumerable<SyntaxNode> DescendantNodesImpl(TextSpan span, Func<SyntaxNode, bool>? descendIntoChildren, bool descendIntoTrivia, bool includeSelf)
24private IEnumerable<SyntaxNodeOrToken> DescendantNodesAndTokensImpl(TextSpan span, Func<SyntaxNode, bool>? descendIntoChildren, bool descendIntoTrivia, bool includeSelf)
31private IEnumerable<SyntaxTrivia> DescendantTriviaImpl(TextSpan span, Func<SyntaxNode, bool>? descendIntoChildren = null, bool descendIntoTrivia = false)
52public ChildSyntaxListEnumeratorStack(SyntaxNode startingNode, Func<SyntaxNode, bool>? descendIntoChildren)
112public void PushChildren(SyntaxNode node, Func<SyntaxNode, bool>? descendIntoChildren)
199public TwoEnumeratorListStack(SyntaxNode startingNode, Func<SyntaxNode, bool>? descendIntoChildren)
246public void PushChildren(SyntaxNode node, Func<SyntaxNode, bool>? descendIntoChildren)
292public ThreeEnumeratorListStack(SyntaxNode startingNode, Func<SyntaxNode, bool>? descendIntoChildren)
349public void PushChildren(SyntaxNode node, Func<SyntaxNode, bool>? descendIntoChildren)
390private IEnumerable<SyntaxNode> DescendantNodesOnly(TextSpan span, Func<SyntaxNode, bool>? descendIntoChildren, bool includeSelf)
415private IEnumerable<SyntaxNodeOrToken> DescendantNodesAndTokensOnly(TextSpan span, Func<SyntaxNode, bool>? descendIntoChildren, bool includeSelf)
444private IEnumerable<SyntaxNodeOrToken> DescendantNodesAndTokensIntoTrivia(TextSpan span, Func<SyntaxNode, bool>? descendIntoChildren, bool includeSelf)
532private IEnumerable<SyntaxTrivia> DescendantTriviaOnly(TextSpan span, Func<SyntaxNode, bool>? descendIntoChildren)
570private IEnumerable<SyntaxTrivia> DescendantTriviaIntoTrivia(TextSpan span, Func<SyntaxNode, bool>? descendIntoChildren)
Syntax\SyntaxNodeOrToken.cs (4)
842internal IList<TDirective> GetDirectives<TDirective>(Func<TDirective, bool>? filter = null)
849private static void GetDirectives<TDirective>(in SyntaxNodeOrToken node, Func<TDirective, bool>? filter, out IList<TDirective> directives)
869private static void GetDirectives<TDirective>(SyntaxNode node, Func<TDirective, bool>? filter, ref List<TDirective>? directives)
878private static void GetDirectivesInTrivia<TDirective>(in SyntaxTrivia trivia, Func<TDirective, bool>? filter, ref List<TDirective>? directives)
Microsoft.CodeAnalysis.Analyzers (442)
src\Compilers\Core\Portable\FileSystem\FileUtilities.cs (4)
47Func<string, bool> fileExists)
322public static T RethrowExceptionsAsIOException<T, TArg>(Func<TArg, T> operation, TArg arg)
339public static async Task<T> RethrowExceptionsAsIOExceptionAsync<T, TArg>(Func<TArg, Task<T>> operation, TArg arg)
355internal static Stream CreateFileStreamChecked(Func<string, Stream> factory, string path, string? paramName = null)
src\Compilers\Core\Portable\InternalUtilities\InterlockedOperations.cs (5)
46public static T Initialize<T, TArg>([NotNull] ref T? target, Func<TArg, T> valueFactory, TArg arg)
66public static int Initialize<TArg>(ref int target, int uninitializedValue, Func<TArg, int> valueFactory, TArg arg)
103public static T? Initialize<T, TArg>([NotNull] ref StrongBox<T?>? target, Func<TArg, T?> valueFactory, TArg arg)
183public static ImmutableArray<T> Initialize<T, TArg>(ref ImmutableArray<T> target, Func<TArg, ImmutableArray<T>> createArray, TArg arg)
193private static ImmutableArray<T> Initialize_Slow<T, TArg>(ref ImmutableArray<T> target, Func<TArg, ImmutableArray<T>> createArray, TArg arg)
src\Compilers\Core\Portable\SourceGeneration\GeneratedCodeUtilities.cs (4)
49SyntaxTree tree, Func<SyntaxTrivia, bool> isComment, CancellationToken cancellationToken)
55internal static bool IsGeneratedCode(string? filePath, SyntaxNode root, Func<SyntaxTrivia, bool> isComment)
88private static bool BeginsWithAutoGeneratedComment(SyntaxNode root, Func<SyntaxTrivia, bool> isComment)
118SyntaxTree tree, Func<SyntaxTrivia, bool> isComment, CancellationToken cancellationToken)
src\Dependencies\Collections\Extensions\IEnumerableExtensions.cs (30)
164public static T? FirstOrNull<T>(this IEnumerable<T> source, Func<T, bool> predicate)
182public static T? SingleOrNull<T>(this IEnumerable<T> source, Func<T, bool> predicate)
261public static bool HasDuplicates<TItem, TValue>(this IEnumerable<TItem> source, Func<TItem, TValue> selector)
271/// <seealso cref="Microsoft.CodeAnalysis.ImmutableArrayExtensions.HasDuplicates{TItem, TValue}(ImmutableArray{TItem}, Func{TItem, TValue}, IEqualityComparer{TValue})"/>
273public static bool HasDuplicates<TItem, TValue>(this IEnumerable<TItem> source, Func<TItem, TValue> selector, IEqualityComparer<TValue> comparer)
321private static readonly Func<object, bool> s_notNullTest = x => x != null;
331return source.Where((Func<T?, bool>)s_notNullTest)!;
376public static ImmutableArray<T> WhereAsArray<T>(this IEnumerable<T> values, Func<T, bool> predicate)
407public static ImmutableArray<TResult> SelectAsArray<TSource, TResult>(this IEnumerable<TSource>? source, Func<TSource, TResult> selector)
417public static ImmutableArray<TResult> SelectAsArray<TItem, TResult>(this IEnumerable<TItem>? source, Func<TItem, bool> predicate, Func<TItem, TResult> selector)
461public static ImmutableArray<TResult> SelectAsArray<TSource, TResult>(this IReadOnlyCollection<TSource>? source, Func<TSource, TResult> selector)
485public static ImmutableArray<TResult> SelectManyAsArray<TSource, TResult>(this IEnumerable<TSource>? source, Func<TSource, IEnumerable<TResult>> selector)
507public static ImmutableArray<TResult> SelectManyAsArray<TItem, TResult>(this IReadOnlyCollection<TItem>? source, Func<TItem, IEnumerable<TResult>> selector)
533public static ImmutableArray<TResult> SelectManyAsArray<TSource, TResult>(this IEnumerable<TSource>? source, Func<TSource, OneOrMany<TResult>> selector)
547public static async ValueTask<ImmutableArray<TResult>> SelectAsArrayAsync<TItem, TResult>(this IEnumerable<TItem> source, Func<TItem, ValueTask<TResult>> selector)
764internal static Dictionary<K, ImmutableArray<T>> ToMultiDictionary<K, T>(this IEnumerable<T> data, Func<T, K> keySelector, IEqualityComparer<K>? comparer = null)
815public static readonly Func<T, T> Identity = t => t;
816public static readonly Func<T, bool> True = t => true;
840/// Alias for <see cref="System.Linq.Enumerable.Any{TSource}(IEnumerable{TSource}, Func{TSource, bool})"/>
842public static bool Contains<T>(this IEnumerable<T> sequence, Func<T, bool> predicate)
846/// Variant of <see cref="System.Linq.Enumerable.Count{TSource}(IEnumerable{TSource}, Func{TSource, bool})"/>
861/// Variant of <see cref="System.Linq.Enumerable.FirstOrDefault{TSource}(IEnumerable{TSource}, Func{TSource, bool})"/>
875/// Variant of <see cref="System.Linq.Enumerable.Any{TSource}(IEnumerable{TSource}, Func{TSource, bool})"/>
889/// Variant of <see cref="System.Linq.Enumerable.OrderBy{TSource, TKey}(IEnumerable{TSource}, Func{TSource, TKey}, IComparer{TKey}?)"/>
895/// Variant of <see cref="System.Linq.Enumerable.OrderByDescending{TSource, TKey}(IEnumerable{TSource}, Func{TSource, TKey}, IComparer{TKey}?)"/>
901/// Variant of <see cref="System.Linq.Enumerable.OrderBy{TSource, TKey}(IEnumerable{TSource}, Func{TSource, TKey}, IComparer{TKey}?)"/>
907/// Variant of <see cref="System.Linq.Enumerable.OrderByDescending{TSource, TKey}(IEnumerable{TSource}, Func{TSource, TKey}, IComparer{TKey}?)"/>
913/// Variant of <see cref="System.Linq.Enumerable.ThenBy{TSource, TKey}(IOrderedEnumerable{TSource}, Func{TSource, TKey}, IComparer{TKey}?)"/>
919/// Variant of <see cref="System.Linq.Enumerable.ThenBy{TSource, TKey}(IOrderedEnumerable{TSource}, Func{TSource, TKey}, IComparer{TKey}?)"/>
src\Dependencies\Collections\Extensions\IListExtensions.cs (4)
21public static bool HasDuplicates<TItem, TValue>(this IReadOnlyList<TItem> list, Func<TItem, TValue> selector)
31/// <seealso cref="ImmutableArrayExtensions.HasDuplicates{TItem, TValue}(System.Collections.Immutable.ImmutableArray{TItem}, Func{TItem, TValue}, IEqualityComparer{TValue})"/>
32/// <seealso cref="Roslyn.Utilities.EnumerableExtensions.HasDuplicates{TItem, TValue}(IEnumerable{TItem}, Func{TItem, TValue}, IEqualityComparer{TValue})"/>
34internal static bool HasDuplicates<TItem, TValue>(this IReadOnlyList<TItem> list, Func<TItem, TValue> selector, IEqualityComparer<TValue> comparer)
src\Dependencies\Collections\Extensions\ImmutableArrayExtensions.cs (27)
138public static ImmutableArray<TResult> SelectAsArray<TItem, TResult>(this ImmutableArray<TItem> items, Func<TItem, TResult> map)
198public static ImmutableArray<TResult> SelectAsArray<TItem, TResult>(this ImmutableArray<TItem> array, Func<TItem, bool> predicate, Func<TItem, TResult> selector)
247public static ImmutableArray<TResult> SelectManyAsArray<TItem, TResult>(this ImmutableArray<TItem> array, Func<TItem, IEnumerable<TResult>> selector)
267public static ImmutableArray<TResult> SelectManyAsArray<TItem, TResult>(this ImmutableArray<TItem> array, Func<TItem, ImmutableArray<TResult>> selector)
287public static ImmutableArray<TResult> SelectManyAsArray<TItem, TResult>(this ImmutableArray<TItem> array, Func<TItem, OneOrMany<TResult>> selector)
308public static ImmutableArray<TResult> SelectManyAsArray<TItem, TResult>(this ImmutableArray<TItem> array, Func<TItem, bool> predicate, Func<TItem, IEnumerable<TResult>> selector)
332public static ImmutableArray<TResult> SelectManyAsArray<TItem, TResult>(this ImmutableArray<TItem> array, Func<TItem, bool> predicate, Func<TItem, ImmutableArray<TResult>> selector)
356public static ImmutableArray<TResult> SelectManyAsArray<TItem, TResult>(this ImmutableArray<TItem> array, Func<TItem, bool> predicate, Func<TItem, OneOrMany<TResult>> selector)
493public static ImmutableArray<T> WhereAsArray<T>(this ImmutableArray<T> array, Func<T, bool> predicate)
504private static ImmutableArray<T> WhereAsArrayImpl<T, TArg>(ImmutableArray<T> array, Func<T, bool>? predicateWithoutArg, Func<T, TArg, bool>? predicateWithArg, TArg arg)
573public static async Task<bool> AnyAsync<T>(this ImmutableArray<T> array, Func<T, Task<bool>> predicateAsync)
595public static async ValueTask<T?> FirstOrDefaultAsync<T>(this ImmutableArray<T> array, Func<T, Task<bool>> predicateAsync)
757public static bool HasDuplicates<TItem, TValue>(this ImmutableArray<TItem> array, Func<TItem, TValue> selector)
767/// <seealso cref="Roslyn.Utilities.EnumerableExtensions.HasDuplicates{TItem, TValue}(IEnumerable{TItem}, Func{TItem, TValue}, IEqualityComparer{TValue})"/>
769internal static bool HasDuplicates<TItem, TValue>(this ImmutableArray<TItem> array, Func<TItem, TValue> selector, IEqualityComparer<TValue> comparer)
990/// Variant of <see cref="System.Linq.ImmutableArrayExtensions.FirstOrDefault{T}(ImmutableArray{T}, Func{T, bool})"/>
1004/// Variant of <see cref="System.Linq.ImmutableArrayExtensions.Single{T}(ImmutableArray{T}, Func{T, bool})"/>
1066/// Specialization of <see cref="System.Linq.Enumerable.Count{TSource}(IEnumerable{TSource}, Func{TSource, bool})"/> for <see cref="ImmutableArray{T}"/>.
1068public static int Count<T>(this ImmutableArray<T> items, Func<T, bool> predicate)
1086public static int Sum<T>(this ImmutableArray<T> items, Func<T, int> selector)
1213/// Variant of <see cref="System.Linq.ImmutableArrayExtensions.Any{T}(ImmutableArray{T}, Func{T, bool})"/>.
1227/// Variant of <see cref="System.Linq.ImmutableArrayExtensions.All{T}(ImmutableArray{T}, Func{T, bool})"/>.
1257public static bool Contains<T>(this ImmutableArray<T> array, Func<T, bool> predicate)
src\Dependencies\Collections\RoslynImmutableInterlocked.cs (7)
33public static bool Update<T>(ref ImmutableSegmentedList<T> location, Func<ImmutableSegmentedList<T>, ImmutableSegmentedList<T>> transformer)
154public static bool Update<T>(ref ImmutableSegmentedHashSet<T> location, Func<ImmutableSegmentedHashSet<T>, ImmutableSegmentedHashSet<T>> transformer)
276public static bool Update<TKey, TValue>(ref ImmutableSegmentedDictionary<TKey, TValue> location, Func<ImmutableSegmentedDictionary<TKey, TValue>, ImmutableSegmentedDictionary<TKey, TValue>> transformer)
410/// <inheritdoc cref="ImmutableInterlocked.GetOrAdd{TKey, TValue}(ref ImmutableDictionary{TKey, TValue}, TKey, Func{TKey, TValue})"/>
411public static TValue GetOrAdd<TKey, TValue>(ref ImmutableSegmentedDictionary<TKey, TValue> location, TKey key, Func<TKey, TValue> valueFactory)
458/// <inheritdoc cref="ImmutableInterlocked.AddOrUpdate{TKey, TValue}(ref ImmutableDictionary{TKey, TValue}, TKey, Func{TKey, TValue}, Func{TKey, TValue, TValue})"/>
459public static TValue AddOrUpdate<TKey, TValue>(ref ImmutableSegmentedDictionary<TKey, TValue> location, TKey key, Func<TKey, TValue> addValueFactory, Func<TKey, TValue, TValue> updateValueFactory)
src\Dependencies\Collections\Segmented\ImmutableSegmentedDictionary.cs (6)
68public static ImmutableSegmentedDictionary<TKey, TValue> ToImmutableSegmentedDictionary<TSource, TKey, TValue>(this IEnumerable<TSource> source, Func<TSource, TKey> keySelector, Func<TSource, TValue> elementSelector)
72public static ImmutableSegmentedDictionary<TKey, TValue> ToImmutableSegmentedDictionary<TSource, TKey, TValue>(this IEnumerable<TSource> source, Func<TSource, TKey> keySelector, Func<TSource, TValue> elementSelector, IEqualityComparer<TKey>? keyComparer)
86public static ImmutableSegmentedDictionary<TKey, TSource> ToImmutableSegmentedDictionary<TSource, TKey>(this IEnumerable<TSource> source, Func<TSource, TKey> keySelector)
90public static ImmutableSegmentedDictionary<TKey, TSource> ToImmutableSegmentedDictionary<TSource, TKey>(this IEnumerable<TSource> source, Func<TSource, TKey> keySelector, IEqualityComparer<TKey>? keyComparer)
src\Dependencies\PooledObjects\ArrayBuilder.cs (7)
457public void FreeAll(Func<T, ArrayBuilder<T>?> getNested)
560internal Dictionary<K, ImmutableArray<T>> ToDictionary<K>(Func<T, K> keySelector, IEqualityComparer<K>? comparer = null)
608public void AddRange<U>(ArrayBuilder<U> items, Func<U, T> selector)
745public ImmutableArray<S> SelectDistinct<S>(Func<T, S> selector)
763public bool Any(Func<T, bool> predicate)
787public bool All(Func<T, bool> predicate)
817public ImmutableArray<TResult> SelectAsArray<TResult>(Func<T, TResult> map)
src\Dependencies\PooledObjects\PooledDelegates.cs (9)
200public static Releaser GetPooledFunction<TArg, TResult>(Func<TArg, TResult> unboundFunction, TArg argument, out Func<TResult> boundFunction)
201=> GetPooledDelegate<FuncWithBoundArgument<TArg, TResult>, TArg, Func<TArg, TResult>, Func<TResult>>(unboundFunction, argument, out boundFunction);
204/// Equivalent to <see cref="GetPooledFunction{TArg, TResult}(Func{TArg, TResult}, TArg, out Func{TResult})"/>,
216/// Gets a <see cref="Func{T, TResult}"/> delegate, which calls <paramref name="unboundFunction"/> with the
246public static Releaser GetPooledFunction<T1, TArg, TResult>(Func<T1, TArg, TResult> unboundFunction, TArg argument, out Func<T1, TResult> boundFunction)
247=> GetPooledDelegate<FuncWithBoundArgument<T1, TArg, TResult>, TArg, Func<T1, TArg, TResult>, Func<T1, TResult>>(unboundFunction, argument, out boundFunction);
412: AbstractDelegateWithBoundArgument<FuncWithBoundArgument<TArg, TResult>, TArg, Func<TArg, TResult>, Func<TResult>>
432: AbstractDelegateWithBoundArgument<FuncWithBoundArgument<T1, TArg, TResult>, TArg, Func<T1, TArg, TResult>, Func<T1, TResult>>
434protected override Func<T1, TResult> Bind()
src\Dependencies\Threading\ParallelExtensions.NetFramework.cs (7)
122Func<object, Task> taskBody = static async o =>
287Func<object, Task> taskBody = static async o =>
395private readonly Func<object, Task> _taskBody;
418protected ForEachAsyncState(Func<object, Task> taskBody, bool needsLock, int dop, TaskScheduler scheduler, CancellationToken cancellationToken, Func<TSource, CancellationToken, ValueTask> body)
584IEnumerable<TSource> source, Func<object, Task> taskBody,
610IAsyncEnumerable<TSource> source, Func<object, Task> taskBody,
637T fromExclusive, T toExclusive, Func<object, Task> taskBody,
src\RoslynAnalyzers\Utilities\Compiler\Lightup\LightupHelpers.cs (6)
19internal static Func<TOperation, TProperty> CreateOperationPropertyAccessor<TOperation, TProperty>(Type? type, string propertyName, TProperty fallbackResult)
23internal static Func<TSyntax, TProperty> CreateSyntaxPropertyAccessor<TSyntax, TProperty>(Type? type, string propertyName, TProperty fallbackResult)
27internal static Func<TSymbol, TProperty> CreateSymbolPropertyAccessor<TSymbol, TProperty>(Type? type, string propertyName, TProperty fallbackResult)
31private static Func<T, TProperty> CreatePropertyAccessor<T, TProperty>(Type? type, string parameterName, string propertyName, TProperty fallbackResult)
50Expression<Func<T, TProperty>> expression = Expression.Lambda<Func<T, TProperty>>(result, parameter);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\ObjectExtensions.TypeSwitch.cs (161)
11public static TResult? TypeSwitch<TBaseType, TDerivedType1, TDerivedType2, TDerivedType3, TResult>(this TBaseType obj, Func<TDerivedType1, TResult> matchFunc1, Func<TDerivedType2, TResult> matchFunc2, Func<TDerivedType3, TResult> matchFunc3, Func<TBaseType, TResult>? defaultFunc = null)
25public static TResult? TypeSwitch<TBaseType, TDerivedType1, TDerivedType2, TDerivedType3, TDerivedType4, TResult>(this TBaseType obj, Func<TDerivedType1, TResult> matchFunc1, Func<TDerivedType2, TResult> matchFunc2, Func<TDerivedType3, TResult> matchFunc3, Func<TDerivedType4, TResult> matchFunc4, Func<TBaseType, TResult>? defaultFunc = null)
41public static TResult? TypeSwitch<TBaseType, TDerivedType1, TDerivedType2, TDerivedType3, TDerivedType4, TDerivedType5, TResult>(this TBaseType obj, Func<TDerivedType1, TResult> matchFunc1, Func<TDerivedType2, TResult> matchFunc2, Func<TDerivedType3, TResult> matchFunc3, Func<TDerivedType4, TResult> matchFunc4, Func<TDerivedType5, TResult> matchFunc5, Func<TBaseType, TResult>? defaultFunc = null)
59public static TResult? TypeSwitch<TBaseType, TDerivedType1, TDerivedType2, TDerivedType3, TDerivedType4, TDerivedType5, TDerivedType6, TResult>(this TBaseType obj, Func<TDerivedType1, TResult> matchFunc1, Func<TDerivedType2, TResult> matchFunc2, Func<TDerivedType3, TResult> matchFunc3, Func<TDerivedType4, TResult> matchFunc4, Func<TDerivedType5, TResult> matchFunc5, Func<TDerivedType6, TResult> matchFunc6, Func<TBaseType, TResult>? defaultFunc = null)
79public static TResult? TypeSwitch<TBaseType, TDerivedType1, TDerivedType2, TDerivedType3, TDerivedType4, TDerivedType5, TDerivedType6, TDerivedType7, TDerivedType8, TDerivedType9, TDerivedType10, TDerivedType11, TDerivedType12, TDerivedType13, TDerivedType14, TDerivedType15, TDerivedType16, TResult>(this TBaseType obj, Func<TDerivedType1, TResult> matchFunc1, Func<TDerivedType2, TResult> matchFunc2, Func<TDerivedType3, TResult> matchFunc3, Func<TDerivedType4, TResult> matchFunc4, Func<TDerivedType5, TResult> matchFunc5, Func<TDerivedType6, TResult> matchFunc6, Func<TDerivedType7, TResult> matchFunc7, Func<TDerivedType8, TResult> matchFunc8, Func<TDerivedType9, TResult> matchFunc9, Func<TDerivedType10, TResult> matchFunc10, Func<TDerivedType11, TResult> matchFunc11, Func<TDerivedType12, TResult> matchFunc12, Func<TDerivedType13, TResult> matchFunc13, Func<TDerivedType14, TResult> matchFunc14, Func<TDerivedType15, TResult> matchFunc15, Func<TDerivedType16, TResult> matchFunc16, Func<TBaseType, TResult>? defaultFunc = null)
119public static TResult? TypeSwitch<TBaseType, TDerivedType1, TDerivedType2, TDerivedType3, TDerivedType4, TDerivedType5, TDerivedType6, TDerivedType7, TDerivedType8, TDerivedType9, TDerivedType10, TDerivedType11, TDerivedType12, TDerivedType13, TDerivedType14, TDerivedType15, TDerivedType16, TDerivedType17, TResult>(this TBaseType obj, Func<TDerivedType1, TResult> matchFunc1, Func<TDerivedType2, TResult> matchFunc2, Func<TDerivedType3, TResult> matchFunc3, Func<TDerivedType4, TResult> matchFunc4, Func<TDerivedType5, TResult> matchFunc5, Func<TDerivedType6, TResult> matchFunc6, Func<TDerivedType7, TResult> matchFunc7, Func<TDerivedType8, TResult> matchFunc8, Func<TDerivedType9, TResult> matchFunc9, Func<TDerivedType10, TResult> matchFunc10, Func<TDerivedType11, TResult> matchFunc11, Func<TDerivedType12, TResult> matchFunc12, Func<TDerivedType13, TResult> matchFunc13, Func<TDerivedType14, TResult> matchFunc14, Func<TDerivedType15, TResult> matchFunc15, Func<TDerivedType16, TResult> matchFunc16, Func<TDerivedType17, TResult> matchFunc17, Func<TBaseType, TResult>? defaultFunc = null)
161public static TResult? TypeSwitch<TBaseType, TDerivedType1, TDerivedType2, TDerivedType3, TDerivedType4, TDerivedType5, TDerivedType6, TDerivedType7, TDerivedType8, TDerivedType9, TDerivedType10, TDerivedType11, TDerivedType12, TDerivedType13, TDerivedType14, TDerivedType15, TDerivedType16, TDerivedType17, TDerivedType18, TDerivedType19, TDerivedType20, TDerivedType21, TDerivedType22, TResult>(this TBaseType obj, Func<TDerivedType1, TResult> matchFunc1, Func<TDerivedType2, TResult> matchFunc2, Func<TDerivedType3, TResult> matchFunc3, Func<TDerivedType4, TResult> matchFunc4, Func<TDerivedType5, TResult> matchFunc5, Func<TDerivedType6, TResult> matchFunc6, Func<TDerivedType7, TResult> matchFunc7, Func<TDerivedType8, TResult> matchFunc8, Func<TDerivedType9, TResult> matchFunc9, Func<TDerivedType10, TResult> matchFunc10, Func<TDerivedType11, TResult> matchFunc11, Func<TDerivedType12, TResult> matchFunc12, Func<TDerivedType13, TResult> matchFunc13, Func<TDerivedType14, TResult> matchFunc14, Func<TDerivedType15, TResult> matchFunc15, Func<TDerivedType16, TResult> matchFunc16, Func<TDerivedType17, TResult> matchFunc17, Func<TDerivedType18, TResult> matchFunc18, Func<TDerivedType19, TResult> matchFunc19, Func<TDerivedType20, TResult> matchFunc20, Func<TDerivedType21, TResult> matchFunc21, Func<TDerivedType22, TResult> matchFunc22, Func<TBaseType, TResult>? defaultFunc = null)
213public static TResult? TypeSwitch<TBaseType, TDerivedType1, TDerivedType2, TDerivedType3, TDerivedType4, TDerivedType5, TDerivedType6, TDerivedType7, TDerivedType8, TDerivedType9, TDerivedType10, TDerivedType11, TDerivedType12, TDerivedType13, TDerivedType14, TDerivedType15, TDerivedType16, TDerivedType17, TDerivedType18, TDerivedType19, TDerivedType20, TDerivedType21, TDerivedType22, TDerivedType23, TDerivedType24, TDerivedType25, TDerivedType26, TDerivedType27, TDerivedType28, TDerivedType29, TDerivedType30, TDerivedType31, TDerivedType32, TDerivedType33, TDerivedType34, TDerivedType35, TDerivedType36, TDerivedType37, TDerivedType38, TDerivedType39, TResult>(this TBaseType obj, Func<TDerivedType1, TResult> matchFunc1, Func<TDerivedType2, TResult> matchFunc2, Func<TDerivedType3, TResult> matchFunc3, Func<TDerivedType4, TResult> matchFunc4, Func<TDerivedType5, TResult> matchFunc5, Func<TDerivedType6, TResult> matchFunc6, Func<TDerivedType7, TResult> matchFunc7, Func<TDerivedType8, TResult> matchFunc8, Func<TDerivedType9, TResult> matchFunc9, Func<TDerivedType10, TResult> matchFunc10, Func<TDerivedType11, TResult> matchFunc11, Func<TDerivedType12, TResult> matchFunc12, Func<TDerivedType13, TResult> matchFunc13, Func<TDerivedType14, TResult> matchFunc14, Func<TDerivedType15, TResult> matchFunc15, Func<TDerivedType16, TResult> matchFunc16, Func<TDerivedType17, TResult> matchFunc17, Func<TDerivedType18, TResult> matchFunc18, Func<TDerivedType19, TResult> matchFunc19, Func<TDerivedType20, TResult> matchFunc20, Func<TDerivedType21, TResult> matchFunc21, Func<TDerivedType22, TResult> matchFunc22, Func<TDerivedType23, TResult> matchFunc23, Func<TDerivedType24, TResult> matchFunc24, Func<TDerivedType25, TResult> matchFunc25, Func<TDerivedType26, TResult> matchFunc26, Func<TDerivedType27, TResult> matchFunc27, Func<TDerivedType28, TResult> matchFunc28, Func<TDerivedType29, TResult> matchFunc29, Func<TDerivedType30, TResult> matchFunc30, Func<TDerivedType31, TResult> matchFunc31, Func<TDerivedType32, TResult> matchFunc32, Func<TDerivedType33, TResult> matchFunc33, Func<TDerivedType34, TResult> matchFunc34, Func<TDerivedType35, TResult> matchFunc35, Func<TDerivedType36, TResult> matchFunc36, Func<TDerivedType37, TResult> matchFunc37, Func<TDerivedType38, TResult> matchFunc38, Func<TDerivedType39, TResult> matchFunc39, Func<TBaseType, TResult>? defaultFunc = null)
299public static TResult? TypeSwitch<TBaseType, TDerivedType1, TDerivedType2, TDerivedType3, TDerivedType4, TDerivedType5, TDerivedType6, TDerivedType7, TDerivedType8, TDerivedType9, TDerivedType10, TDerivedType11, TDerivedType12, TDerivedType13, TDerivedType14, TDerivedType15, TDerivedType16, TDerivedType17, TDerivedType18, TDerivedType19, TDerivedType20, TDerivedType21, TDerivedType22, TDerivedType23, TDerivedType24, TDerivedType25, TDerivedType26, TDerivedType27, TDerivedType28, TDerivedType29, TDerivedType30, TDerivedType31, TDerivedType32, TDerivedType33, TDerivedType34, TDerivedType35, TDerivedType36, TDerivedType37, TDerivedType38, TDerivedType39, TDerivedType40, TResult>(this TBaseType obj, Func<TDerivedType1, TResult> matchFunc1, Func<TDerivedType2, TResult> matchFunc2, Func<TDerivedType3, TResult> matchFunc3, Func<TDerivedType4, TResult> matchFunc4, Func<TDerivedType5, TResult> matchFunc5, Func<TDerivedType6, TResult> matchFunc6, Func<TDerivedType7, TResult> matchFunc7, Func<TDerivedType8, TResult> matchFunc8, Func<TDerivedType9, TResult> matchFunc9, Func<TDerivedType10, TResult> matchFunc10, Func<TDerivedType11, TResult> matchFunc11, Func<TDerivedType12, TResult> matchFunc12, Func<TDerivedType13, TResult> matchFunc13, Func<TDerivedType14, TResult> matchFunc14, Func<TDerivedType15, TResult> matchFunc15, Func<TDerivedType16, TResult> matchFunc16, Func<TDerivedType17, TResult> matchFunc17, Func<TDerivedType18, TResult> matchFunc18, Func<TDerivedType19, TResult> matchFunc19, Func<TDerivedType20, TResult> matchFunc20, Func<TDerivedType21, TResult> matchFunc21, Func<TDerivedType22, TResult> matchFunc22, Func<TDerivedType23, TResult> matchFunc23, Func<TDerivedType24, TResult> matchFunc24, Func<TDerivedType25, TResult> matchFunc25, Func<TDerivedType26, TResult> matchFunc26, Func<TDerivedType27, TResult> matchFunc27, Func<TDerivedType28, TResult> matchFunc28, Func<TDerivedType29, TResult> matchFunc29, Func<TDerivedType30, TResult> matchFunc30, Func<TDerivedType31, TResult> matchFunc31, Func<TDerivedType32, TResult> matchFunc32, Func<TDerivedType33, TResult> matchFunc33, Func<TDerivedType34, TResult> matchFunc34, Func<TDerivedType35, TResult> matchFunc35, Func<TDerivedType36, TResult> matchFunc36, Func<TDerivedType37, TResult> matchFunc37, Func<TDerivedType38, TResult> matchFunc38, Func<TDerivedType39, TResult> matchFunc39, Func<TDerivedType40, TResult> matchFunc40, Func<TBaseType, TResult>? defaultFunc = null)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\SyntaxNodeExtensions.cs (6)
104this SyntaxNode node, TextSpan searchSpan, Func<SyntaxNode, bool> predicate)
129public static bool CheckParent<T>([NotNullWhen(returnValue: true)] this SyntaxNode? node, Func<T, bool> valueChecker) where T : SyntaxNode
145public static bool IsChildNode<TParent>(this SyntaxNode node, Func<TParent, SyntaxNode?> childGetter)
162public static bool IsFoundUnder<TParent>(this SyntaxNode node, Func<TParent, SyntaxNode?> childGetter)
201public static SyntaxNode? FindInnermostCommonNode(this IEnumerable<SyntaxNode> nodes, Func<SyntaxNode, bool> predicate)
806public static TNode? FirstAncestorOrSelfUntil<TNode>(this SyntaxNode? node, Func<SyntaxNode, bool> predicate)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\SyntaxTokenExtensions.cs (5)
15public static SyntaxNode? GetAncestor(this SyntaxToken token, Func<SyntaxNode, bool>? predicate)
18public static T? GetAncestor<T>(this SyntaxToken token, Func<T, bool>? predicate = null) where T : SyntaxNode
21public static T GetRequiredAncestor<T>(this SyntaxToken token, Func<T, bool>? predicate = null) where T : SyntaxNode
32public static IEnumerable<SyntaxNode> GetAncestors(this SyntaxToken token, Func<SyntaxNode, bool> predicate)
42public static bool CheckParent<T>(this SyntaxToken token, Func<T, bool> valueChecker) where T : SyntaxNode
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Options\PublicOptionFactory.cs (4)
17public static Option2<T> WithPublicOption<T, TPublicValue>(this Option2<T> option, string feature, string name, Func<T, TPublicValue> toPublicValue, Func<TPublicValue, T> toInternalValue)
20public static PerLanguageOption2<T> WithPublicOption<T, TPublicValue>(this PerLanguageOption2<T> option, string feature, string name, Func<T, TPublicValue> toPublicValue, Func<TPublicValue, T> toInternalValue)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\TopologicalSorter.cs (8)
13public static IEnumerable<T> TopologicalSort<T>(this IEnumerable<T> items, Func<T, IEnumerable<T>> itemsBefore)
26public static IEnumerable<T> TopologicalSort<T>(this IEnumerable<T> items, Func<T, IEnumerable<T>> itemsBefore, Func<T, IEnumerable<T>> itemsAfter)
29var combinedItemsBefore = CreateCombinedItemsBefore(items, itemsBefore, itemsAfter);
35Func<T, IEnumerable<T>> itemsBefore,
50private static Func<T, IEnumerable<T>> CreateCombinedItemsBefore<T>(IEnumerable<T> items, Func<T, IEnumerable<T>> itemsBefore, Func<T, IEnumerable<T>> itemsAfter)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Extensions\SyntaxEditorExtensions.cs (4)
29Func<TType, (TNode semanticNode, IEnumerable<TNode> additionalNodes)> selector,
52Func<TType, TNode> selector,
96Func<TType, (TNode semanticNode, IEnumerable<TNode> additionalNodes)> selector,
153Func<TType, (TNode semanticNode, IEnumerable<TNode> additionalNodes)> selector,
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Simplification\AbstractSimplificationService.cs (6)
35protected static readonly Func<SyntaxNode, bool> s_containsAnnotations = n => n.ContainsAnnotations;
36protected static readonly Func<SyntaxNodeOrToken, bool> s_hasSimplifierAnnotation = n => n.HasAnnotation(Simplifier.Annotation);
40protected abstract ImmutableArray<NodeOrTokenToReduce> GetNodesAndTokensToReduce(SyntaxNode root, Func<SyntaxNodeOrToken, bool> isNodeOrTokenOutsideSimplifySpans);
51public abstract SyntaxNode Expand(SyntaxNode node, SemanticModel semanticModel, SyntaxAnnotation? annotationForReplacedAliasIdentifier, Func<SyntaxNode, bool>? expandInsideNode, bool expandParameter, CancellationToken cancellationToken);
52public abstract SyntaxToken Expand(SyntaxToken token, SemanticModel semanticModel, Func<SyntaxNode, bool>? expandInsideNode, CancellationToken cancellationToken);
275Func<SyntaxNodeOrToken, bool> isNodeOrTokenOutsideSimplifySpan)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Utilities\NameGenerator.cs (6)
43Func<string, bool>? canUse = null,
63Func<string, bool>? canUse = null,
86Func<string, bool>? canUse = null,
134public static string GenerateUniqueName(string baseName, Func<string, bool> canUse)
140public static string GenerateUniqueName(string baseName, string extension, Func<string, bool> canUse)
160public static string GenerateUniqueName(IEnumerable<string> baseNames, Func<string, bool> canUse)
Microsoft.CodeAnalysis.AnalyzerUtilities (506)
src\Compilers\Core\Portable\FileSystem\FileUtilities.cs (4)
47Func<string, bool> fileExists)
322public static T RethrowExceptionsAsIOException<T, TArg>(Func<TArg, T> operation, TArg arg)
339public static async Task<T> RethrowExceptionsAsIOExceptionAsync<T, TArg>(Func<TArg, Task<T>> operation, TArg arg)
355internal static Stream CreateFileStreamChecked(Func<string, Stream> factory, string path, string? paramName = null)
src\Compilers\Core\Portable\InternalUtilities\InterlockedOperations.cs (5)
46public static T Initialize<T, TArg>([NotNull] ref T? target, Func<TArg, T> valueFactory, TArg arg)
66public static int Initialize<TArg>(ref int target, int uninitializedValue, Func<TArg, int> valueFactory, TArg arg)
103public static T? Initialize<T, TArg>([NotNull] ref StrongBox<T?>? target, Func<TArg, T?> valueFactory, TArg arg)
183public static ImmutableArray<T> Initialize<T, TArg>(ref ImmutableArray<T> target, Func<TArg, ImmutableArray<T>> createArray, TArg arg)
193private static ImmutableArray<T> Initialize_Slow<T, TArg>(ref ImmutableArray<T> target, Func<TArg, ImmutableArray<T>> createArray, TArg arg)
src\Compilers\Core\Portable\SourceGeneration\GeneratedCodeUtilities.cs (4)
49SyntaxTree tree, Func<SyntaxTrivia, bool> isComment, CancellationToken cancellationToken)
55internal static bool IsGeneratedCode(string? filePath, SyntaxNode root, Func<SyntaxTrivia, bool> isComment)
88private static bool BeginsWithAutoGeneratedComment(SyntaxNode root, Func<SyntaxTrivia, bool> isComment)
118SyntaxTree tree, Func<SyntaxTrivia, bool> isComment, CancellationToken cancellationToken)
src\Dependencies\Collections\Extensions\IEnumerableExtensions.cs (30)
164public static T? FirstOrNull<T>(this IEnumerable<T> source, Func<T, bool> predicate)
182public static T? SingleOrNull<T>(this IEnumerable<T> source, Func<T, bool> predicate)
261public static bool HasDuplicates<TItem, TValue>(this IEnumerable<TItem> source, Func<TItem, TValue> selector)
271/// <seealso cref="Microsoft.CodeAnalysis.ImmutableArrayExtensions.HasDuplicates{TItem, TValue}(ImmutableArray{TItem}, Func{TItem, TValue}, IEqualityComparer{TValue})"/>
273public static bool HasDuplicates<TItem, TValue>(this IEnumerable<TItem> source, Func<TItem, TValue> selector, IEqualityComparer<TValue> comparer)
321private static readonly Func<object, bool> s_notNullTest = x => x != null;
331return source.Where((Func<T?, bool>)s_notNullTest)!;
376public static ImmutableArray<T> WhereAsArray<T>(this IEnumerable<T> values, Func<T, bool> predicate)
407public static ImmutableArray<TResult> SelectAsArray<TSource, TResult>(this IEnumerable<TSource>? source, Func<TSource, TResult> selector)
417public static ImmutableArray<TResult> SelectAsArray<TItem, TResult>(this IEnumerable<TItem>? source, Func<TItem, bool> predicate, Func<TItem, TResult> selector)
461public static ImmutableArray<TResult> SelectAsArray<TSource, TResult>(this IReadOnlyCollection<TSource>? source, Func<TSource, TResult> selector)
485public static ImmutableArray<TResult> SelectManyAsArray<TSource, TResult>(this IEnumerable<TSource>? source, Func<TSource, IEnumerable<TResult>> selector)
507public static ImmutableArray<TResult> SelectManyAsArray<TItem, TResult>(this IReadOnlyCollection<TItem>? source, Func<TItem, IEnumerable<TResult>> selector)
533public static ImmutableArray<TResult> SelectManyAsArray<TSource, TResult>(this IEnumerable<TSource>? source, Func<TSource, OneOrMany<TResult>> selector)
547public static async ValueTask<ImmutableArray<TResult>> SelectAsArrayAsync<TItem, TResult>(this IEnumerable<TItem> source, Func<TItem, ValueTask<TResult>> selector)
764internal static Dictionary<K, ImmutableArray<T>> ToMultiDictionary<K, T>(this IEnumerable<T> data, Func<T, K> keySelector, IEqualityComparer<K>? comparer = null)
815public static readonly Func<T, T> Identity = t => t;
816public static readonly Func<T, bool> True = t => true;
840/// Alias for <see cref="System.Linq.Enumerable.Any{TSource}(IEnumerable{TSource}, Func{TSource, bool})"/>
842public static bool Contains<T>(this IEnumerable<T> sequence, Func<T, bool> predicate)
846/// Variant of <see cref="System.Linq.Enumerable.Count{TSource}(IEnumerable{TSource}, Func{TSource, bool})"/>
861/// Variant of <see cref="System.Linq.Enumerable.FirstOrDefault{TSource}(IEnumerable{TSource}, Func{TSource, bool})"/>
875/// Variant of <see cref="System.Linq.Enumerable.Any{TSource}(IEnumerable{TSource}, Func{TSource, bool})"/>
889/// Variant of <see cref="System.Linq.Enumerable.OrderBy{TSource, TKey}(IEnumerable{TSource}, Func{TSource, TKey}, IComparer{TKey}?)"/>
895/// Variant of <see cref="System.Linq.Enumerable.OrderByDescending{TSource, TKey}(IEnumerable{TSource}, Func{TSource, TKey}, IComparer{TKey}?)"/>
901/// Variant of <see cref="System.Linq.Enumerable.OrderBy{TSource, TKey}(IEnumerable{TSource}, Func{TSource, TKey}, IComparer{TKey}?)"/>
907/// Variant of <see cref="System.Linq.Enumerable.OrderByDescending{TSource, TKey}(IEnumerable{TSource}, Func{TSource, TKey}, IComparer{TKey}?)"/>
913/// Variant of <see cref="System.Linq.Enumerable.ThenBy{TSource, TKey}(IOrderedEnumerable{TSource}, Func{TSource, TKey}, IComparer{TKey}?)"/>
919/// Variant of <see cref="System.Linq.Enumerable.ThenBy{TSource, TKey}(IOrderedEnumerable{TSource}, Func{TSource, TKey}, IComparer{TKey}?)"/>
src\Dependencies\Collections\Extensions\IListExtensions.cs (4)
21public static bool HasDuplicates<TItem, TValue>(this IReadOnlyList<TItem> list, Func<TItem, TValue> selector)
31/// <seealso cref="ImmutableArrayExtensions.HasDuplicates{TItem, TValue}(System.Collections.Immutable.ImmutableArray{TItem}, Func{TItem, TValue}, IEqualityComparer{TValue})"/>
32/// <seealso cref="Roslyn.Utilities.EnumerableExtensions.HasDuplicates{TItem, TValue}(IEnumerable{TItem}, Func{TItem, TValue}, IEqualityComparer{TValue})"/>
34internal static bool HasDuplicates<TItem, TValue>(this IReadOnlyList<TItem> list, Func<TItem, TValue> selector, IEqualityComparer<TValue> comparer)
src\Dependencies\Collections\Extensions\ImmutableArrayExtensions.cs (27)
138public static ImmutableArray<TResult> SelectAsArray<TItem, TResult>(this ImmutableArray<TItem> items, Func<TItem, TResult> map)
198public static ImmutableArray<TResult> SelectAsArray<TItem, TResult>(this ImmutableArray<TItem> array, Func<TItem, bool> predicate, Func<TItem, TResult> selector)
247public static ImmutableArray<TResult> SelectManyAsArray<TItem, TResult>(this ImmutableArray<TItem> array, Func<TItem, IEnumerable<TResult>> selector)
267public static ImmutableArray<TResult> SelectManyAsArray<TItem, TResult>(this ImmutableArray<TItem> array, Func<TItem, ImmutableArray<TResult>> selector)
287public static ImmutableArray<TResult> SelectManyAsArray<TItem, TResult>(this ImmutableArray<TItem> array, Func<TItem, OneOrMany<TResult>> selector)
308public static ImmutableArray<TResult> SelectManyAsArray<TItem, TResult>(this ImmutableArray<TItem> array, Func<TItem, bool> predicate, Func<TItem, IEnumerable<TResult>> selector)
332public static ImmutableArray<TResult> SelectManyAsArray<TItem, TResult>(this ImmutableArray<TItem> array, Func<TItem, bool> predicate, Func<TItem, ImmutableArray<TResult>> selector)
356public static ImmutableArray<TResult> SelectManyAsArray<TItem, TResult>(this ImmutableArray<TItem> array, Func<TItem, bool> predicate, Func<TItem, OneOrMany<TResult>> selector)
493public static ImmutableArray<T> WhereAsArray<T>(this ImmutableArray<T> array, Func<T, bool> predicate)
504private static ImmutableArray<T> WhereAsArrayImpl<T, TArg>(ImmutableArray<T> array, Func<T, bool>? predicateWithoutArg, Func<T, TArg, bool>? predicateWithArg, TArg arg)
573public static async Task<bool> AnyAsync<T>(this ImmutableArray<T> array, Func<T, Task<bool>> predicateAsync)
595public static async ValueTask<T?> FirstOrDefaultAsync<T>(this ImmutableArray<T> array, Func<T, Task<bool>> predicateAsync)
757public static bool HasDuplicates<TItem, TValue>(this ImmutableArray<TItem> array, Func<TItem, TValue> selector)
767/// <seealso cref="Roslyn.Utilities.EnumerableExtensions.HasDuplicates{TItem, TValue}(IEnumerable{TItem}, Func{TItem, TValue}, IEqualityComparer{TValue})"/>
769internal static bool HasDuplicates<TItem, TValue>(this ImmutableArray<TItem> array, Func<TItem, TValue> selector, IEqualityComparer<TValue> comparer)
990/// Variant of <see cref="System.Linq.ImmutableArrayExtensions.FirstOrDefault{T}(ImmutableArray{T}, Func{T, bool})"/>
1004/// Variant of <see cref="System.Linq.ImmutableArrayExtensions.Single{T}(ImmutableArray{T}, Func{T, bool})"/>
1066/// Specialization of <see cref="System.Linq.Enumerable.Count{TSource}(IEnumerable{TSource}, Func{TSource, bool})"/> for <see cref="ImmutableArray{T}"/>.
1068public static int Count<T>(this ImmutableArray<T> items, Func<T, bool> predicate)
1086public static int Sum<T>(this ImmutableArray<T> items, Func<T, int> selector)
1213/// Variant of <see cref="System.Linq.ImmutableArrayExtensions.Any{T}(ImmutableArray{T}, Func{T, bool})"/>.
1227/// Variant of <see cref="System.Linq.ImmutableArrayExtensions.All{T}(ImmutableArray{T}, Func{T, bool})"/>.
1257public static bool Contains<T>(this ImmutableArray<T> array, Func<T, bool> predicate)
src\Dependencies\Collections\RoslynImmutableInterlocked.cs (7)
33public static bool Update<T>(ref ImmutableSegmentedList<T> location, Func<ImmutableSegmentedList<T>, ImmutableSegmentedList<T>> transformer)
154public static bool Update<T>(ref ImmutableSegmentedHashSet<T> location, Func<ImmutableSegmentedHashSet<T>, ImmutableSegmentedHashSet<T>> transformer)
276public static bool Update<TKey, TValue>(ref ImmutableSegmentedDictionary<TKey, TValue> location, Func<ImmutableSegmentedDictionary<TKey, TValue>, ImmutableSegmentedDictionary<TKey, TValue>> transformer)
410/// <inheritdoc cref="ImmutableInterlocked.GetOrAdd{TKey, TValue}(ref ImmutableDictionary{TKey, TValue}, TKey, Func{TKey, TValue})"/>
411public static TValue GetOrAdd<TKey, TValue>(ref ImmutableSegmentedDictionary<TKey, TValue> location, TKey key, Func<TKey, TValue> valueFactory)
458/// <inheritdoc cref="ImmutableInterlocked.AddOrUpdate{TKey, TValue}(ref ImmutableDictionary{TKey, TValue}, TKey, Func{TKey, TValue}, Func{TKey, TValue, TValue})"/>
459public static TValue AddOrUpdate<TKey, TValue>(ref ImmutableSegmentedDictionary<TKey, TValue> location, TKey key, Func<TKey, TValue> addValueFactory, Func<TKey, TValue, TValue> updateValueFactory)
src\Dependencies\Collections\Segmented\ImmutableSegmentedDictionary.cs (6)
68public static ImmutableSegmentedDictionary<TKey, TValue> ToImmutableSegmentedDictionary<TSource, TKey, TValue>(this IEnumerable<TSource> source, Func<TSource, TKey> keySelector, Func<TSource, TValue> elementSelector)
72public static ImmutableSegmentedDictionary<TKey, TValue> ToImmutableSegmentedDictionary<TSource, TKey, TValue>(this IEnumerable<TSource> source, Func<TSource, TKey> keySelector, Func<TSource, TValue> elementSelector, IEqualityComparer<TKey>? keyComparer)
86public static ImmutableSegmentedDictionary<TKey, TSource> ToImmutableSegmentedDictionary<TSource, TKey>(this IEnumerable<TSource> source, Func<TSource, TKey> keySelector)
90public static ImmutableSegmentedDictionary<TKey, TSource> ToImmutableSegmentedDictionary<TSource, TKey>(this IEnumerable<TSource> source, Func<TSource, TKey> keySelector, IEqualityComparer<TKey>? keyComparer)
src\Dependencies\PooledObjects\ArrayBuilder.cs (7)
457public void FreeAll(Func<T, ArrayBuilder<T>?> getNested)
560internal Dictionary<K, ImmutableArray<T>> ToDictionary<K>(Func<T, K> keySelector, IEqualityComparer<K>? comparer = null)
608public void AddRange<U>(ArrayBuilder<U> items, Func<U, T> selector)
745public ImmutableArray<S> SelectDistinct<S>(Func<T, S> selector)
763public bool Any(Func<T, bool> predicate)
787public bool All(Func<T, bool> predicate)
817public ImmutableArray<TResult> SelectAsArray<TResult>(Func<T, TResult> map)
src\Dependencies\PooledObjects\PooledDelegates.cs (9)
200public static Releaser GetPooledFunction<TArg, TResult>(Func<TArg, TResult> unboundFunction, TArg argument, out Func<TResult> boundFunction)
201=> GetPooledDelegate<FuncWithBoundArgument<TArg, TResult>, TArg, Func<TArg, TResult>, Func<TResult>>(unboundFunction, argument, out boundFunction);
204/// Equivalent to <see cref="GetPooledFunction{TArg, TResult}(Func{TArg, TResult}, TArg, out Func{TResult})"/>,
216/// Gets a <see cref="Func{T, TResult}"/> delegate, which calls <paramref name="unboundFunction"/> with the
246public static Releaser GetPooledFunction<T1, TArg, TResult>(Func<T1, TArg, TResult> unboundFunction, TArg argument, out Func<T1, TResult> boundFunction)
247=> GetPooledDelegate<FuncWithBoundArgument<T1, TArg, TResult>, TArg, Func<T1, TArg, TResult>, Func<T1, TResult>>(unboundFunction, argument, out boundFunction);
412: AbstractDelegateWithBoundArgument<FuncWithBoundArgument<TArg, TResult>, TArg, Func<TArg, TResult>, Func<TResult>>
432: AbstractDelegateWithBoundArgument<FuncWithBoundArgument<T1, TArg, TResult>, TArg, Func<T1, TArg, TResult>, Func<T1, TResult>>
434protected override Func<T1, TResult> Bind()
src\Dependencies\Threading\ParallelExtensions.NetFramework.cs (7)
122Func<object, Task> taskBody = static async o =>
287Func<object, Task> taskBody = static async o =>
395private readonly Func<object, Task> _taskBody;
418protected ForEachAsyncState(Func<object, Task> taskBody, bool needsLock, int dop, TaskScheduler scheduler, CancellationToken cancellationToken, Func<TSource, CancellationToken, ValueTask> body)
584IEnumerable<TSource> source, Func<object, Task> taskBody,
610IAsyncEnumerable<TSource> source, Func<object, Task> taskBody,
637T fromExclusive, T toExclusive, Func<object, Task> taskBody,
src\RoslynAnalyzers\Utilities\Compiler\Lightup\LightupHelpers.cs (6)
19internal static Func<TOperation, TProperty> CreateOperationPropertyAccessor<TOperation, TProperty>(Type? type, string propertyName, TProperty fallbackResult)
23internal static Func<TSyntax, TProperty> CreateSyntaxPropertyAccessor<TSyntax, TProperty>(Type? type, string propertyName, TProperty fallbackResult)
27internal static Func<TSymbol, TProperty> CreateSymbolPropertyAccessor<TSymbol, TProperty>(Type? type, string propertyName, TProperty fallbackResult)
31private static Func<T, TProperty> CreatePropertyAccessor<T, TProperty>(Type? type, string parameterName, string propertyName, TProperty fallbackResult)
50Expression<Func<T, TProperty>> expression = Expression.Lambda<Func<T, TProperty>>(result, parameter);
src\RoslynAnalyzers\Utilities\FlowAnalysis\FlowAnalysis\Analysis\PointsToAnalysis\PointsToAnalysisData.cs (6)
20private readonly Func<ITypeSymbol?, bool> _isDisposable;
22internal PointsToAnalysisData(Func<ITypeSymbol?, bool> isDisposable)
27internal PointsToAnalysisData(IDictionary<AnalysisEntity, PointsToAbstractValue> fromData, Func<ITypeSymbol?, bool> isDisposable)
41Func<ITypeSymbol?, bool> isDisposable)
122internal static void AssertValidPointsToAnalysisData(IDictionary<AnalysisEntity, PointsToAbstractValue> map, Func<ITypeSymbol?, bool> isDisposable)
139Func<ITypeSymbol?, bool> isDisposable)
src\RoslynAnalyzers\Utilities\FlowAnalysis\FlowAnalysis\Framework\DataFlow\AnalysisEntityFactory.cs (8)
35private readonly Func<IOperation, PointsToAbstractValue>? _getPointsToAbstractValue;
37private readonly Func<IFlowCaptureOperation, bool> _getIsLValueFlowCapture;
40private readonly Func<IOperation, AnalysisEntity?>? _interproceduralGetAnalysisEntityForFlowCapture;
41private readonly Func<ISymbol, ImmutableStack<IOperation>?> _getInterproceduralCallStackForOwningSymbol;
46Func<IOperation, PointsToAbstractValue>? getPointsToAbstractValue,
48Func<IFlowCaptureOperation, bool> getIsLValueFlowCapture,
54Func<IOperation, AnalysisEntity?>? interproceduralGetAnalysisEntityForFlowCapture,
55Func<ISymbol, ImmutableStack<IOperation>?> getInterproceduralCallStackForOwningSymbol)
src\RoslynAnalyzers\Utilities\FlowAnalysis\FlowAnalysis\Framework\DataFlow\InterproceduralAnalysisData.cs (8)
38Func<IOperation, TAbstractAnalysisValue> getCachedAbstractValueFromCaller,
39Func<IMethodSymbol, ControlFlowGraph?> getInterproceduralControlFlowGraph,
40Func<IOperation, AnalysisEntity?> getAnalysisEntityForFlowCapture,
41Func<ISymbol, ImmutableStack<IOperation>?> getInterproceduralCallStackForOwningSymbol)
65public Func<IOperation, TAbstractAnalysisValue> GetCachedAbstractValueFromCaller { get; }
66public Func<IMethodSymbol, ControlFlowGraph?> GetInterproceduralControlFlowGraph { get; }
67public Func<IOperation, AnalysisEntity?> GetAnalysisEntityForFlowCapture { get; }
68public Func<ISymbol, ImmutableStack<IOperation>?> GetInterproceduralCallStackForOwningSymbol { get; }
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\ObjectExtensions.TypeSwitch.cs (161)
11public static TResult? TypeSwitch<TBaseType, TDerivedType1, TDerivedType2, TDerivedType3, TResult>(this TBaseType obj, Func<TDerivedType1, TResult> matchFunc1, Func<TDerivedType2, TResult> matchFunc2, Func<TDerivedType3, TResult> matchFunc3, Func<TBaseType, TResult>? defaultFunc = null)
25public static TResult? TypeSwitch<TBaseType, TDerivedType1, TDerivedType2, TDerivedType3, TDerivedType4, TResult>(this TBaseType obj, Func<TDerivedType1, TResult> matchFunc1, Func<TDerivedType2, TResult> matchFunc2, Func<TDerivedType3, TResult> matchFunc3, Func<TDerivedType4, TResult> matchFunc4, Func<TBaseType, TResult>? defaultFunc = null)
41public static TResult? TypeSwitch<TBaseType, TDerivedType1, TDerivedType2, TDerivedType3, TDerivedType4, TDerivedType5, TResult>(this TBaseType obj, Func<TDerivedType1, TResult> matchFunc1, Func<TDerivedType2, TResult> matchFunc2, Func<TDerivedType3, TResult> matchFunc3, Func<TDerivedType4, TResult> matchFunc4, Func<TDerivedType5, TResult> matchFunc5, Func<TBaseType, TResult>? defaultFunc = null)
59public static TResult? TypeSwitch<TBaseType, TDerivedType1, TDerivedType2, TDerivedType3, TDerivedType4, TDerivedType5, TDerivedType6, TResult>(this TBaseType obj, Func<TDerivedType1, TResult> matchFunc1, Func<TDerivedType2, TResult> matchFunc2, Func<TDerivedType3, TResult> matchFunc3, Func<TDerivedType4, TResult> matchFunc4, Func<TDerivedType5, TResult> matchFunc5, Func<TDerivedType6, TResult> matchFunc6, Func<TBaseType, TResult>? defaultFunc = null)
79public static TResult? TypeSwitch<TBaseType, TDerivedType1, TDerivedType2, TDerivedType3, TDerivedType4, TDerivedType5, TDerivedType6, TDerivedType7, TDerivedType8, TDerivedType9, TDerivedType10, TDerivedType11, TDerivedType12, TDerivedType13, TDerivedType14, TDerivedType15, TDerivedType16, TResult>(this TBaseType obj, Func<TDerivedType1, TResult> matchFunc1, Func<TDerivedType2, TResult> matchFunc2, Func<TDerivedType3, TResult> matchFunc3, Func<TDerivedType4, TResult> matchFunc4, Func<TDerivedType5, TResult> matchFunc5, Func<TDerivedType6, TResult> matchFunc6, Func<TDerivedType7, TResult> matchFunc7, Func<TDerivedType8, TResult> matchFunc8, Func<TDerivedType9, TResult> matchFunc9, Func<TDerivedType10, TResult> matchFunc10, Func<TDerivedType11, TResult> matchFunc11, Func<TDerivedType12, TResult> matchFunc12, Func<TDerivedType13, TResult> matchFunc13, Func<TDerivedType14, TResult> matchFunc14, Func<TDerivedType15, TResult> matchFunc15, Func<TDerivedType16, TResult> matchFunc16, Func<TBaseType, TResult>? defaultFunc = null)
119public static TResult? TypeSwitch<TBaseType, TDerivedType1, TDerivedType2, TDerivedType3, TDerivedType4, TDerivedType5, TDerivedType6, TDerivedType7, TDerivedType8, TDerivedType9, TDerivedType10, TDerivedType11, TDerivedType12, TDerivedType13, TDerivedType14, TDerivedType15, TDerivedType16, TDerivedType17, TResult>(this TBaseType obj, Func<TDerivedType1, TResult> matchFunc1, Func<TDerivedType2, TResult> matchFunc2, Func<TDerivedType3, TResult> matchFunc3, Func<TDerivedType4, TResult> matchFunc4, Func<TDerivedType5, TResult> matchFunc5, Func<TDerivedType6, TResult> matchFunc6, Func<TDerivedType7, TResult> matchFunc7, Func<TDerivedType8, TResult> matchFunc8, Func<TDerivedType9, TResult> matchFunc9, Func<TDerivedType10, TResult> matchFunc10, Func<TDerivedType11, TResult> matchFunc11, Func<TDerivedType12, TResult> matchFunc12, Func<TDerivedType13, TResult> matchFunc13, Func<TDerivedType14, TResult> matchFunc14, Func<TDerivedType15, TResult> matchFunc15, Func<TDerivedType16, TResult> matchFunc16, Func<TDerivedType17, TResult> matchFunc17, Func<TBaseType, TResult>? defaultFunc = null)
161public static TResult? TypeSwitch<TBaseType, TDerivedType1, TDerivedType2, TDerivedType3, TDerivedType4, TDerivedType5, TDerivedType6, TDerivedType7, TDerivedType8, TDerivedType9, TDerivedType10, TDerivedType11, TDerivedType12, TDerivedType13, TDerivedType14, TDerivedType15, TDerivedType16, TDerivedType17, TDerivedType18, TDerivedType19, TDerivedType20, TDerivedType21, TDerivedType22, TResult>(this TBaseType obj, Func<TDerivedType1, TResult> matchFunc1, Func<TDerivedType2, TResult> matchFunc2, Func<TDerivedType3, TResult> matchFunc3, Func<TDerivedType4, TResult> matchFunc4, Func<TDerivedType5, TResult> matchFunc5, Func<TDerivedType6, TResult> matchFunc6, Func<TDerivedType7, TResult> matchFunc7, Func<TDerivedType8, TResult> matchFunc8, Func<TDerivedType9, TResult> matchFunc9, Func<TDerivedType10, TResult> matchFunc10, Func<TDerivedType11, TResult> matchFunc11, Func<TDerivedType12, TResult> matchFunc12, Func<TDerivedType13, TResult> matchFunc13, Func<TDerivedType14, TResult> matchFunc14, Func<TDerivedType15, TResult> matchFunc15, Func<TDerivedType16, TResult> matchFunc16, Func<TDerivedType17, TResult> matchFunc17, Func<TDerivedType18, TResult> matchFunc18, Func<TDerivedType19, TResult> matchFunc19, Func<TDerivedType20, TResult> matchFunc20, Func<TDerivedType21, TResult> matchFunc21, Func<TDerivedType22, TResult> matchFunc22, Func<TBaseType, TResult>? defaultFunc = null)
213public static TResult? TypeSwitch<TBaseType, TDerivedType1, TDerivedType2, TDerivedType3, TDerivedType4, TDerivedType5, TDerivedType6, TDerivedType7, TDerivedType8, TDerivedType9, TDerivedType10, TDerivedType11, TDerivedType12, TDerivedType13, TDerivedType14, TDerivedType15, TDerivedType16, TDerivedType17, TDerivedType18, TDerivedType19, TDerivedType20, TDerivedType21, TDerivedType22, TDerivedType23, TDerivedType24, TDerivedType25, TDerivedType26, TDerivedType27, TDerivedType28, TDerivedType29, TDerivedType30, TDerivedType31, TDerivedType32, TDerivedType33, TDerivedType34, TDerivedType35, TDerivedType36, TDerivedType37, TDerivedType38, TDerivedType39, TResult>(this TBaseType obj, Func<TDerivedType1, TResult> matchFunc1, Func<TDerivedType2, TResult> matchFunc2, Func<TDerivedType3, TResult> matchFunc3, Func<TDerivedType4, TResult> matchFunc4, Func<TDerivedType5, TResult> matchFunc5, Func<TDerivedType6, TResult> matchFunc6, Func<TDerivedType7, TResult> matchFunc7, Func<TDerivedType8, TResult> matchFunc8, Func<TDerivedType9, TResult> matchFunc9, Func<TDerivedType10, TResult> matchFunc10, Func<TDerivedType11, TResult> matchFunc11, Func<TDerivedType12, TResult> matchFunc12, Func<TDerivedType13, TResult> matchFunc13, Func<TDerivedType14, TResult> matchFunc14, Func<TDerivedType15, TResult> matchFunc15, Func<TDerivedType16, TResult> matchFunc16, Func<TDerivedType17, TResult> matchFunc17, Func<TDerivedType18, TResult> matchFunc18, Func<TDerivedType19, TResult> matchFunc19, Func<TDerivedType20, TResult> matchFunc20, Func<TDerivedType21, TResult> matchFunc21, Func<TDerivedType22, TResult> matchFunc22, Func<TDerivedType23, TResult> matchFunc23, Func<TDerivedType24, TResult> matchFunc24, Func<TDerivedType25, TResult> matchFunc25, Func<TDerivedType26, TResult> matchFunc26, Func<TDerivedType27, TResult> matchFunc27, Func<TDerivedType28, TResult> matchFunc28, Func<TDerivedType29, TResult> matchFunc29, Func<TDerivedType30, TResult> matchFunc30, Func<TDerivedType31, TResult> matchFunc31, Func<TDerivedType32, TResult> matchFunc32, Func<TDerivedType33, TResult> matchFunc33, Func<TDerivedType34, TResult> matchFunc34, Func<TDerivedType35, TResult> matchFunc35, Func<TDerivedType36, TResult> matchFunc36, Func<TDerivedType37, TResult> matchFunc37, Func<TDerivedType38, TResult> matchFunc38, Func<TDerivedType39, TResult> matchFunc39, Func<TBaseType, TResult>? defaultFunc = null)
299public static TResult? TypeSwitch<TBaseType, TDerivedType1, TDerivedType2, TDerivedType3, TDerivedType4, TDerivedType5, TDerivedType6, TDerivedType7, TDerivedType8, TDerivedType9, TDerivedType10, TDerivedType11, TDerivedType12, TDerivedType13, TDerivedType14, TDerivedType15, TDerivedType16, TDerivedType17, TDerivedType18, TDerivedType19, TDerivedType20, TDerivedType21, TDerivedType22, TDerivedType23, TDerivedType24, TDerivedType25, TDerivedType26, TDerivedType27, TDerivedType28, TDerivedType29, TDerivedType30, TDerivedType31, TDerivedType32, TDerivedType33, TDerivedType34, TDerivedType35, TDerivedType36, TDerivedType37, TDerivedType38, TDerivedType39, TDerivedType40, TResult>(this TBaseType obj, Func<TDerivedType1, TResult> matchFunc1, Func<TDerivedType2, TResult> matchFunc2, Func<TDerivedType3, TResult> matchFunc3, Func<TDerivedType4, TResult> matchFunc4, Func<TDerivedType5, TResult> matchFunc5, Func<TDerivedType6, TResult> matchFunc6, Func<TDerivedType7, TResult> matchFunc7, Func<TDerivedType8, TResult> matchFunc8, Func<TDerivedType9, TResult> matchFunc9, Func<TDerivedType10, TResult> matchFunc10, Func<TDerivedType11, TResult> matchFunc11, Func<TDerivedType12, TResult> matchFunc12, Func<TDerivedType13, TResult> matchFunc13, Func<TDerivedType14, TResult> matchFunc14, Func<TDerivedType15, TResult> matchFunc15, Func<TDerivedType16, TResult> matchFunc16, Func<TDerivedType17, TResult> matchFunc17, Func<TDerivedType18, TResult> matchFunc18, Func<TDerivedType19, TResult> matchFunc19, Func<TDerivedType20, TResult> matchFunc20, Func<TDerivedType21, TResult> matchFunc21, Func<TDerivedType22, TResult> matchFunc22, Func<TDerivedType23, TResult> matchFunc23, Func<TDerivedType24, TResult> matchFunc24, Func<TDerivedType25, TResult> matchFunc25, Func<TDerivedType26, TResult> matchFunc26, Func<TDerivedType27, TResult> matchFunc27, Func<TDerivedType28, TResult> matchFunc28, Func<TDerivedType29, TResult> matchFunc29, Func<TDerivedType30, TResult> matchFunc30, Func<TDerivedType31, TResult> matchFunc31, Func<TDerivedType32, TResult> matchFunc32, Func<TDerivedType33, TResult> matchFunc33, Func<TDerivedType34, TResult> matchFunc34, Func<TDerivedType35, TResult> matchFunc35, Func<TDerivedType36, TResult> matchFunc36, Func<TDerivedType37, TResult> matchFunc37, Func<TDerivedType38, TResult> matchFunc38, Func<TDerivedType39, TResult> matchFunc39, Func<TDerivedType40, TResult> matchFunc40, Func<TBaseType, TResult>? defaultFunc = null)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\SyntaxNodeExtensions.cs (6)
104this SyntaxNode node, TextSpan searchSpan, Func<SyntaxNode, bool> predicate)
129public static bool CheckParent<T>([NotNullWhen(returnValue: true)] this SyntaxNode? node, Func<T, bool> valueChecker) where T : SyntaxNode
145public static bool IsChildNode<TParent>(this SyntaxNode node, Func<TParent, SyntaxNode?> childGetter)
162public static bool IsFoundUnder<TParent>(this SyntaxNode node, Func<TParent, SyntaxNode?> childGetter)
201public static SyntaxNode? FindInnermostCommonNode(this IEnumerable<SyntaxNode> nodes, Func<SyntaxNode, bool> predicate)
806public static TNode? FirstAncestorOrSelfUntil<TNode>(this SyntaxNode? node, Func<SyntaxNode, bool> predicate)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\SyntaxTokenExtensions.cs (5)
15public static SyntaxNode? GetAncestor(this SyntaxToken token, Func<SyntaxNode, bool>? predicate)
18public static T? GetAncestor<T>(this SyntaxToken token, Func<T, bool>? predicate = null) where T : SyntaxNode
21public static T GetRequiredAncestor<T>(this SyntaxToken token, Func<T, bool>? predicate = null) where T : SyntaxNode
32public static IEnumerable<SyntaxNode> GetAncestors(this SyntaxToken token, Func<SyntaxNode, bool> predicate)
42public static bool CheckParent<T>(this SyntaxToken token, Func<T, bool> valueChecker) where T : SyntaxNode
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Options\PublicOptionFactory.cs (4)
17public static Option2<T> WithPublicOption<T, TPublicValue>(this Option2<T> option, string feature, string name, Func<T, TPublicValue> toPublicValue, Func<TPublicValue, T> toInternalValue)
20public static PerLanguageOption2<T> WithPublicOption<T, TPublicValue>(this PerLanguageOption2<T> option, string feature, string name, Func<T, TPublicValue> toPublicValue, Func<TPublicValue, T> toInternalValue)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\TopologicalSorter.cs (8)
13public static IEnumerable<T> TopologicalSort<T>(this IEnumerable<T> items, Func<T, IEnumerable<T>> itemsBefore)
26public static IEnumerable<T> TopologicalSort<T>(this IEnumerable<T> items, Func<T, IEnumerable<T>> itemsBefore, Func<T, IEnumerable<T>> itemsAfter)
29var combinedItemsBefore = CreateCombinedItemsBefore(items, itemsBefore, itemsAfter);
35Func<T, IEnumerable<T>> itemsBefore,
50private static Func<T, IEnumerable<T>> CreateCombinedItemsBefore<T>(IEnumerable<T> items, Func<T, IEnumerable<T>> itemsBefore, Func<T, IEnumerable<T>> itemsAfter)
Microsoft.CodeAnalysis.BannedApiAnalyzers (442)
src\Compilers\Core\Portable\FileSystem\FileUtilities.cs (4)
47Func<string, bool> fileExists)
322public static T RethrowExceptionsAsIOException<T, TArg>(Func<TArg, T> operation, TArg arg)
339public static async Task<T> RethrowExceptionsAsIOExceptionAsync<T, TArg>(Func<TArg, Task<T>> operation, TArg arg)
355internal static Stream CreateFileStreamChecked(Func<string, Stream> factory, string path, string? paramName = null)
src\Compilers\Core\Portable\InternalUtilities\InterlockedOperations.cs (5)
46public static T Initialize<T, TArg>([NotNull] ref T? target, Func<TArg, T> valueFactory, TArg arg)
66public static int Initialize<TArg>(ref int target, int uninitializedValue, Func<TArg, int> valueFactory, TArg arg)
103public static T? Initialize<T, TArg>([NotNull] ref StrongBox<T?>? target, Func<TArg, T?> valueFactory, TArg arg)
183public static ImmutableArray<T> Initialize<T, TArg>(ref ImmutableArray<T> target, Func<TArg, ImmutableArray<T>> createArray, TArg arg)
193private static ImmutableArray<T> Initialize_Slow<T, TArg>(ref ImmutableArray<T> target, Func<TArg, ImmutableArray<T>> createArray, TArg arg)
src\Compilers\Core\Portable\SourceGeneration\GeneratedCodeUtilities.cs (4)
49SyntaxTree tree, Func<SyntaxTrivia, bool> isComment, CancellationToken cancellationToken)
55internal static bool IsGeneratedCode(string? filePath, SyntaxNode root, Func<SyntaxTrivia, bool> isComment)
88private static bool BeginsWithAutoGeneratedComment(SyntaxNode root, Func<SyntaxTrivia, bool> isComment)
118SyntaxTree tree, Func<SyntaxTrivia, bool> isComment, CancellationToken cancellationToken)
src\Dependencies\Collections\Extensions\IEnumerableExtensions.cs (30)
164public static T? FirstOrNull<T>(this IEnumerable<T> source, Func<T, bool> predicate)
182public static T? SingleOrNull<T>(this IEnumerable<T> source, Func<T, bool> predicate)
261public static bool HasDuplicates<TItem, TValue>(this IEnumerable<TItem> source, Func<TItem, TValue> selector)
271/// <seealso cref="Microsoft.CodeAnalysis.ImmutableArrayExtensions.HasDuplicates{TItem, TValue}(ImmutableArray{TItem}, Func{TItem, TValue}, IEqualityComparer{TValue})"/>
273public static bool HasDuplicates<TItem, TValue>(this IEnumerable<TItem> source, Func<TItem, TValue> selector, IEqualityComparer<TValue> comparer)
321private static readonly Func<object, bool> s_notNullTest = x => x != null;
331return source.Where((Func<T?, bool>)s_notNullTest)!;
376public static ImmutableArray<T> WhereAsArray<T>(this IEnumerable<T> values, Func<T, bool> predicate)
407public static ImmutableArray<TResult> SelectAsArray<TSource, TResult>(this IEnumerable<TSource>? source, Func<TSource, TResult> selector)
417public static ImmutableArray<TResult> SelectAsArray<TItem, TResult>(this IEnumerable<TItem>? source, Func<TItem, bool> predicate, Func<TItem, TResult> selector)
461public static ImmutableArray<TResult> SelectAsArray<TSource, TResult>(this IReadOnlyCollection<TSource>? source, Func<TSource, TResult> selector)
485public static ImmutableArray<TResult> SelectManyAsArray<TSource, TResult>(this IEnumerable<TSource>? source, Func<TSource, IEnumerable<TResult>> selector)
507public static ImmutableArray<TResult> SelectManyAsArray<TItem, TResult>(this IReadOnlyCollection<TItem>? source, Func<TItem, IEnumerable<TResult>> selector)
533public static ImmutableArray<TResult> SelectManyAsArray<TSource, TResult>(this IEnumerable<TSource>? source, Func<TSource, OneOrMany<TResult>> selector)
547public static async ValueTask<ImmutableArray<TResult>> SelectAsArrayAsync<TItem, TResult>(this IEnumerable<TItem> source, Func<TItem, ValueTask<TResult>> selector)
764internal static Dictionary<K, ImmutableArray<T>> ToMultiDictionary<K, T>(this IEnumerable<T> data, Func<T, K> keySelector, IEqualityComparer<K>? comparer = null)
815public static readonly Func<T, T> Identity = t => t;
816public static readonly Func<T, bool> True = t => true;
840/// Alias for <see cref="System.Linq.Enumerable.Any{TSource}(IEnumerable{TSource}, Func{TSource, bool})"/>
842public static bool Contains<T>(this IEnumerable<T> sequence, Func<T, bool> predicate)
846/// Variant of <see cref="System.Linq.Enumerable.Count{TSource}(IEnumerable{TSource}, Func{TSource, bool})"/>
861/// Variant of <see cref="System.Linq.Enumerable.FirstOrDefault{TSource}(IEnumerable{TSource}, Func{TSource, bool})"/>
875/// Variant of <see cref="System.Linq.Enumerable.Any{TSource}(IEnumerable{TSource}, Func{TSource, bool})"/>
889/// Variant of <see cref="System.Linq.Enumerable.OrderBy{TSource, TKey}(IEnumerable{TSource}, Func{TSource, TKey}, IComparer{TKey}?)"/>
895/// Variant of <see cref="System.Linq.Enumerable.OrderByDescending{TSource, TKey}(IEnumerable{TSource}, Func{TSource, TKey}, IComparer{TKey}?)"/>
901/// Variant of <see cref="System.Linq.Enumerable.OrderBy{TSource, TKey}(IEnumerable{TSource}, Func{TSource, TKey}, IComparer{TKey}?)"/>
907/// Variant of <see cref="System.Linq.Enumerable.OrderByDescending{TSource, TKey}(IEnumerable{TSource}, Func{TSource, TKey}, IComparer{TKey}?)"/>
913/// Variant of <see cref="System.Linq.Enumerable.ThenBy{TSource, TKey}(IOrderedEnumerable{TSource}, Func{TSource, TKey}, IComparer{TKey}?)"/>
919/// Variant of <see cref="System.Linq.Enumerable.ThenBy{TSource, TKey}(IOrderedEnumerable{TSource}, Func{TSource, TKey}, IComparer{TKey}?)"/>
src\Dependencies\Collections\Extensions\IListExtensions.cs (4)
21public static bool HasDuplicates<TItem, TValue>(this IReadOnlyList<TItem> list, Func<TItem, TValue> selector)
31/// <seealso cref="ImmutableArrayExtensions.HasDuplicates{TItem, TValue}(System.Collections.Immutable.ImmutableArray{TItem}, Func{TItem, TValue}, IEqualityComparer{TValue})"/>
32/// <seealso cref="Roslyn.Utilities.EnumerableExtensions.HasDuplicates{TItem, TValue}(IEnumerable{TItem}, Func{TItem, TValue}, IEqualityComparer{TValue})"/>
34internal static bool HasDuplicates<TItem, TValue>(this IReadOnlyList<TItem> list, Func<TItem, TValue> selector, IEqualityComparer<TValue> comparer)
src\Dependencies\Collections\Extensions\ImmutableArrayExtensions.cs (27)
138public static ImmutableArray<TResult> SelectAsArray<TItem, TResult>(this ImmutableArray<TItem> items, Func<TItem, TResult> map)
198public static ImmutableArray<TResult> SelectAsArray<TItem, TResult>(this ImmutableArray<TItem> array, Func<TItem, bool> predicate, Func<TItem, TResult> selector)
247public static ImmutableArray<TResult> SelectManyAsArray<TItem, TResult>(this ImmutableArray<TItem> array, Func<TItem, IEnumerable<TResult>> selector)
267public static ImmutableArray<TResult> SelectManyAsArray<TItem, TResult>(this ImmutableArray<TItem> array, Func<TItem, ImmutableArray<TResult>> selector)
287public static ImmutableArray<TResult> SelectManyAsArray<TItem, TResult>(this ImmutableArray<TItem> array, Func<TItem, OneOrMany<TResult>> selector)
308public static ImmutableArray<TResult> SelectManyAsArray<TItem, TResult>(this ImmutableArray<TItem> array, Func<TItem, bool> predicate, Func<TItem, IEnumerable<TResult>> selector)
332public static ImmutableArray<TResult> SelectManyAsArray<TItem, TResult>(this ImmutableArray<TItem> array, Func<TItem, bool> predicate, Func<TItem, ImmutableArray<TResult>> selector)
356public static ImmutableArray<TResult> SelectManyAsArray<TItem, TResult>(this ImmutableArray<TItem> array, Func<TItem, bool> predicate, Func<TItem, OneOrMany<TResult>> selector)
493public static ImmutableArray<T> WhereAsArray<T>(this ImmutableArray<T> array, Func<T, bool> predicate)
504private static ImmutableArray<T> WhereAsArrayImpl<T, TArg>(ImmutableArray<T> array, Func<T, bool>? predicateWithoutArg, Func<T, TArg, bool>? predicateWithArg, TArg arg)
573public static async Task<bool> AnyAsync<T>(this ImmutableArray<T> array, Func<T, Task<bool>> predicateAsync)
595public static async ValueTask<T?> FirstOrDefaultAsync<T>(this ImmutableArray<T> array, Func<T, Task<bool>> predicateAsync)
757public static bool HasDuplicates<TItem, TValue>(this ImmutableArray<TItem> array, Func<TItem, TValue> selector)
767/// <seealso cref="Roslyn.Utilities.EnumerableExtensions.HasDuplicates{TItem, TValue}(IEnumerable{TItem}, Func{TItem, TValue}, IEqualityComparer{TValue})"/>
769internal static bool HasDuplicates<TItem, TValue>(this ImmutableArray<TItem> array, Func<TItem, TValue> selector, IEqualityComparer<TValue> comparer)
990/// Variant of <see cref="System.Linq.ImmutableArrayExtensions.FirstOrDefault{T}(ImmutableArray{T}, Func{T, bool})"/>
1004/// Variant of <see cref="System.Linq.ImmutableArrayExtensions.Single{T}(ImmutableArray{T}, Func{T, bool})"/>
1066/// Specialization of <see cref="System.Linq.Enumerable.Count{TSource}(IEnumerable{TSource}, Func{TSource, bool})"/> for <see cref="ImmutableArray{T}"/>.
1068public static int Count<T>(this ImmutableArray<T> items, Func<T, bool> predicate)
1086public static int Sum<T>(this ImmutableArray<T> items, Func<T, int> selector)
1213/// Variant of <see cref="System.Linq.ImmutableArrayExtensions.Any{T}(ImmutableArray{T}, Func{T, bool})"/>.
1227/// Variant of <see cref="System.Linq.ImmutableArrayExtensions.All{T}(ImmutableArray{T}, Func{T, bool})"/>.
1257public static bool Contains<T>(this ImmutableArray<T> array, Func<T, bool> predicate)
src\Dependencies\Collections\RoslynImmutableInterlocked.cs (7)
33public static bool Update<T>(ref ImmutableSegmentedList<T> location, Func<ImmutableSegmentedList<T>, ImmutableSegmentedList<T>> transformer)
154public static bool Update<T>(ref ImmutableSegmentedHashSet<T> location, Func<ImmutableSegmentedHashSet<T>, ImmutableSegmentedHashSet<T>> transformer)
276public static bool Update<TKey, TValue>(ref ImmutableSegmentedDictionary<TKey, TValue> location, Func<ImmutableSegmentedDictionary<TKey, TValue>, ImmutableSegmentedDictionary<TKey, TValue>> transformer)
410/// <inheritdoc cref="ImmutableInterlocked.GetOrAdd{TKey, TValue}(ref ImmutableDictionary{TKey, TValue}, TKey, Func{TKey, TValue})"/>
411public static TValue GetOrAdd<TKey, TValue>(ref ImmutableSegmentedDictionary<TKey, TValue> location, TKey key, Func<TKey, TValue> valueFactory)
458/// <inheritdoc cref="ImmutableInterlocked.AddOrUpdate{TKey, TValue}(ref ImmutableDictionary{TKey, TValue}, TKey, Func{TKey, TValue}, Func{TKey, TValue, TValue})"/>
459public static TValue AddOrUpdate<TKey, TValue>(ref ImmutableSegmentedDictionary<TKey, TValue> location, TKey key, Func<TKey, TValue> addValueFactory, Func<TKey, TValue, TValue> updateValueFactory)
src\Dependencies\Collections\Segmented\ImmutableSegmentedDictionary.cs (6)
68public static ImmutableSegmentedDictionary<TKey, TValue> ToImmutableSegmentedDictionary<TSource, TKey, TValue>(this IEnumerable<TSource> source, Func<TSource, TKey> keySelector, Func<TSource, TValue> elementSelector)
72public static ImmutableSegmentedDictionary<TKey, TValue> ToImmutableSegmentedDictionary<TSource, TKey, TValue>(this IEnumerable<TSource> source, Func<TSource, TKey> keySelector, Func<TSource, TValue> elementSelector, IEqualityComparer<TKey>? keyComparer)
86public static ImmutableSegmentedDictionary<TKey, TSource> ToImmutableSegmentedDictionary<TSource, TKey>(this IEnumerable<TSource> source, Func<TSource, TKey> keySelector)
90public static ImmutableSegmentedDictionary<TKey, TSource> ToImmutableSegmentedDictionary<TSource, TKey>(this IEnumerable<TSource> source, Func<TSource, TKey> keySelector, IEqualityComparer<TKey>? keyComparer)
src\Dependencies\PooledObjects\ArrayBuilder.cs (7)
457public void FreeAll(Func<T, ArrayBuilder<T>?> getNested)
560internal Dictionary<K, ImmutableArray<T>> ToDictionary<K>(Func<T, K> keySelector, IEqualityComparer<K>? comparer = null)
608public void AddRange<U>(ArrayBuilder<U> items, Func<U, T> selector)
745public ImmutableArray<S> SelectDistinct<S>(Func<T, S> selector)
763public bool Any(Func<T, bool> predicate)
787public bool All(Func<T, bool> predicate)
817public ImmutableArray<TResult> SelectAsArray<TResult>(Func<T, TResult> map)
src\Dependencies\PooledObjects\PooledDelegates.cs (9)
200public static Releaser GetPooledFunction<TArg, TResult>(Func<TArg, TResult> unboundFunction, TArg argument, out Func<TResult> boundFunction)
201=> GetPooledDelegate<FuncWithBoundArgument<TArg, TResult>, TArg, Func<TArg, TResult>, Func<TResult>>(unboundFunction, argument, out boundFunction);
204/// Equivalent to <see cref="GetPooledFunction{TArg, TResult}(Func{TArg, TResult}, TArg, out Func{TResult})"/>,
216/// Gets a <see cref="Func{T, TResult}"/> delegate, which calls <paramref name="unboundFunction"/> with the
246public static Releaser GetPooledFunction<T1, TArg, TResult>(Func<T1, TArg, TResult> unboundFunction, TArg argument, out Func<T1, TResult> boundFunction)
247=> GetPooledDelegate<FuncWithBoundArgument<T1, TArg, TResult>, TArg, Func<T1, TArg, TResult>, Func<T1, TResult>>(unboundFunction, argument, out boundFunction);
412: AbstractDelegateWithBoundArgument<FuncWithBoundArgument<TArg, TResult>, TArg, Func<TArg, TResult>, Func<TResult>>
432: AbstractDelegateWithBoundArgument<FuncWithBoundArgument<T1, TArg, TResult>, TArg, Func<T1, TArg, TResult>, Func<T1, TResult>>
434protected override Func<T1, TResult> Bind()
src\Dependencies\Threading\ParallelExtensions.NetFramework.cs (7)
122Func<object, Task> taskBody = static async o =>
287Func<object, Task> taskBody = static async o =>
395private readonly Func<object, Task> _taskBody;
418protected ForEachAsyncState(Func<object, Task> taskBody, bool needsLock, int dop, TaskScheduler scheduler, CancellationToken cancellationToken, Func<TSource, CancellationToken, ValueTask> body)
584IEnumerable<TSource> source, Func<object, Task> taskBody,
610IAsyncEnumerable<TSource> source, Func<object, Task> taskBody,
637T fromExclusive, T toExclusive, Func<object, Task> taskBody,
src\RoslynAnalyzers\Utilities\Compiler\Lightup\LightupHelpers.cs (6)
19internal static Func<TOperation, TProperty> CreateOperationPropertyAccessor<TOperation, TProperty>(Type? type, string propertyName, TProperty fallbackResult)
23internal static Func<TSyntax, TProperty> CreateSyntaxPropertyAccessor<TSyntax, TProperty>(Type? type, string propertyName, TProperty fallbackResult)
27internal static Func<TSymbol, TProperty> CreateSymbolPropertyAccessor<TSymbol, TProperty>(Type? type, string propertyName, TProperty fallbackResult)
31private static Func<T, TProperty> CreatePropertyAccessor<T, TProperty>(Type? type, string parameterName, string propertyName, TProperty fallbackResult)
50Expression<Func<T, TProperty>> expression = Expression.Lambda<Func<T, TProperty>>(result, parameter);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\ObjectExtensions.TypeSwitch.cs (161)
11public static TResult? TypeSwitch<TBaseType, TDerivedType1, TDerivedType2, TDerivedType3, TResult>(this TBaseType obj, Func<TDerivedType1, TResult> matchFunc1, Func<TDerivedType2, TResult> matchFunc2, Func<TDerivedType3, TResult> matchFunc3, Func<TBaseType, TResult>? defaultFunc = null)
25public static TResult? TypeSwitch<TBaseType, TDerivedType1, TDerivedType2, TDerivedType3, TDerivedType4, TResult>(this TBaseType obj, Func<TDerivedType1, TResult> matchFunc1, Func<TDerivedType2, TResult> matchFunc2, Func<TDerivedType3, TResult> matchFunc3, Func<TDerivedType4, TResult> matchFunc4, Func<TBaseType, TResult>? defaultFunc = null)
41public static TResult? TypeSwitch<TBaseType, TDerivedType1, TDerivedType2, TDerivedType3, TDerivedType4, TDerivedType5, TResult>(this TBaseType obj, Func<TDerivedType1, TResult> matchFunc1, Func<TDerivedType2, TResult> matchFunc2, Func<TDerivedType3, TResult> matchFunc3, Func<TDerivedType4, TResult> matchFunc4, Func<TDerivedType5, TResult> matchFunc5, Func<TBaseType, TResult>? defaultFunc = null)
59public static TResult? TypeSwitch<TBaseType, TDerivedType1, TDerivedType2, TDerivedType3, TDerivedType4, TDerivedType5, TDerivedType6, TResult>(this TBaseType obj, Func<TDerivedType1, TResult> matchFunc1, Func<TDerivedType2, TResult> matchFunc2, Func<TDerivedType3, TResult> matchFunc3, Func<TDerivedType4, TResult> matchFunc4, Func<TDerivedType5, TResult> matchFunc5, Func<TDerivedType6, TResult> matchFunc6, Func<TBaseType, TResult>? defaultFunc = null)
79public static TResult? TypeSwitch<TBaseType, TDerivedType1, TDerivedType2, TDerivedType3, TDerivedType4, TDerivedType5, TDerivedType6, TDerivedType7, TDerivedType8, TDerivedType9, TDerivedType10, TDerivedType11, TDerivedType12, TDerivedType13, TDerivedType14, TDerivedType15, TDerivedType16, TResult>(this TBaseType obj, Func<TDerivedType1, TResult> matchFunc1, Func<TDerivedType2, TResult> matchFunc2, Func<TDerivedType3, TResult> matchFunc3, Func<TDerivedType4, TResult> matchFunc4, Func<TDerivedType5, TResult> matchFunc5, Func<TDerivedType6, TResult> matchFunc6, Func<TDerivedType7, TResult> matchFunc7, Func<TDerivedType8, TResult> matchFunc8, Func<TDerivedType9, TResult> matchFunc9, Func<TDerivedType10, TResult> matchFunc10, Func<TDerivedType11, TResult> matchFunc11, Func<TDerivedType12, TResult> matchFunc12, Func<TDerivedType13, TResult> matchFunc13, Func<TDerivedType14, TResult> matchFunc14, Func<TDerivedType15, TResult> matchFunc15, Func<TDerivedType16, TResult> matchFunc16, Func<TBaseType, TResult>? defaultFunc = null)
119public static TResult? TypeSwitch<TBaseType, TDerivedType1, TDerivedType2, TDerivedType3, TDerivedType4, TDerivedType5, TDerivedType6, TDerivedType7, TDerivedType8, TDerivedType9, TDerivedType10, TDerivedType11, TDerivedType12, TDerivedType13, TDerivedType14, TDerivedType15, TDerivedType16, TDerivedType17, TResult>(this TBaseType obj, Func<TDerivedType1, TResult> matchFunc1, Func<TDerivedType2, TResult> matchFunc2, Func<TDerivedType3, TResult> matchFunc3, Func<TDerivedType4, TResult> matchFunc4, Func<TDerivedType5, TResult> matchFunc5, Func<TDerivedType6, TResult> matchFunc6, Func<TDerivedType7, TResult> matchFunc7, Func<TDerivedType8, TResult> matchFunc8, Func<TDerivedType9, TResult> matchFunc9, Func<TDerivedType10, TResult> matchFunc10, Func<TDerivedType11, TResult> matchFunc11, Func<TDerivedType12, TResult> matchFunc12, Func<TDerivedType13, TResult> matchFunc13, Func<TDerivedType14, TResult> matchFunc14, Func<TDerivedType15, TResult> matchFunc15, Func<TDerivedType16, TResult> matchFunc16, Func<TDerivedType17, TResult> matchFunc17, Func<TBaseType, TResult>? defaultFunc = null)
161public static TResult? TypeSwitch<TBaseType, TDerivedType1, TDerivedType2, TDerivedType3, TDerivedType4, TDerivedType5, TDerivedType6, TDerivedType7, TDerivedType8, TDerivedType9, TDerivedType10, TDerivedType11, TDerivedType12, TDerivedType13, TDerivedType14, TDerivedType15, TDerivedType16, TDerivedType17, TDerivedType18, TDerivedType19, TDerivedType20, TDerivedType21, TDerivedType22, TResult>(this TBaseType obj, Func<TDerivedType1, TResult> matchFunc1, Func<TDerivedType2, TResult> matchFunc2, Func<TDerivedType3, TResult> matchFunc3, Func<TDerivedType4, TResult> matchFunc4, Func<TDerivedType5, TResult> matchFunc5, Func<TDerivedType6, TResult> matchFunc6, Func<TDerivedType7, TResult> matchFunc7, Func<TDerivedType8, TResult> matchFunc8, Func<TDerivedType9, TResult> matchFunc9, Func<TDerivedType10, TResult> matchFunc10, Func<TDerivedType11, TResult> matchFunc11, Func<TDerivedType12, TResult> matchFunc12, Func<TDerivedType13, TResult> matchFunc13, Func<TDerivedType14, TResult> matchFunc14, Func<TDerivedType15, TResult> matchFunc15, Func<TDerivedType16, TResult> matchFunc16, Func<TDerivedType17, TResult> matchFunc17, Func<TDerivedType18, TResult> matchFunc18, Func<TDerivedType19, TResult> matchFunc19, Func<TDerivedType20, TResult> matchFunc20, Func<TDerivedType21, TResult> matchFunc21, Func<TDerivedType22, TResult> matchFunc22, Func<TBaseType, TResult>? defaultFunc = null)
213public static TResult? TypeSwitch<TBaseType, TDerivedType1, TDerivedType2, TDerivedType3, TDerivedType4, TDerivedType5, TDerivedType6, TDerivedType7, TDerivedType8, TDerivedType9, TDerivedType10, TDerivedType11, TDerivedType12, TDerivedType13, TDerivedType14, TDerivedType15, TDerivedType16, TDerivedType17, TDerivedType18, TDerivedType19, TDerivedType20, TDerivedType21, TDerivedType22, TDerivedType23, TDerivedType24, TDerivedType25, TDerivedType26, TDerivedType27, TDerivedType28, TDerivedType29, TDerivedType30, TDerivedType31, TDerivedType32, TDerivedType33, TDerivedType34, TDerivedType35, TDerivedType36, TDerivedType37, TDerivedType38, TDerivedType39, TResult>(this TBaseType obj, Func<TDerivedType1, TResult> matchFunc1, Func<TDerivedType2, TResult> matchFunc2, Func<TDerivedType3, TResult> matchFunc3, Func<TDerivedType4, TResult> matchFunc4, Func<TDerivedType5, TResult> matchFunc5, Func<TDerivedType6, TResult> matchFunc6, Func<TDerivedType7, TResult> matchFunc7, Func<TDerivedType8, TResult> matchFunc8, Func<TDerivedType9, TResult> matchFunc9, Func<TDerivedType10, TResult> matchFunc10, Func<TDerivedType11, TResult> matchFunc11, Func<TDerivedType12, TResult> matchFunc12, Func<TDerivedType13, TResult> matchFunc13, Func<TDerivedType14, TResult> matchFunc14, Func<TDerivedType15, TResult> matchFunc15, Func<TDerivedType16, TResult> matchFunc16, Func<TDerivedType17, TResult> matchFunc17, Func<TDerivedType18, TResult> matchFunc18, Func<TDerivedType19, TResult> matchFunc19, Func<TDerivedType20, TResult> matchFunc20, Func<TDerivedType21, TResult> matchFunc21, Func<TDerivedType22, TResult> matchFunc22, Func<TDerivedType23, TResult> matchFunc23, Func<TDerivedType24, TResult> matchFunc24, Func<TDerivedType25, TResult> matchFunc25, Func<TDerivedType26, TResult> matchFunc26, Func<TDerivedType27, TResult> matchFunc27, Func<TDerivedType28, TResult> matchFunc28, Func<TDerivedType29, TResult> matchFunc29, Func<TDerivedType30, TResult> matchFunc30, Func<TDerivedType31, TResult> matchFunc31, Func<TDerivedType32, TResult> matchFunc32, Func<TDerivedType33, TResult> matchFunc33, Func<TDerivedType34, TResult> matchFunc34, Func<TDerivedType35, TResult> matchFunc35, Func<TDerivedType36, TResult> matchFunc36, Func<TDerivedType37, TResult> matchFunc37, Func<TDerivedType38, TResult> matchFunc38, Func<TDerivedType39, TResult> matchFunc39, Func<TBaseType, TResult>? defaultFunc = null)
299public static TResult? TypeSwitch<TBaseType, TDerivedType1, TDerivedType2, TDerivedType3, TDerivedType4, TDerivedType5, TDerivedType6, TDerivedType7, TDerivedType8, TDerivedType9, TDerivedType10, TDerivedType11, TDerivedType12, TDerivedType13, TDerivedType14, TDerivedType15, TDerivedType16, TDerivedType17, TDerivedType18, TDerivedType19, TDerivedType20, TDerivedType21, TDerivedType22, TDerivedType23, TDerivedType24, TDerivedType25, TDerivedType26, TDerivedType27, TDerivedType28, TDerivedType29, TDerivedType30, TDerivedType31, TDerivedType32, TDerivedType33, TDerivedType34, TDerivedType35, TDerivedType36, TDerivedType37, TDerivedType38, TDerivedType39, TDerivedType40, TResult>(this TBaseType obj, Func<TDerivedType1, TResult> matchFunc1, Func<TDerivedType2, TResult> matchFunc2, Func<TDerivedType3, TResult> matchFunc3, Func<TDerivedType4, TResult> matchFunc4, Func<TDerivedType5, TResult> matchFunc5, Func<TDerivedType6, TResult> matchFunc6, Func<TDerivedType7, TResult> matchFunc7, Func<TDerivedType8, TResult> matchFunc8, Func<TDerivedType9, TResult> matchFunc9, Func<TDerivedType10, TResult> matchFunc10, Func<TDerivedType11, TResult> matchFunc11, Func<TDerivedType12, TResult> matchFunc12, Func<TDerivedType13, TResult> matchFunc13, Func<TDerivedType14, TResult> matchFunc14, Func<TDerivedType15, TResult> matchFunc15, Func<TDerivedType16, TResult> matchFunc16, Func<TDerivedType17, TResult> matchFunc17, Func<TDerivedType18, TResult> matchFunc18, Func<TDerivedType19, TResult> matchFunc19, Func<TDerivedType20, TResult> matchFunc20, Func<TDerivedType21, TResult> matchFunc21, Func<TDerivedType22, TResult> matchFunc22, Func<TDerivedType23, TResult> matchFunc23, Func<TDerivedType24, TResult> matchFunc24, Func<TDerivedType25, TResult> matchFunc25, Func<TDerivedType26, TResult> matchFunc26, Func<TDerivedType27, TResult> matchFunc27, Func<TDerivedType28, TResult> matchFunc28, Func<TDerivedType29, TResult> matchFunc29, Func<TDerivedType30, TResult> matchFunc30, Func<TDerivedType31, TResult> matchFunc31, Func<TDerivedType32, TResult> matchFunc32, Func<TDerivedType33, TResult> matchFunc33, Func<TDerivedType34, TResult> matchFunc34, Func<TDerivedType35, TResult> matchFunc35, Func<TDerivedType36, TResult> matchFunc36, Func<TDerivedType37, TResult> matchFunc37, Func<TDerivedType38, TResult> matchFunc38, Func<TDerivedType39, TResult> matchFunc39, Func<TDerivedType40, TResult> matchFunc40, Func<TBaseType, TResult>? defaultFunc = null)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\SyntaxNodeExtensions.cs (6)
104this SyntaxNode node, TextSpan searchSpan, Func<SyntaxNode, bool> predicate)
129public static bool CheckParent<T>([NotNullWhen(returnValue: true)] this SyntaxNode? node, Func<T, bool> valueChecker) where T : SyntaxNode
145public static bool IsChildNode<TParent>(this SyntaxNode node, Func<TParent, SyntaxNode?> childGetter)
162public static bool IsFoundUnder<TParent>(this SyntaxNode node, Func<TParent, SyntaxNode?> childGetter)
201public static SyntaxNode? FindInnermostCommonNode(this IEnumerable<SyntaxNode> nodes, Func<SyntaxNode, bool> predicate)
806public static TNode? FirstAncestorOrSelfUntil<TNode>(this SyntaxNode? node, Func<SyntaxNode, bool> predicate)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\SyntaxTokenExtensions.cs (5)
15public static SyntaxNode? GetAncestor(this SyntaxToken token, Func<SyntaxNode, bool>? predicate)
18public static T? GetAncestor<T>(this SyntaxToken token, Func<T, bool>? predicate = null) where T : SyntaxNode
21public static T GetRequiredAncestor<T>(this SyntaxToken token, Func<T, bool>? predicate = null) where T : SyntaxNode
32public static IEnumerable<SyntaxNode> GetAncestors(this SyntaxToken token, Func<SyntaxNode, bool> predicate)
42public static bool CheckParent<T>(this SyntaxToken token, Func<T, bool> valueChecker) where T : SyntaxNode
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Options\PublicOptionFactory.cs (4)
17public static Option2<T> WithPublicOption<T, TPublicValue>(this Option2<T> option, string feature, string name, Func<T, TPublicValue> toPublicValue, Func<TPublicValue, T> toInternalValue)
20public static PerLanguageOption2<T> WithPublicOption<T, TPublicValue>(this PerLanguageOption2<T> option, string feature, string name, Func<T, TPublicValue> toPublicValue, Func<TPublicValue, T> toInternalValue)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\TopologicalSorter.cs (8)
13public static IEnumerable<T> TopologicalSort<T>(this IEnumerable<T> items, Func<T, IEnumerable<T>> itemsBefore)
26public static IEnumerable<T> TopologicalSort<T>(this IEnumerable<T> items, Func<T, IEnumerable<T>> itemsBefore, Func<T, IEnumerable<T>> itemsAfter)
29var combinedItemsBefore = CreateCombinedItemsBefore(items, itemsBefore, itemsAfter);
35Func<T, IEnumerable<T>> itemsBefore,
50private static Func<T, IEnumerable<T>> CreateCombinedItemsBefore<T>(IEnumerable<T> items, Func<T, IEnumerable<T>> itemsBefore, Func<T, IEnumerable<T>> itemsAfter)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Extensions\SyntaxEditorExtensions.cs (4)
29Func<TType, (TNode semanticNode, IEnumerable<TNode> additionalNodes)> selector,
52Func<TType, TNode> selector,
96Func<TType, (TNode semanticNode, IEnumerable<TNode> additionalNodes)> selector,
153Func<TType, (TNode semanticNode, IEnumerable<TNode> additionalNodes)> selector,
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Simplification\AbstractSimplificationService.cs (6)
35protected static readonly Func<SyntaxNode, bool> s_containsAnnotations = n => n.ContainsAnnotations;
36protected static readonly Func<SyntaxNodeOrToken, bool> s_hasSimplifierAnnotation = n => n.HasAnnotation(Simplifier.Annotation);
40protected abstract ImmutableArray<NodeOrTokenToReduce> GetNodesAndTokensToReduce(SyntaxNode root, Func<SyntaxNodeOrToken, bool> isNodeOrTokenOutsideSimplifySpans);
51public abstract SyntaxNode Expand(SyntaxNode node, SemanticModel semanticModel, SyntaxAnnotation? annotationForReplacedAliasIdentifier, Func<SyntaxNode, bool>? expandInsideNode, bool expandParameter, CancellationToken cancellationToken);
52public abstract SyntaxToken Expand(SyntaxToken token, SemanticModel semanticModel, Func<SyntaxNode, bool>? expandInsideNode, CancellationToken cancellationToken);
275Func<SyntaxNodeOrToken, bool> isNodeOrTokenOutsideSimplifySpan)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Utilities\NameGenerator.cs (6)
43Func<string, bool>? canUse = null,
63Func<string, bool>? canUse = null,
86Func<string, bool>? canUse = null,
134public static string GenerateUniqueName(string baseName, Func<string, bool> canUse)
140public static string GenerateUniqueName(string baseName, string extension, Func<string, bool> canUse)
160public static string GenerateUniqueName(IEnumerable<string> baseNames, Func<string, bool> canUse)
Microsoft.CodeAnalysis.CodeStyle (389)
src\Compilers\Core\Portable\FileSystem\FileUtilities.cs (4)
47Func<string, bool> fileExists)
322public static T RethrowExceptionsAsIOException<T, TArg>(Func<TArg, T> operation, TArg arg)
339public static async Task<T> RethrowExceptionsAsIOExceptionAsync<T, TArg>(Func<TArg, Task<T>> operation, TArg arg)
355internal static Stream CreateFileStreamChecked(Func<string, Stream> factory, string path, string? paramName = null)
src\Compilers\Core\Portable\InternalUtilities\InterlockedOperations.cs (5)
46public static T Initialize<T, TArg>([NotNull] ref T? target, Func<TArg, T> valueFactory, TArg arg)
66public static int Initialize<TArg>(ref int target, int uninitializedValue, Func<TArg, int> valueFactory, TArg arg)
103public static T? Initialize<T, TArg>([NotNull] ref StrongBox<T?>? target, Func<TArg, T?> valueFactory, TArg arg)
183public static ImmutableArray<T> Initialize<T, TArg>(ref ImmutableArray<T> target, Func<TArg, ImmutableArray<T>> createArray, TArg arg)
193private static ImmutableArray<T> Initialize_Slow<T, TArg>(ref ImmutableArray<T> target, Func<TArg, ImmutableArray<T>> createArray, TArg arg)
src\Compilers\Core\Portable\SourceGeneration\GeneratedCodeUtilities.cs (4)
49SyntaxTree tree, Func<SyntaxTrivia, bool> isComment, CancellationToken cancellationToken)
55internal static bool IsGeneratedCode(string? filePath, SyntaxNode root, Func<SyntaxTrivia, bool> isComment)
88private static bool BeginsWithAutoGeneratedComment(SyntaxNode root, Func<SyntaxTrivia, bool> isComment)
118SyntaxTree tree, Func<SyntaxTrivia, bool> isComment, CancellationToken cancellationToken)
src\Dependencies\Collections\Extensions\IEnumerableExtensions.cs (30)
164public static T? FirstOrNull<T>(this IEnumerable<T> source, Func<T, bool> predicate)
182public static T? SingleOrNull<T>(this IEnumerable<T> source, Func<T, bool> predicate)
261public static bool HasDuplicates<TItem, TValue>(this IEnumerable<TItem> source, Func<TItem, TValue> selector)
271/// <seealso cref="Microsoft.CodeAnalysis.ImmutableArrayExtensions.HasDuplicates{TItem, TValue}(ImmutableArray{TItem}, Func{TItem, TValue}, IEqualityComparer{TValue})"/>
273public static bool HasDuplicates<TItem, TValue>(this IEnumerable<TItem> source, Func<TItem, TValue> selector, IEqualityComparer<TValue> comparer)
321private static readonly Func<object, bool> s_notNullTest = x => x != null;
331return source.Where((Func<T?, bool>)s_notNullTest)!;
376public static ImmutableArray<T> WhereAsArray<T>(this IEnumerable<T> values, Func<T, bool> predicate)
407public static ImmutableArray<TResult> SelectAsArray<TSource, TResult>(this IEnumerable<TSource>? source, Func<TSource, TResult> selector)
417public static ImmutableArray<TResult> SelectAsArray<TItem, TResult>(this IEnumerable<TItem>? source, Func<TItem, bool> predicate, Func<TItem, TResult> selector)
461public static ImmutableArray<TResult> SelectAsArray<TSource, TResult>(this IReadOnlyCollection<TSource>? source, Func<TSource, TResult> selector)
485public static ImmutableArray<TResult> SelectManyAsArray<TSource, TResult>(this IEnumerable<TSource>? source, Func<TSource, IEnumerable<TResult>> selector)
507public static ImmutableArray<TResult> SelectManyAsArray<TItem, TResult>(this IReadOnlyCollection<TItem>? source, Func<TItem, IEnumerable<TResult>> selector)
533public static ImmutableArray<TResult> SelectManyAsArray<TSource, TResult>(this IEnumerable<TSource>? source, Func<TSource, OneOrMany<TResult>> selector)
547public static async ValueTask<ImmutableArray<TResult>> SelectAsArrayAsync<TItem, TResult>(this IEnumerable<TItem> source, Func<TItem, ValueTask<TResult>> selector)
764internal static Dictionary<K, ImmutableArray<T>> ToMultiDictionary<K, T>(this IEnumerable<T> data, Func<T, K> keySelector, IEqualityComparer<K>? comparer = null)
815public static readonly Func<T, T> Identity = t => t;
816public static readonly Func<T, bool> True = t => true;
840/// Alias for <see cref="System.Linq.Enumerable.Any{TSource}(IEnumerable{TSource}, Func{TSource, bool})"/>
842public static bool Contains<T>(this IEnumerable<T> sequence, Func<T, bool> predicate)
846/// Variant of <see cref="System.Linq.Enumerable.Count{TSource}(IEnumerable{TSource}, Func{TSource, bool})"/>
861/// Variant of <see cref="System.Linq.Enumerable.FirstOrDefault{TSource}(IEnumerable{TSource}, Func{TSource, bool})"/>
875/// Variant of <see cref="System.Linq.Enumerable.Any{TSource}(IEnumerable{TSource}, Func{TSource, bool})"/>
889/// Variant of <see cref="System.Linq.Enumerable.OrderBy{TSource, TKey}(IEnumerable{TSource}, Func{TSource, TKey}, IComparer{TKey}?)"/>
895/// Variant of <see cref="System.Linq.Enumerable.OrderByDescending{TSource, TKey}(IEnumerable{TSource}, Func{TSource, TKey}, IComparer{TKey}?)"/>
901/// Variant of <see cref="System.Linq.Enumerable.OrderBy{TSource, TKey}(IEnumerable{TSource}, Func{TSource, TKey}, IComparer{TKey}?)"/>
907/// Variant of <see cref="System.Linq.Enumerable.OrderByDescending{TSource, TKey}(IEnumerable{TSource}, Func{TSource, TKey}, IComparer{TKey}?)"/>
913/// Variant of <see cref="System.Linq.Enumerable.ThenBy{TSource, TKey}(IOrderedEnumerable{TSource}, Func{TSource, TKey}, IComparer{TKey}?)"/>
919/// Variant of <see cref="System.Linq.Enumerable.ThenBy{TSource, TKey}(IOrderedEnumerable{TSource}, Func{TSource, TKey}, IComparer{TKey}?)"/>
src\Dependencies\Collections\Extensions\IListExtensions.cs (4)
21public static bool HasDuplicates<TItem, TValue>(this IReadOnlyList<TItem> list, Func<TItem, TValue> selector)
31/// <seealso cref="ImmutableArrayExtensions.HasDuplicates{TItem, TValue}(System.Collections.Immutable.ImmutableArray{TItem}, Func{TItem, TValue}, IEqualityComparer{TValue})"/>
32/// <seealso cref="Roslyn.Utilities.EnumerableExtensions.HasDuplicates{TItem, TValue}(IEnumerable{TItem}, Func{TItem, TValue}, IEqualityComparer{TValue})"/>
34internal static bool HasDuplicates<TItem, TValue>(this IReadOnlyList<TItem> list, Func<TItem, TValue> selector, IEqualityComparer<TValue> comparer)
src\Dependencies\Collections\Extensions\ImmutableArrayExtensions.cs (27)
138public static ImmutableArray<TResult> SelectAsArray<TItem, TResult>(this ImmutableArray<TItem> items, Func<TItem, TResult> map)
198public static ImmutableArray<TResult> SelectAsArray<TItem, TResult>(this ImmutableArray<TItem> array, Func<TItem, bool> predicate, Func<TItem, TResult> selector)
247public static ImmutableArray<TResult> SelectManyAsArray<TItem, TResult>(this ImmutableArray<TItem> array, Func<TItem, IEnumerable<TResult>> selector)
267public static ImmutableArray<TResult> SelectManyAsArray<TItem, TResult>(this ImmutableArray<TItem> array, Func<TItem, ImmutableArray<TResult>> selector)
287public static ImmutableArray<TResult> SelectManyAsArray<TItem, TResult>(this ImmutableArray<TItem> array, Func<TItem, OneOrMany<TResult>> selector)
308public static ImmutableArray<TResult> SelectManyAsArray<TItem, TResult>(this ImmutableArray<TItem> array, Func<TItem, bool> predicate, Func<TItem, IEnumerable<TResult>> selector)
332public static ImmutableArray<TResult> SelectManyAsArray<TItem, TResult>(this ImmutableArray<TItem> array, Func<TItem, bool> predicate, Func<TItem, ImmutableArray<TResult>> selector)
356public static ImmutableArray<TResult> SelectManyAsArray<TItem, TResult>(this ImmutableArray<TItem> array, Func<TItem, bool> predicate, Func<TItem, OneOrMany<TResult>> selector)
493public static ImmutableArray<T> WhereAsArray<T>(this ImmutableArray<T> array, Func<T, bool> predicate)
504private static ImmutableArray<T> WhereAsArrayImpl<T, TArg>(ImmutableArray<T> array, Func<T, bool>? predicateWithoutArg, Func<T, TArg, bool>? predicateWithArg, TArg arg)
573public static async Task<bool> AnyAsync<T>(this ImmutableArray<T> array, Func<T, Task<bool>> predicateAsync)
595public static async ValueTask<T?> FirstOrDefaultAsync<T>(this ImmutableArray<T> array, Func<T, Task<bool>> predicateAsync)
757public static bool HasDuplicates<TItem, TValue>(this ImmutableArray<TItem> array, Func<TItem, TValue> selector)
767/// <seealso cref="Roslyn.Utilities.EnumerableExtensions.HasDuplicates{TItem, TValue}(IEnumerable{TItem}, Func{TItem, TValue}, IEqualityComparer{TValue})"/>
769internal static bool HasDuplicates<TItem, TValue>(this ImmutableArray<TItem> array, Func<TItem, TValue> selector, IEqualityComparer<TValue> comparer)
990/// Variant of <see cref="System.Linq.ImmutableArrayExtensions.FirstOrDefault{T}(ImmutableArray{T}, Func{T, bool})"/>
1004/// Variant of <see cref="System.Linq.ImmutableArrayExtensions.Single{T}(ImmutableArray{T}, Func{T, bool})"/>
1066/// Specialization of <see cref="System.Linq.Enumerable.Count{TSource}(IEnumerable{TSource}, Func{TSource, bool})"/> for <see cref="ImmutableArray{T}"/>.
1068public static int Count<T>(this ImmutableArray<T> items, Func<T, bool> predicate)
1086public static int Sum<T>(this ImmutableArray<T> items, Func<T, int> selector)
1213/// Variant of <see cref="System.Linq.ImmutableArrayExtensions.Any{T}(ImmutableArray{T}, Func{T, bool})"/>.
1227/// Variant of <see cref="System.Linq.ImmutableArrayExtensions.All{T}(ImmutableArray{T}, Func{T, bool})"/>.
1257public static bool Contains<T>(this ImmutableArray<T> array, Func<T, bool> predicate)
src\Dependencies\Collections\RoslynImmutableInterlocked.cs (7)
33public static bool Update<T>(ref ImmutableSegmentedList<T> location, Func<ImmutableSegmentedList<T>, ImmutableSegmentedList<T>> transformer)
154public static bool Update<T>(ref ImmutableSegmentedHashSet<T> location, Func<ImmutableSegmentedHashSet<T>, ImmutableSegmentedHashSet<T>> transformer)
276public static bool Update<TKey, TValue>(ref ImmutableSegmentedDictionary<TKey, TValue> location, Func<ImmutableSegmentedDictionary<TKey, TValue>, ImmutableSegmentedDictionary<TKey, TValue>> transformer)
410/// <inheritdoc cref="ImmutableInterlocked.GetOrAdd{TKey, TValue}(ref ImmutableDictionary{TKey, TValue}, TKey, Func{TKey, TValue})"/>
411public static TValue GetOrAdd<TKey, TValue>(ref ImmutableSegmentedDictionary<TKey, TValue> location, TKey key, Func<TKey, TValue> valueFactory)
458/// <inheritdoc cref="ImmutableInterlocked.AddOrUpdate{TKey, TValue}(ref ImmutableDictionary{TKey, TValue}, TKey, Func{TKey, TValue}, Func{TKey, TValue, TValue})"/>
459public static TValue AddOrUpdate<TKey, TValue>(ref ImmutableSegmentedDictionary<TKey, TValue> location, TKey key, Func<TKey, TValue> addValueFactory, Func<TKey, TValue, TValue> updateValueFactory)
src\Dependencies\Collections\Segmented\ImmutableSegmentedDictionary.cs (6)
68public static ImmutableSegmentedDictionary<TKey, TValue> ToImmutableSegmentedDictionary<TSource, TKey, TValue>(this IEnumerable<TSource> source, Func<TSource, TKey> keySelector, Func<TSource, TValue> elementSelector)
72public static ImmutableSegmentedDictionary<TKey, TValue> ToImmutableSegmentedDictionary<TSource, TKey, TValue>(this IEnumerable<TSource> source, Func<TSource, TKey> keySelector, Func<TSource, TValue> elementSelector, IEqualityComparer<TKey>? keyComparer)
86public static ImmutableSegmentedDictionary<TKey, TSource> ToImmutableSegmentedDictionary<TSource, TKey>(this IEnumerable<TSource> source, Func<TSource, TKey> keySelector)
90public static ImmutableSegmentedDictionary<TKey, TSource> ToImmutableSegmentedDictionary<TSource, TKey>(this IEnumerable<TSource> source, Func<TSource, TKey> keySelector, IEqualityComparer<TKey>? keyComparer)
src\Dependencies\PooledObjects\ArrayBuilder.cs (7)
457public void FreeAll(Func<T, ArrayBuilder<T>?> getNested)
560internal Dictionary<K, ImmutableArray<T>> ToDictionary<K>(Func<T, K> keySelector, IEqualityComparer<K>? comparer = null)
608public void AddRange<U>(ArrayBuilder<U> items, Func<U, T> selector)
745public ImmutableArray<S> SelectDistinct<S>(Func<T, S> selector)
763public bool Any(Func<T, bool> predicate)
787public bool All(Func<T, bool> predicate)
817public ImmutableArray<TResult> SelectAsArray<TResult>(Func<T, TResult> map)
src\Dependencies\PooledObjects\PooledDelegates.cs (9)
200public static Releaser GetPooledFunction<TArg, TResult>(Func<TArg, TResult> unboundFunction, TArg argument, out Func<TResult> boundFunction)
201=> GetPooledDelegate<FuncWithBoundArgument<TArg, TResult>, TArg, Func<TArg, TResult>, Func<TResult>>(unboundFunction, argument, out boundFunction);
204/// Equivalent to <see cref="GetPooledFunction{TArg, TResult}(Func{TArg, TResult}, TArg, out Func{TResult})"/>,
216/// Gets a <see cref="Func{T, TResult}"/> delegate, which calls <paramref name="unboundFunction"/> with the
246public static Releaser GetPooledFunction<T1, TArg, TResult>(Func<T1, TArg, TResult> unboundFunction, TArg argument, out Func<T1, TResult> boundFunction)
247=> GetPooledDelegate<FuncWithBoundArgument<T1, TArg, TResult>, TArg, Func<T1, TArg, TResult>, Func<T1, TResult>>(unboundFunction, argument, out boundFunction);
412: AbstractDelegateWithBoundArgument<FuncWithBoundArgument<TArg, TResult>, TArg, Func<TArg, TResult>, Func<TResult>>
432: AbstractDelegateWithBoundArgument<FuncWithBoundArgument<T1, TArg, TResult>, TArg, Func<T1, TArg, TResult>, Func<T1, TResult>>
434protected override Func<T1, TResult> Bind()
src\Dependencies\Threading\ParallelExtensions.NetFramework.cs (7)
122Func<object, Task> taskBody = static async o =>
287Func<object, Task> taskBody = static async o =>
395private readonly Func<object, Task> _taskBody;
418protected ForEachAsyncState(Func<object, Task> taskBody, bool needsLock, int dop, TaskScheduler scheduler, CancellationToken cancellationToken, Func<TSource, CancellationToken, ValueTask> body)
584IEnumerable<TSource> source, Func<object, Task> taskBody,
610IAsyncEnumerable<TSource> source, Func<object, Task> taskBody,
637T fromExclusive, T toExclusive, Func<object, Task> taskBody,
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\ObjectExtensions.TypeSwitch.cs (161)
11public static TResult? TypeSwitch<TBaseType, TDerivedType1, TDerivedType2, TDerivedType3, TResult>(this TBaseType obj, Func<TDerivedType1, TResult> matchFunc1, Func<TDerivedType2, TResult> matchFunc2, Func<TDerivedType3, TResult> matchFunc3, Func<TBaseType, TResult>? defaultFunc = null)
25public static TResult? TypeSwitch<TBaseType, TDerivedType1, TDerivedType2, TDerivedType3, TDerivedType4, TResult>(this TBaseType obj, Func<TDerivedType1, TResult> matchFunc1, Func<TDerivedType2, TResult> matchFunc2, Func<TDerivedType3, TResult> matchFunc3, Func<TDerivedType4, TResult> matchFunc4, Func<TBaseType, TResult>? defaultFunc = null)
41public static TResult? TypeSwitch<TBaseType, TDerivedType1, TDerivedType2, TDerivedType3, TDerivedType4, TDerivedType5, TResult>(this TBaseType obj, Func<TDerivedType1, TResult> matchFunc1, Func<TDerivedType2, TResult> matchFunc2, Func<TDerivedType3, TResult> matchFunc3, Func<TDerivedType4, TResult> matchFunc4, Func<TDerivedType5, TResult> matchFunc5, Func<TBaseType, TResult>? defaultFunc = null)
59public static TResult? TypeSwitch<TBaseType, TDerivedType1, TDerivedType2, TDerivedType3, TDerivedType4, TDerivedType5, TDerivedType6, TResult>(this TBaseType obj, Func<TDerivedType1, TResult> matchFunc1, Func<TDerivedType2, TResult> matchFunc2, Func<TDerivedType3, TResult> matchFunc3, Func<TDerivedType4, TResult> matchFunc4, Func<TDerivedType5, TResult> matchFunc5, Func<TDerivedType6, TResult> matchFunc6, Func<TBaseType, TResult>? defaultFunc = null)
79public static TResult? TypeSwitch<TBaseType, TDerivedType1, TDerivedType2, TDerivedType3, TDerivedType4, TDerivedType5, TDerivedType6, TDerivedType7, TDerivedType8, TDerivedType9, TDerivedType10, TDerivedType11, TDerivedType12, TDerivedType13, TDerivedType14, TDerivedType15, TDerivedType16, TResult>(this TBaseType obj, Func<TDerivedType1, TResult> matchFunc1, Func<TDerivedType2, TResult> matchFunc2, Func<TDerivedType3, TResult> matchFunc3, Func<TDerivedType4, TResult> matchFunc4, Func<TDerivedType5, TResult> matchFunc5, Func<TDerivedType6, TResult> matchFunc6, Func<TDerivedType7, TResult> matchFunc7, Func<TDerivedType8, TResult> matchFunc8, Func<TDerivedType9, TResult> matchFunc9, Func<TDerivedType10, TResult> matchFunc10, Func<TDerivedType11, TResult> matchFunc11, Func<TDerivedType12, TResult> matchFunc12, Func<TDerivedType13, TResult> matchFunc13, Func<TDerivedType14, TResult> matchFunc14, Func<TDerivedType15, TResult> matchFunc15, Func<TDerivedType16, TResult> matchFunc16, Func<TBaseType, TResult>? defaultFunc = null)
119public static TResult? TypeSwitch<TBaseType, TDerivedType1, TDerivedType2, TDerivedType3, TDerivedType4, TDerivedType5, TDerivedType6, TDerivedType7, TDerivedType8, TDerivedType9, TDerivedType10, TDerivedType11, TDerivedType12, TDerivedType13, TDerivedType14, TDerivedType15, TDerivedType16, TDerivedType17, TResult>(this TBaseType obj, Func<TDerivedType1, TResult> matchFunc1, Func<TDerivedType2, TResult> matchFunc2, Func<TDerivedType3, TResult> matchFunc3, Func<TDerivedType4, TResult> matchFunc4, Func<TDerivedType5, TResult> matchFunc5, Func<TDerivedType6, TResult> matchFunc6, Func<TDerivedType7, TResult> matchFunc7, Func<TDerivedType8, TResult> matchFunc8, Func<TDerivedType9, TResult> matchFunc9, Func<TDerivedType10, TResult> matchFunc10, Func<TDerivedType11, TResult> matchFunc11, Func<TDerivedType12, TResult> matchFunc12, Func<TDerivedType13, TResult> matchFunc13, Func<TDerivedType14, TResult> matchFunc14, Func<TDerivedType15, TResult> matchFunc15, Func<TDerivedType16, TResult> matchFunc16, Func<TDerivedType17, TResult> matchFunc17, Func<TBaseType, TResult>? defaultFunc = null)
161public static TResult? TypeSwitch<TBaseType, TDerivedType1, TDerivedType2, TDerivedType3, TDerivedType4, TDerivedType5, TDerivedType6, TDerivedType7, TDerivedType8, TDerivedType9, TDerivedType10, TDerivedType11, TDerivedType12, TDerivedType13, TDerivedType14, TDerivedType15, TDerivedType16, TDerivedType17, TDerivedType18, TDerivedType19, TDerivedType20, TDerivedType21, TDerivedType22, TResult>(this TBaseType obj, Func<TDerivedType1, TResult> matchFunc1, Func<TDerivedType2, TResult> matchFunc2, Func<TDerivedType3, TResult> matchFunc3, Func<TDerivedType4, TResult> matchFunc4, Func<TDerivedType5, TResult> matchFunc5, Func<TDerivedType6, TResult> matchFunc6, Func<TDerivedType7, TResult> matchFunc7, Func<TDerivedType8, TResult> matchFunc8, Func<TDerivedType9, TResult> matchFunc9, Func<TDerivedType10, TResult> matchFunc10, Func<TDerivedType11, TResult> matchFunc11, Func<TDerivedType12, TResult> matchFunc12, Func<TDerivedType13, TResult> matchFunc13, Func<TDerivedType14, TResult> matchFunc14, Func<TDerivedType15, TResult> matchFunc15, Func<TDerivedType16, TResult> matchFunc16, Func<TDerivedType17, TResult> matchFunc17, Func<TDerivedType18, TResult> matchFunc18, Func<TDerivedType19, TResult> matchFunc19, Func<TDerivedType20, TResult> matchFunc20, Func<TDerivedType21, TResult> matchFunc21, Func<TDerivedType22, TResult> matchFunc22, Func<TBaseType, TResult>? defaultFunc = null)
213public static TResult? TypeSwitch<TBaseType, TDerivedType1, TDerivedType2, TDerivedType3, TDerivedType4, TDerivedType5, TDerivedType6, TDerivedType7, TDerivedType8, TDerivedType9, TDerivedType10, TDerivedType11, TDerivedType12, TDerivedType13, TDerivedType14, TDerivedType15, TDerivedType16, TDerivedType17, TDerivedType18, TDerivedType19, TDerivedType20, TDerivedType21, TDerivedType22, TDerivedType23, TDerivedType24, TDerivedType25, TDerivedType26, TDerivedType27, TDerivedType28, TDerivedType29, TDerivedType30, TDerivedType31, TDerivedType32, TDerivedType33, TDerivedType34, TDerivedType35, TDerivedType36, TDerivedType37, TDerivedType38, TDerivedType39, TResult>(this TBaseType obj, Func<TDerivedType1, TResult> matchFunc1, Func<TDerivedType2, TResult> matchFunc2, Func<TDerivedType3, TResult> matchFunc3, Func<TDerivedType4, TResult> matchFunc4, Func<TDerivedType5, TResult> matchFunc5, Func<TDerivedType6, TResult> matchFunc6, Func<TDerivedType7, TResult> matchFunc7, Func<TDerivedType8, TResult> matchFunc8, Func<TDerivedType9, TResult> matchFunc9, Func<TDerivedType10, TResult> matchFunc10, Func<TDerivedType11, TResult> matchFunc11, Func<TDerivedType12, TResult> matchFunc12, Func<TDerivedType13, TResult> matchFunc13, Func<TDerivedType14, TResult> matchFunc14, Func<TDerivedType15, TResult> matchFunc15, Func<TDerivedType16, TResult> matchFunc16, Func<TDerivedType17, TResult> matchFunc17, Func<TDerivedType18, TResult> matchFunc18, Func<TDerivedType19, TResult> matchFunc19, Func<TDerivedType20, TResult> matchFunc20, Func<TDerivedType21, TResult> matchFunc21, Func<TDerivedType22, TResult> matchFunc22, Func<TDerivedType23, TResult> matchFunc23, Func<TDerivedType24, TResult> matchFunc24, Func<TDerivedType25, TResult> matchFunc25, Func<TDerivedType26, TResult> matchFunc26, Func<TDerivedType27, TResult> matchFunc27, Func<TDerivedType28, TResult> matchFunc28, Func<TDerivedType29, TResult> matchFunc29, Func<TDerivedType30, TResult> matchFunc30, Func<TDerivedType31, TResult> matchFunc31, Func<TDerivedType32, TResult> matchFunc32, Func<TDerivedType33, TResult> matchFunc33, Func<TDerivedType34, TResult> matchFunc34, Func<TDerivedType35, TResult> matchFunc35, Func<TDerivedType36, TResult> matchFunc36, Func<TDerivedType37, TResult> matchFunc37, Func<TDerivedType38, TResult> matchFunc38, Func<TDerivedType39, TResult> matchFunc39, Func<TBaseType, TResult>? defaultFunc = null)
299public static TResult? TypeSwitch<TBaseType, TDerivedType1, TDerivedType2, TDerivedType3, TDerivedType4, TDerivedType5, TDerivedType6, TDerivedType7, TDerivedType8, TDerivedType9, TDerivedType10, TDerivedType11, TDerivedType12, TDerivedType13, TDerivedType14, TDerivedType15, TDerivedType16, TDerivedType17, TDerivedType18, TDerivedType19, TDerivedType20, TDerivedType21, TDerivedType22, TDerivedType23, TDerivedType24, TDerivedType25, TDerivedType26, TDerivedType27, TDerivedType28, TDerivedType29, TDerivedType30, TDerivedType31, TDerivedType32, TDerivedType33, TDerivedType34, TDerivedType35, TDerivedType36, TDerivedType37, TDerivedType38, TDerivedType39, TDerivedType40, TResult>(this TBaseType obj, Func<TDerivedType1, TResult> matchFunc1, Func<TDerivedType2, TResult> matchFunc2, Func<TDerivedType3, TResult> matchFunc3, Func<TDerivedType4, TResult> matchFunc4, Func<TDerivedType5, TResult> matchFunc5, Func<TDerivedType6, TResult> matchFunc6, Func<TDerivedType7, TResult> matchFunc7, Func<TDerivedType8, TResult> matchFunc8, Func<TDerivedType9, TResult> matchFunc9, Func<TDerivedType10, TResult> matchFunc10, Func<TDerivedType11, TResult> matchFunc11, Func<TDerivedType12, TResult> matchFunc12, Func<TDerivedType13, TResult> matchFunc13, Func<TDerivedType14, TResult> matchFunc14, Func<TDerivedType15, TResult> matchFunc15, Func<TDerivedType16, TResult> matchFunc16, Func<TDerivedType17, TResult> matchFunc17, Func<TDerivedType18, TResult> matchFunc18, Func<TDerivedType19, TResult> matchFunc19, Func<TDerivedType20, TResult> matchFunc20, Func<TDerivedType21, TResult> matchFunc21, Func<TDerivedType22, TResult> matchFunc22, Func<TDerivedType23, TResult> matchFunc23, Func<TDerivedType24, TResult> matchFunc24, Func<TDerivedType25, TResult> matchFunc25, Func<TDerivedType26, TResult> matchFunc26, Func<TDerivedType27, TResult> matchFunc27, Func<TDerivedType28, TResult> matchFunc28, Func<TDerivedType29, TResult> matchFunc29, Func<TDerivedType30, TResult> matchFunc30, Func<TDerivedType31, TResult> matchFunc31, Func<TDerivedType32, TResult> matchFunc32, Func<TDerivedType33, TResult> matchFunc33, Func<TDerivedType34, TResult> matchFunc34, Func<TDerivedType35, TResult> matchFunc35, Func<TDerivedType36, TResult> matchFunc36, Func<TDerivedType37, TResult> matchFunc37, Func<TDerivedType38, TResult> matchFunc38, Func<TDerivedType39, TResult> matchFunc39, Func<TDerivedType40, TResult> matchFunc40, Func<TBaseType, TResult>? defaultFunc = null)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\SyntaxNodeExtensions.cs (6)
104this SyntaxNode node, TextSpan searchSpan, Func<SyntaxNode, bool> predicate)
129public static bool CheckParent<T>([NotNullWhen(returnValue: true)] this SyntaxNode? node, Func<T, bool> valueChecker) where T : SyntaxNode
145public static bool IsChildNode<TParent>(this SyntaxNode node, Func<TParent, SyntaxNode?> childGetter)
162public static bool IsFoundUnder<TParent>(this SyntaxNode node, Func<TParent, SyntaxNode?> childGetter)
201public static SyntaxNode? FindInnermostCommonNode(this IEnumerable<SyntaxNode> nodes, Func<SyntaxNode, bool> predicate)
806public static TNode? FirstAncestorOrSelfUntil<TNode>(this SyntaxNode? node, Func<SyntaxNode, bool> predicate)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\SyntaxTokenExtensions.cs (5)
15public static SyntaxNode? GetAncestor(this SyntaxToken token, Func<SyntaxNode, bool>? predicate)
18public static T? GetAncestor<T>(this SyntaxToken token, Func<T, bool>? predicate = null) where T : SyntaxNode
21public static T GetRequiredAncestor<T>(this SyntaxToken token, Func<T, bool>? predicate = null) where T : SyntaxNode
32public static IEnumerable<SyntaxNode> GetAncestors(this SyntaxToken token, Func<SyntaxNode, bool> predicate)
42public static bool CheckParent<T>(this SyntaxToken token, Func<T, bool> valueChecker) where T : SyntaxNode
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Options\PublicOptionFactory.cs (4)
17public static Option2<T> WithPublicOption<T, TPublicValue>(this Option2<T> option, string feature, string name, Func<T, TPublicValue> toPublicValue, Func<TPublicValue, T> toInternalValue)
20public static PerLanguageOption2<T> WithPublicOption<T, TPublicValue>(this PerLanguageOption2<T> option, string feature, string name, Func<T, TPublicValue> toPublicValue, Func<TPublicValue, T> toInternalValue)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\TopologicalSorter.cs (8)
13public static IEnumerable<T> TopologicalSort<T>(this IEnumerable<T> items, Func<T, IEnumerable<T>> itemsBefore)
26public static IEnumerable<T> TopologicalSort<T>(this IEnumerable<T> items, Func<T, IEnumerable<T>> itemsBefore, Func<T, IEnumerable<T>> itemsAfter)
29var combinedItemsBefore = CreateCombinedItemsBefore(items, itemsBefore, itemsAfter);
35Func<T, IEnumerable<T>> itemsBefore,
50private static Func<T, IEnumerable<T>> CreateCombinedItemsBefore<T>(IEnumerable<T> items, Func<T, IEnumerable<T>> itemsBefore, Func<T, IEnumerable<T>> itemsAfter)
Microsoft.CodeAnalysis.CodeStyle.Fixes (46)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Extensions\SyntaxEditorExtensions.cs (4)
29Func<TType, (TNode semanticNode, IEnumerable<TNode> additionalNodes)> selector,
52Func<TType, TNode> selector,
96Func<TType, (TNode semanticNode, IEnumerable<TNode> additionalNodes)> selector,
153Func<TType, (TNode semanticNode, IEnumerable<TNode> additionalNodes)> selector,
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Simplification\AbstractSimplificationService.cs (6)
35protected static readonly Func<SyntaxNode, bool> s_containsAnnotations = n => n.ContainsAnnotations;
36protected static readonly Func<SyntaxNodeOrToken, bool> s_hasSimplifierAnnotation = n => n.HasAnnotation(Simplifier.Annotation);
40protected abstract ImmutableArray<NodeOrTokenToReduce> GetNodesAndTokensToReduce(SyntaxNode root, Func<SyntaxNodeOrToken, bool> isNodeOrTokenOutsideSimplifySpans);
51public abstract SyntaxNode Expand(SyntaxNode node, SemanticModel semanticModel, SyntaxAnnotation? annotationForReplacedAliasIdentifier, Func<SyntaxNode, bool>? expandInsideNode, bool expandParameter, CancellationToken cancellationToken);
52public abstract SyntaxToken Expand(SyntaxToken token, SemanticModel semanticModel, Func<SyntaxNode, bool>? expandInsideNode, CancellationToken cancellationToken);
275Func<SyntaxNodeOrToken, bool> isNodeOrTokenOutsideSimplifySpan)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Utilities\NameGenerator.cs (6)
43Func<string, bool>? canUse = null,
63Func<string, bool>? canUse = null,
86Func<string, bool>? canUse = null,
134public static string GenerateUniqueName(string baseName, Func<string, bool> canUse)
140public static string GenerateUniqueName(string baseName, string extension, Func<string, bool> canUse)
160public static string GenerateUniqueName(IEnumerable<string> baseNames, Func<string, bool> canUse)
Microsoft.CodeAnalysis.CodeStyle.UnitTestUtilities (2)
Microsoft.CodeAnalysis.Collections.Package (105)
Extensions\IEnumerableExtensions.cs (30)
164public static T? FirstOrNull<T>(this IEnumerable<T> source, Func<T, bool> predicate)
182public static T? SingleOrNull<T>(this IEnumerable<T> source, Func<T, bool> predicate)
261public static bool HasDuplicates<TItem, TValue>(this IEnumerable<TItem> source, Func<TItem, TValue> selector)
271/// <seealso cref="Microsoft.CodeAnalysis.ImmutableArrayExtensions.HasDuplicates{TItem, TValue}(ImmutableArray{TItem}, Func{TItem, TValue}, IEqualityComparer{TValue})"/>
273public static bool HasDuplicates<TItem, TValue>(this IEnumerable<TItem> source, Func<TItem, TValue> selector, IEqualityComparer<TValue> comparer)
321private static readonly Func<object, bool> s_notNullTest = x => x != null;
331return source.Where((Func<T?, bool>)s_notNullTest)!;
376public static ImmutableArray<T> WhereAsArray<T>(this IEnumerable<T> values, Func<T, bool> predicate)
407public static ImmutableArray<TResult> SelectAsArray<TSource, TResult>(this IEnumerable<TSource>? source, Func<TSource, TResult> selector)
417public static ImmutableArray<TResult> SelectAsArray<TItem, TResult>(this IEnumerable<TItem>? source, Func<TItem, bool> predicate, Func<TItem, TResult> selector)
461public static ImmutableArray<TResult> SelectAsArray<TSource, TResult>(this IReadOnlyCollection<TSource>? source, Func<TSource, TResult> selector)
485public static ImmutableArray<TResult> SelectManyAsArray<TSource, TResult>(this IEnumerable<TSource>? source, Func<TSource, IEnumerable<TResult>> selector)
507public static ImmutableArray<TResult> SelectManyAsArray<TItem, TResult>(this IReadOnlyCollection<TItem>? source, Func<TItem, IEnumerable<TResult>> selector)
533public static ImmutableArray<TResult> SelectManyAsArray<TSource, TResult>(this IEnumerable<TSource>? source, Func<TSource, OneOrMany<TResult>> selector)
547public static async ValueTask<ImmutableArray<TResult>> SelectAsArrayAsync<TItem, TResult>(this IEnumerable<TItem> source, Func<TItem, ValueTask<TResult>> selector)
764internal static Dictionary<K, ImmutableArray<T>> ToMultiDictionary<K, T>(this IEnumerable<T> data, Func<T, K> keySelector, IEqualityComparer<K>? comparer = null)
815public static readonly Func<T, T> Identity = t => t;
816public static readonly Func<T, bool> True = t => true;
840/// Alias for <see cref="System.Linq.Enumerable.Any{TSource}(IEnumerable{TSource}, Func{TSource, bool})"/>
842public static bool Contains<T>(this IEnumerable<T> sequence, Func<T, bool> predicate)
846/// Variant of <see cref="System.Linq.Enumerable.Count{TSource}(IEnumerable{TSource}, Func{TSource, bool})"/>
861/// Variant of <see cref="System.Linq.Enumerable.FirstOrDefault{TSource}(IEnumerable{TSource}, Func{TSource, bool})"/>
875/// Variant of <see cref="System.Linq.Enumerable.Any{TSource}(IEnumerable{TSource}, Func{TSource, bool})"/>
889/// Variant of <see cref="System.Linq.Enumerable.OrderBy{TSource, TKey}(IEnumerable{TSource}, Func{TSource, TKey}, IComparer{TKey}?)"/>
895/// Variant of <see cref="System.Linq.Enumerable.OrderByDescending{TSource, TKey}(IEnumerable{TSource}, Func{TSource, TKey}, IComparer{TKey}?)"/>
901/// Variant of <see cref="System.Linq.Enumerable.OrderBy{TSource, TKey}(IEnumerable{TSource}, Func{TSource, TKey}, IComparer{TKey}?)"/>
907/// Variant of <see cref="System.Linq.Enumerable.OrderByDescending{TSource, TKey}(IEnumerable{TSource}, Func{TSource, TKey}, IComparer{TKey}?)"/>
913/// Variant of <see cref="System.Linq.Enumerable.ThenBy{TSource, TKey}(IOrderedEnumerable{TSource}, Func{TSource, TKey}, IComparer{TKey}?)"/>
919/// Variant of <see cref="System.Linq.Enumerable.ThenBy{TSource, TKey}(IOrderedEnumerable{TSource}, Func{TSource, TKey}, IComparer{TKey}?)"/>
Extensions\IListExtensions.cs (4)
21public static bool HasDuplicates<TItem, TValue>(this IReadOnlyList<TItem> list, Func<TItem, TValue> selector)
31/// <seealso cref="ImmutableArrayExtensions.HasDuplicates{TItem, TValue}(System.Collections.Immutable.ImmutableArray{TItem}, Func{TItem, TValue}, IEqualityComparer{TValue})"/>
32/// <seealso cref="Roslyn.Utilities.EnumerableExtensions.HasDuplicates{TItem, TValue}(IEnumerable{TItem}, Func{TItem, TValue}, IEqualityComparer{TValue})"/>
34internal static bool HasDuplicates<TItem, TValue>(this IReadOnlyList<TItem> list, Func<TItem, TValue> selector, IEqualityComparer<TValue> comparer)
Extensions\ImmutableArrayExtensions.cs (27)
138public static ImmutableArray<TResult> SelectAsArray<TItem, TResult>(this ImmutableArray<TItem> items, Func<TItem, TResult> map)
198public static ImmutableArray<TResult> SelectAsArray<TItem, TResult>(this ImmutableArray<TItem> array, Func<TItem, bool> predicate, Func<TItem, TResult> selector)
247public static ImmutableArray<TResult> SelectManyAsArray<TItem, TResult>(this ImmutableArray<TItem> array, Func<TItem, IEnumerable<TResult>> selector)
267public static ImmutableArray<TResult> SelectManyAsArray<TItem, TResult>(this ImmutableArray<TItem> array, Func<TItem, ImmutableArray<TResult>> selector)
287public static ImmutableArray<TResult> SelectManyAsArray<TItem, TResult>(this ImmutableArray<TItem> array, Func<TItem, OneOrMany<TResult>> selector)
308public static ImmutableArray<TResult> SelectManyAsArray<TItem, TResult>(this ImmutableArray<TItem> array, Func<TItem, bool> predicate, Func<TItem, IEnumerable<TResult>> selector)
332public static ImmutableArray<TResult> SelectManyAsArray<TItem, TResult>(this ImmutableArray<TItem> array, Func<TItem, bool> predicate, Func<TItem, ImmutableArray<TResult>> selector)
356public static ImmutableArray<TResult> SelectManyAsArray<TItem, TResult>(this ImmutableArray<TItem> array, Func<TItem, bool> predicate, Func<TItem, OneOrMany<TResult>> selector)
493public static ImmutableArray<T> WhereAsArray<T>(this ImmutableArray<T> array, Func<T, bool> predicate)
504private static ImmutableArray<T> WhereAsArrayImpl<T, TArg>(ImmutableArray<T> array, Func<T, bool>? predicateWithoutArg, Func<T, TArg, bool>? predicateWithArg, TArg arg)
573public static async Task<bool> AnyAsync<T>(this ImmutableArray<T> array, Func<T, Task<bool>> predicateAsync)
595public static async ValueTask<T?> FirstOrDefaultAsync<T>(this ImmutableArray<T> array, Func<T, Task<bool>> predicateAsync)
757public static bool HasDuplicates<TItem, TValue>(this ImmutableArray<TItem> array, Func<TItem, TValue> selector)
767/// <seealso cref="Roslyn.Utilities.EnumerableExtensions.HasDuplicates{TItem, TValue}(IEnumerable{TItem}, Func{TItem, TValue}, IEqualityComparer{TValue})"/>
769internal static bool HasDuplicates<TItem, TValue>(this ImmutableArray<TItem> array, Func<TItem, TValue> selector, IEqualityComparer<TValue> comparer)
990/// Variant of <see cref="System.Linq.ImmutableArrayExtensions.FirstOrDefault{T}(ImmutableArray{T}, Func{T, bool})"/>
1004/// Variant of <see cref="System.Linq.ImmutableArrayExtensions.Single{T}(ImmutableArray{T}, Func{T, bool})"/>
1066/// Specialization of <see cref="System.Linq.Enumerable.Count{TSource}(IEnumerable{TSource}, Func{TSource, bool})"/> for <see cref="ImmutableArray{T}"/>.
1068public static int Count<T>(this ImmutableArray<T> items, Func<T, bool> predicate)
1086public static int Sum<T>(this ImmutableArray<T> items, Func<T, int> selector)
1213/// Variant of <see cref="System.Linq.ImmutableArrayExtensions.Any{T}(ImmutableArray{T}, Func{T, bool})"/>.
1227/// Variant of <see cref="System.Linq.ImmutableArrayExtensions.All{T}(ImmutableArray{T}, Func{T, bool})"/>.
1257public static bool Contains<T>(this ImmutableArray<T> array, Func<T, bool> predicate)
RoslynImmutableInterlocked.cs (7)
33public static bool Update<T>(ref ImmutableSegmentedList<T> location, Func<ImmutableSegmentedList<T>, ImmutableSegmentedList<T>> transformer)
154public static bool Update<T>(ref ImmutableSegmentedHashSet<T> location, Func<ImmutableSegmentedHashSet<T>, ImmutableSegmentedHashSet<T>> transformer)
276public static bool Update<TKey, TValue>(ref ImmutableSegmentedDictionary<TKey, TValue> location, Func<ImmutableSegmentedDictionary<TKey, TValue>, ImmutableSegmentedDictionary<TKey, TValue>> transformer)
410/// <inheritdoc cref="ImmutableInterlocked.GetOrAdd{TKey, TValue}(ref ImmutableDictionary{TKey, TValue}, TKey, Func{TKey, TValue})"/>
411public static TValue GetOrAdd<TKey, TValue>(ref ImmutableSegmentedDictionary<TKey, TValue> location, TKey key, Func<TKey, TValue> valueFactory)
458/// <inheritdoc cref="ImmutableInterlocked.AddOrUpdate{TKey, TValue}(ref ImmutableDictionary{TKey, TValue}, TKey, Func{TKey, TValue}, Func{TKey, TValue, TValue})"/>
459public static TValue AddOrUpdate<TKey, TValue>(ref ImmutableSegmentedDictionary<TKey, TValue> location, TKey key, Func<TKey, TValue> addValueFactory, Func<TKey, TValue, TValue> updateValueFactory)
Segmented\ImmutableSegmentedDictionary.cs (6)
68public static ImmutableSegmentedDictionary<TKey, TValue> ToImmutableSegmentedDictionary<TSource, TKey, TValue>(this IEnumerable<TSource> source, Func<TSource, TKey> keySelector, Func<TSource, TValue> elementSelector)
72public static ImmutableSegmentedDictionary<TKey, TValue> ToImmutableSegmentedDictionary<TSource, TKey, TValue>(this IEnumerable<TSource> source, Func<TSource, TKey> keySelector, Func<TSource, TValue> elementSelector, IEqualityComparer<TKey>? keyComparer)
86public static ImmutableSegmentedDictionary<TKey, TSource> ToImmutableSegmentedDictionary<TSource, TKey>(this IEnumerable<TSource> source, Func<TSource, TKey> keySelector)
90public static ImmutableSegmentedDictionary<TKey, TSource> ToImmutableSegmentedDictionary<TSource, TKey>(this IEnumerable<TSource> source, Func<TSource, TKey> keySelector, IEqualityComparer<TKey>? keyComparer)
src\Dependencies\PooledObjects\ArrayBuilder.cs (7)
457public void FreeAll(Func<T, ArrayBuilder<T>?> getNested)
560internal Dictionary<K, ImmutableArray<T>> ToDictionary<K>(Func<T, K> keySelector, IEqualityComparer<K>? comparer = null)
608public void AddRange<U>(ArrayBuilder<U> items, Func<U, T> selector)
745public ImmutableArray<S> SelectDistinct<S>(Func<T, S> selector)
763public bool Any(Func<T, bool> predicate)
787public bool All(Func<T, bool> predicate)
817public ImmutableArray<TResult> SelectAsArray<TResult>(Func<T, TResult> map)
src\Dependencies\PooledObjects\PooledDelegates.cs (9)
200public static Releaser GetPooledFunction<TArg, TResult>(Func<TArg, TResult> unboundFunction, TArg argument, out Func<TResult> boundFunction)
201=> GetPooledDelegate<FuncWithBoundArgument<TArg, TResult>, TArg, Func<TArg, TResult>, Func<TResult>>(unboundFunction, argument, out boundFunction);
204/// Equivalent to <see cref="GetPooledFunction{TArg, TResult}(Func{TArg, TResult}, TArg, out Func{TResult})"/>,
216/// Gets a <see cref="Func{T, TResult}"/> delegate, which calls <paramref name="unboundFunction"/> with the
246public static Releaser GetPooledFunction<T1, TArg, TResult>(Func<T1, TArg, TResult> unboundFunction, TArg argument, out Func<T1, TResult> boundFunction)
247=> GetPooledDelegate<FuncWithBoundArgument<T1, TArg, TResult>, TArg, Func<T1, TArg, TResult>, Func<T1, TResult>>(unboundFunction, argument, out boundFunction);
412: AbstractDelegateWithBoundArgument<FuncWithBoundArgument<TArg, TResult>, TArg, Func<TArg, TResult>, Func<TResult>>
432: AbstractDelegateWithBoundArgument<FuncWithBoundArgument<T1, TArg, TResult>, TArg, Func<T1, TArg, TResult>, Func<T1, TResult>>
434protected override Func<T1, TResult> Bind()
Microsoft.CodeAnalysis.Contracts.Package (1)
Microsoft.CodeAnalysis.CSharp (134)
Binder\Semantics\Conversions\UserDefinedImplicitConversions.cs (9)
436private static int? MostSpecificConversionOperator(Func<UserDefinedConversionAnalysis, bool> constraint, ImmutableArray<UserDefinedConversionAnalysis> u)
547private static BestIndex UniqueIndex<T>(ImmutableArray<T> items, Func<T, bool> predicate)
691Func<T, TypeSymbol> extract,
699Func<T, bool> valid,
700Func<T, TypeSymbol> extract,
753Func<T, TypeSymbol> extract,
761Func<T, bool> valid,
762Func<T, TypeSymbol> extract,
804private static int? UniqueBestValidIndex<T>(ImmutableArray<T> items, Func<T, bool> valid, Func<T, T, BetterResult> better)
Compilation\CSharpCompilation.cs (10)
3081private static void AppendLoadDirectiveDiagnostics(DiagnosticBag builder, SyntaxAndDeclarationManager syntaxAndDeclarations, SyntaxTree syntaxTree, Func<IEnumerable<Diagnostic>, IEnumerable<Diagnostic>>? locationFilterOpt = null)
3843Func<ISymbol, bool> isAddedSymbol,
4671public override bool ContainsSymbolsWithName(Func<string, bool> predicate, SymbolFilter filter = SymbolFilter.TypeAndMember, CancellationToken cancellationToken = default)
4689public override IEnumerable<ISymbol> GetSymbolsWithName(Func<string, bool> predicate, SymbolFilter filter = SymbolFilter.TypeAndMember, CancellationToken cancellationToken = default)
4707/// This will be faster than <see cref="ContainsSymbolsWithName(Func{string, bool}, SymbolFilter, CancellationToken)"/>
4727/// faster than <see cref="GetSymbolsWithName(Func{string, bool}, SymbolFilter,
4846Func<SyntaxNode, SyntaxKind> getKind = node => node.Kind();
4847Func<SyntaxTrivia, bool> isComment = trivia => trivia.Kind() == SyntaxKind.SingleLineCommentTrivia || trivia.Kind() == SyntaxKind.MultiLineCommentTrivia;
5116private readonly Func<string, bool> _predicate;
5119CSharpCompilation compilation, SymbolFilter filter, Func<string, bool> predicate, CancellationToken cancellationToken)
FlowAnalysis\NullableWalker.cs (11)
267private PooledDictionary<BoundExpression, Func<TypeWithAnnotations, TypeWithState>>? _targetTypedAnalysisCompletionOpt;
274private PooledDictionary<BoundExpression, Func<TypeWithAnnotations, TypeWithState>> TargetTypedAnalysisCompletion
275=> _targetTypedAnalysisCompletionOpt ??= PooledDictionary<BoundExpression, Func<TypeWithAnnotations, TypeWithState>>.GetInstance();
3987var completion = VisitOptionalImplicitConversion(elementExpr, targetElementType,
4527Action<int, Symbol>? visitMemberAssignment(BoundAssignmentOperator node, int containingSlot, Symbol symbol, bool delayCompletionForType, Func<TypeWithAnnotations, TypeWithState>? conversionCompletion = null)
4560Action<int, Symbol>? visitMemberAssignmentAsContinuation(BoundAssignmentOperator node, Func<TypeWithAnnotations, TypeWithState> conversionCompletion)
7615if (IsTargetTypedExpression(argumentNoConversion) && _targetTypedAnalysisCompletionOpt?.TryGetValue(argumentNoConversion, out var completion) is true)
8960private (TypeWithState resultType, Func<TypeWithAnnotations, TypeWithState>? completion) VisitOptionalImplicitConversion(
8974(TypeWithState resultType, Func<TypeWithAnnotations, TypeWithState>? completion) visitConversion(
9011Func<TypeWithAnnotations, TypeWithState> visitConversionAsContinuation(BoundExpression expr, bool useLegacyWarnings, bool trackMembers, AssignmentKind assignmentKind, BoundExpression operand, Conversion conversion, TypeWithState operandType)
9440if (TargetTypedAnalysisCompletion.TryGetValue(conversionOperand, out Func<TypeWithAnnotations, TypeWithState>? completion))
Parser\LanguageParser.cs (17)
207internal TNode ParseWithStackGuard<TNode>(Func<LanguageParser, TNode> parseFunc, Func<LanguageParser, TNode> createEmptyNodeFunc) where TNode : CSharpSyntaxNode
4328Func<LanguageParser, bool> isNotExpectedFunction,
4349Func<LanguageParser, bool> isNotExpectedFunction,
4350Func<LanguageParser, bool> abortFunction,
4370Func<LanguageParser, bool> isNotExpectedFunction,
4395Func<LanguageParser, bool> isNotExpectedFunction,
4396Func<LanguageParser, bool> abortFunction,
4418Func<LanguageParser, bool> isNotExpectedFunction,
4445Func<LanguageParser, bool> isNotExpectedFunction,
4446Func<LanguageParser, bool> abortFunction,
4678Func<LanguageParser, ParameterSyntax> parseElement = forExtension
14088Func<LanguageParser, bool> isPossibleElement,
14089Func<LanguageParser, TNode> parseElement,
14110Func<LanguageParser, bool> isPossibleElement,
14111Func<LanguageParser, TNode> parseElement,
14112Func<TNode, bool>? immediatelyAbort,
Syntax\SyntaxEquivalence.cs (5)
19internal static bool AreEquivalent(SyntaxTree? before, SyntaxTree? after, Func<SyntaxKind, bool>? ignoreChildNode, bool topLevel)
34public static bool AreEquivalent(SyntaxNode? before, SyntaxNode? after, Func<SyntaxKind, bool>? ignoreChildNode, bool topLevel)
56private static bool AreTokensEquivalent(GreenNode? before, GreenNode? after, Func<SyntaxKind, bool>? ignoreChildNode)
105private static bool AreEquivalentRecursive(GreenNode? before, GreenNode? after, Func<SyntaxKind, bool>? ignoreChildNode, bool topLevel)
254private static bool AreNullableDirectivesEquivalent(GreenNode before, GreenNode after, Func<SyntaxKind, bool>? ignoreChildNode)
Microsoft.CodeAnalysis.CSharp.CodeStyle (14)
Microsoft.CodeAnalysis.CSharp.CodeStyle.Fixes (17)
src\Analyzers\CSharp\CodeFixes\UseCollectionExpression\CSharpCollectionExpressionRewriter.cs (5)
38Func<TParentExpression, InitializerExpressionSyntax?> getInitializer,
797ExpressionSyntax expression, Func<ExpressionSyntax, ExpressionSyntax>? indent)
804ExpressionSyntax expression, Func<ExpressionSyntax, ExpressionSyntax>? indent)
820AssignmentExpressionSyntax assignment, Func<ExpressionSyntax, ExpressionSyntax> indent)
826InvocationExpressionSyntax invocation, Func<ExpressionSyntax, ExpressionSyntax> indent)
Microsoft.CodeAnalysis.CSharp.CommandLine.UnitTests (4)
CommandLineTests.cs (4)
479Func<string, string> prependBasePath = fileName => Path.Combine(basePath, fileName);
11411Func<string, CSharpCommandLineArguments> parse = (x) => FullParse(x, baseDirectory);
12394private void VerifyQuotedValid<T>(string name, string value, T expected, Func<CSharpCommandLineArguments, T> getValue)
12405private void VerifyQuotedInvalid<T>(string name, string value, T expected, Func<CSharpCommandLineArguments, T> getValue)
Microsoft.CodeAnalysis.CSharp.EditorFeatures.UnitTests (33)
CodeActions\ApplyChangesOperationTests.cs (9)
23=> new MyCodeRefactoringProvider((Func<Solution, Solution>)parameters.fixProviderData);
27private readonly Func<Solution, Solution> _changeSolution;
29public MyCodeRefactoringProvider(Func<Solution, Solution> changeSolution)
209Func<Solution, Solution> codeActionTransform,
210Func<Solution, Solution> intermediaryTransform)
215Func<Solution, Solution> codeActionTransform,
216Func<Solution, Solution> intermediaryTransform)
221Func<Solution, Solution> codeActionTransform,
222Func<Solution, Solution> intermediaryTransform,
NavigateTo\NavigateToSearcherTests.cs (10)
47It.IsAny<Func<ImmutableArray<INavigateToSearchResult>, Task>>(),
56Func<ImmutableArray<INavigateToSearchResult>, Task> onResultsFound,
70It.IsAny<Func<ImmutableArray<INavigateToSearchResult>, Task>>(),
78Func<ImmutableArray<INavigateToSearchResult>, Task> onResultsFound,
97It.IsAny<Func<ImmutableArray<INavigateToSearchResult>, Task>>(),
106Func<ImmutableArray<INavigateToSearchResult>, Task> onResultsFound2,
515public Task SearchCachedDocumentsAsync(Solution solution, ImmutableArray<Project> projects, ImmutableArray<Document> priorityDocuments, string searchPattern, IImmutableSet<string> kinds, Document? activeDocument, Func<ImmutableArray<INavigateToSearchResult>, Task> onResultsFound, Func<Task> onProjectCompleted, CancellationToken cancellationToken)
521public Task SearchDocumentAsync(Document document, string searchPattern, IImmutableSet<string> kinds, Func<ImmutableArray<INavigateToSearchResult>, Task> onResultsFound, CancellationToken cancellationToken)
527public Task SearchGeneratedDocumentsAsync(Solution solution, ImmutableArray<Project> projects, string searchPattern, IImmutableSet<string> kinds, Document? activeDocument, Func<ImmutableArray<INavigateToSearchResult>, Task> onResultsFound, Func<Task> onProjectCompleted, CancellationToken cancellationToken)
533public Task SearchProjectsAsync(Solution solution, ImmutableArray<Project> projects, ImmutableArray<Document> priorityDocuments, string searchPattern, IImmutableSet<string> kinds, Document? activeDocument, Func<ImmutableArray<INavigateToSearchResult>, Task> onResultsFound, Func<Task> onProjectCompleted, CancellationToken cancellationToken)
Microsoft.CodeAnalysis.CSharp.Emit.UnitTests (12)
Microsoft.CodeAnalysis.CSharp.Emit2.UnitTests (19)
Emit\EditAndContinue\EditAndContinueTestBase.cs (8)
43internal static readonly Func<MethodDefinitionHandle, EditAndContinueMethodDebugInformation> EmptyLocalsProvider = handle => default(EditAndContinueMethodDebugInformation);
52public static EmitBaseline CreateInitialBaseline(Compilation compilation, ModuleMetadata module, Func<MethodDefinitionHandle, EditAndContinueMethodDebugInformation> debugInformationProvider)
62internal static Func<SyntaxNode, SyntaxNode> GetSyntaxMapFromMarkers(SourceWithMarkedNodes source0, SourceWithMarkedNodes source1)
76internal static Func<SyntaxNode, SyntaxNode> GetSyntaxMapByKind(MethodSymbol method0, params SyntaxKind[] kinds)
92internal static Func<SyntaxNode, SyntaxNode> GetEquivalentNodesMap(MethodSymbol method1, MethodSymbol method0)
149Func<Compilation, ISymbol> symbolProvider,
150Func<Compilation, ISymbol>? newSymbolProvider = null,
152Func<SyntaxNode, RuntimeRudeEdit?>? rudeEdits = null)
Microsoft.CodeAnalysis.CSharp.Emit3.UnitTests (15)
Microsoft.CodeAnalysis.CSharp.Features (99)
Completion\CompletionProviders\DeclarationName\DeclarationNameInfo.cs (12)
218Func<TSyntaxNode, SyntaxNode?> typeSyntaxGetter,
219Func<TSyntaxNode, SyntaxTokenList?> modifierGetter,
220Func<DeclarationModifiers, ImmutableArray<SymbolKindOrTypeKind>> possibleDeclarationComputer,
252Func<TSyntaxNode, SyntaxNode?> typeSyntaxGetter,
253Func<TSyntaxNode, SyntaxTokenList> modifierGetter,
254Func<DeclarationModifiers, ImmutableArray<SymbolKindOrTypeKind>> possibleDeclarationComputer,
263Func<TSyntaxNode, SyntaxNode?> typeSyntaxGetter,
264Func<TSyntaxNode, SyntaxTokenList> modifierGetter,
265Func<DeclarationModifiers, ImmutableArray<SymbolKindOrTypeKind>> possibleDeclarationComputer,
288Func<DeclarationModifiers, ImmutableArray<SymbolKindOrTypeKind>> possibleDeclarationComputer,
353var possibleDeclarationComputer = token.IsKind(SyntaxKind.CommaToken)
354? (Func<DeclarationModifiers, ImmutableArray<SymbolKindOrTypeKind>>)
EditAndContinue\BreakpointSpans.cs (8)
475internal static IEnumerable<SyntaxToken> GetActiveTokensForImplicitConstructorInitializer(ConstructorDeclarationSyntax constructor, Func<SyntaxNode, IEnumerable<SyntaxToken>> getDescendantTokens)
481internal static IEnumerable<SyntaxToken> GetActiveTokensForExplicitConstructorInitializer(ConstructorInitializerSyntax constructorInitializer, Func<SyntaxNode, IEnumerable<SyntaxToken>> getDescendantTokens)
490internal static IEnumerable<SyntaxToken> GetActiveTokensForImplicitPrimaryConstructorInitializer(TypeDeclarationSyntax typeDeclaration, Func<SyntaxNode, IEnumerable<SyntaxToken>> getDescendantTokens)
509internal static IEnumerable<SyntaxToken> GetActiveTokensForExplicitPrimaryConstructorInitializer(PrimaryConstructorBaseTypeSyntax baseTypeSyntax, Func<SyntaxNode, IEnumerable<SyntaxToken>> getDescendantTokens)
517internal static IEnumerable<SyntaxToken> GetActiveTokensForCopyConstructor(RecordDeclarationSyntax recordDeclaration, Func<SyntaxNode, IEnumerable<SyntaxToken>> getDescendantTokens)
531internal static IEnumerable<SyntaxToken> GetActiveTokensForRecordParameter(ParameterSyntax parameter, Func<SyntaxNode, IEnumerable<SyntaxToken>> getDescendantTokens)
548internal static IEnumerable<SyntaxToken> GetActiveTokensForAutoPropertyAccessor(AccessorDeclarationSyntax accessor, Func<SyntaxNode, IEnumerable<SyntaxToken>> getDescendantTokens)
853VariableDeclaratorSyntax variableDeclarator, SyntaxTokenList modifiers, SyntaxToken semicolon, Func<SyntaxNode, IEnumerable<SyntaxToken>> getDescendantTokens)
SignatureHelp\SignatureHelpUtilities.cs (16)
19private static readonly Func<BaseArgumentListSyntax, SyntaxToken> s_getBaseArgumentListOpenToken = list => list.GetOpenToken();
20private static readonly Func<TypeArgumentListSyntax, SyntaxToken> s_getTypeArgumentListOpenToken = list => list.LessThanToken;
21private static readonly Func<InitializerExpressionSyntax, SyntaxToken> s_getInitializerExpressionOpenToken = e => e.OpenBraceToken;
22private static readonly Func<AttributeArgumentListSyntax, SyntaxToken> s_getAttributeArgumentListOpenToken = list => list.OpenParenToken;
24private static readonly Func<BaseArgumentListSyntax, SyntaxToken> s_getBaseArgumentListCloseToken = list => list.GetCloseToken();
25private static readonly Func<TypeArgumentListSyntax, SyntaxToken> s_getTypeArgumentListCloseToken = list => list.GreaterThanToken;
26private static readonly Func<InitializerExpressionSyntax, SyntaxToken> s_getInitializerExpressionCloseToken = e => e.CloseBraceToken;
27private static readonly Func<AttributeArgumentListSyntax, SyntaxToken> s_getAttributeArgumentListCloseToken = list => list.CloseParenToken;
29private static readonly Func<BaseArgumentListSyntax, SyntaxNodeOrTokenList> s_getBaseArgumentListArgumentsWithSeparators =
31private static readonly Func<TypeArgumentListSyntax, SyntaxNodeOrTokenList> s_getTypeArgumentListArgumentsWithSeparators =
33private static readonly Func<InitializerExpressionSyntax, SyntaxNodeOrTokenList> s_getInitializerExpressionArgumentsWithSeparators =
35private static readonly Func<AttributeArgumentListSyntax, SyntaxNodeOrTokenList> s_getAttributeArgumentListArgumentsWithSeparators =
38private static readonly Func<BaseArgumentListSyntax, IEnumerable<string?>> s_getBaseArgumentListNames =
40private static readonly Func<TypeArgumentListSyntax, IEnumerable<string?>> s_getTypeArgumentListNames =
42private static readonly Func<InitializerExpressionSyntax, IEnumerable<string?>> s_getInitializerExpressionNames =
44private static readonly Func<AttributeArgumentListSyntax, IEnumerable<string?>> s_getAttributeArgumentListNames =
src\Analyzers\CSharp\CodeFixes\UseCollectionExpression\CSharpCollectionExpressionRewriter.cs (5)
38Func<TParentExpression, InitializerExpressionSyntax?> getInitializer,
797ExpressionSyntax expression, Func<ExpressionSyntax, ExpressionSyntax>? indent)
804ExpressionSyntax expression, Func<ExpressionSyntax, ExpressionSyntax>? indent)
820AssignmentExpressionSyntax assignment, Func<ExpressionSyntax, ExpressionSyntax> indent)
826InvocationExpressionSyntax invocation, Func<ExpressionSyntax, ExpressionSyntax> indent)
Microsoft.CodeAnalysis.CSharp.Features.UnitTests (6)
EditAndContinue\Helpers\EditingTestBase.cs (4)
120internal static SemanticEditDescription SemanticEdit(SemanticEditKind kind, Func<Compilation, ISymbol> symbolProvider, SyntaxMapDescription.Mapping? syntaxMap, IEnumerable<RuntimeRudeEditDescription>? rudeEdits = null, string? partialType = null)
123internal static SemanticEditDescription SemanticEdit(SemanticEditKind kind, Func<Compilation, ISymbol> symbolProvider, IEnumerable<(TextSpan, TextSpan)>? syntaxMap, IEnumerable<RuntimeRudeEditDescription>? rudeEdits = null, string? partialType = null)
126internal static SemanticEditDescription SemanticEdit(SemanticEditKind kind, Func<Compilation, ISymbol> symbolProvider, string? partialType = null, bool preserveLocalVariables = false, Func<Compilation, ISymbol>? deletedSymbolContainerProvider = null)
Microsoft.CodeAnalysis.CSharp.IOperation.UnitTests (3)
Microsoft.CodeAnalysis.CSharp.Scripting.UnitTests (4)
Microsoft.CodeAnalysis.CSharp.Semantic.UnitTests (28)
Semantics\AmbiguousOverrideTests.cs (16)
519Func<int, Func<MethodSymbol, bool>> hasCustomModifierCount = c => m => m.CustomModifierCount() == c;
574Func<int, Func<MethodSymbol, bool>> hasCustomModifierCount = c => m => m.CustomModifierCount() == c;
639Func<int, Func<PropertySymbol, bool>> hasCustomModifierCount = c => p => p.CustomModifierCount() == c;
707Func<int, Func<PropertySymbol, bool>> hasCustomModifierCount = c => p => p.CustomModifierCount() == c;
773Func<int, Func<PropertySymbol, bool>> hasCustomModifierCount = c => p => p.CustomModifierCount() == c;
847Func<int, Func<PropertySymbol, bool>> hasCustomModifierCount = c => p => p.CustomModifierCount() == c;
931Func<int, Func<EventSymbol, bool>> hasCustomModifierCount = c => e => e.Type.CustomModifierCount() == c;
1014Func<int, Func<EventSymbol, bool>> hasCustomModifierCount = c => e => e.Type.CustomModifierCount() == c;
Microsoft.CodeAnalysis.CSharp.Symbol.UnitTests (137)
SymbolDisplay\SymbolDisplayTests.cs (123)
29Func<NamespaceSymbol, Symbol> findSymbol = global =>
48Func<NamespaceSymbol, Symbol> findSymbol = global =>
72Func<NamespaceSymbol, Symbol> findSymbol = global =>
100Func<NamespaceSymbol, Symbol> findSymbol = global =>
128Func<NamespaceSymbol, Symbol> findSymbol = global =>
153Func<NamespaceSymbol, Symbol> findSymbol = global => global.GetTypeMembers("A", 0).Single();
176Func<NamespaceSymbol, Symbol> findSymbol = global =>
204Func<NamespaceSymbol, Symbol> findSymbol = global =>
229Func<NamespaceSymbol, Symbol> findSymbol = global =>
255Func<NamespaceSymbol, Symbol> findSymbol = global =>
289Func<NamespaceSymbol, Symbol> findSymbol = global =>
338Func<NamespaceSymbol, Symbol> findSymbol = global =>
403Func<NamespaceSymbol, Symbol> findSymbol = global =>
459Func<NamespaceSymbol, Symbol> findSymbol = global =>
524Func<NamespaceSymbol, Symbol> findSymbol = global =>
589Func<NamespaceSymbol, Symbol> findSymbol = global =>
645Func<NamespaceSymbol, Symbol> findSymbol = global =>
697Func<NamespaceSymbol, Symbol> findSymbol = global =>
735Func<NamespaceSymbol, Symbol> findSymbol = global =>
759Func<NamespaceSymbol, Symbol> findSymbol = global =>
797Func<NamespaceSymbol, Symbol> findSymbol = global =>
830Func<NamespaceSymbol, Symbol> findSymbol = global =>
869Func<NamespaceSymbol, Symbol> findSymbol = global =>
904Func<NamespaceSymbol, Symbol> findSymbol = global =>
939Func<NamespaceSymbol, Symbol> findSymbol = global =>
974Func<NamespaceSymbol, Symbol> findSymbol = global =>
1009Func<NamespaceSymbol, Symbol> findSymbol = global =>
1063Func<NamespaceSymbol, Symbol> findSymbol = global =>
1104Func<NamespaceSymbol, Symbol> findSymbol = global =>
1150Func<NamespaceSymbol, Symbol> findSymbol = global =>
1179Func<NamespaceSymbol, Symbol> findSymbol = global =>
1211Func<NamespaceSymbol, Symbol> findSymbol = global =>
1254Func<NamespaceSymbol, Symbol> findSymbol = global =>
1279Func<NamespaceSymbol, Symbol> findSymbol = global =>
1306Func<NamespaceSymbol, Symbol> findSymbol = global =>
1332Func<NamespaceSymbol, Symbol> findSymbol = global =>
1356Func<NamespaceSymbol, Symbol> findSymbol = global =>
1379Func<NamespaceSymbol, Symbol> findSymbol = global =>
1405Func<NamespaceSymbol, Symbol> findSymbol = global =>
1445Func<NamespaceSymbol, Symbol> findSymbol = global =>
1468Func<NamespaceSymbol, Symbol> findSymbol = global =>
1603Func<NamespaceSymbol, Symbol> findSymbol = global =>
1633Func<NamespaceSymbol, Symbol> findSymbol = global =>
1667Func<NamespaceSymbol, Symbol> findType = global =>
1670Func<NamespaceSymbol, Symbol> findTypeParameter = global =>
1709Func<NamespaceSymbol, Symbol> findSymbol = global =>
1741Func<NamespaceSymbol, Symbol> findSymbol = global =>
1774Func<NamespaceSymbol, Symbol> findSymbol = global =>
1816Func<NamespaceSymbol, Symbol> findSymbol = global =>
1839Func<NamespaceSymbol, Symbol> findSymbol = global =>
1876Func<NamespaceSymbol, Symbol> findSymbol = global =>
1899Func<NamespaceSymbol, Symbol> findSymbol = global =>
1934Func<NamespaceSymbol, Symbol> findSymbol = global =>
1957Func<NamespaceSymbol, Symbol> findSymbol = global =>
2062Func<NamespaceSymbol, Symbol> findSymbol = global =>
2100Func<NamespaceSymbol, Symbol> findSymbol = global =>
2138Func<NamespaceSymbol, Symbol> findSymbol = global =>
2176Func<NamespaceSymbol, Symbol> findSymbol = global =>
2208Func<NamespaceSymbol, Symbol> findSymbol = global =>
2242Func<NamespaceSymbol, Symbol> findSymbol = global =>
2268Func<NamespaceSymbol, Symbol> findSymbol = global =>
2323Func<NamespaceSymbol, Symbol> findSymbol = global =>
2422Func<NamespaceSymbol, Symbol> findSymbol1 = global =>
2426Func<NamespaceSymbol, Symbol> findSymbol2 = global =>
2475Func<NamespaceSymbol, Symbol> findSymbol1 = global =>
2479Func<NamespaceSymbol, Symbol> findSymbol2 = global =>
2514Func<NamespaceSymbol, Symbol> findSymbol = global =>
2551Func<NamespaceSymbol, Symbol> findSymbol = global =>
2588Func<NamespaceSymbol, Symbol> findSymbol = global =>
2614Func<NamespaceSymbol, Symbol> findSymbol = global =>
2644Func<NamespaceSymbol, Symbol> findSymbol = global =>
2672Func<NamespaceSymbol, Symbol> findSymbol = global =>
2763Func<NamespaceSymbol, Symbol> findSymbol = global =>
2824Func<NamespaceSymbol, Symbol> findSymbol = global =>
2916Func<NamespaceSymbol, Symbol> findSymbol = global =>
2946Func<NamespaceSymbol, Symbol> findSymbol = global =>
2980Func<NamespaceSymbol, Symbol> findSymbol = global =>
3011Func<NamespaceSymbol, Symbol> findSymbol = global =>
3045Func<NamespaceSymbol, Symbol> findSymbol = global =>
3072Func<NamespaceSymbol, Symbol> findSymbol = global =>
3317Func<NamespaceSymbol, Symbol> findSymbol = global =>
3340Func<NamespaceSymbol, Symbol> findSymbol = global =>
3361Func<NamespaceSymbol, Symbol> findSymbol = global =>
3386Func<NamespaceSymbol, Symbol> findSymbol = global =>
3696Func<NamespaceSymbol, Symbol> findSymbol,
3718Func<NamespaceSymbol, Symbol> findSymbol,
3728Func<NamespaceSymbol, Symbol> findSymbol,
3756Func<NamespaceSymbol, Symbol> findSymbol = global =>
3807Func<NamespaceSymbol, Symbol> findSymbol = global =>
3861Func<NamespaceSymbol, Symbol> findSymbol = global =>
3913Func<NamespaceSymbol, Symbol> findSymbol = global =>
3964Func<NamespaceSymbol, Symbol> findSymbol = global =>
4045Func<NamespaceSymbol, Symbol> findSymbol = global =>
4115Func<NamespaceSymbol, Symbol> findSymbol1 = global =>
4117Func<NamespaceSymbol, Symbol> findSymbol2 = global =>
4119Func<NamespaceSymbol, Symbol> findSymbol3 = global =>
4227Func<NamespaceSymbol, Symbol> findSymbol1 = global =>
4229Func<NamespaceSymbol, Symbol> findSymbol2 = global =>
4231Func<NamespaceSymbol, Symbol> findSymbol3 = global =>
4341Func<NamespaceSymbol, Symbol> findSymbol = global =>
4445Func<NamespaceSymbol, Symbol> findSymbol = global =>
4549Func<NamespaceSymbol, Symbol> findSymbol = global =>
4593Func<NamespaceSymbol, Symbol> findSymbol = global =>
4640Func<NamespaceSymbol, Symbol> findSymbol = global =>
4682Func<NamespaceSymbol, Symbol> findSymbol = global =>
4717Func<NamespaceSymbol, Symbol> findSymbol = global =>
4765Func<NamespaceSymbol, Symbol> findSymbol = global =>
4806Func<NamespaceSymbol, Symbol> findSymbol = global =>
4876Func<NamespaceSymbol, Symbol> findSymbol = global =>
5456Func<NamespaceSymbol, Symbol> findSymbol = global =>
5488Func<NamespaceSymbol, Symbol> findSymbol = global =>
5519Func<NamespaceSymbol, Symbol> findSymbol = global =>
5550Func<NamespaceSymbol, Symbol> findSymbol = global =>
5587Func<NamespaceSymbol, Symbol> findSymbol = global =>
5638Func<NamespaceSymbol, Symbol> findSymbol = global =>
8322Func<NamespaceSymbol, Symbol> findSymbol = global => global.GetTypeMembers("Person").Single();
8343Func<NamespaceSymbol, Symbol> findSymbol = global => global.GetTypeMembers("Person").Single();
8364Func<NamespaceSymbol, Symbol> findSymbol = global => global.GetTypeMembers("Person").Single();
8387Func<NamespaceSymbol, Symbol> findSymbol = global => global.GetTypeMembers("Person").Single();
8414Func<NamespaceSymbol, Symbol> findSymbol = global =>
8435Func<NamespaceSymbol, Symbol> findSymbol = global =>
8456Func<NamespaceSymbol, Symbol> findSymbol = global =>
8477Func<NamespaceSymbol, Symbol> findSymbol = global =>
Microsoft.CodeAnalysis.CSharp.Syntax.UnitTests (14)
Syntax\SyntaxRewriterTests.cs (10)
727private readonly Func<InternalSyntax.CSharpSyntaxNode, InternalSyntax.CSharpSyntaxNode> _rewriteNode;
728private readonly Func<InternalSyntax.SyntaxToken, InternalSyntax.SyntaxToken> _rewriteToken;
731Func<InternalSyntax.CSharpSyntaxNode, InternalSyntax.CSharpSyntaxNode> rewriteNode = null,
732Func<InternalSyntax.SyntaxToken, InternalSyntax.SyntaxToken> rewriteToken = null)
756private readonly Func<SyntaxNode, SyntaxNode> _rewriteNode;
757private readonly Func<SyntaxToken, SyntaxToken> _rewriteToken;
758private readonly Func<SyntaxTrivia, SyntaxTrivia> _rewriteTrivia;
761Func<SyntaxNode, SyntaxNode> rewriteNode = null,
762Func<SyntaxToken, SyntaxToken> rewriteToken = null,
763Func<SyntaxTrivia, SyntaxTrivia> rewriteTrivia = null)
Microsoft.CodeAnalysis.CSharp.Test.Utilities (1)
Microsoft.CodeAnalysis.CSharp.Workspaces (28)
Simplification\CSharpSimplificationService.cs (3)
52public override SyntaxNode Expand(SyntaxNode node, SemanticModel semanticModel, SyntaxAnnotation? annotationForReplacedAliasIdentifier, Func<SyntaxNode, bool>? expandInsideNode, bool expandParameter, CancellationToken cancellationToken)
77public override SyntaxToken Expand(SyntaxToken token, SemanticModel semanticModel, Func<SyntaxNode, bool>? expandInsideNode, CancellationToken cancellationToken)
177protected override ImmutableArray<NodeOrTokenToReduce> GetNodesAndTokensToReduce(SyntaxNode root, Func<SyntaxNodeOrToken, bool> isNodeOrTokenOutsideSimplifySpans)
Microsoft.CodeAnalysis.Debugging.Package (20)
src\Dependencies\PooledObjects\ArrayBuilder.cs (7)
457public void FreeAll(Func<T, ArrayBuilder<T>?> getNested)
560internal Dictionary<K, ImmutableArray<T>> ToDictionary<K>(Func<T, K> keySelector, IEqualityComparer<K>? comparer = null)
608public void AddRange<U>(ArrayBuilder<U> items, Func<U, T> selector)
745public ImmutableArray<S> SelectDistinct<S>(Func<T, S> selector)
763public bool Any(Func<T, bool> predicate)
787public bool All(Func<T, bool> predicate)
817public ImmutableArray<TResult> SelectAsArray<TResult>(Func<T, TResult> map)
src\Dependencies\PooledObjects\PooledDelegates.cs (9)
200public static Releaser GetPooledFunction<TArg, TResult>(Func<TArg, TResult> unboundFunction, TArg argument, out Func<TResult> boundFunction)
201=> GetPooledDelegate<FuncWithBoundArgument<TArg, TResult>, TArg, Func<TArg, TResult>, Func<TResult>>(unboundFunction, argument, out boundFunction);
204/// Equivalent to <see cref="GetPooledFunction{TArg, TResult}(Func{TArg, TResult}, TArg, out Func{TResult})"/>,
216/// Gets a <see cref="Func{T, TResult}"/> delegate, which calls <paramref name="unboundFunction"/> with the
246public static Releaser GetPooledFunction<T1, TArg, TResult>(Func<T1, TArg, TResult> unboundFunction, TArg argument, out Func<T1, TResult> boundFunction)
247=> GetPooledDelegate<FuncWithBoundArgument<T1, TArg, TResult>, TArg, Func<T1, TArg, TResult>, Func<T1, TResult>>(unboundFunction, argument, out boundFunction);
412: AbstractDelegateWithBoundArgument<FuncWithBoundArgument<TArg, TResult>, TArg, Func<TArg, TResult>, Func<TResult>>
432: AbstractDelegateWithBoundArgument<FuncWithBoundArgument<T1, TArg, TResult>, TArg, Func<T1, TArg, TResult>, Func<T1, TResult>>
434protected override Func<T1, TResult> Bind()
Microsoft.CodeAnalysis.EditorFeatures (54)
Lightup\ISmartRenameSessionWrapper.cs (10)
25private static readonly Func<object, TimeSpan> s_automaticFetchDelayAccessor;
26private static readonly Func<object, bool> s_isAvailableAccessor;
27private static readonly Func<object, bool> s_hasSuggestionsAccessor;
28private static readonly Func<object, bool> s_isInProgressAccessor;
29private static readonly Func<object, string> s_statusMessageAccessor;
30private static readonly Func<object, bool> s_statusMessageVisibilityAccessor;
31private static readonly Func<object, IReadOnlyList<string>> s_suggestedNamesAccessor;
32private static readonly Func<object, Guid> s_correlationIdAccessor;
33private static readonly Func<object?, object?>? s_renameContextImmutableListCreateBuilderAccessor;
35private static readonly Func<object, object>? s_renameContextImmutableListBuilderToArrayAccessor;
Lightup\LightupHelpers.cs (8)
58public static Func<T, TResult> CreatePropertyAccessor<T, TResult>(Type? type, string propertyName, TResult defaultValue)
93Expression.Lambda<Func<T, TResult>>(
239public static Func<T, TResult> CreateGenericFunctionAccessor<T, TResult>(Type? type, string methodName, Type genericArgumentType, TResult defaultValue)
273Expression.Lambda<Func<T, TResult>>(
294public static Func<T, TResult> CreateFunctionAccessor<T, TResult>(Type? type, string methodName, TResult defaultValue)
329Expression.Lambda<Func<T, TResult>>(
506private static Func<T, TResult> CreateFallbackAccessor<T, TResult>(TResult defaultValue)
553private static Func<T, TResult> CreateFallbackFunction<T, TResult>(TResult defaultValue)
Microsoft.CodeAnalysis.EditorFeatures.Test.Utilities (8)
NavigateTo\AbstractNavigateToTests.cs (5)
86protected async Task TestAsync(TestHost testHost, Composition composition, string content, Func<EditorTestWorkspace, Task> body)
99protected async Task TestAsync(TestHost testHost, Composition composition, XElement content, Func<EditorTestWorkspace, Task> body)
113string content, Func<EditorTestWorkspace, Task> body, TestHost testHost,
121XElement content, Func<EditorTestWorkspace, Task> body, TestHost testHost,
225private static readonly ImmutableArray<Func<NavigateToItem, IComparable>> s_comparisonComponents =
RefactoringHelpers\RefactoringHelpersTestBase.cs (3)
32protected async Task TestAsync<TNode>(string text, Func<TNode, bool> predicate, bool allowEmptyNodes = false) where TNode : SyntaxNode
63protected async Task TestMissingAsync<TNode>(string text, Func<TNode, bool> predicate, bool allowEmptyNodes = false) where TNode : SyntaxNode
102private async Task<TNode?> GetNodeForSelectionAsync<TNode>(string text, TextSpan selection, Func<TNode, bool> predicate, bool allowEmptyNodes = false) where TNode : SyntaxNode
Microsoft.CodeAnalysis.EditorFeatures.Text (3)
Microsoft.CodeAnalysis.EditorFeatures.UnitTests (34)
CodeGeneration\CodeGenerationTests.cs (30)
58Func<SemanticModel, ITypeSymbol> type = null,
104ImmutableArray<Func<SemanticModel, IParameterSymbol>> parameters = default,
138Func<SemanticModel, ImmutableArray<IMethodSymbol>> getExplicitInterfaces = null,
140ImmutableArray<Func<SemanticModel, IParameterSymbol>> parameters = default,
183ImmutableArray<Func<SemanticModel, IParameterSymbol>> parameters = default,
226ImmutableArray<Func<SemanticModel, IParameterSymbol>> parameters = default,
268Func<SemanticModel, IParameterSymbol> fromType,
324ImmutableArray<Func<SemanticModel, IParameterSymbol>> parameters,
345ImmutableArray<Func<SemanticModel, IParameterSymbol>> parameters = default,
376ImmutableArray<Func<SemanticModel, IParameterSymbol>> parameters = default,
378Func<SemanticModel, ImmutableArray<IEventSymbol>> getExplicitInterfaceImplementations = null,
420ImmutableArray<Func<SemanticModel, IParameterSymbol>> parameters = default,
513ImmutableArray<Func<SemanticModel, ISymbol>> members = default,
547Func<TestContext, AttributeData> attributeToGenerate,
587Func<SemanticModel, ITypeSymbol> getType = null,
588ImmutableArray<Func<SemanticModel, ISymbol>> getNewMembers = default,
672internal static Func<SemanticModel, IParameterSymbol> Parameter(Type type, string name, bool hasDefaultValue = false, object defaultValue = null, bool isParams = false)
679internal static Func<SemanticModel, IParameterSymbol> Parameter(string typeFullName, string parameterName, bool hasDefaultValue = false, object defaultValue = null, bool isParams = false, int typeArrayRank = 0)
695internal static ImmutableArray<Func<SemanticModel, IParameterSymbol>> Parameters(params ReadOnlySpan<Func<SemanticModel, IParameterSymbol>> p)
698internal static ImmutableArray<Func<SemanticModel, ISymbol>> Members(params ReadOnlySpan<Func<SemanticModel, ISymbol>> m)
701internal static Func<SemanticModel, ITypeSymbol> CreateArrayType(Type type, int rank = 1)
704private static ImmutableArray<IParameterSymbol> GetParameterSymbols(ImmutableArray<Func<SemanticModel, IParameterSymbol>> parameters, TestContext context)
710Func<SemanticModel, ImmutableArray<IMethodSymbol>> explicitInterface, TestContext context)
715private static ImmutableArray<ISymbol> GetSymbols(ImmutableArray<Func<SemanticModel, ISymbol>> members, TestContext context)
722private static Func<SemanticModel, ISymbol> CreateEnumField(string name, object value)
729internal static Func<SemanticModel, ISymbol> CreateField(Accessibility accessibility, Editing.DeclarationModifiers modifiers, Type type, string name)
736private static Func<SemanticModel, INamedTypeSymbol> GetTypeSymbol(Type type)
739private static Func<SemanticModel, INamedTypeSymbol> GetTypeSymbol(string typeMetadataName)
Microsoft.CodeAnalysis.ExpressionEvaluator.ExpressionCompiler (1)
Microsoft.CodeAnalysis.ExpressionEvaluator.FunctionResolver (3)
Microsoft.CodeAnalysis.ExpressionEvaluator.ResultProvider (4)
Microsoft.CodeAnalysis.ExpressionEvaluator.ResultProvider.Utilities (7)
Microsoft.CodeAnalysis.Extensions.Package (110)
src\Dependencies\Collections\Extensions\IEnumerableExtensions.cs (30)
164public static T? FirstOrNull<T>(this IEnumerable<T> source, Func<T, bool> predicate)
182public static T? SingleOrNull<T>(this IEnumerable<T> source, Func<T, bool> predicate)
261public static bool HasDuplicates<TItem, TValue>(this IEnumerable<TItem> source, Func<TItem, TValue> selector)
271/// <seealso cref="Microsoft.CodeAnalysis.ImmutableArrayExtensions.HasDuplicates{TItem, TValue}(ImmutableArray{TItem}, Func{TItem, TValue}, IEqualityComparer{TValue})"/>
273public static bool HasDuplicates<TItem, TValue>(this IEnumerable<TItem> source, Func<TItem, TValue> selector, IEqualityComparer<TValue> comparer)
321private static readonly Func<object, bool> s_notNullTest = x => x != null;
331return source.Where((Func<T?, bool>)s_notNullTest)!;
376public static ImmutableArray<T> WhereAsArray<T>(this IEnumerable<T> values, Func<T, bool> predicate)
407public static ImmutableArray<TResult> SelectAsArray<TSource, TResult>(this IEnumerable<TSource>? source, Func<TSource, TResult> selector)
417public static ImmutableArray<TResult> SelectAsArray<TItem, TResult>(this IEnumerable<TItem>? source, Func<TItem, bool> predicate, Func<TItem, TResult> selector)
461public static ImmutableArray<TResult> SelectAsArray<TSource, TResult>(this IReadOnlyCollection<TSource>? source, Func<TSource, TResult> selector)
485public static ImmutableArray<TResult> SelectManyAsArray<TSource, TResult>(this IEnumerable<TSource>? source, Func<TSource, IEnumerable<TResult>> selector)
507public static ImmutableArray<TResult> SelectManyAsArray<TItem, TResult>(this IReadOnlyCollection<TItem>? source, Func<TItem, IEnumerable<TResult>> selector)
533public static ImmutableArray<TResult> SelectManyAsArray<TSource, TResult>(this IEnumerable<TSource>? source, Func<TSource, OneOrMany<TResult>> selector)
547public static async ValueTask<ImmutableArray<TResult>> SelectAsArrayAsync<TItem, TResult>(this IEnumerable<TItem> source, Func<TItem, ValueTask<TResult>> selector)
764internal static Dictionary<K, ImmutableArray<T>> ToMultiDictionary<K, T>(this IEnumerable<T> data, Func<T, K> keySelector, IEqualityComparer<K>? comparer = null)
815public static readonly Func<T, T> Identity = t => t;
816public static readonly Func<T, bool> True = t => true;
840/// Alias for <see cref="System.Linq.Enumerable.Any{TSource}(IEnumerable{TSource}, Func{TSource, bool})"/>
842public static bool Contains<T>(this IEnumerable<T> sequence, Func<T, bool> predicate)
846/// Variant of <see cref="System.Linq.Enumerable.Count{TSource}(IEnumerable{TSource}, Func{TSource, bool})"/>
861/// Variant of <see cref="System.Linq.Enumerable.FirstOrDefault{TSource}(IEnumerable{TSource}, Func{TSource, bool})"/>
875/// Variant of <see cref="System.Linq.Enumerable.Any{TSource}(IEnumerable{TSource}, Func{TSource, bool})"/>
889/// Variant of <see cref="System.Linq.Enumerable.OrderBy{TSource, TKey}(IEnumerable{TSource}, Func{TSource, TKey}, IComparer{TKey}?)"/>
895/// Variant of <see cref="System.Linq.Enumerable.OrderByDescending{TSource, TKey}(IEnumerable{TSource}, Func{TSource, TKey}, IComparer{TKey}?)"/>
901/// Variant of <see cref="System.Linq.Enumerable.OrderBy{TSource, TKey}(IEnumerable{TSource}, Func{TSource, TKey}, IComparer{TKey}?)"/>
907/// Variant of <see cref="System.Linq.Enumerable.OrderByDescending{TSource, TKey}(IEnumerable{TSource}, Func{TSource, TKey}, IComparer{TKey}?)"/>
913/// Variant of <see cref="System.Linq.Enumerable.ThenBy{TSource, TKey}(IOrderedEnumerable{TSource}, Func{TSource, TKey}, IComparer{TKey}?)"/>
919/// Variant of <see cref="System.Linq.Enumerable.ThenBy{TSource, TKey}(IOrderedEnumerable{TSource}, Func{TSource, TKey}, IComparer{TKey}?)"/>
src\Dependencies\Collections\Extensions\IListExtensions.cs (4)
21public static bool HasDuplicates<TItem, TValue>(this IReadOnlyList<TItem> list, Func<TItem, TValue> selector)
31/// <seealso cref="ImmutableArrayExtensions.HasDuplicates{TItem, TValue}(System.Collections.Immutable.ImmutableArray{TItem}, Func{TItem, TValue}, IEqualityComparer{TValue})"/>
32/// <seealso cref="Roslyn.Utilities.EnumerableExtensions.HasDuplicates{TItem, TValue}(IEnumerable{TItem}, Func{TItem, TValue}, IEqualityComparer{TValue})"/>
34internal static bool HasDuplicates<TItem, TValue>(this IReadOnlyList<TItem> list, Func<TItem, TValue> selector, IEqualityComparer<TValue> comparer)
src\Dependencies\Collections\Extensions\ImmutableArrayExtensions.cs (27)
138public static ImmutableArray<TResult> SelectAsArray<TItem, TResult>(this ImmutableArray<TItem> items, Func<TItem, TResult> map)
198public static ImmutableArray<TResult> SelectAsArray<TItem, TResult>(this ImmutableArray<TItem> array, Func<TItem, bool> predicate, Func<TItem, TResult> selector)
247public static ImmutableArray<TResult> SelectManyAsArray<TItem, TResult>(this ImmutableArray<TItem> array, Func<TItem, IEnumerable<TResult>> selector)
267public static ImmutableArray<TResult> SelectManyAsArray<TItem, TResult>(this ImmutableArray<TItem> array, Func<TItem, ImmutableArray<TResult>> selector)
287public static ImmutableArray<TResult> SelectManyAsArray<TItem, TResult>(this ImmutableArray<TItem> array, Func<TItem, OneOrMany<TResult>> selector)
308public static ImmutableArray<TResult> SelectManyAsArray<TItem, TResult>(this ImmutableArray<TItem> array, Func<TItem, bool> predicate, Func<TItem, IEnumerable<TResult>> selector)
332public static ImmutableArray<TResult> SelectManyAsArray<TItem, TResult>(this ImmutableArray<TItem> array, Func<TItem, bool> predicate, Func<TItem, ImmutableArray<TResult>> selector)
356public static ImmutableArray<TResult> SelectManyAsArray<TItem, TResult>(this ImmutableArray<TItem> array, Func<TItem, bool> predicate, Func<TItem, OneOrMany<TResult>> selector)
493public static ImmutableArray<T> WhereAsArray<T>(this ImmutableArray<T> array, Func<T, bool> predicate)
504private static ImmutableArray<T> WhereAsArrayImpl<T, TArg>(ImmutableArray<T> array, Func<T, bool>? predicateWithoutArg, Func<T, TArg, bool>? predicateWithArg, TArg arg)
573public static async Task<bool> AnyAsync<T>(this ImmutableArray<T> array, Func<T, Task<bool>> predicateAsync)
595public static async ValueTask<T?> FirstOrDefaultAsync<T>(this ImmutableArray<T> array, Func<T, Task<bool>> predicateAsync)
757public static bool HasDuplicates<TItem, TValue>(this ImmutableArray<TItem> array, Func<TItem, TValue> selector)
767/// <seealso cref="Roslyn.Utilities.EnumerableExtensions.HasDuplicates{TItem, TValue}(IEnumerable{TItem}, Func{TItem, TValue}, IEqualityComparer{TValue})"/>
769internal static bool HasDuplicates<TItem, TValue>(this ImmutableArray<TItem> array, Func<TItem, TValue> selector, IEqualityComparer<TValue> comparer)
990/// Variant of <see cref="System.Linq.ImmutableArrayExtensions.FirstOrDefault{T}(ImmutableArray{T}, Func{T, bool})"/>
1004/// Variant of <see cref="System.Linq.ImmutableArrayExtensions.Single{T}(ImmutableArray{T}, Func{T, bool})"/>
1066/// Specialization of <see cref="System.Linq.Enumerable.Count{TSource}(IEnumerable{TSource}, Func{TSource, bool})"/> for <see cref="ImmutableArray{T}"/>.
1068public static int Count<T>(this ImmutableArray<T> items, Func<T, bool> predicate)
1086public static int Sum<T>(this ImmutableArray<T> items, Func<T, int> selector)
1213/// Variant of <see cref="System.Linq.ImmutableArrayExtensions.Any{T}(ImmutableArray{T}, Func{T, bool})"/>.
1227/// Variant of <see cref="System.Linq.ImmutableArrayExtensions.All{T}(ImmutableArray{T}, Func{T, bool})"/>.
1257public static bool Contains<T>(this ImmutableArray<T> array, Func<T, bool> predicate)
src\Dependencies\Collections\RoslynImmutableInterlocked.cs (7)
33public static bool Update<T>(ref ImmutableSegmentedList<T> location, Func<ImmutableSegmentedList<T>, ImmutableSegmentedList<T>> transformer)
154public static bool Update<T>(ref ImmutableSegmentedHashSet<T> location, Func<ImmutableSegmentedHashSet<T>, ImmutableSegmentedHashSet<T>> transformer)
276public static bool Update<TKey, TValue>(ref ImmutableSegmentedDictionary<TKey, TValue> location, Func<ImmutableSegmentedDictionary<TKey, TValue>, ImmutableSegmentedDictionary<TKey, TValue>> transformer)
410/// <inheritdoc cref="ImmutableInterlocked.GetOrAdd{TKey, TValue}(ref ImmutableDictionary{TKey, TValue}, TKey, Func{TKey, TValue})"/>
411public static TValue GetOrAdd<TKey, TValue>(ref ImmutableSegmentedDictionary<TKey, TValue> location, TKey key, Func<TKey, TValue> valueFactory)
458/// <inheritdoc cref="ImmutableInterlocked.AddOrUpdate{TKey, TValue}(ref ImmutableDictionary{TKey, TValue}, TKey, Func{TKey, TValue}, Func{TKey, TValue, TValue})"/>
459public static TValue AddOrUpdate<TKey, TValue>(ref ImmutableSegmentedDictionary<TKey, TValue> location, TKey key, Func<TKey, TValue> addValueFactory, Func<TKey, TValue, TValue> updateValueFactory)
src\Dependencies\Collections\Segmented\ImmutableSegmentedDictionary.cs (6)
68public static ImmutableSegmentedDictionary<TKey, TValue> ToImmutableSegmentedDictionary<TSource, TKey, TValue>(this IEnumerable<TSource> source, Func<TSource, TKey> keySelector, Func<TSource, TValue> elementSelector)
72public static ImmutableSegmentedDictionary<TKey, TValue> ToImmutableSegmentedDictionary<TSource, TKey, TValue>(this IEnumerable<TSource> source, Func<TSource, TKey> keySelector, Func<TSource, TValue> elementSelector, IEqualityComparer<TKey>? keyComparer)
86public static ImmutableSegmentedDictionary<TKey, TSource> ToImmutableSegmentedDictionary<TSource, TKey>(this IEnumerable<TSource> source, Func<TSource, TKey> keySelector)
90public static ImmutableSegmentedDictionary<TKey, TSource> ToImmutableSegmentedDictionary<TSource, TKey>(this IEnumerable<TSource> source, Func<TSource, TKey> keySelector, IEqualityComparer<TKey>? keyComparer)
src\Dependencies\PooledObjects\ArrayBuilder.cs (7)
457public void FreeAll(Func<T, ArrayBuilder<T>?> getNested)
560internal Dictionary<K, ImmutableArray<T>> ToDictionary<K>(Func<T, K> keySelector, IEqualityComparer<K>? comparer = null)
608public void AddRange<U>(ArrayBuilder<U> items, Func<U, T> selector)
745public ImmutableArray<S> SelectDistinct<S>(Func<T, S> selector)
763public bool Any(Func<T, bool> predicate)
787public bool All(Func<T, bool> predicate)
817public ImmutableArray<TResult> SelectAsArray<TResult>(Func<T, TResult> map)
src\Dependencies\PooledObjects\PooledDelegates.cs (9)
200public static Releaser GetPooledFunction<TArg, TResult>(Func<TArg, TResult> unboundFunction, TArg argument, out Func<TResult> boundFunction)
201=> GetPooledDelegate<FuncWithBoundArgument<TArg, TResult>, TArg, Func<TArg, TResult>, Func<TResult>>(unboundFunction, argument, out boundFunction);
204/// Equivalent to <see cref="GetPooledFunction{TArg, TResult}(Func{TArg, TResult}, TArg, out Func{TResult})"/>,
216/// Gets a <see cref="Func{T, TResult}"/> delegate, which calls <paramref name="unboundFunction"/> with the
246public static Releaser GetPooledFunction<T1, TArg, TResult>(Func<T1, TArg, TResult> unboundFunction, TArg argument, out Func<T1, TResult> boundFunction)
247=> GetPooledDelegate<FuncWithBoundArgument<T1, TArg, TResult>, TArg, Func<T1, TArg, TResult>, Func<T1, TResult>>(unboundFunction, argument, out boundFunction);
412: AbstractDelegateWithBoundArgument<FuncWithBoundArgument<TArg, TResult>, TArg, Func<TArg, TResult>, Func<TResult>>
432: AbstractDelegateWithBoundArgument<FuncWithBoundArgument<T1, TArg, TResult>, TArg, Func<T1, TArg, TResult>, Func<T1, TResult>>
434protected override Func<T1, TResult> Bind()
Microsoft.CodeAnalysis.ExternalAccess.FSharp (10)
Microsoft.CodeAnalysis.ExternalAccess.Razor.Features (2)
Microsoft.CodeAnalysis.Features (144)
Common\AbstractProjectExtensionProvider.cs (4)
80public static ImmutableArray<TExtension> GetExtensions(TextDocument document, Func<TExportAttribute, ExtensionInfo>? getExtensionInfoForFiltering)
88public static ImmutableArray<TExtension> FilterExtensions(TextDocument document, ImmutableArray<TExtension> extensions, Func<TExportAttribute, ExtensionInfo> getExtensionInfoForFiltering)
92static bool ShouldIncludeExtension(TExtension extension, (TextDocument, Func<TExportAttribute, ExtensionInfo>) args)
114static ExtensionInfo? GetOrCreateExtensionInfo(TExtension extension, Func<TExportAttribute, ExtensionInfo> getExtensionInfoForFiltering)
Completion\CommonCompletionUtilities.cs (6)
28Func<char, bool> isWordStartCharacter, Func<char, bool> isWordCharacter)
34Func<char, bool> isWordStartCharacter, Func<char, bool> isWordCharacter, bool alwaysExtendEndSpan = false)
60public static bool IsStartingNewWord(SourceText text, int characterPosition, Func<char, bool> isWordStartCharacter, Func<char, bool> isWordCharacter)
EditAndContinue\AbstractEditAndContinueAnalyzer.cs (15)
428internal abstract Func<SyntaxNode, bool> IsLambda { get; }
429internal abstract Func<SyntaxNode, bool> IsNotLambda { get; }
430internal abstract Func<SyntaxNode, IEnumerable<SyntaxToken>> DescendantTokensIgnoringLambdaBodies { get; }
451var isLambda = IsLambda;
1273out var runtimeRudeEdits,
1300var matchingNodes =
2007Func<SyntaxNode, bool> nodeSelector,
2008Func<TSyntaxNode, OneOrMany<SyntaxNode>> getTypedNodes,
2076Func<TSyntaxNode, OneOrMany<SyntaxNode>> getTypedNodes,
2182private static List<SyntaxNode?>? GetAncestors(SyntaxNode? root, SyntaxNode node, Func<SyntaxNode, bool> nodeSelector)
5426private static Func<SyntaxNode, SyntaxNode?> CreateSyntaxMapForEquivalentNodes(MemberBody oldBody, MemberBody newBody)
5434private static Func<SyntaxNode, SyntaxNode?> CreateSyntaxMap(DeclarationBodyMap bodyMap)
5720private bool AnyMemberInitializerBody(INamedTypeSymbol type, Func<MemberBody, bool> predicate, bool isStatic, CancellationToken cancellationToken)
5788out Func<SyntaxNode, RuntimeRudeEdit?>? runtimeRudeEdits,
6358protected abstract SyntaxNode? GetSymbolDeclarationSyntax(ISymbol symbol, Func<ImmutableArray<SyntaxReference>, SyntaxReference?> selector, CancellationToken cancellationToken);
NavigateTo\NavigateToSearcher.cs (3)
350Func<INavigateToSearchService, ImmutableArray<Project>, Func<ImmutableArray<INavigateToSearchResult>, Task>, Func<Task>, Task> processProjectAsync,
532public Task SearchDocumentAsync(Document document, string searchPattern, IImmutableSet<string> kinds, Func<ImmutableArray<INavigateToSearchResult>, Task> onResultsFound, CancellationToken cancellationToken)
535public async Task SearchProjectsAsync(Solution solution, ImmutableArray<Project> projects, ImmutableArray<Document> priorityDocuments, string searchPattern, IImmutableSet<string> kinds, Document? activeDocument, Func<ImmutableArray<INavigateToSearchResult>, Task> onResultsFound, Func<Task> onProjectCompleted, CancellationToken cancellationToken)
SignatureHelp\CommonSignatureHelpUtilities.cs (10)
26Func<TArgumentList, SyntaxToken> getOpenToken,
27Func<TArgumentList, SyntaxToken> getCloseToken,
28Func<TArgumentList, SyntaxNodeOrTokenList> getArgumentsWithSeparators,
29Func<TArgumentList, IEnumerable<string?>> getArgumentNames)
50Func<TArgumentList, SyntaxToken> getOpenToken,
51Func<TArgumentList, SyntaxToken> getCloseToken,
52Func<TArgumentList, SyntaxNodeOrTokenList> getArgumentsWithSeparators,
74Func<TArgumentList, SyntaxToken> getCloseToken)
83Func<TArgumentList, SyntaxToken> getCloseToken)
108Func<SyntaxToken, bool> isTriggerToken,
SignatureHelp\SignatureHelpParameter.cs (7)
21Func<CancellationToken, IEnumerable<TaggedText>>? documentationFactory,
36public Func<CancellationToken, IEnumerable<TaggedText>> DocumentationFactory { get; } = documentationFactory ?? s_emptyDocumentationFactory;
66private static readonly Func<CancellationToken, IEnumerable<TaggedText>> s_emptyDocumentationFactory = _ => [];
85Func<CancellationToken, IEnumerable<TaggedText>>? documentationFactory,
100public Func<CancellationToken, IEnumerable<TaggedText>> DocumentationFactory { get; } = documentationFactory ?? s_emptyDocumentationFactory;
130private static readonly Func<CancellationToken, IEnumerable<TaggedText>> s_emptyDocumentationFactory = _ => [];
136Func<CancellationToken, IEnumerable<SymbolDisplayPart>>? documentationFactory,
Microsoft.CodeAnalysis.Features.Test.Utilities (11)
Microsoft.CodeAnalysis.Features.UnitTests (1)
Microsoft.CodeAnalysis.InteractiveHost (127)
src\Compilers\Core\Portable\FileSystem\FileUtilities.cs (4)
47Func<string, bool> fileExists)
322public static T RethrowExceptionsAsIOException<T, TArg>(Func<TArg, T> operation, TArg arg)
339public static async Task<T> RethrowExceptionsAsIOExceptionAsync<T, TArg>(Func<TArg, Task<T>> operation, TArg arg)
355internal static Stream CreateFileStreamChecked(Func<string, Stream> factory, string path, string? paramName = null)
src\Dependencies\Collections\Extensions\IEnumerableExtensions.cs (30)
164public static T? FirstOrNull<T>(this IEnumerable<T> source, Func<T, bool> predicate)
182public static T? SingleOrNull<T>(this IEnumerable<T> source, Func<T, bool> predicate)
261public static bool HasDuplicates<TItem, TValue>(this IEnumerable<TItem> source, Func<TItem, TValue> selector)
271/// <seealso cref="Microsoft.CodeAnalysis.ImmutableArrayExtensions.HasDuplicates{TItem, TValue}(ImmutableArray{TItem}, Func{TItem, TValue}, IEqualityComparer{TValue})"/>
273public static bool HasDuplicates<TItem, TValue>(this IEnumerable<TItem> source, Func<TItem, TValue> selector, IEqualityComparer<TValue> comparer)
321private static readonly Func<object, bool> s_notNullTest = x => x != null;
331return source.Where((Func<T?, bool>)s_notNullTest)!;
376public static ImmutableArray<T> WhereAsArray<T>(this IEnumerable<T> values, Func<T, bool> predicate)
407public static ImmutableArray<TResult> SelectAsArray<TSource, TResult>(this IEnumerable<TSource>? source, Func<TSource, TResult> selector)
417public static ImmutableArray<TResult> SelectAsArray<TItem, TResult>(this IEnumerable<TItem>? source, Func<TItem, bool> predicate, Func<TItem, TResult> selector)
461public static ImmutableArray<TResult> SelectAsArray<TSource, TResult>(this IReadOnlyCollection<TSource>? source, Func<TSource, TResult> selector)
485public static ImmutableArray<TResult> SelectManyAsArray<TSource, TResult>(this IEnumerable<TSource>? source, Func<TSource, IEnumerable<TResult>> selector)
507public static ImmutableArray<TResult> SelectManyAsArray<TItem, TResult>(this IReadOnlyCollection<TItem>? source, Func<TItem, IEnumerable<TResult>> selector)
533public static ImmutableArray<TResult> SelectManyAsArray<TSource, TResult>(this IEnumerable<TSource>? source, Func<TSource, OneOrMany<TResult>> selector)
547public static async ValueTask<ImmutableArray<TResult>> SelectAsArrayAsync<TItem, TResult>(this IEnumerable<TItem> source, Func<TItem, ValueTask<TResult>> selector)
764internal static Dictionary<K, ImmutableArray<T>> ToMultiDictionary<K, T>(this IEnumerable<T> data, Func<T, K> keySelector, IEqualityComparer<K>? comparer = null)
815public static readonly Func<T, T> Identity = t => t;
816public static readonly Func<T, bool> True = t => true;
840/// Alias for <see cref="System.Linq.Enumerable.Any{TSource}(IEnumerable{TSource}, Func{TSource, bool})"/>
842public static bool Contains<T>(this IEnumerable<T> sequence, Func<T, bool> predicate)
846/// Variant of <see cref="System.Linq.Enumerable.Count{TSource}(IEnumerable{TSource}, Func{TSource, bool})"/>
861/// Variant of <see cref="System.Linq.Enumerable.FirstOrDefault{TSource}(IEnumerable{TSource}, Func{TSource, bool})"/>
875/// Variant of <see cref="System.Linq.Enumerable.Any{TSource}(IEnumerable{TSource}, Func{TSource, bool})"/>
889/// Variant of <see cref="System.Linq.Enumerable.OrderBy{TSource, TKey}(IEnumerable{TSource}, Func{TSource, TKey}, IComparer{TKey}?)"/>
895/// Variant of <see cref="System.Linq.Enumerable.OrderByDescending{TSource, TKey}(IEnumerable{TSource}, Func{TSource, TKey}, IComparer{TKey}?)"/>
901/// Variant of <see cref="System.Linq.Enumerable.OrderBy{TSource, TKey}(IEnumerable{TSource}, Func{TSource, TKey}, IComparer{TKey}?)"/>
907/// Variant of <see cref="System.Linq.Enumerable.OrderByDescending{TSource, TKey}(IEnumerable{TSource}, Func{TSource, TKey}, IComparer{TKey}?)"/>
913/// Variant of <see cref="System.Linq.Enumerable.ThenBy{TSource, TKey}(IOrderedEnumerable{TSource}, Func{TSource, TKey}, IComparer{TKey}?)"/>
919/// Variant of <see cref="System.Linq.Enumerable.ThenBy{TSource, TKey}(IOrderedEnumerable{TSource}, Func{TSource, TKey}, IComparer{TKey}?)"/>
src\Dependencies\Collections\Extensions\IListExtensions.cs (4)
21public static bool HasDuplicates<TItem, TValue>(this IReadOnlyList<TItem> list, Func<TItem, TValue> selector)
31/// <seealso cref="ImmutableArrayExtensions.HasDuplicates{TItem, TValue}(System.Collections.Immutable.ImmutableArray{TItem}, Func{TItem, TValue}, IEqualityComparer{TValue})"/>
32/// <seealso cref="Roslyn.Utilities.EnumerableExtensions.HasDuplicates{TItem, TValue}(IEnumerable{TItem}, Func{TItem, TValue}, IEqualityComparer{TValue})"/>
34internal static bool HasDuplicates<TItem, TValue>(this IReadOnlyList<TItem> list, Func<TItem, TValue> selector, IEqualityComparer<TValue> comparer)
src\Dependencies\Collections\Extensions\ImmutableArrayExtensions.cs (27)
138public static ImmutableArray<TResult> SelectAsArray<TItem, TResult>(this ImmutableArray<TItem> items, Func<TItem, TResult> map)
198public static ImmutableArray<TResult> SelectAsArray<TItem, TResult>(this ImmutableArray<TItem> array, Func<TItem, bool> predicate, Func<TItem, TResult> selector)
247public static ImmutableArray<TResult> SelectManyAsArray<TItem, TResult>(this ImmutableArray<TItem> array, Func<TItem, IEnumerable<TResult>> selector)
267public static ImmutableArray<TResult> SelectManyAsArray<TItem, TResult>(this ImmutableArray<TItem> array, Func<TItem, ImmutableArray<TResult>> selector)
287public static ImmutableArray<TResult> SelectManyAsArray<TItem, TResult>(this ImmutableArray<TItem> array, Func<TItem, OneOrMany<TResult>> selector)
308public static ImmutableArray<TResult> SelectManyAsArray<TItem, TResult>(this ImmutableArray<TItem> array, Func<TItem, bool> predicate, Func<TItem, IEnumerable<TResult>> selector)
332public static ImmutableArray<TResult> SelectManyAsArray<TItem, TResult>(this ImmutableArray<TItem> array, Func<TItem, bool> predicate, Func<TItem, ImmutableArray<TResult>> selector)
356public static ImmutableArray<TResult> SelectManyAsArray<TItem, TResult>(this ImmutableArray<TItem> array, Func<TItem, bool> predicate, Func<TItem, OneOrMany<TResult>> selector)
493public static ImmutableArray<T> WhereAsArray<T>(this ImmutableArray<T> array, Func<T, bool> predicate)
504private static ImmutableArray<T> WhereAsArrayImpl<T, TArg>(ImmutableArray<T> array, Func<T, bool>? predicateWithoutArg, Func<T, TArg, bool>? predicateWithArg, TArg arg)
573public static async Task<bool> AnyAsync<T>(this ImmutableArray<T> array, Func<T, Task<bool>> predicateAsync)
595public static async ValueTask<T?> FirstOrDefaultAsync<T>(this ImmutableArray<T> array, Func<T, Task<bool>> predicateAsync)
757public static bool HasDuplicates<TItem, TValue>(this ImmutableArray<TItem> array, Func<TItem, TValue> selector)
767/// <seealso cref="Roslyn.Utilities.EnumerableExtensions.HasDuplicates{TItem, TValue}(IEnumerable{TItem}, Func{TItem, TValue}, IEqualityComparer{TValue})"/>
769internal static bool HasDuplicates<TItem, TValue>(this ImmutableArray<TItem> array, Func<TItem, TValue> selector, IEqualityComparer<TValue> comparer)
990/// Variant of <see cref="System.Linq.ImmutableArrayExtensions.FirstOrDefault{T}(ImmutableArray{T}, Func{T, bool})"/>
1004/// Variant of <see cref="System.Linq.ImmutableArrayExtensions.Single{T}(ImmutableArray{T}, Func{T, bool})"/>
1066/// Specialization of <see cref="System.Linq.Enumerable.Count{TSource}(IEnumerable{TSource}, Func{TSource, bool})"/> for <see cref="ImmutableArray{T}"/>.
1068public static int Count<T>(this ImmutableArray<T> items, Func<T, bool> predicate)
1086public static int Sum<T>(this ImmutableArray<T> items, Func<T, int> selector)
1213/// Variant of <see cref="System.Linq.ImmutableArrayExtensions.Any{T}(ImmutableArray{T}, Func{T, bool})"/>.
1227/// Variant of <see cref="System.Linq.ImmutableArrayExtensions.All{T}(ImmutableArray{T}, Func{T, bool})"/>.
1257public static bool Contains<T>(this ImmutableArray<T> array, Func<T, bool> predicate)
src\Dependencies\Collections\RoslynImmutableInterlocked.cs (7)
33public static bool Update<T>(ref ImmutableSegmentedList<T> location, Func<ImmutableSegmentedList<T>, ImmutableSegmentedList<T>> transformer)
154public static bool Update<T>(ref ImmutableSegmentedHashSet<T> location, Func<ImmutableSegmentedHashSet<T>, ImmutableSegmentedHashSet<T>> transformer)
276public static bool Update<TKey, TValue>(ref ImmutableSegmentedDictionary<TKey, TValue> location, Func<ImmutableSegmentedDictionary<TKey, TValue>, ImmutableSegmentedDictionary<TKey, TValue>> transformer)
410/// <inheritdoc cref="ImmutableInterlocked.GetOrAdd{TKey, TValue}(ref ImmutableDictionary{TKey, TValue}, TKey, Func{TKey, TValue})"/>
411public static TValue GetOrAdd<TKey, TValue>(ref ImmutableSegmentedDictionary<TKey, TValue> location, TKey key, Func<TKey, TValue> valueFactory)
458/// <inheritdoc cref="ImmutableInterlocked.AddOrUpdate{TKey, TValue}(ref ImmutableDictionary{TKey, TValue}, TKey, Func{TKey, TValue}, Func{TKey, TValue, TValue})"/>
459public static TValue AddOrUpdate<TKey, TValue>(ref ImmutableSegmentedDictionary<TKey, TValue> location, TKey key, Func<TKey, TValue> addValueFactory, Func<TKey, TValue, TValue> updateValueFactory)
src\Dependencies\Collections\Segmented\ImmutableSegmentedDictionary.cs (6)
68public static ImmutableSegmentedDictionary<TKey, TValue> ToImmutableSegmentedDictionary<TSource, TKey, TValue>(this IEnumerable<TSource> source, Func<TSource, TKey> keySelector, Func<TSource, TValue> elementSelector)
72public static ImmutableSegmentedDictionary<TKey, TValue> ToImmutableSegmentedDictionary<TSource, TKey, TValue>(this IEnumerable<TSource> source, Func<TSource, TKey> keySelector, Func<TSource, TValue> elementSelector, IEqualityComparer<TKey>? keyComparer)
86public static ImmutableSegmentedDictionary<TKey, TSource> ToImmutableSegmentedDictionary<TSource, TKey>(this IEnumerable<TSource> source, Func<TSource, TKey> keySelector)
90public static ImmutableSegmentedDictionary<TKey, TSource> ToImmutableSegmentedDictionary<TSource, TKey>(this IEnumerable<TSource> source, Func<TSource, TKey> keySelector, IEqualityComparer<TKey>? keyComparer)
src\Dependencies\PooledObjects\ArrayBuilder.cs (7)
457public void FreeAll(Func<T, ArrayBuilder<T>?> getNested)
560internal Dictionary<K, ImmutableArray<T>> ToDictionary<K>(Func<T, K> keySelector, IEqualityComparer<K>? comparer = null)
608public void AddRange<U>(ArrayBuilder<U> items, Func<U, T> selector)
745public ImmutableArray<S> SelectDistinct<S>(Func<T, S> selector)
763public bool Any(Func<T, bool> predicate)
787public bool All(Func<T, bool> predicate)
817public ImmutableArray<TResult> SelectAsArray<TResult>(Func<T, TResult> map)
src\Dependencies\PooledObjects\PooledDelegates.cs (9)
200public static Releaser GetPooledFunction<TArg, TResult>(Func<TArg, TResult> unboundFunction, TArg argument, out Func<TResult> boundFunction)
201=> GetPooledDelegate<FuncWithBoundArgument<TArg, TResult>, TArg, Func<TArg, TResult>, Func<TResult>>(unboundFunction, argument, out boundFunction);
204/// Equivalent to <see cref="GetPooledFunction{TArg, TResult}(Func{TArg, TResult}, TArg, out Func{TResult})"/>,
216/// Gets a <see cref="Func{T, TResult}"/> delegate, which calls <paramref name="unboundFunction"/> with the
246public static Releaser GetPooledFunction<T1, TArg, TResult>(Func<T1, TArg, TResult> unboundFunction, TArg argument, out Func<T1, TResult> boundFunction)
247=> GetPooledDelegate<FuncWithBoundArgument<T1, TArg, TResult>, TArg, Func<T1, TArg, TResult>, Func<T1, TResult>>(unboundFunction, argument, out boundFunction);
412: AbstractDelegateWithBoundArgument<FuncWithBoundArgument<TArg, TResult>, TArg, Func<TArg, TResult>, Func<TResult>>
432: AbstractDelegateWithBoundArgument<FuncWithBoundArgument<T1, TArg, TResult>, TArg, Func<T1, TArg, TResult>, Func<T1, TResult>>
434protected override Func<T1, TResult> Bind()
src\Dependencies\Threading\ParallelExtensions.NetFramework.cs (7)
122Func<object, Task> taskBody = static async o =>
287Func<object, Task> taskBody = static async o =>
395private readonly Func<object, Task> _taskBody;
418protected ForEachAsyncState(Func<object, Task> taskBody, bool needsLock, int dop, TaskScheduler scheduler, CancellationToken cancellationToken, Func<TSource, CancellationToken, ValueTask> body)
584IEnumerable<TSource> source, Func<object, Task> taskBody,
610IAsyncEnumerable<TSource> source, Func<object, Task> taskBody,
637T fromExclusive, T toExclusive, Func<object, Task> taskBody,
Microsoft.CodeAnalysis.LanguageServer.Protocol (26)
Protocol\SumType.cs (9)
154public TResult Match<TResult>(Func<T1, TResult> firstMatch, Func<T2, TResult> secondMatch, Func<TResult>? defaultMatch = null)
427public TResult Match<TResult>(Func<T1, TResult> firstMatch, Func<T2, TResult> secondMatch, Func<T3, TResult> thirdMatch, Func<TResult>? defaultMatch = null)
798public TResult Match<TResult>(Func<T1, TResult> firstMatch, Func<T2, TResult> secondMatch, Func<T3, TResult> thirdMatch, Func<T4, TResult> fourthMatch, Func<TResult>? defaultMatch = null)
Microsoft.CodeAnalysis.PerformanceSensitiveAnalyzers (442)
Microsoft.CodeAnalysis.PooledObjects.Package (20)
ArrayBuilder.cs (7)
457public void FreeAll(Func<T, ArrayBuilder<T>?> getNested)
560internal Dictionary<K, ImmutableArray<T>> ToDictionary<K>(Func<T, K> keySelector, IEqualityComparer<K>? comparer = null)
608public void AddRange<U>(ArrayBuilder<U> items, Func<U, T> selector)
745public ImmutableArray<S> SelectDistinct<S>(Func<T, S> selector)
763public bool Any(Func<T, bool> predicate)
787public bool All(Func<T, bool> predicate)
817public ImmutableArray<TResult> SelectAsArray<TResult>(Func<T, TResult> map)
PooledDelegates.cs (9)
200public static Releaser GetPooledFunction<TArg, TResult>(Func<TArg, TResult> unboundFunction, TArg argument, out Func<TResult> boundFunction)
201=> GetPooledDelegate<FuncWithBoundArgument<TArg, TResult>, TArg, Func<TArg, TResult>, Func<TResult>>(unboundFunction, argument, out boundFunction);
204/// Equivalent to <see cref="GetPooledFunction{TArg, TResult}(Func{TArg, TResult}, TArg, out Func{TResult})"/>,
216/// Gets a <see cref="Func{T, TResult}"/> delegate, which calls <paramref name="unboundFunction"/> with the
246public static Releaser GetPooledFunction<T1, TArg, TResult>(Func<T1, TArg, TResult> unboundFunction, TArg argument, out Func<T1, TResult> boundFunction)
247=> GetPooledDelegate<FuncWithBoundArgument<T1, TArg, TResult>, TArg, Func<T1, TArg, TResult>, Func<T1, TResult>>(unboundFunction, argument, out boundFunction);
412: AbstractDelegateWithBoundArgument<FuncWithBoundArgument<TArg, TResult>, TArg, Func<TArg, TResult>, Func<TResult>>
432: AbstractDelegateWithBoundArgument<FuncWithBoundArgument<T1, TArg, TResult>, TArg, Func<T1, TArg, TResult>, Func<T1, TResult>>
434protected override Func<T1, TResult> Bind()
Microsoft.CodeAnalysis.PublicApiAnalyzers (408)
src\Compilers\Core\Portable\FileSystem\FileUtilities.cs (4)
47Func<string, bool> fileExists)
322public static T RethrowExceptionsAsIOException<T, TArg>(Func<TArg, T> operation, TArg arg)
339public static async Task<T> RethrowExceptionsAsIOExceptionAsync<T, TArg>(Func<TArg, Task<T>> operation, TArg arg)
355internal static Stream CreateFileStreamChecked(Func<string, Stream> factory, string path, string? paramName = null)
src\Compilers\Core\Portable\InternalUtilities\InterlockedOperations.cs (5)
46public static T Initialize<T, TArg>([NotNull] ref T? target, Func<TArg, T> valueFactory, TArg arg)
66public static int Initialize<TArg>(ref int target, int uninitializedValue, Func<TArg, int> valueFactory, TArg arg)
103public static T? Initialize<T, TArg>([NotNull] ref StrongBox<T?>? target, Func<TArg, T?> valueFactory, TArg arg)
183public static ImmutableArray<T> Initialize<T, TArg>(ref ImmutableArray<T> target, Func<TArg, ImmutableArray<T>> createArray, TArg arg)
193private static ImmutableArray<T> Initialize_Slow<T, TArg>(ref ImmutableArray<T> target, Func<TArg, ImmutableArray<T>> createArray, TArg arg)
src\Compilers\Core\Portable\SourceGeneration\GeneratedCodeUtilities.cs (4)
49SyntaxTree tree, Func<SyntaxTrivia, bool> isComment, CancellationToken cancellationToken)
55internal static bool IsGeneratedCode(string? filePath, SyntaxNode root, Func<SyntaxTrivia, bool> isComment)
88private static bool BeginsWithAutoGeneratedComment(SyntaxNode root, Func<SyntaxTrivia, bool> isComment)
118SyntaxTree tree, Func<SyntaxTrivia, bool> isComment, CancellationToken cancellationToken)
src\Dependencies\Collections\Extensions\IEnumerableExtensions.cs (30)
164public static T? FirstOrNull<T>(this IEnumerable<T> source, Func<T, bool> predicate)
182public static T? SingleOrNull<T>(this IEnumerable<T> source, Func<T, bool> predicate)
261public static bool HasDuplicates<TItem, TValue>(this IEnumerable<TItem> source, Func<TItem, TValue> selector)
271/// <seealso cref="Microsoft.CodeAnalysis.ImmutableArrayExtensions.HasDuplicates{TItem, TValue}(ImmutableArray{TItem}, Func{TItem, TValue}, IEqualityComparer{TValue})"/>
273public static bool HasDuplicates<TItem, TValue>(this IEnumerable<TItem> source, Func<TItem, TValue> selector, IEqualityComparer<TValue> comparer)
321private static readonly Func<object, bool> s_notNullTest = x => x != null;
331return source.Where((Func<T?, bool>)s_notNullTest)!;
376public static ImmutableArray<T> WhereAsArray<T>(this IEnumerable<T> values, Func<T, bool> predicate)
407public static ImmutableArray<TResult> SelectAsArray<TSource, TResult>(this IEnumerable<TSource>? source, Func<TSource, TResult> selector)
417public static ImmutableArray<TResult> SelectAsArray<TItem, TResult>(this IEnumerable<TItem>? source, Func<TItem, bool> predicate, Func<TItem, TResult> selector)
461public static ImmutableArray<TResult> SelectAsArray<TSource, TResult>(this IReadOnlyCollection<TSource>? source, Func<TSource, TResult> selector)
485public static ImmutableArray<TResult> SelectManyAsArray<TSource, TResult>(this IEnumerable<TSource>? source, Func<TSource, IEnumerable<TResult>> selector)
507public static ImmutableArray<TResult> SelectManyAsArray<TItem, TResult>(this IReadOnlyCollection<TItem>? source, Func<TItem, IEnumerable<TResult>> selector)
533public static ImmutableArray<TResult> SelectManyAsArray<TSource, TResult>(this IEnumerable<TSource>? source, Func<TSource, OneOrMany<TResult>> selector)
547public static async ValueTask<ImmutableArray<TResult>> SelectAsArrayAsync<TItem, TResult>(this IEnumerable<TItem> source, Func<TItem, ValueTask<TResult>> selector)
764internal static Dictionary<K, ImmutableArray<T>> ToMultiDictionary<K, T>(this IEnumerable<T> data, Func<T, K> keySelector, IEqualityComparer<K>? comparer = null)
815public static readonly Func<T, T> Identity = t => t;
816public static readonly Func<T, bool> True = t => true;
840/// Alias for <see cref="System.Linq.Enumerable.Any{TSource}(IEnumerable{TSource}, Func{TSource, bool})"/>
842public static bool Contains<T>(this IEnumerable<T> sequence, Func<T, bool> predicate)
846/// Variant of <see cref="System.Linq.Enumerable.Count{TSource}(IEnumerable{TSource}, Func{TSource, bool})"/>
861/// Variant of <see cref="System.Linq.Enumerable.FirstOrDefault{TSource}(IEnumerable{TSource}, Func{TSource, bool})"/>
875/// Variant of <see cref="System.Linq.Enumerable.Any{TSource}(IEnumerable{TSource}, Func{TSource, bool})"/>
889/// Variant of <see cref="System.Linq.Enumerable.OrderBy{TSource, TKey}(IEnumerable{TSource}, Func{TSource, TKey}, IComparer{TKey}?)"/>
895/// Variant of <see cref="System.Linq.Enumerable.OrderByDescending{TSource, TKey}(IEnumerable{TSource}, Func{TSource, TKey}, IComparer{TKey}?)"/>
901/// Variant of <see cref="System.Linq.Enumerable.OrderBy{TSource, TKey}(IEnumerable{TSource}, Func{TSource, TKey}, IComparer{TKey}?)"/>
907/// Variant of <see cref="System.Linq.Enumerable.OrderByDescending{TSource, TKey}(IEnumerable{TSource}, Func{TSource, TKey}, IComparer{TKey}?)"/>
913/// Variant of <see cref="System.Linq.Enumerable.ThenBy{TSource, TKey}(IOrderedEnumerable{TSource}, Func{TSource, TKey}, IComparer{TKey}?)"/>
919/// Variant of <see cref="System.Linq.Enumerable.ThenBy{TSource, TKey}(IOrderedEnumerable{TSource}, Func{TSource, TKey}, IComparer{TKey}?)"/>
src\Dependencies\Collections\Extensions\IListExtensions.cs (4)
21public static bool HasDuplicates<TItem, TValue>(this IReadOnlyList<TItem> list, Func<TItem, TValue> selector)
31/// <seealso cref="ImmutableArrayExtensions.HasDuplicates{TItem, TValue}(System.Collections.Immutable.ImmutableArray{TItem}, Func{TItem, TValue}, IEqualityComparer{TValue})"/>
32/// <seealso cref="Roslyn.Utilities.EnumerableExtensions.HasDuplicates{TItem, TValue}(IEnumerable{TItem}, Func{TItem, TValue}, IEqualityComparer{TValue})"/>
34internal static bool HasDuplicates<TItem, TValue>(this IReadOnlyList<TItem> list, Func<TItem, TValue> selector, IEqualityComparer<TValue> comparer)
src\Dependencies\Collections\Extensions\ImmutableArrayExtensions.cs (27)
138public static ImmutableArray<TResult> SelectAsArray<TItem, TResult>(this ImmutableArray<TItem> items, Func<TItem, TResult> map)
198public static ImmutableArray<TResult> SelectAsArray<TItem, TResult>(this ImmutableArray<TItem> array, Func<TItem, bool> predicate, Func<TItem, TResult> selector)
247public static ImmutableArray<TResult> SelectManyAsArray<TItem, TResult>(this ImmutableArray<TItem> array, Func<TItem, IEnumerable<TResult>> selector)
267public static ImmutableArray<TResult> SelectManyAsArray<TItem, TResult>(this ImmutableArray<TItem> array, Func<TItem, ImmutableArray<TResult>> selector)
287public static ImmutableArray<TResult> SelectManyAsArray<TItem, TResult>(this ImmutableArray<TItem> array, Func<TItem, OneOrMany<TResult>> selector)
308public static ImmutableArray<TResult> SelectManyAsArray<TItem, TResult>(this ImmutableArray<TItem> array, Func<TItem, bool> predicate, Func<TItem, IEnumerable<TResult>> selector)
332public static ImmutableArray<TResult> SelectManyAsArray<TItem, TResult>(this ImmutableArray<TItem> array, Func<TItem, bool> predicate, Func<TItem, ImmutableArray<TResult>> selector)
356public static ImmutableArray<TResult> SelectManyAsArray<TItem, TResult>(this ImmutableArray<TItem> array, Func<TItem, bool> predicate, Func<TItem, OneOrMany<TResult>> selector)
493public static ImmutableArray<T> WhereAsArray<T>(this ImmutableArray<T> array, Func<T, bool> predicate)
504private static ImmutableArray<T> WhereAsArrayImpl<T, TArg>(ImmutableArray<T> array, Func<T, bool>? predicateWithoutArg, Func<T, TArg, bool>? predicateWithArg, TArg arg)
573public static async Task<bool> AnyAsync<T>(this ImmutableArray<T> array, Func<T, Task<bool>> predicateAsync)
595public static async ValueTask<T?> FirstOrDefaultAsync<T>(this ImmutableArray<T> array, Func<T, Task<bool>> predicateAsync)
757public static bool HasDuplicates<TItem, TValue>(this ImmutableArray<TItem> array, Func<TItem, TValue> selector)
767/// <seealso cref="Roslyn.Utilities.EnumerableExtensions.HasDuplicates{TItem, TValue}(IEnumerable{TItem}, Func{TItem, TValue}, IEqualityComparer{TValue})"/>
769internal static bool HasDuplicates<TItem, TValue>(this ImmutableArray<TItem> array, Func<TItem, TValue> selector, IEqualityComparer<TValue> comparer)
990/// Variant of <see cref="System.Linq.ImmutableArrayExtensions.FirstOrDefault{T}(ImmutableArray{T}, Func{T, bool})"/>
1004/// Variant of <see cref="System.Linq.ImmutableArrayExtensions.Single{T}(ImmutableArray{T}, Func{T, bool})"/>
1066/// Specialization of <see cref="System.Linq.Enumerable.Count{TSource}(IEnumerable{TSource}, Func{TSource, bool})"/> for <see cref="ImmutableArray{T}"/>.
1068public static int Count<T>(this ImmutableArray<T> items, Func<T, bool> predicate)
1086public static int Sum<T>(this ImmutableArray<T> items, Func<T, int> selector)
1213/// Variant of <see cref="System.Linq.ImmutableArrayExtensions.Any{T}(ImmutableArray{T}, Func{T, bool})"/>.
1227/// Variant of <see cref="System.Linq.ImmutableArrayExtensions.All{T}(ImmutableArray{T}, Func{T, bool})"/>.
1257public static bool Contains<T>(this ImmutableArray<T> array, Func<T, bool> predicate)
src\Dependencies\Collections\RoslynImmutableInterlocked.cs (7)
33public static bool Update<T>(ref ImmutableSegmentedList<T> location, Func<ImmutableSegmentedList<T>, ImmutableSegmentedList<T>> transformer)
154public static bool Update<T>(ref ImmutableSegmentedHashSet<T> location, Func<ImmutableSegmentedHashSet<T>, ImmutableSegmentedHashSet<T>> transformer)
276public static bool Update<TKey, TValue>(ref ImmutableSegmentedDictionary<TKey, TValue> location, Func<ImmutableSegmentedDictionary<TKey, TValue>, ImmutableSegmentedDictionary<TKey, TValue>> transformer)
410/// <inheritdoc cref="ImmutableInterlocked.GetOrAdd{TKey, TValue}(ref ImmutableDictionary{TKey, TValue}, TKey, Func{TKey, TValue})"/>
411public static TValue GetOrAdd<TKey, TValue>(ref ImmutableSegmentedDictionary<TKey, TValue> location, TKey key, Func<TKey, TValue> valueFactory)
458/// <inheritdoc cref="ImmutableInterlocked.AddOrUpdate{TKey, TValue}(ref ImmutableDictionary{TKey, TValue}, TKey, Func{TKey, TValue}, Func{TKey, TValue, TValue})"/>
459public static TValue AddOrUpdate<TKey, TValue>(ref ImmutableSegmentedDictionary<TKey, TValue> location, TKey key, Func<TKey, TValue> addValueFactory, Func<TKey, TValue, TValue> updateValueFactory)
src\Dependencies\Collections\Segmented\ImmutableSegmentedDictionary.cs (6)
68public static ImmutableSegmentedDictionary<TKey, TValue> ToImmutableSegmentedDictionary<TSource, TKey, TValue>(this IEnumerable<TSource> source, Func<TSource, TKey> keySelector, Func<TSource, TValue> elementSelector)
72public static ImmutableSegmentedDictionary<TKey, TValue> ToImmutableSegmentedDictionary<TSource, TKey, TValue>(this IEnumerable<TSource> source, Func<TSource, TKey> keySelector, Func<TSource, TValue> elementSelector, IEqualityComparer<TKey>? keyComparer)
86public static ImmutableSegmentedDictionary<TKey, TSource> ToImmutableSegmentedDictionary<TSource, TKey>(this IEnumerable<TSource> source, Func<TSource, TKey> keySelector)
90public static ImmutableSegmentedDictionary<TKey, TSource> ToImmutableSegmentedDictionary<TSource, TKey>(this IEnumerable<TSource> source, Func<TSource, TKey> keySelector, IEqualityComparer<TKey>? keyComparer)
src\Dependencies\PooledObjects\ArrayBuilder.cs (7)
457public void FreeAll(Func<T, ArrayBuilder<T>?> getNested)
560internal Dictionary<K, ImmutableArray<T>> ToDictionary<K>(Func<T, K> keySelector, IEqualityComparer<K>? comparer = null)
608public void AddRange<U>(ArrayBuilder<U> items, Func<U, T> selector)
745public ImmutableArray<S> SelectDistinct<S>(Func<T, S> selector)
763public bool Any(Func<T, bool> predicate)
787public bool All(Func<T, bool> predicate)
817public ImmutableArray<TResult> SelectAsArray<TResult>(Func<T, TResult> map)
src\Dependencies\PooledObjects\PooledDelegates.cs (9)
200public static Releaser GetPooledFunction<TArg, TResult>(Func<TArg, TResult> unboundFunction, TArg argument, out Func<TResult> boundFunction)
201=> GetPooledDelegate<FuncWithBoundArgument<TArg, TResult>, TArg, Func<TArg, TResult>, Func<TResult>>(unboundFunction, argument, out boundFunction);
204/// Equivalent to <see cref="GetPooledFunction{TArg, TResult}(Func{TArg, TResult}, TArg, out Func{TResult})"/>,
216/// Gets a <see cref="Func{T, TResult}"/> delegate, which calls <paramref name="unboundFunction"/> with the
246public static Releaser GetPooledFunction<T1, TArg, TResult>(Func<T1, TArg, TResult> unboundFunction, TArg argument, out Func<T1, TResult> boundFunction)
247=> GetPooledDelegate<FuncWithBoundArgument<T1, TArg, TResult>, TArg, Func<T1, TArg, TResult>, Func<T1, TResult>>(unboundFunction, argument, out boundFunction);
412: AbstractDelegateWithBoundArgument<FuncWithBoundArgument<TArg, TResult>, TArg, Func<TArg, TResult>, Func<TResult>>
432: AbstractDelegateWithBoundArgument<FuncWithBoundArgument<T1, TArg, TResult>, TArg, Func<T1, TArg, TResult>, Func<T1, TResult>>
434protected override Func<T1, TResult> Bind()
src\Dependencies\Threading\ParallelExtensions.NetFramework.cs (7)
122Func<object, Task> taskBody = static async o =>
287Func<object, Task> taskBody = static async o =>
395private readonly Func<object, Task> _taskBody;
418protected ForEachAsyncState(Func<object, Task> taskBody, bool needsLock, int dop, TaskScheduler scheduler, CancellationToken cancellationToken, Func<TSource, CancellationToken, ValueTask> body)
584IEnumerable<TSource> source, Func<object, Task> taskBody,
610IAsyncEnumerable<TSource> source, Func<object, Task> taskBody,
637T fromExclusive, T toExclusive, Func<object, Task> taskBody,
src\RoslynAnalyzers\Utilities\Compiler\Lightup\LightupHelpers.cs (6)
19internal static Func<TOperation, TProperty> CreateOperationPropertyAccessor<TOperation, TProperty>(Type? type, string propertyName, TProperty fallbackResult)
23internal static Func<TSyntax, TProperty> CreateSyntaxPropertyAccessor<TSyntax, TProperty>(Type? type, string propertyName, TProperty fallbackResult)
27internal static Func<TSymbol, TProperty> CreateSymbolPropertyAccessor<TSymbol, TProperty>(Type? type, string propertyName, TProperty fallbackResult)
31private static Func<T, TProperty> CreatePropertyAccessor<T, TProperty>(Type? type, string parameterName, string propertyName, TProperty fallbackResult)
50Expression<Func<T, TProperty>> expression = Expression.Lambda<Func<T, TProperty>>(result, parameter);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\ObjectExtensions.TypeSwitch.cs (161)
11public static TResult? TypeSwitch<TBaseType, TDerivedType1, TDerivedType2, TDerivedType3, TResult>(this TBaseType obj, Func<TDerivedType1, TResult> matchFunc1, Func<TDerivedType2, TResult> matchFunc2, Func<TDerivedType3, TResult> matchFunc3, Func<TBaseType, TResult>? defaultFunc = null)
25public static TResult? TypeSwitch<TBaseType, TDerivedType1, TDerivedType2, TDerivedType3, TDerivedType4, TResult>(this TBaseType obj, Func<TDerivedType1, TResult> matchFunc1, Func<TDerivedType2, TResult> matchFunc2, Func<TDerivedType3, TResult> matchFunc3, Func<TDerivedType4, TResult> matchFunc4, Func<TBaseType, TResult>? defaultFunc = null)
41public static TResult? TypeSwitch<TBaseType, TDerivedType1, TDerivedType2, TDerivedType3, TDerivedType4, TDerivedType5, TResult>(this TBaseType obj, Func<TDerivedType1, TResult> matchFunc1, Func<TDerivedType2, TResult> matchFunc2, Func<TDerivedType3, TResult> matchFunc3, Func<TDerivedType4, TResult> matchFunc4, Func<TDerivedType5, TResult> matchFunc5, Func<TBaseType, TResult>? defaultFunc = null)
59public static TResult? TypeSwitch<TBaseType, TDerivedType1, TDerivedType2, TDerivedType3, TDerivedType4, TDerivedType5, TDerivedType6, TResult>(this TBaseType obj, Func<TDerivedType1, TResult> matchFunc1, Func<TDerivedType2, TResult> matchFunc2, Func<TDerivedType3, TResult> matchFunc3, Func<TDerivedType4, TResult> matchFunc4, Func<TDerivedType5, TResult> matchFunc5, Func<TDerivedType6, TResult> matchFunc6, Func<TBaseType, TResult>? defaultFunc = null)
79public static TResult? TypeSwitch<TBaseType, TDerivedType1, TDerivedType2, TDerivedType3, TDerivedType4, TDerivedType5, TDerivedType6, TDerivedType7, TDerivedType8, TDerivedType9, TDerivedType10, TDerivedType11, TDerivedType12, TDerivedType13, TDerivedType14, TDerivedType15, TDerivedType16, TResult>(this TBaseType obj, Func<TDerivedType1, TResult> matchFunc1, Func<TDerivedType2, TResult> matchFunc2, Func<TDerivedType3, TResult> matchFunc3, Func<TDerivedType4, TResult> matchFunc4, Func<TDerivedType5, TResult> matchFunc5, Func<TDerivedType6, TResult> matchFunc6, Func<TDerivedType7, TResult> matchFunc7, Func<TDerivedType8, TResult> matchFunc8, Func<TDerivedType9, TResult> matchFunc9, Func<TDerivedType10, TResult> matchFunc10, Func<TDerivedType11, TResult> matchFunc11, Func<TDerivedType12, TResult> matchFunc12, Func<TDerivedType13, TResult> matchFunc13, Func<TDerivedType14, TResult> matchFunc14, Func<TDerivedType15, TResult> matchFunc15, Func<TDerivedType16, TResult> matchFunc16, Func<TBaseType, TResult>? defaultFunc = null)
119public static TResult? TypeSwitch<TBaseType, TDerivedType1, TDerivedType2, TDerivedType3, TDerivedType4, TDerivedType5, TDerivedType6, TDerivedType7, TDerivedType8, TDerivedType9, TDerivedType10, TDerivedType11, TDerivedType12, TDerivedType13, TDerivedType14, TDerivedType15, TDerivedType16, TDerivedType17, TResult>(this TBaseType obj, Func<TDerivedType1, TResult> matchFunc1, Func<TDerivedType2, TResult> matchFunc2, Func<TDerivedType3, TResult> matchFunc3, Func<TDerivedType4, TResult> matchFunc4, Func<TDerivedType5, TResult> matchFunc5, Func<TDerivedType6, TResult> matchFunc6, Func<TDerivedType7, TResult> matchFunc7, Func<TDerivedType8, TResult> matchFunc8, Func<TDerivedType9, TResult> matchFunc9, Func<TDerivedType10, TResult> matchFunc10, Func<TDerivedType11, TResult> matchFunc11, Func<TDerivedType12, TResult> matchFunc12, Func<TDerivedType13, TResult> matchFunc13, Func<TDerivedType14, TResult> matchFunc14, Func<TDerivedType15, TResult> matchFunc15, Func<TDerivedType16, TResult> matchFunc16, Func<TDerivedType17, TResult> matchFunc17, Func<TBaseType, TResult>? defaultFunc = null)
161public static TResult? TypeSwitch<TBaseType, TDerivedType1, TDerivedType2, TDerivedType3, TDerivedType4, TDerivedType5, TDerivedType6, TDerivedType7, TDerivedType8, TDerivedType9, TDerivedType10, TDerivedType11, TDerivedType12, TDerivedType13, TDerivedType14, TDerivedType15, TDerivedType16, TDerivedType17, TDerivedType18, TDerivedType19, TDerivedType20, TDerivedType21, TDerivedType22, TResult>(this TBaseType obj, Func<TDerivedType1, TResult> matchFunc1, Func<TDerivedType2, TResult> matchFunc2, Func<TDerivedType3, TResult> matchFunc3, Func<TDerivedType4, TResult> matchFunc4, Func<TDerivedType5, TResult> matchFunc5, Func<TDerivedType6, TResult> matchFunc6, Func<TDerivedType7, TResult> matchFunc7, Func<TDerivedType8, TResult> matchFunc8, Func<TDerivedType9, TResult> matchFunc9, Func<TDerivedType10, TResult> matchFunc10, Func<TDerivedType11, TResult> matchFunc11, Func<TDerivedType12, TResult> matchFunc12, Func<TDerivedType13, TResult> matchFunc13, Func<TDerivedType14, TResult> matchFunc14, Func<TDerivedType15, TResult> matchFunc15, Func<TDerivedType16, TResult> matchFunc16, Func<TDerivedType17, TResult> matchFunc17, Func<TDerivedType18, TResult> matchFunc18, Func<TDerivedType19, TResult> matchFunc19, Func<TDerivedType20, TResult> matchFunc20, Func<TDerivedType21, TResult> matchFunc21, Func<TDerivedType22, TResult> matchFunc22, Func<TBaseType, TResult>? defaultFunc = null)
213public static TResult? TypeSwitch<TBaseType, TDerivedType1, TDerivedType2, TDerivedType3, TDerivedType4, TDerivedType5, TDerivedType6, TDerivedType7, TDerivedType8, TDerivedType9, TDerivedType10, TDerivedType11, TDerivedType12, TDerivedType13, TDerivedType14, TDerivedType15, TDerivedType16, TDerivedType17, TDerivedType18, TDerivedType19, TDerivedType20, TDerivedType21, TDerivedType22, TDerivedType23, TDerivedType24, TDerivedType25, TDerivedType26, TDerivedType27, TDerivedType28, TDerivedType29, TDerivedType30, TDerivedType31, TDerivedType32, TDerivedType33, TDerivedType34, TDerivedType35, TDerivedType36, TDerivedType37, TDerivedType38, TDerivedType39, TResult>(this TBaseType obj, Func<TDerivedType1, TResult> matchFunc1, Func<TDerivedType2, TResult> matchFunc2, Func<TDerivedType3, TResult> matchFunc3, Func<TDerivedType4, TResult> matchFunc4, Func<TDerivedType5, TResult> matchFunc5, Func<TDerivedType6, TResult> matchFunc6, Func<TDerivedType7, TResult> matchFunc7, Func<TDerivedType8, TResult> matchFunc8, Func<TDerivedType9, TResult> matchFunc9, Func<TDerivedType10, TResult> matchFunc10, Func<TDerivedType11, TResult> matchFunc11, Func<TDerivedType12, TResult> matchFunc12, Func<TDerivedType13, TResult> matchFunc13, Func<TDerivedType14, TResult> matchFunc14, Func<TDerivedType15, TResult> matchFunc15, Func<TDerivedType16, TResult> matchFunc16, Func<TDerivedType17, TResult> matchFunc17, Func<TDerivedType18, TResult> matchFunc18, Func<TDerivedType19, TResult> matchFunc19, Func<TDerivedType20, TResult> matchFunc20, Func<TDerivedType21, TResult> matchFunc21, Func<TDerivedType22, TResult> matchFunc22, Func<TDerivedType23, TResult> matchFunc23, Func<TDerivedType24, TResult> matchFunc24, Func<TDerivedType25, TResult> matchFunc25, Func<TDerivedType26, TResult> matchFunc26, Func<TDerivedType27, TResult> matchFunc27, Func<TDerivedType28, TResult> matchFunc28, Func<TDerivedType29, TResult> matchFunc29, Func<TDerivedType30, TResult> matchFunc30, Func<TDerivedType31, TResult> matchFunc31, Func<TDerivedType32, TResult> matchFunc32, Func<TDerivedType33, TResult> matchFunc33, Func<TDerivedType34, TResult> matchFunc34, Func<TDerivedType35, TResult> matchFunc35, Func<TDerivedType36, TResult> matchFunc36, Func<TDerivedType37, TResult> matchFunc37, Func<TDerivedType38, TResult> matchFunc38, Func<TDerivedType39, TResult> matchFunc39, Func<TBaseType, TResult>? defaultFunc = null)
299public static TResult? TypeSwitch<TBaseType, TDerivedType1, TDerivedType2, TDerivedType3, TDerivedType4, TDerivedType5, TDerivedType6, TDerivedType7, TDerivedType8, TDerivedType9, TDerivedType10, TDerivedType11, TDerivedType12, TDerivedType13, TDerivedType14, TDerivedType15, TDerivedType16, TDerivedType17, TDerivedType18, TDerivedType19, TDerivedType20, TDerivedType21, TDerivedType22, TDerivedType23, TDerivedType24, TDerivedType25, TDerivedType26, TDerivedType27, TDerivedType28, TDerivedType29, TDerivedType30, TDerivedType31, TDerivedType32, TDerivedType33, TDerivedType34, TDerivedType35, TDerivedType36, TDerivedType37, TDerivedType38, TDerivedType39, TDerivedType40, TResult>(this TBaseType obj, Func<TDerivedType1, TResult> matchFunc1, Func<TDerivedType2, TResult> matchFunc2, Func<TDerivedType3, TResult> matchFunc3, Func<TDerivedType4, TResult> matchFunc4, Func<TDerivedType5, TResult> matchFunc5, Func<TDerivedType6, TResult> matchFunc6, Func<TDerivedType7, TResult> matchFunc7, Func<TDerivedType8, TResult> matchFunc8, Func<TDerivedType9, TResult> matchFunc9, Func<TDerivedType10, TResult> matchFunc10, Func<TDerivedType11, TResult> matchFunc11, Func<TDerivedType12, TResult> matchFunc12, Func<TDerivedType13, TResult> matchFunc13, Func<TDerivedType14, TResult> matchFunc14, Func<TDerivedType15, TResult> matchFunc15, Func<TDerivedType16, TResult> matchFunc16, Func<TDerivedType17, TResult> matchFunc17, Func<TDerivedType18, TResult> matchFunc18, Func<TDerivedType19, TResult> matchFunc19, Func<TDerivedType20, TResult> matchFunc20, Func<TDerivedType21, TResult> matchFunc21, Func<TDerivedType22, TResult> matchFunc22, Func<TDerivedType23, TResult> matchFunc23, Func<TDerivedType24, TResult> matchFunc24, Func<TDerivedType25, TResult> matchFunc25, Func<TDerivedType26, TResult> matchFunc26, Func<TDerivedType27, TResult> matchFunc27, Func<TDerivedType28, TResult> matchFunc28, Func<TDerivedType29, TResult> matchFunc29, Func<TDerivedType30, TResult> matchFunc30, Func<TDerivedType31, TResult> matchFunc31, Func<TDerivedType32, TResult> matchFunc32, Func<TDerivedType33, TResult> matchFunc33, Func<TDerivedType34, TResult> matchFunc34, Func<TDerivedType35, TResult> matchFunc35, Func<TDerivedType36, TResult> matchFunc36, Func<TDerivedType37, TResult> matchFunc37, Func<TDerivedType38, TResult> matchFunc38, Func<TDerivedType39, TResult> matchFunc39, Func<TDerivedType40, TResult> matchFunc40, Func<TBaseType, TResult>? defaultFunc = null)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\SyntaxNodeExtensions.cs (6)
104this SyntaxNode node, TextSpan searchSpan, Func<SyntaxNode, bool> predicate)
129public static bool CheckParent<T>([NotNullWhen(returnValue: true)] this SyntaxNode? node, Func<T, bool> valueChecker) where T : SyntaxNode
145public static bool IsChildNode<TParent>(this SyntaxNode node, Func<TParent, SyntaxNode?> childGetter)
162public static bool IsFoundUnder<TParent>(this SyntaxNode node, Func<TParent, SyntaxNode?> childGetter)
201public static SyntaxNode? FindInnermostCommonNode(this IEnumerable<SyntaxNode> nodes, Func<SyntaxNode, bool> predicate)
806public static TNode? FirstAncestorOrSelfUntil<TNode>(this SyntaxNode? node, Func<SyntaxNode, bool> predicate)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\SyntaxTokenExtensions.cs (5)
15public static SyntaxNode? GetAncestor(this SyntaxToken token, Func<SyntaxNode, bool>? predicate)
18public static T? GetAncestor<T>(this SyntaxToken token, Func<T, bool>? predicate = null) where T : SyntaxNode
21public static T GetRequiredAncestor<T>(this SyntaxToken token, Func<T, bool>? predicate = null) where T : SyntaxNode
32public static IEnumerable<SyntaxNode> GetAncestors(this SyntaxToken token, Func<SyntaxNode, bool> predicate)
42public static bool CheckParent<T>(this SyntaxToken token, Func<T, bool> valueChecker) where T : SyntaxNode
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Options\PublicOptionFactory.cs (4)
17public static Option2<T> WithPublicOption<T, TPublicValue>(this Option2<T> option, string feature, string name, Func<T, TPublicValue> toPublicValue, Func<TPublicValue, T> toInternalValue)
20public static PerLanguageOption2<T> WithPublicOption<T, TPublicValue>(this PerLanguageOption2<T> option, string feature, string name, Func<T, TPublicValue> toPublicValue, Func<TPublicValue, T> toInternalValue)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\TopologicalSorter.cs (8)
13public static IEnumerable<T> TopologicalSort<T>(this IEnumerable<T> items, Func<T, IEnumerable<T>> itemsBefore)
26public static IEnumerable<T> TopologicalSort<T>(this IEnumerable<T> items, Func<T, IEnumerable<T>> itemsBefore, Func<T, IEnumerable<T>> itemsAfter)
29var combinedItemsBefore = CreateCombinedItemsBefore(items, itemsBefore, itemsAfter);
35Func<T, IEnumerable<T>> itemsBefore,
50private static Func<T, IEnumerable<T>> CreateCombinedItemsBefore<T>(IEnumerable<T> items, Func<T, IEnumerable<T>> itemsBefore, Func<T, IEnumerable<T>> itemsAfter)
Microsoft.CodeAnalysis.PublicApiAnalyzers.CodeFixes (2)
Microsoft.CodeAnalysis.Rebuild.UnitTests (4)
Microsoft.CodeAnalysis.Remote.ServiceHub (27)
Services\BrokeredServiceBase.cs (7)
89Func<Solution, ValueTask<T>> implementation,
103protected static ValueTask<T> RunServiceAsync<T>(Func<CancellationToken, ValueTask<T>> implementation, CancellationToken cancellationToken)
109Checksum solutionChecksum, Func<Solution, ValueTask<T>> implementation, CancellationToken cancellationToken)
115internal static async ValueTask<T> RunServiceImplAsync<T>(Func<CancellationToken, ValueTask<T>> implementation, CancellationToken cancellationToken)
127protected static ValueTask RunServiceAsync(Func<CancellationToken, ValueTask> implementation, CancellationToken cancellationToken)
133Checksum solutionChecksum, Func<Solution, ValueTask> implementation, CancellationToken cancellationToken)
164internal static async ValueTask RunServiceImplAsync(Func<CancellationToken, ValueTask> implementation, CancellationToken cancellationToken)
Microsoft.CodeAnalysis.Remote.Workspaces (9)
ServiceDescriptor.cs (4)
34private readonly Func<string, string> _featureDisplayNameProvider;
42Func<string, string> displayNameProvider,
61public static ServiceDescriptor CreateRemoteServiceDescriptor(string componentName, string simpleName, string suffix, RemoteSerializationOptions options, Func<string, string> featureDisplayNameProvider, Type? clientInterface)
64public static ServiceDescriptor CreateInProcServiceDescriptor(string componentName, string simpleName, string suffix, Func<string, string> featureDisplayNameProvider)
Microsoft.CodeAnalysis.ResxSourceGenerator (408)
src\Compilers\Core\Portable\FileSystem\FileUtilities.cs (4)
47Func<string, bool> fileExists)
322public static T RethrowExceptionsAsIOException<T, TArg>(Func<TArg, T> operation, TArg arg)
339public static async Task<T> RethrowExceptionsAsIOExceptionAsync<T, TArg>(Func<TArg, Task<T>> operation, TArg arg)
355internal static Stream CreateFileStreamChecked(Func<string, Stream> factory, string path, string? paramName = null)
src\Compilers\Core\Portable\InternalUtilities\InterlockedOperations.cs (5)
46public static T Initialize<T, TArg>([NotNull] ref T? target, Func<TArg, T> valueFactory, TArg arg)
66public static int Initialize<TArg>(ref int target, int uninitializedValue, Func<TArg, int> valueFactory, TArg arg)
103public static T? Initialize<T, TArg>([NotNull] ref StrongBox<T?>? target, Func<TArg, T?> valueFactory, TArg arg)
183public static ImmutableArray<T> Initialize<T, TArg>(ref ImmutableArray<T> target, Func<TArg, ImmutableArray<T>> createArray, TArg arg)
193private static ImmutableArray<T> Initialize_Slow<T, TArg>(ref ImmutableArray<T> target, Func<TArg, ImmutableArray<T>> createArray, TArg arg)
src\Compilers\Core\Portable\SourceGeneration\GeneratedCodeUtilities.cs (4)
49SyntaxTree tree, Func<SyntaxTrivia, bool> isComment, CancellationToken cancellationToken)
55internal static bool IsGeneratedCode(string? filePath, SyntaxNode root, Func<SyntaxTrivia, bool> isComment)
88private static bool BeginsWithAutoGeneratedComment(SyntaxNode root, Func<SyntaxTrivia, bool> isComment)
118SyntaxTree tree, Func<SyntaxTrivia, bool> isComment, CancellationToken cancellationToken)
src\Dependencies\Collections\Extensions\IEnumerableExtensions.cs (30)
164public static T? FirstOrNull<T>(this IEnumerable<T> source, Func<T, bool> predicate)
182public static T? SingleOrNull<T>(this IEnumerable<T> source, Func<T, bool> predicate)
261public static bool HasDuplicates<TItem, TValue>(this IEnumerable<TItem> source, Func<TItem, TValue> selector)
271/// <seealso cref="Microsoft.CodeAnalysis.ImmutableArrayExtensions.HasDuplicates{TItem, TValue}(ImmutableArray{TItem}, Func{TItem, TValue}, IEqualityComparer{TValue})"/>
273public static bool HasDuplicates<TItem, TValue>(this IEnumerable<TItem> source, Func<TItem, TValue> selector, IEqualityComparer<TValue> comparer)
321private static readonly Func<object, bool> s_notNullTest = x => x != null;
331return source.Where((Func<T?, bool>)s_notNullTest)!;
376public static ImmutableArray<T> WhereAsArray<T>(this IEnumerable<T> values, Func<T, bool> predicate)
407public static ImmutableArray<TResult> SelectAsArray<TSource, TResult>(this IEnumerable<TSource>? source, Func<TSource, TResult> selector)
417public static ImmutableArray<TResult> SelectAsArray<TItem, TResult>(this IEnumerable<TItem>? source, Func<TItem, bool> predicate, Func<TItem, TResult> selector)
461public static ImmutableArray<TResult> SelectAsArray<TSource, TResult>(this IReadOnlyCollection<TSource>? source, Func<TSource, TResult> selector)
485public static ImmutableArray<TResult> SelectManyAsArray<TSource, TResult>(this IEnumerable<TSource>? source, Func<TSource, IEnumerable<TResult>> selector)
507public static ImmutableArray<TResult> SelectManyAsArray<TItem, TResult>(this IReadOnlyCollection<TItem>? source, Func<TItem, IEnumerable<TResult>> selector)
533public static ImmutableArray<TResult> SelectManyAsArray<TSource, TResult>(this IEnumerable<TSource>? source, Func<TSource, OneOrMany<TResult>> selector)
547public static async ValueTask<ImmutableArray<TResult>> SelectAsArrayAsync<TItem, TResult>(this IEnumerable<TItem> source, Func<TItem, ValueTask<TResult>> selector)
764internal static Dictionary<K, ImmutableArray<T>> ToMultiDictionary<K, T>(this IEnumerable<T> data, Func<T, K> keySelector, IEqualityComparer<K>? comparer = null)
815public static readonly Func<T, T> Identity = t => t;
816public static readonly Func<T, bool> True = t => true;
840/// Alias for <see cref="System.Linq.Enumerable.Any{TSource}(IEnumerable{TSource}, Func{TSource, bool})"/>
842public static bool Contains<T>(this IEnumerable<T> sequence, Func<T, bool> predicate)
846/// Variant of <see cref="System.Linq.Enumerable.Count{TSource}(IEnumerable{TSource}, Func{TSource, bool})"/>
861/// Variant of <see cref="System.Linq.Enumerable.FirstOrDefault{TSource}(IEnumerable{TSource}, Func{TSource, bool})"/>
875/// Variant of <see cref="System.Linq.Enumerable.Any{TSource}(IEnumerable{TSource}, Func{TSource, bool})"/>
889/// Variant of <see cref="System.Linq.Enumerable.OrderBy{TSource, TKey}(IEnumerable{TSource}, Func{TSource, TKey}, IComparer{TKey}?)"/>
895/// Variant of <see cref="System.Linq.Enumerable.OrderByDescending{TSource, TKey}(IEnumerable{TSource}, Func{TSource, TKey}, IComparer{TKey}?)"/>
901/// Variant of <see cref="System.Linq.Enumerable.OrderBy{TSource, TKey}(IEnumerable{TSource}, Func{TSource, TKey}, IComparer{TKey}?)"/>
907/// Variant of <see cref="System.Linq.Enumerable.OrderByDescending{TSource, TKey}(IEnumerable{TSource}, Func{TSource, TKey}, IComparer{TKey}?)"/>
913/// Variant of <see cref="System.Linq.Enumerable.ThenBy{TSource, TKey}(IOrderedEnumerable{TSource}, Func{TSource, TKey}, IComparer{TKey}?)"/>
919/// Variant of <see cref="System.Linq.Enumerable.ThenBy{TSource, TKey}(IOrderedEnumerable{TSource}, Func{TSource, TKey}, IComparer{TKey}?)"/>
src\Dependencies\Collections\Extensions\IListExtensions.cs (4)
21public static bool HasDuplicates<TItem, TValue>(this IReadOnlyList<TItem> list, Func<TItem, TValue> selector)
31/// <seealso cref="ImmutableArrayExtensions.HasDuplicates{TItem, TValue}(System.Collections.Immutable.ImmutableArray{TItem}, Func{TItem, TValue}, IEqualityComparer{TValue})"/>
32/// <seealso cref="Roslyn.Utilities.EnumerableExtensions.HasDuplicates{TItem, TValue}(IEnumerable{TItem}, Func{TItem, TValue}, IEqualityComparer{TValue})"/>
34internal static bool HasDuplicates<TItem, TValue>(this IReadOnlyList<TItem> list, Func<TItem, TValue> selector, IEqualityComparer<TValue> comparer)
src\Dependencies\Collections\Extensions\ImmutableArrayExtensions.cs (27)
138public static ImmutableArray<TResult> SelectAsArray<TItem, TResult>(this ImmutableArray<TItem> items, Func<TItem, TResult> map)
198public static ImmutableArray<TResult> SelectAsArray<TItem, TResult>(this ImmutableArray<TItem> array, Func<TItem, bool> predicate, Func<TItem, TResult> selector)
247public static ImmutableArray<TResult> SelectManyAsArray<TItem, TResult>(this ImmutableArray<TItem> array, Func<TItem, IEnumerable<TResult>> selector)
267public static ImmutableArray<TResult> SelectManyAsArray<TItem, TResult>(this ImmutableArray<TItem> array, Func<TItem, ImmutableArray<TResult>> selector)
287public static ImmutableArray<TResult> SelectManyAsArray<TItem, TResult>(this ImmutableArray<TItem> array, Func<TItem, OneOrMany<TResult>> selector)
308public static ImmutableArray<TResult> SelectManyAsArray<TItem, TResult>(this ImmutableArray<TItem> array, Func<TItem, bool> predicate, Func<TItem, IEnumerable<TResult>> selector)
332public static ImmutableArray<TResult> SelectManyAsArray<TItem, TResult>(this ImmutableArray<TItem> array, Func<TItem, bool> predicate, Func<TItem, ImmutableArray<TResult>> selector)
356public static ImmutableArray<TResult> SelectManyAsArray<TItem, TResult>(this ImmutableArray<TItem> array, Func<TItem, bool> predicate, Func<TItem, OneOrMany<TResult>> selector)
493public static ImmutableArray<T> WhereAsArray<T>(this ImmutableArray<T> array, Func<T, bool> predicate)
504private static ImmutableArray<T> WhereAsArrayImpl<T, TArg>(ImmutableArray<T> array, Func<T, bool>? predicateWithoutArg, Func<T, TArg, bool>? predicateWithArg, TArg arg)
573public static async Task<bool> AnyAsync<T>(this ImmutableArray<T> array, Func<T, Task<bool>> predicateAsync)
595public static async ValueTask<T?> FirstOrDefaultAsync<T>(this ImmutableArray<T> array, Func<T, Task<bool>> predicateAsync)
757public static bool HasDuplicates<TItem, TValue>(this ImmutableArray<TItem> array, Func<TItem, TValue> selector)
767/// <seealso cref="Roslyn.Utilities.EnumerableExtensions.HasDuplicates{TItem, TValue}(IEnumerable{TItem}, Func{TItem, TValue}, IEqualityComparer{TValue})"/>
769internal static bool HasDuplicates<TItem, TValue>(this ImmutableArray<TItem> array, Func<TItem, TValue> selector, IEqualityComparer<TValue> comparer)
990/// Variant of <see cref="System.Linq.ImmutableArrayExtensions.FirstOrDefault{T}(ImmutableArray{T}, Func{T, bool})"/>
1004/// Variant of <see cref="System.Linq.ImmutableArrayExtensions.Single{T}(ImmutableArray{T}, Func{T, bool})"/>
1066/// Specialization of <see cref="System.Linq.Enumerable.Count{TSource}(IEnumerable{TSource}, Func{TSource, bool})"/> for <see cref="ImmutableArray{T}"/>.
1068public static int Count<T>(this ImmutableArray<T> items, Func<T, bool> predicate)
1086public static int Sum<T>(this ImmutableArray<T> items, Func<T, int> selector)
1213/// Variant of <see cref="System.Linq.ImmutableArrayExtensions.Any{T}(ImmutableArray{T}, Func{T, bool})"/>.
1227/// Variant of <see cref="System.Linq.ImmutableArrayExtensions.All{T}(ImmutableArray{T}, Func{T, bool})"/>.
1257public static bool Contains<T>(this ImmutableArray<T> array, Func<T, bool> predicate)
src\Dependencies\Collections\RoslynImmutableInterlocked.cs (7)
33public static bool Update<T>(ref ImmutableSegmentedList<T> location, Func<ImmutableSegmentedList<T>, ImmutableSegmentedList<T>> transformer)
154public static bool Update<T>(ref ImmutableSegmentedHashSet<T> location, Func<ImmutableSegmentedHashSet<T>, ImmutableSegmentedHashSet<T>> transformer)
276public static bool Update<TKey, TValue>(ref ImmutableSegmentedDictionary<TKey, TValue> location, Func<ImmutableSegmentedDictionary<TKey, TValue>, ImmutableSegmentedDictionary<TKey, TValue>> transformer)
410/// <inheritdoc cref="ImmutableInterlocked.GetOrAdd{TKey, TValue}(ref ImmutableDictionary{TKey, TValue}, TKey, Func{TKey, TValue})"/>
411public static TValue GetOrAdd<TKey, TValue>(ref ImmutableSegmentedDictionary<TKey, TValue> location, TKey key, Func<TKey, TValue> valueFactory)
458/// <inheritdoc cref="ImmutableInterlocked.AddOrUpdate{TKey, TValue}(ref ImmutableDictionary{TKey, TValue}, TKey, Func{TKey, TValue}, Func{TKey, TValue, TValue})"/>
459public static TValue AddOrUpdate<TKey, TValue>(ref ImmutableSegmentedDictionary<TKey, TValue> location, TKey key, Func<TKey, TValue> addValueFactory, Func<TKey, TValue, TValue> updateValueFactory)
src\Dependencies\Collections\Segmented\ImmutableSegmentedDictionary.cs (6)
68public static ImmutableSegmentedDictionary<TKey, TValue> ToImmutableSegmentedDictionary<TSource, TKey, TValue>(this IEnumerable<TSource> source, Func<TSource, TKey> keySelector, Func<TSource, TValue> elementSelector)
72public static ImmutableSegmentedDictionary<TKey, TValue> ToImmutableSegmentedDictionary<TSource, TKey, TValue>(this IEnumerable<TSource> source, Func<TSource, TKey> keySelector, Func<TSource, TValue> elementSelector, IEqualityComparer<TKey>? keyComparer)
86public static ImmutableSegmentedDictionary<TKey, TSource> ToImmutableSegmentedDictionary<TSource, TKey>(this IEnumerable<TSource> source, Func<TSource, TKey> keySelector)
90public static ImmutableSegmentedDictionary<TKey, TSource> ToImmutableSegmentedDictionary<TSource, TKey>(this IEnumerable<TSource> source, Func<TSource, TKey> keySelector, IEqualityComparer<TKey>? keyComparer)
src\Dependencies\PooledObjects\ArrayBuilder.cs (7)
457public void FreeAll(Func<T, ArrayBuilder<T>?> getNested)
560internal Dictionary<K, ImmutableArray<T>> ToDictionary<K>(Func<T, K> keySelector, IEqualityComparer<K>? comparer = null)
608public void AddRange<U>(ArrayBuilder<U> items, Func<U, T> selector)
745public ImmutableArray<S> SelectDistinct<S>(Func<T, S> selector)
763public bool Any(Func<T, bool> predicate)
787public bool All(Func<T, bool> predicate)
817public ImmutableArray<TResult> SelectAsArray<TResult>(Func<T, TResult> map)
src\Dependencies\PooledObjects\PooledDelegates.cs (9)
200public static Releaser GetPooledFunction<TArg, TResult>(Func<TArg, TResult> unboundFunction, TArg argument, out Func<TResult> boundFunction)
201=> GetPooledDelegate<FuncWithBoundArgument<TArg, TResult>, TArg, Func<TArg, TResult>, Func<TResult>>(unboundFunction, argument, out boundFunction);
204/// Equivalent to <see cref="GetPooledFunction{TArg, TResult}(Func{TArg, TResult}, TArg, out Func{TResult})"/>,
216/// Gets a <see cref="Func{T, TResult}"/> delegate, which calls <paramref name="unboundFunction"/> with the
246public static Releaser GetPooledFunction<T1, TArg, TResult>(Func<T1, TArg, TResult> unboundFunction, TArg argument, out Func<T1, TResult> boundFunction)
247=> GetPooledDelegate<FuncWithBoundArgument<T1, TArg, TResult>, TArg, Func<T1, TArg, TResult>, Func<T1, TResult>>(unboundFunction, argument, out boundFunction);
412: AbstractDelegateWithBoundArgument<FuncWithBoundArgument<TArg, TResult>, TArg, Func<TArg, TResult>, Func<TResult>>
432: AbstractDelegateWithBoundArgument<FuncWithBoundArgument<T1, TArg, TResult>, TArg, Func<T1, TArg, TResult>, Func<T1, TResult>>
434protected override Func<T1, TResult> Bind()
src\Dependencies\Threading\ParallelExtensions.NetFramework.cs (7)
122Func<object, Task> taskBody = static async o =>
287Func<object, Task> taskBody = static async o =>
395private readonly Func<object, Task> _taskBody;
418protected ForEachAsyncState(Func<object, Task> taskBody, bool needsLock, int dop, TaskScheduler scheduler, CancellationToken cancellationToken, Func<TSource, CancellationToken, ValueTask> body)
584IEnumerable<TSource> source, Func<object, Task> taskBody,
610IAsyncEnumerable<TSource> source, Func<object, Task> taskBody,
637T fromExclusive, T toExclusive, Func<object, Task> taskBody,
src\RoslynAnalyzers\Utilities\Compiler\Lightup\LightupHelpers.cs (6)
19internal static Func<TOperation, TProperty> CreateOperationPropertyAccessor<TOperation, TProperty>(Type? type, string propertyName, TProperty fallbackResult)
23internal static Func<TSyntax, TProperty> CreateSyntaxPropertyAccessor<TSyntax, TProperty>(Type? type, string propertyName, TProperty fallbackResult)
27internal static Func<TSymbol, TProperty> CreateSymbolPropertyAccessor<TSymbol, TProperty>(Type? type, string propertyName, TProperty fallbackResult)
31private static Func<T, TProperty> CreatePropertyAccessor<T, TProperty>(Type? type, string parameterName, string propertyName, TProperty fallbackResult)
50Expression<Func<T, TProperty>> expression = Expression.Lambda<Func<T, TProperty>>(result, parameter);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\ObjectExtensions.TypeSwitch.cs (161)
11public static TResult? TypeSwitch<TBaseType, TDerivedType1, TDerivedType2, TDerivedType3, TResult>(this TBaseType obj, Func<TDerivedType1, TResult> matchFunc1, Func<TDerivedType2, TResult> matchFunc2, Func<TDerivedType3, TResult> matchFunc3, Func<TBaseType, TResult>? defaultFunc = null)
25public static TResult? TypeSwitch<TBaseType, TDerivedType1, TDerivedType2, TDerivedType3, TDerivedType4, TResult>(this TBaseType obj, Func<TDerivedType1, TResult> matchFunc1, Func<TDerivedType2, TResult> matchFunc2, Func<TDerivedType3, TResult> matchFunc3, Func<TDerivedType4, TResult> matchFunc4, Func<TBaseType, TResult>? defaultFunc = null)
41public static TResult? TypeSwitch<TBaseType, TDerivedType1, TDerivedType2, TDerivedType3, TDerivedType4, TDerivedType5, TResult>(this TBaseType obj, Func<TDerivedType1, TResult> matchFunc1, Func<TDerivedType2, TResult> matchFunc2, Func<TDerivedType3, TResult> matchFunc3, Func<TDerivedType4, TResult> matchFunc4, Func<TDerivedType5, TResult> matchFunc5, Func<TBaseType, TResult>? defaultFunc = null)
59public static TResult? TypeSwitch<TBaseType, TDerivedType1, TDerivedType2, TDerivedType3, TDerivedType4, TDerivedType5, TDerivedType6, TResult>(this TBaseType obj, Func<TDerivedType1, TResult> matchFunc1, Func<TDerivedType2, TResult> matchFunc2, Func<TDerivedType3, TResult> matchFunc3, Func<TDerivedType4, TResult> matchFunc4, Func<TDerivedType5, TResult> matchFunc5, Func<TDerivedType6, TResult> matchFunc6, Func<TBaseType, TResult>? defaultFunc = null)
79public static TResult? TypeSwitch<TBaseType, TDerivedType1, TDerivedType2, TDerivedType3, TDerivedType4, TDerivedType5, TDerivedType6, TDerivedType7, TDerivedType8, TDerivedType9, TDerivedType10, TDerivedType11, TDerivedType12, TDerivedType13, TDerivedType14, TDerivedType15, TDerivedType16, TResult>(this TBaseType obj, Func<TDerivedType1, TResult> matchFunc1, Func<TDerivedType2, TResult> matchFunc2, Func<TDerivedType3, TResult> matchFunc3, Func<TDerivedType4, TResult> matchFunc4, Func<TDerivedType5, TResult> matchFunc5, Func<TDerivedType6, TResult> matchFunc6, Func<TDerivedType7, TResult> matchFunc7, Func<TDerivedType8, TResult> matchFunc8, Func<TDerivedType9, TResult> matchFunc9, Func<TDerivedType10, TResult> matchFunc10, Func<TDerivedType11, TResult> matchFunc11, Func<TDerivedType12, TResult> matchFunc12, Func<TDerivedType13, TResult> matchFunc13, Func<TDerivedType14, TResult> matchFunc14, Func<TDerivedType15, TResult> matchFunc15, Func<TDerivedType16, TResult> matchFunc16, Func<TBaseType, TResult>? defaultFunc = null)
119public static TResult? TypeSwitch<TBaseType, TDerivedType1, TDerivedType2, TDerivedType3, TDerivedType4, TDerivedType5, TDerivedType6, TDerivedType7, TDerivedType8, TDerivedType9, TDerivedType10, TDerivedType11, TDerivedType12, TDerivedType13, TDerivedType14, TDerivedType15, TDerivedType16, TDerivedType17, TResult>(this TBaseType obj, Func<TDerivedType1, TResult> matchFunc1, Func<TDerivedType2, TResult> matchFunc2, Func<TDerivedType3, TResult> matchFunc3, Func<TDerivedType4, TResult> matchFunc4, Func<TDerivedType5, TResult> matchFunc5, Func<TDerivedType6, TResult> matchFunc6, Func<TDerivedType7, TResult> matchFunc7, Func<TDerivedType8, TResult> matchFunc8, Func<TDerivedType9, TResult> matchFunc9, Func<TDerivedType10, TResult> matchFunc10, Func<TDerivedType11, TResult> matchFunc11, Func<TDerivedType12, TResult> matchFunc12, Func<TDerivedType13, TResult> matchFunc13, Func<TDerivedType14, TResult> matchFunc14, Func<TDerivedType15, TResult> matchFunc15, Func<TDerivedType16, TResult> matchFunc16, Func<TDerivedType17, TResult> matchFunc17, Func<TBaseType, TResult>? defaultFunc = null)
161public static TResult? TypeSwitch<TBaseType, TDerivedType1, TDerivedType2, TDerivedType3, TDerivedType4, TDerivedType5, TDerivedType6, TDerivedType7, TDerivedType8, TDerivedType9, TDerivedType10, TDerivedType11, TDerivedType12, TDerivedType13, TDerivedType14, TDerivedType15, TDerivedType16, TDerivedType17, TDerivedType18, TDerivedType19, TDerivedType20, TDerivedType21, TDerivedType22, TResult>(this TBaseType obj, Func<TDerivedType1, TResult> matchFunc1, Func<TDerivedType2, TResult> matchFunc2, Func<TDerivedType3, TResult> matchFunc3, Func<TDerivedType4, TResult> matchFunc4, Func<TDerivedType5, TResult> matchFunc5, Func<TDerivedType6, TResult> matchFunc6, Func<TDerivedType7, TResult> matchFunc7, Func<TDerivedType8, TResult> matchFunc8, Func<TDerivedType9, TResult> matchFunc9, Func<TDerivedType10, TResult> matchFunc10, Func<TDerivedType11, TResult> matchFunc11, Func<TDerivedType12, TResult> matchFunc12, Func<TDerivedType13, TResult> matchFunc13, Func<TDerivedType14, TResult> matchFunc14, Func<TDerivedType15, TResult> matchFunc15, Func<TDerivedType16, TResult> matchFunc16, Func<TDerivedType17, TResult> matchFunc17, Func<TDerivedType18, TResult> matchFunc18, Func<TDerivedType19, TResult> matchFunc19, Func<TDerivedType20, TResult> matchFunc20, Func<TDerivedType21, TResult> matchFunc21, Func<TDerivedType22, TResult> matchFunc22, Func<TBaseType, TResult>? defaultFunc = null)
213public static TResult? TypeSwitch<TBaseType, TDerivedType1, TDerivedType2, TDerivedType3, TDerivedType4, TDerivedType5, TDerivedType6, TDerivedType7, TDerivedType8, TDerivedType9, TDerivedType10, TDerivedType11, TDerivedType12, TDerivedType13, TDerivedType14, TDerivedType15, TDerivedType16, TDerivedType17, TDerivedType18, TDerivedType19, TDerivedType20, TDerivedType21, TDerivedType22, TDerivedType23, TDerivedType24, TDerivedType25, TDerivedType26, TDerivedType27, TDerivedType28, TDerivedType29, TDerivedType30, TDerivedType31, TDerivedType32, TDerivedType33, TDerivedType34, TDerivedType35, TDerivedType36, TDerivedType37, TDerivedType38, TDerivedType39, TResult>(this TBaseType obj, Func<TDerivedType1, TResult> matchFunc1, Func<TDerivedType2, TResult> matchFunc2, Func<TDerivedType3, TResult> matchFunc3, Func<TDerivedType4, TResult> matchFunc4, Func<TDerivedType5, TResult> matchFunc5, Func<TDerivedType6, TResult> matchFunc6, Func<TDerivedType7, TResult> matchFunc7, Func<TDerivedType8, TResult> matchFunc8, Func<TDerivedType9, TResult> matchFunc9, Func<TDerivedType10, TResult> matchFunc10, Func<TDerivedType11, TResult> matchFunc11, Func<TDerivedType12, TResult> matchFunc12, Func<TDerivedType13, TResult> matchFunc13, Func<TDerivedType14, TResult> matchFunc14, Func<TDerivedType15, TResult> matchFunc15, Func<TDerivedType16, TResult> matchFunc16, Func<TDerivedType17, TResult> matchFunc17, Func<TDerivedType18, TResult> matchFunc18, Func<TDerivedType19, TResult> matchFunc19, Func<TDerivedType20, TResult> matchFunc20, Func<TDerivedType21, TResult> matchFunc21, Func<TDerivedType22, TResult> matchFunc22, Func<TDerivedType23, TResult> matchFunc23, Func<TDerivedType24, TResult> matchFunc24, Func<TDerivedType25, TResult> matchFunc25, Func<TDerivedType26, TResult> matchFunc26, Func<TDerivedType27, TResult> matchFunc27, Func<TDerivedType28, TResult> matchFunc28, Func<TDerivedType29, TResult> matchFunc29, Func<TDerivedType30, TResult> matchFunc30, Func<TDerivedType31, TResult> matchFunc31, Func<TDerivedType32, TResult> matchFunc32, Func<TDerivedType33, TResult> matchFunc33, Func<TDerivedType34, TResult> matchFunc34, Func<TDerivedType35, TResult> matchFunc35, Func<TDerivedType36, TResult> matchFunc36, Func<TDerivedType37, TResult> matchFunc37, Func<TDerivedType38, TResult> matchFunc38, Func<TDerivedType39, TResult> matchFunc39, Func<TBaseType, TResult>? defaultFunc = null)
299public static TResult? TypeSwitch<TBaseType, TDerivedType1, TDerivedType2, TDerivedType3, TDerivedType4, TDerivedType5, TDerivedType6, TDerivedType7, TDerivedType8, TDerivedType9, TDerivedType10, TDerivedType11, TDerivedType12, TDerivedType13, TDerivedType14, TDerivedType15, TDerivedType16, TDerivedType17, TDerivedType18, TDerivedType19, TDerivedType20, TDerivedType21, TDerivedType22, TDerivedType23, TDerivedType24, TDerivedType25, TDerivedType26, TDerivedType27, TDerivedType28, TDerivedType29, TDerivedType30, TDerivedType31, TDerivedType32, TDerivedType33, TDerivedType34, TDerivedType35, TDerivedType36, TDerivedType37, TDerivedType38, TDerivedType39, TDerivedType40, TResult>(this TBaseType obj, Func<TDerivedType1, TResult> matchFunc1, Func<TDerivedType2, TResult> matchFunc2, Func<TDerivedType3, TResult> matchFunc3, Func<TDerivedType4, TResult> matchFunc4, Func<TDerivedType5, TResult> matchFunc5, Func<TDerivedType6, TResult> matchFunc6, Func<TDerivedType7, TResult> matchFunc7, Func<TDerivedType8, TResult> matchFunc8, Func<TDerivedType9, TResult> matchFunc9, Func<TDerivedType10, TResult> matchFunc10, Func<TDerivedType11, TResult> matchFunc11, Func<TDerivedType12, TResult> matchFunc12, Func<TDerivedType13, TResult> matchFunc13, Func<TDerivedType14, TResult> matchFunc14, Func<TDerivedType15, TResult> matchFunc15, Func<TDerivedType16, TResult> matchFunc16, Func<TDerivedType17, TResult> matchFunc17, Func<TDerivedType18, TResult> matchFunc18, Func<TDerivedType19, TResult> matchFunc19, Func<TDerivedType20, TResult> matchFunc20, Func<TDerivedType21, TResult> matchFunc21, Func<TDerivedType22, TResult> matchFunc22, Func<TDerivedType23, TResult> matchFunc23, Func<TDerivedType24, TResult> matchFunc24, Func<TDerivedType25, TResult> matchFunc25, Func<TDerivedType26, TResult> matchFunc26, Func<TDerivedType27, TResult> matchFunc27, Func<TDerivedType28, TResult> matchFunc28, Func<TDerivedType29, TResult> matchFunc29, Func<TDerivedType30, TResult> matchFunc30, Func<TDerivedType31, TResult> matchFunc31, Func<TDerivedType32, TResult> matchFunc32, Func<TDerivedType33, TResult> matchFunc33, Func<TDerivedType34, TResult> matchFunc34, Func<TDerivedType35, TResult> matchFunc35, Func<TDerivedType36, TResult> matchFunc36, Func<TDerivedType37, TResult> matchFunc37, Func<TDerivedType38, TResult> matchFunc38, Func<TDerivedType39, TResult> matchFunc39, Func<TDerivedType40, TResult> matchFunc40, Func<TBaseType, TResult>? defaultFunc = null)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\SyntaxNodeExtensions.cs (6)
104this SyntaxNode node, TextSpan searchSpan, Func<SyntaxNode, bool> predicate)
129public static bool CheckParent<T>([NotNullWhen(returnValue: true)] this SyntaxNode? node, Func<T, bool> valueChecker) where T : SyntaxNode
145public static bool IsChildNode<TParent>(this SyntaxNode node, Func<TParent, SyntaxNode?> childGetter)
162public static bool IsFoundUnder<TParent>(this SyntaxNode node, Func<TParent, SyntaxNode?> childGetter)
201public static SyntaxNode? FindInnermostCommonNode(this IEnumerable<SyntaxNode> nodes, Func<SyntaxNode, bool> predicate)
806public static TNode? FirstAncestorOrSelfUntil<TNode>(this SyntaxNode? node, Func<SyntaxNode, bool> predicate)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\SyntaxTokenExtensions.cs (5)
15public static SyntaxNode? GetAncestor(this SyntaxToken token, Func<SyntaxNode, bool>? predicate)
18public static T? GetAncestor<T>(this SyntaxToken token, Func<T, bool>? predicate = null) where T : SyntaxNode
21public static T GetRequiredAncestor<T>(this SyntaxToken token, Func<T, bool>? predicate = null) where T : SyntaxNode
32public static IEnumerable<SyntaxNode> GetAncestors(this SyntaxToken token, Func<SyntaxNode, bool> predicate)
42public static bool CheckParent<T>(this SyntaxToken token, Func<T, bool> valueChecker) where T : SyntaxNode
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Options\PublicOptionFactory.cs (4)
17public static Option2<T> WithPublicOption<T, TPublicValue>(this Option2<T> option, string feature, string name, Func<T, TPublicValue> toPublicValue, Func<TPublicValue, T> toInternalValue)
20public static PerLanguageOption2<T> WithPublicOption<T, TPublicValue>(this PerLanguageOption2<T> option, string feature, string name, Func<T, TPublicValue> toPublicValue, Func<TPublicValue, T> toInternalValue)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\TopologicalSorter.cs (8)
13public static IEnumerable<T> TopologicalSort<T>(this IEnumerable<T> items, Func<T, IEnumerable<T>> itemsBefore)
26public static IEnumerable<T> TopologicalSort<T>(this IEnumerable<T> items, Func<T, IEnumerable<T>> itemsBefore, Func<T, IEnumerable<T>> itemsAfter)
29var combinedItemsBefore = CreateCombinedItemsBefore(items, itemsBefore, itemsAfter);
35Func<T, IEnumerable<T>> itemsBefore,
50private static Func<T, IEnumerable<T>> CreateCombinedItemsBefore<T>(IEnumerable<T> items, Func<T, IEnumerable<T>> itemsBefore, Func<T, IEnumerable<T>> itemsAfter)
Microsoft.CodeAnalysis.Scripting (34)
Script.cs (24)
194public Task<ScriptState> RunAsync(object globals = null, Func<Exception, bool> catchException = null, CancellationToken cancellationToken = default(CancellationToken))
197internal abstract Task<ScriptState> CommonRunAsync(object globals, Func<Exception, bool> catchException, CancellationToken cancellationToken);
222public Task<ScriptState> RunFromAsync(ScriptState previousState, Func<Exception, bool> catchException = null, CancellationToken cancellationToken = default(CancellationToken))
225internal abstract Task<ScriptState> CommonRunFromAsync(ScriptState previousState, Func<Exception, bool> catchException, CancellationToken cancellationToken);
235internal abstract Func<object[], Task> CommonGetExecutor(CancellationToken cancellationToken);
341private ImmutableArray<Func<object[], Task>> _lazyPrecedingExecutors;
342private Func<object[], Task<T>> _lazyExecutor;
374internal override Func<object[], Task> CommonGetExecutor(CancellationToken cancellationToken)
380internal override Task<ScriptState> CommonRunAsync(object globals, Func<Exception, bool> catchException, CancellationToken cancellationToken)
383internal override Task<ScriptState> CommonRunFromAsync(ScriptState previousState, Func<Exception, bool> catchException, CancellationToken cancellationToken)
387private Func<object[], Task<T>> GetExecutor(CancellationToken cancellationToken)
398private ImmutableArray<Func<object[], Task>> GetPrecedingExecutors(CancellationToken cancellationToken)
411private ImmutableArray<Func<object[], Task>> TryGetPrecedingExecutors(Script lastExecutedScriptInChainOpt, CancellationToken cancellationToken)
416return ImmutableArray<Func<object[], Task>>.Empty;
430return default(ImmutableArray<Func<object[], Task>>);
433var executors = ArrayBuilder<Func<object[], Task>>.GetInstance(scriptsReversed.Count);
486public new Task<ScriptState<T>> RunAsync(object globals = null, Func<Exception, bool> catchException = null, CancellationToken cancellationToken = default(CancellationToken))
495var currentExecutor = GetExecutor(cancellationToken);
509var currentExecutor = GetExecutor(cancellationToken);
546public new Task<ScriptState<T>> RunFromAsync(ScriptState previousState, Func<Exception, bool> catchException = null, CancellationToken cancellationToken = default(CancellationToken))
568var currentExecutor = GetExecutor(cancellationToken);
576ImmutableArray<Func<object[], Task>> precedingExecutors,
577Func<object[], Task> currentExecutor,
578Func<Exception, bool> catchExceptionOpt,
Microsoft.CodeAnalysis.Test.Utilities (53)
Assert\AssertEx.cs (14)
228Func<T, string> itemInspector = null,
255Func<T, string> itemInspector = null,
382public static void SetEqual(IEnumerable<string> expected, IEnumerable<string> actual, IEqualityComparer<string> comparer = null, string message = null, string itemSeparator = "\r\n", Func<string, string> itemInspector = null)
477public static void SetEqual<T>(IEnumerable<T> expected, IEnumerable<T> actual, IEqualityComparer<T> comparer = null, string message = null, string itemSeparator = "\r\n", Func<T, string> itemInspector = null)
505public static void None<T>(IEnumerable<T> actual, Func<T, bool> predicate)
517public static void Any<T>(IEnumerable<T> actual, Func<T, bool> predicate)
523public static void All<T>(IEnumerable<T> actual, Func<T, bool> predicate)
539public static string ToString<T>(IEnumerable<T> list, string separator = ", ", Func<T, string> itemInspector = null)
648Func<T, string> itemInspector = escapeQuotes ? new Func<T, string>(t => t.ToString().Replace("\"", "\"\"")) : null;
659Func<T, string> itemInspector = null,
764Func<T, string> itemInspector = null,
824static string join(string itemSeparator, ReadOnlySpan<T> items, Func<T, string> itemInspector)
917public static void Equal<T>(T[,] expected, Func<int, int, T> getResult, Func<T, T, bool> valuesEqual, Func<T, string> printValue, string format, int size)
1016public static void Contains<T>(IEnumerable<T> collection, Predicate<T> filter, Func<T, string>? itemInspector = null, string? itemSeparator = null)
MarkedSource\SourceWithMarkedNodes.cs (4)
41public SourceWithMarkedNodes(string markedSource, Func<string, SyntaxTree> parser, Func<string, int> getSyntaxKind, bool removeTags = false)
52private static IEnumerable<MarkedSpan> GetSpansRecursive(string markedSource, int offset, Func<string, int> getSyntaxKind)
133public static Func<SyntaxNode, SyntaxNode> GetSyntaxMap(SourceWithMarkedNodes source0, SourceWithMarkedNodes source1, List<SyntaxNode> unmappedNodes = null)
Microsoft.CodeAnalysis.Threading.Package (107)
src\Dependencies\Collections\Extensions\IEnumerableExtensions.cs (30)
164public static T? FirstOrNull<T>(this IEnumerable<T> source, Func<T, bool> predicate)
182public static T? SingleOrNull<T>(this IEnumerable<T> source, Func<T, bool> predicate)
261public static bool HasDuplicates<TItem, TValue>(this IEnumerable<TItem> source, Func<TItem, TValue> selector)
271/// <seealso cref="Microsoft.CodeAnalysis.ImmutableArrayExtensions.HasDuplicates{TItem, TValue}(ImmutableArray{TItem}, Func{TItem, TValue}, IEqualityComparer{TValue})"/>
273public static bool HasDuplicates<TItem, TValue>(this IEnumerable<TItem> source, Func<TItem, TValue> selector, IEqualityComparer<TValue> comparer)
321private static readonly Func<object, bool> s_notNullTest = x => x != null;
331return source.Where((Func<T?, bool>)s_notNullTest)!;
376public static ImmutableArray<T> WhereAsArray<T>(this IEnumerable<T> values, Func<T, bool> predicate)
407public static ImmutableArray<TResult> SelectAsArray<TSource, TResult>(this IEnumerable<TSource>? source, Func<TSource, TResult> selector)
417public static ImmutableArray<TResult> SelectAsArray<TItem, TResult>(this IEnumerable<TItem>? source, Func<TItem, bool> predicate, Func<TItem, TResult> selector)
461public static ImmutableArray<TResult> SelectAsArray<TSource, TResult>(this IReadOnlyCollection<TSource>? source, Func<TSource, TResult> selector)
485public static ImmutableArray<TResult> SelectManyAsArray<TSource, TResult>(this IEnumerable<TSource>? source, Func<TSource, IEnumerable<TResult>> selector)
507public static ImmutableArray<TResult> SelectManyAsArray<TItem, TResult>(this IReadOnlyCollection<TItem>? source, Func<TItem, IEnumerable<TResult>> selector)
533public static ImmutableArray<TResult> SelectManyAsArray<TSource, TResult>(this IEnumerable<TSource>? source, Func<TSource, OneOrMany<TResult>> selector)
547public static async ValueTask<ImmutableArray<TResult>> SelectAsArrayAsync<TItem, TResult>(this IEnumerable<TItem> source, Func<TItem, ValueTask<TResult>> selector)
764internal static Dictionary<K, ImmutableArray<T>> ToMultiDictionary<K, T>(this IEnumerable<T> data, Func<T, K> keySelector, IEqualityComparer<K>? comparer = null)
815public static readonly Func<T, T> Identity = t => t;
816public static readonly Func<T, bool> True = t => true;
840/// Alias for <see cref="System.Linq.Enumerable.Any{TSource}(IEnumerable{TSource}, Func{TSource, bool})"/>
842public static bool Contains<T>(this IEnumerable<T> sequence, Func<T, bool> predicate)
846/// Variant of <see cref="System.Linq.Enumerable.Count{TSource}(IEnumerable{TSource}, Func{TSource, bool})"/>
861/// Variant of <see cref="System.Linq.Enumerable.FirstOrDefault{TSource}(IEnumerable{TSource}, Func{TSource, bool})"/>
875/// Variant of <see cref="System.Linq.Enumerable.Any{TSource}(IEnumerable{TSource}, Func{TSource, bool})"/>
889/// Variant of <see cref="System.Linq.Enumerable.OrderBy{TSource, TKey}(IEnumerable{TSource}, Func{TSource, TKey}, IComparer{TKey}?)"/>
895/// Variant of <see cref="System.Linq.Enumerable.OrderByDescending{TSource, TKey}(IEnumerable{TSource}, Func{TSource, TKey}, IComparer{TKey}?)"/>
901/// Variant of <see cref="System.Linq.Enumerable.OrderBy{TSource, TKey}(IEnumerable{TSource}, Func{TSource, TKey}, IComparer{TKey}?)"/>
907/// Variant of <see cref="System.Linq.Enumerable.OrderByDescending{TSource, TKey}(IEnumerable{TSource}, Func{TSource, TKey}, IComparer{TKey}?)"/>
913/// Variant of <see cref="System.Linq.Enumerable.ThenBy{TSource, TKey}(IOrderedEnumerable{TSource}, Func{TSource, TKey}, IComparer{TKey}?)"/>
919/// Variant of <see cref="System.Linq.Enumerable.ThenBy{TSource, TKey}(IOrderedEnumerable{TSource}, Func{TSource, TKey}, IComparer{TKey}?)"/>
src\Dependencies\Collections\Extensions\IListExtensions.cs (4)
21public static bool HasDuplicates<TItem, TValue>(this IReadOnlyList<TItem> list, Func<TItem, TValue> selector)
31/// <seealso cref="ImmutableArrayExtensions.HasDuplicates{TItem, TValue}(System.Collections.Immutable.ImmutableArray{TItem}, Func{TItem, TValue}, IEqualityComparer{TValue})"/>
32/// <seealso cref="Roslyn.Utilities.EnumerableExtensions.HasDuplicates{TItem, TValue}(IEnumerable{TItem}, Func{TItem, TValue}, IEqualityComparer{TValue})"/>
34internal static bool HasDuplicates<TItem, TValue>(this IReadOnlyList<TItem> list, Func<TItem, TValue> selector, IEqualityComparer<TValue> comparer)
src\Dependencies\Collections\Extensions\ImmutableArrayExtensions.cs (27)
138public static ImmutableArray<TResult> SelectAsArray<TItem, TResult>(this ImmutableArray<TItem> items, Func<TItem, TResult> map)
198public static ImmutableArray<TResult> SelectAsArray<TItem, TResult>(this ImmutableArray<TItem> array, Func<TItem, bool> predicate, Func<TItem, TResult> selector)
247public static ImmutableArray<TResult> SelectManyAsArray<TItem, TResult>(this ImmutableArray<TItem> array, Func<TItem, IEnumerable<TResult>> selector)
267public static ImmutableArray<TResult> SelectManyAsArray<TItem, TResult>(this ImmutableArray<TItem> array, Func<TItem, ImmutableArray<TResult>> selector)
287public static ImmutableArray<TResult> SelectManyAsArray<TItem, TResult>(this ImmutableArray<TItem> array, Func<TItem, OneOrMany<TResult>> selector)
308public static ImmutableArray<TResult> SelectManyAsArray<TItem, TResult>(this ImmutableArray<TItem> array, Func<TItem, bool> predicate, Func<TItem, IEnumerable<TResult>> selector)
332public static ImmutableArray<TResult> SelectManyAsArray<TItem, TResult>(this ImmutableArray<TItem> array, Func<TItem, bool> predicate, Func<TItem, ImmutableArray<TResult>> selector)
356public static ImmutableArray<TResult> SelectManyAsArray<TItem, TResult>(this ImmutableArray<TItem> array, Func<TItem, bool> predicate, Func<TItem, OneOrMany<TResult>> selector)
493public static ImmutableArray<T> WhereAsArray<T>(this ImmutableArray<T> array, Func<T, bool> predicate)
504private static ImmutableArray<T> WhereAsArrayImpl<T, TArg>(ImmutableArray<T> array, Func<T, bool>? predicateWithoutArg, Func<T, TArg, bool>? predicateWithArg, TArg arg)
573public static async Task<bool> AnyAsync<T>(this ImmutableArray<T> array, Func<T, Task<bool>> predicateAsync)
595public static async ValueTask<T?> FirstOrDefaultAsync<T>(this ImmutableArray<T> array, Func<T, Task<bool>> predicateAsync)
757public static bool HasDuplicates<TItem, TValue>(this ImmutableArray<TItem> array, Func<TItem, TValue> selector)
767/// <seealso cref="Roslyn.Utilities.EnumerableExtensions.HasDuplicates{TItem, TValue}(IEnumerable{TItem}, Func{TItem, TValue}, IEqualityComparer{TValue})"/>
769internal static bool HasDuplicates<TItem, TValue>(this ImmutableArray<TItem> array, Func<TItem, TValue> selector, IEqualityComparer<TValue> comparer)
990/// Variant of <see cref="System.Linq.ImmutableArrayExtensions.FirstOrDefault{T}(ImmutableArray{T}, Func{T, bool})"/>
1004/// Variant of <see cref="System.Linq.ImmutableArrayExtensions.Single{T}(ImmutableArray{T}, Func{T, bool})"/>
1066/// Specialization of <see cref="System.Linq.Enumerable.Count{TSource}(IEnumerable{TSource}, Func{TSource, bool})"/> for <see cref="ImmutableArray{T}"/>.
1068public static int Count<T>(this ImmutableArray<T> items, Func<T, bool> predicate)
1086public static int Sum<T>(this ImmutableArray<T> items, Func<T, int> selector)
1213/// Variant of <see cref="System.Linq.ImmutableArrayExtensions.Any{T}(ImmutableArray{T}, Func{T, bool})"/>.
1227/// Variant of <see cref="System.Linq.ImmutableArrayExtensions.All{T}(ImmutableArray{T}, Func{T, bool})"/>.
1257public static bool Contains<T>(this ImmutableArray<T> array, Func<T, bool> predicate)
src\Dependencies\Collections\RoslynImmutableInterlocked.cs (7)
33public static bool Update<T>(ref ImmutableSegmentedList<T> location, Func<ImmutableSegmentedList<T>, ImmutableSegmentedList<T>> transformer)
154public static bool Update<T>(ref ImmutableSegmentedHashSet<T> location, Func<ImmutableSegmentedHashSet<T>, ImmutableSegmentedHashSet<T>> transformer)
276public static bool Update<TKey, TValue>(ref ImmutableSegmentedDictionary<TKey, TValue> location, Func<ImmutableSegmentedDictionary<TKey, TValue>, ImmutableSegmentedDictionary<TKey, TValue>> transformer)
410/// <inheritdoc cref="ImmutableInterlocked.GetOrAdd{TKey, TValue}(ref ImmutableDictionary{TKey, TValue}, TKey, Func{TKey, TValue})"/>
411public static TValue GetOrAdd<TKey, TValue>(ref ImmutableSegmentedDictionary<TKey, TValue> location, TKey key, Func<TKey, TValue> valueFactory)
458/// <inheritdoc cref="ImmutableInterlocked.AddOrUpdate{TKey, TValue}(ref ImmutableDictionary{TKey, TValue}, TKey, Func{TKey, TValue}, Func{TKey, TValue, TValue})"/>
459public static TValue AddOrUpdate<TKey, TValue>(ref ImmutableSegmentedDictionary<TKey, TValue> location, TKey key, Func<TKey, TValue> addValueFactory, Func<TKey, TValue, TValue> updateValueFactory)
src\Dependencies\Collections\Segmented\ImmutableSegmentedDictionary.cs (6)
68public static ImmutableSegmentedDictionary<TKey, TValue> ToImmutableSegmentedDictionary<TSource, TKey, TValue>(this IEnumerable<TSource> source, Func<TSource, TKey> keySelector, Func<TSource, TValue> elementSelector)
72public static ImmutableSegmentedDictionary<TKey, TValue> ToImmutableSegmentedDictionary<TSource, TKey, TValue>(this IEnumerable<TSource> source, Func<TSource, TKey> keySelector, Func<TSource, TValue> elementSelector, IEqualityComparer<TKey>? keyComparer)
86public static ImmutableSegmentedDictionary<TKey, TSource> ToImmutableSegmentedDictionary<TSource, TKey>(this IEnumerable<TSource> source, Func<TSource, TKey> keySelector)
90public static ImmutableSegmentedDictionary<TKey, TSource> ToImmutableSegmentedDictionary<TSource, TKey>(this IEnumerable<TSource> source, Func<TSource, TKey> keySelector, IEqualityComparer<TKey>? keyComparer)
src\Dependencies\PooledObjects\ArrayBuilder.cs (7)
457public void FreeAll(Func<T, ArrayBuilder<T>?> getNested)
560internal Dictionary<K, ImmutableArray<T>> ToDictionary<K>(Func<T, K> keySelector, IEqualityComparer<K>? comparer = null)
608public void AddRange<U>(ArrayBuilder<U> items, Func<U, T> selector)
745public ImmutableArray<S> SelectDistinct<S>(Func<T, S> selector)
763public bool Any(Func<T, bool> predicate)
787public bool All(Func<T, bool> predicate)
817public ImmutableArray<TResult> SelectAsArray<TResult>(Func<T, TResult> map)
src\Dependencies\PooledObjects\PooledDelegates.cs (9)
200public static Releaser GetPooledFunction<TArg, TResult>(Func<TArg, TResult> unboundFunction, TArg argument, out Func<TResult> boundFunction)
201=> GetPooledDelegate<FuncWithBoundArgument<TArg, TResult>, TArg, Func<TArg, TResult>, Func<TResult>>(unboundFunction, argument, out boundFunction);
204/// Equivalent to <see cref="GetPooledFunction{TArg, TResult}(Func{TArg, TResult}, TArg, out Func{TResult})"/>,
216/// Gets a <see cref="Func{T, TResult}"/> delegate, which calls <paramref name="unboundFunction"/> with the
246public static Releaser GetPooledFunction<T1, TArg, TResult>(Func<T1, TArg, TResult> unboundFunction, TArg argument, out Func<T1, TResult> boundFunction)
247=> GetPooledDelegate<FuncWithBoundArgument<T1, TArg, TResult>, TArg, Func<T1, TArg, TResult>, Func<T1, TResult>>(unboundFunction, argument, out boundFunction);
412: AbstractDelegateWithBoundArgument<FuncWithBoundArgument<TArg, TResult>, TArg, Func<TArg, TResult>, Func<TResult>>
432: AbstractDelegateWithBoundArgument<FuncWithBoundArgument<T1, TArg, TResult>, TArg, Func<T1, TArg, TResult>, Func<T1, TResult>>
434protected override Func<T1, TResult> Bind()
Microsoft.CodeAnalysis.UnitTests (37)
Collections\List\SegmentedList.Generic.Tests.Misc.cs (6)
27public Func<T?[], IEnumerable<T?>>[] CollectionGenerators { get; }
31CollectionGenerators = new Func<T?[], IEnumerable<T?>>[]
125public void InsertRangeIEnumerable(T?[] itemsX, T?[] itemsY, int index, int repeat, Func<T?[], IEnumerable<T?>> constructIEnumerable)
181public void InsertRangeValidations(T?[] items, Func<T?[], IEnumerable<T?>> constructIEnumerable)
821foreach (Func<int[], IEnumerable<int>> collectionGenerator in IntDriver.CollectionGenerators)
839foreach (Func<string?[], IEnumerable<string?>> collectionGenerator in StringDriver.CollectionGenerators)
Microsoft.CodeAnalysis.VisualBasic (4)
Microsoft.CodeAnalysis.Workspaces (534)
Classification\SyntaxClassification\AbstractSyntaxClassificationService.Worker.cs (6)
25private readonly Func<SyntaxNode, ImmutableArray<ISyntaxClassifier>> _getNodeClassifiers;
26private readonly Func<SyntaxToken, ImmutableArray<ISyntaxClassifier>> _getTokenClassifiers;
38Func<SyntaxNode, ImmutableArray<ISyntaxClassifier>> getNodeClassifiers,
39Func<SyntaxToken, ImmutableArray<ISyntaxClassifier>> getTokenClassifiers,
60Func<SyntaxNode, ImmutableArray<ISyntaxClassifier>> getNodeClassifiers,
61Func<SyntaxToken, ImmutableArray<ISyntaxClassifier>> getTokenClassifiers,
CodeActions\CodeAction.cs (8)
109private bool IsNonProgressApiOverridden(Dictionary<Type, bool> dictionary, Func<CodeAction, bool> computeResult)
486public static CodeAction Create(string title, Func<CancellationToken, Task<Document>> createChangedDocument, string? equivalenceKey)
493/// <inheritdoc cref="Create(string, Func{CancellationToken, Task{Document}}, string?)"/>
496public static CodeAction Create(string title, Func<CancellationToken, Task<Document>> createChangedDocument, string? equivalenceKey = null, CodeActionPriority priority = CodeActionPriority.Default)
499/// <inheritdoc cref="Create(string, Func{CancellationToken, Task{Document}}, string?, CodeActionPriority)"/>
520public static CodeAction Create(string title, Func<CancellationToken, Task<Solution>> createChangedSolution, string? equivalenceKey)
531public static CodeAction Create(string title, Func<CancellationToken, Task<Solution>> createChangedSolution, string? equivalenceKey = null, CodeActionPriority priority = CodeActionPriority.Default)
534/// <inheritdoc cref="Create(string, Func{CancellationToken, Task{Solution}}, string?, CodeActionPriority)"/>
ExtensionManager\IExtensionManagerExtensions.cs (5)
69Func<CancellationToken, Task<T>?> function,
90public static Func<SyntaxNode, ImmutableArray<TExtension>> CreateNodeExtensionGetter<TExtension>(
91this IExtensionManager extensionManager, IEnumerable<TExtension> extensions, Func<TExtension, ImmutableArray<Type>> nodeTypeGetter)
114public static Func<SyntaxToken, ImmutableArray<TExtension>> CreateTokenExtensionGetter<TExtension>(
115this IExtensionManager extensionManager, IEnumerable<TExtension> extensions, Func<TExtension, ImmutableArray<int>> tokenKindGetter)
FindSymbols\FindReferences\DependentTypeFinder.cs (10)
43private static readonly Func<Location, bool> s_isInMetadata = static loc => loc.IsInMetadata;
44private static readonly Func<Location, bool> s_isInSource = static loc => loc.IsInSource;
46private static readonly Func<INamedTypeSymbol, bool> s_isInterface = static t => t is { TypeKind: TypeKind.Interface };
47private static readonly Func<INamedTypeSymbol, bool> s_isNonSealedClass = static t => t is { TypeKind: TypeKind.Class, IsSealed: false };
48private static readonly Func<INamedTypeSymbol, bool> s_isInterfaceOrNonSealedClass = static t => s_isInterface(t) || s_isNonSealedClass(t);
66Func<INamedTypeSymbol, bool> shouldContinueSearching,
255Func<INamedTypeSymbol, bool>? predicate)
376SymbolSet foundTypes, Func<Location, bool> assert, string message)
389private static void AddRange(SymbolSet foundTypes, SymbolSet currentTypes, Func<INamedTypeSymbol, bool> shouldContinueSearching)
540Func<INamedTypeSymbol, bool> shouldContinueSearching)
FindSymbols\SymbolFinder_Declarations_CustomQueries.cs (4)
28public static Task<IEnumerable<ISymbol>> FindSourceDeclarationsAsync(Solution solution, Func<string, bool> predicate, CancellationToken cancellationToken = default)
34public static async Task<IEnumerable<ISymbol>> FindSourceDeclarationsAsync(Solution solution, Func<string, bool> predicate, SymbolFilter filter, CancellationToken cancellationToken = default)
73public static Task<IEnumerable<ISymbol>> FindSourceDeclarationsAsync(Project project, Func<string, bool> predicate, CancellationToken cancellationToken = default)
79public static async Task<IEnumerable<ISymbol>> FindSourceDeclarationsAsync(Project project, Func<string, bool> predicate, SymbolFilter filter, CancellationToken cancellationToken = default)
Simplification\Simplifier.cs (6)
62public static async Task<TNode> ExpandAsync<TNode>(TNode node, Document document, Func<SyntaxNode, bool>? expandInsideNode = null, bool expandParameter = false, CancellationToken cancellationToken = default) where TNode : SyntaxNode
81public static TNode Expand<TNode>(TNode node, SemanticModel semanticModel, Workspace workspace, Func<SyntaxNode, bool>? expandInsideNode = null, bool expandParameter = false, CancellationToken cancellationToken = default) where TNode : SyntaxNode
92internal static TNode Expand<TNode>(TNode node, SemanticModel semanticModel, SolutionServices services, Func<SyntaxNode, bool>? expandInsideNode = null, bool expandParameter = false, CancellationToken cancellationToken = default) where TNode : SyntaxNode
112public static async Task<SyntaxToken> ExpandAsync(SyntaxToken token, Document document, Func<SyntaxNode, bool>? expandInsideNode = null, CancellationToken cancellationToken = default)
126public static SyntaxToken Expand(SyntaxToken token, SemanticModel semanticModel, Workspace workspace, Func<SyntaxNode, bool>? expandInsideNode = null, CancellationToken cancellationToken = default)
137internal static SyntaxToken Expand(SyntaxToken token, SemanticModel semanticModel, SolutionServices services, Func<SyntaxNode, bool>? expandInsideNode = null, CancellationToken cancellationToken = default)
src\Compilers\Core\Portable\FileSystem\FileUtilities.cs (4)
47Func<string, bool> fileExists)
322public static T RethrowExceptionsAsIOException<T, TArg>(Func<TArg, T> operation, TArg arg)
339public static async Task<T> RethrowExceptionsAsIOExceptionAsync<T, TArg>(Func<TArg, Task<T>> operation, TArg arg)
355internal static Stream CreateFileStreamChecked(Func<string, Stream> factory, string path, string? paramName = null)
src\Compilers\Core\Portable\InternalUtilities\InterlockedOperations.cs (5)
46public static T Initialize<T, TArg>([NotNull] ref T? target, Func<TArg, T> valueFactory, TArg arg)
66public static int Initialize<TArg>(ref int target, int uninitializedValue, Func<TArg, int> valueFactory, TArg arg)
103public static T? Initialize<T, TArg>([NotNull] ref StrongBox<T?>? target, Func<TArg, T?> valueFactory, TArg arg)
183public static ImmutableArray<T> Initialize<T, TArg>(ref ImmutableArray<T> target, Func<TArg, ImmutableArray<T>> createArray, TArg arg)
193private static ImmutableArray<T> Initialize_Slow<T, TArg>(ref ImmutableArray<T> target, Func<TArg, ImmutableArray<T>> createArray, TArg arg)
src\Compilers\Core\Portable\SourceGeneration\GeneratedCodeUtilities.cs (4)
49SyntaxTree tree, Func<SyntaxTrivia, bool> isComment, CancellationToken cancellationToken)
55internal static bool IsGeneratedCode(string? filePath, SyntaxNode root, Func<SyntaxTrivia, bool> isComment)
88private static bool BeginsWithAutoGeneratedComment(SyntaxNode root, Func<SyntaxTrivia, bool> isComment)
118SyntaxTree tree, Func<SyntaxTrivia, bool> isComment, CancellationToken cancellationToken)
src\Dependencies\Collections\Extensions\IEnumerableExtensions.cs (30)
164public static T? FirstOrNull<T>(this IEnumerable<T> source, Func<T, bool> predicate)
182public static T? SingleOrNull<T>(this IEnumerable<T> source, Func<T, bool> predicate)
261public static bool HasDuplicates<TItem, TValue>(this IEnumerable<TItem> source, Func<TItem, TValue> selector)
271/// <seealso cref="Microsoft.CodeAnalysis.ImmutableArrayExtensions.HasDuplicates{TItem, TValue}(ImmutableArray{TItem}, Func{TItem, TValue}, IEqualityComparer{TValue})"/>
273public static bool HasDuplicates<TItem, TValue>(this IEnumerable<TItem> source, Func<TItem, TValue> selector, IEqualityComparer<TValue> comparer)
321private static readonly Func<object, bool> s_notNullTest = x => x != null;
331return source.Where((Func<T?, bool>)s_notNullTest)!;
376public static ImmutableArray<T> WhereAsArray<T>(this IEnumerable<T> values, Func<T, bool> predicate)
407public static ImmutableArray<TResult> SelectAsArray<TSource, TResult>(this IEnumerable<TSource>? source, Func<TSource, TResult> selector)
417public static ImmutableArray<TResult> SelectAsArray<TItem, TResult>(this IEnumerable<TItem>? source, Func<TItem, bool> predicate, Func<TItem, TResult> selector)
461public static ImmutableArray<TResult> SelectAsArray<TSource, TResult>(this IReadOnlyCollection<TSource>? source, Func<TSource, TResult> selector)
485public static ImmutableArray<TResult> SelectManyAsArray<TSource, TResult>(this IEnumerable<TSource>? source, Func<TSource, IEnumerable<TResult>> selector)
507public static ImmutableArray<TResult> SelectManyAsArray<TItem, TResult>(this IReadOnlyCollection<TItem>? source, Func<TItem, IEnumerable<TResult>> selector)
533public static ImmutableArray<TResult> SelectManyAsArray<TSource, TResult>(this IEnumerable<TSource>? source, Func<TSource, OneOrMany<TResult>> selector)
547public static async ValueTask<ImmutableArray<TResult>> SelectAsArrayAsync<TItem, TResult>(this IEnumerable<TItem> source, Func<TItem, ValueTask<TResult>> selector)
764internal static Dictionary<K, ImmutableArray<T>> ToMultiDictionary<K, T>(this IEnumerable<T> data, Func<T, K> keySelector, IEqualityComparer<K>? comparer = null)
815public static readonly Func<T, T> Identity = t => t;
816public static readonly Func<T, bool> True = t => true;
840/// Alias for <see cref="System.Linq.Enumerable.Any{TSource}(IEnumerable{TSource}, Func{TSource, bool})"/>
842public static bool Contains<T>(this IEnumerable<T> sequence, Func<T, bool> predicate)
846/// Variant of <see cref="System.Linq.Enumerable.Count{TSource}(IEnumerable{TSource}, Func{TSource, bool})"/>
861/// Variant of <see cref="System.Linq.Enumerable.FirstOrDefault{TSource}(IEnumerable{TSource}, Func{TSource, bool})"/>
875/// Variant of <see cref="System.Linq.Enumerable.Any{TSource}(IEnumerable{TSource}, Func{TSource, bool})"/>
889/// Variant of <see cref="System.Linq.Enumerable.OrderBy{TSource, TKey}(IEnumerable{TSource}, Func{TSource, TKey}, IComparer{TKey}?)"/>
895/// Variant of <see cref="System.Linq.Enumerable.OrderByDescending{TSource, TKey}(IEnumerable{TSource}, Func{TSource, TKey}, IComparer{TKey}?)"/>
901/// Variant of <see cref="System.Linq.Enumerable.OrderBy{TSource, TKey}(IEnumerable{TSource}, Func{TSource, TKey}, IComparer{TKey}?)"/>
907/// Variant of <see cref="System.Linq.Enumerable.OrderByDescending{TSource, TKey}(IEnumerable{TSource}, Func{TSource, TKey}, IComparer{TKey}?)"/>
913/// Variant of <see cref="System.Linq.Enumerable.ThenBy{TSource, TKey}(IOrderedEnumerable{TSource}, Func{TSource, TKey}, IComparer{TKey}?)"/>
919/// Variant of <see cref="System.Linq.Enumerable.ThenBy{TSource, TKey}(IOrderedEnumerable{TSource}, Func{TSource, TKey}, IComparer{TKey}?)"/>
src\Dependencies\Collections\Extensions\IListExtensions.cs (4)
21public static bool HasDuplicates<TItem, TValue>(this IReadOnlyList<TItem> list, Func<TItem, TValue> selector)
31/// <seealso cref="ImmutableArrayExtensions.HasDuplicates{TItem, TValue}(System.Collections.Immutable.ImmutableArray{TItem}, Func{TItem, TValue}, IEqualityComparer{TValue})"/>
32/// <seealso cref="Roslyn.Utilities.EnumerableExtensions.HasDuplicates{TItem, TValue}(IEnumerable{TItem}, Func{TItem, TValue}, IEqualityComparer{TValue})"/>
34internal static bool HasDuplicates<TItem, TValue>(this IReadOnlyList<TItem> list, Func<TItem, TValue> selector, IEqualityComparer<TValue> comparer)
src\Dependencies\Collections\Extensions\ImmutableArrayExtensions.cs (27)
138public static ImmutableArray<TResult> SelectAsArray<TItem, TResult>(this ImmutableArray<TItem> items, Func<TItem, TResult> map)
198public static ImmutableArray<TResult> SelectAsArray<TItem, TResult>(this ImmutableArray<TItem> array, Func<TItem, bool> predicate, Func<TItem, TResult> selector)
247public static ImmutableArray<TResult> SelectManyAsArray<TItem, TResult>(this ImmutableArray<TItem> array, Func<TItem, IEnumerable<TResult>> selector)
267public static ImmutableArray<TResult> SelectManyAsArray<TItem, TResult>(this ImmutableArray<TItem> array, Func<TItem, ImmutableArray<TResult>> selector)
287public static ImmutableArray<TResult> SelectManyAsArray<TItem, TResult>(this ImmutableArray<TItem> array, Func<TItem, OneOrMany<TResult>> selector)
308public static ImmutableArray<TResult> SelectManyAsArray<TItem, TResult>(this ImmutableArray<TItem> array, Func<TItem, bool> predicate, Func<TItem, IEnumerable<TResult>> selector)
332public static ImmutableArray<TResult> SelectManyAsArray<TItem, TResult>(this ImmutableArray<TItem> array, Func<TItem, bool> predicate, Func<TItem, ImmutableArray<TResult>> selector)
356public static ImmutableArray<TResult> SelectManyAsArray<TItem, TResult>(this ImmutableArray<TItem> array, Func<TItem, bool> predicate, Func<TItem, OneOrMany<TResult>> selector)
493public static ImmutableArray<T> WhereAsArray<T>(this ImmutableArray<T> array, Func<T, bool> predicate)
504private static ImmutableArray<T> WhereAsArrayImpl<T, TArg>(ImmutableArray<T> array, Func<T, bool>? predicateWithoutArg, Func<T, TArg, bool>? predicateWithArg, TArg arg)
573public static async Task<bool> AnyAsync<T>(this ImmutableArray<T> array, Func<T, Task<bool>> predicateAsync)
595public static async ValueTask<T?> FirstOrDefaultAsync<T>(this ImmutableArray<T> array, Func<T, Task<bool>> predicateAsync)
757public static bool HasDuplicates<TItem, TValue>(this ImmutableArray<TItem> array, Func<TItem, TValue> selector)
767/// <seealso cref="Roslyn.Utilities.EnumerableExtensions.HasDuplicates{TItem, TValue}(IEnumerable{TItem}, Func{TItem, TValue}, IEqualityComparer{TValue})"/>
769internal static bool HasDuplicates<TItem, TValue>(this ImmutableArray<TItem> array, Func<TItem, TValue> selector, IEqualityComparer<TValue> comparer)
990/// Variant of <see cref="System.Linq.ImmutableArrayExtensions.FirstOrDefault{T}(ImmutableArray{T}, Func{T, bool})"/>
1004/// Variant of <see cref="System.Linq.ImmutableArrayExtensions.Single{T}(ImmutableArray{T}, Func{T, bool})"/>
1066/// Specialization of <see cref="System.Linq.Enumerable.Count{TSource}(IEnumerable{TSource}, Func{TSource, bool})"/> for <see cref="ImmutableArray{T}"/>.
1068public static int Count<T>(this ImmutableArray<T> items, Func<T, bool> predicate)
1086public static int Sum<T>(this ImmutableArray<T> items, Func<T, int> selector)
1213/// Variant of <see cref="System.Linq.ImmutableArrayExtensions.Any{T}(ImmutableArray{T}, Func{T, bool})"/>.
1227/// Variant of <see cref="System.Linq.ImmutableArrayExtensions.All{T}(ImmutableArray{T}, Func{T, bool})"/>.
1257public static bool Contains<T>(this ImmutableArray<T> array, Func<T, bool> predicate)
src\Dependencies\Collections\RoslynImmutableInterlocked.cs (7)
33public static bool Update<T>(ref ImmutableSegmentedList<T> location, Func<ImmutableSegmentedList<T>, ImmutableSegmentedList<T>> transformer)
154public static bool Update<T>(ref ImmutableSegmentedHashSet<T> location, Func<ImmutableSegmentedHashSet<T>, ImmutableSegmentedHashSet<T>> transformer)
276public static bool Update<TKey, TValue>(ref ImmutableSegmentedDictionary<TKey, TValue> location, Func<ImmutableSegmentedDictionary<TKey, TValue>, ImmutableSegmentedDictionary<TKey, TValue>> transformer)
410/// <inheritdoc cref="ImmutableInterlocked.GetOrAdd{TKey, TValue}(ref ImmutableDictionary{TKey, TValue}, TKey, Func{TKey, TValue})"/>
411public static TValue GetOrAdd<TKey, TValue>(ref ImmutableSegmentedDictionary<TKey, TValue> location, TKey key, Func<TKey, TValue> valueFactory)
458/// <inheritdoc cref="ImmutableInterlocked.AddOrUpdate{TKey, TValue}(ref ImmutableDictionary{TKey, TValue}, TKey, Func{TKey, TValue}, Func{TKey, TValue, TValue})"/>
459public static TValue AddOrUpdate<TKey, TValue>(ref ImmutableSegmentedDictionary<TKey, TValue> location, TKey key, Func<TKey, TValue> addValueFactory, Func<TKey, TValue, TValue> updateValueFactory)
src\Dependencies\Collections\Segmented\ImmutableSegmentedDictionary.cs (6)
68public static ImmutableSegmentedDictionary<TKey, TValue> ToImmutableSegmentedDictionary<TSource, TKey, TValue>(this IEnumerable<TSource> source, Func<TSource, TKey> keySelector, Func<TSource, TValue> elementSelector)
72public static ImmutableSegmentedDictionary<TKey, TValue> ToImmutableSegmentedDictionary<TSource, TKey, TValue>(this IEnumerable<TSource> source, Func<TSource, TKey> keySelector, Func<TSource, TValue> elementSelector, IEqualityComparer<TKey>? keyComparer)
86public static ImmutableSegmentedDictionary<TKey, TSource> ToImmutableSegmentedDictionary<TSource, TKey>(this IEnumerable<TSource> source, Func<TSource, TKey> keySelector)
90public static ImmutableSegmentedDictionary<TKey, TSource> ToImmutableSegmentedDictionary<TSource, TKey>(this IEnumerable<TSource> source, Func<TSource, TKey> keySelector, IEqualityComparer<TKey>? keyComparer)
src\Dependencies\PooledObjects\ArrayBuilder.cs (7)
457public void FreeAll(Func<T, ArrayBuilder<T>?> getNested)
560internal Dictionary<K, ImmutableArray<T>> ToDictionary<K>(Func<T, K> keySelector, IEqualityComparer<K>? comparer = null)
608public void AddRange<U>(ArrayBuilder<U> items, Func<U, T> selector)
745public ImmutableArray<S> SelectDistinct<S>(Func<T, S> selector)
763public bool Any(Func<T, bool> predicate)
787public bool All(Func<T, bool> predicate)
817public ImmutableArray<TResult> SelectAsArray<TResult>(Func<T, TResult> map)
src\Dependencies\PooledObjects\PooledDelegates.cs (9)
200public static Releaser GetPooledFunction<TArg, TResult>(Func<TArg, TResult> unboundFunction, TArg argument, out Func<TResult> boundFunction)
201=> GetPooledDelegate<FuncWithBoundArgument<TArg, TResult>, TArg, Func<TArg, TResult>, Func<TResult>>(unboundFunction, argument, out boundFunction);
204/// Equivalent to <see cref="GetPooledFunction{TArg, TResult}(Func{TArg, TResult}, TArg, out Func{TResult})"/>,
216/// Gets a <see cref="Func{T, TResult}"/> delegate, which calls <paramref name="unboundFunction"/> with the
246public static Releaser GetPooledFunction<T1, TArg, TResult>(Func<T1, TArg, TResult> unboundFunction, TArg argument, out Func<T1, TResult> boundFunction)
247=> GetPooledDelegate<FuncWithBoundArgument<T1, TArg, TResult>, TArg, Func<T1, TArg, TResult>, Func<T1, TResult>>(unboundFunction, argument, out boundFunction);
412: AbstractDelegateWithBoundArgument<FuncWithBoundArgument<TArg, TResult>, TArg, Func<TArg, TResult>, Func<TResult>>
432: AbstractDelegateWithBoundArgument<FuncWithBoundArgument<T1, TArg, TResult>, TArg, Func<T1, TArg, TResult>, Func<T1, TResult>>
434protected override Func<T1, TResult> Bind()
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\ObjectExtensions.TypeSwitch.cs (161)
11public static TResult? TypeSwitch<TBaseType, TDerivedType1, TDerivedType2, TDerivedType3, TResult>(this TBaseType obj, Func<TDerivedType1, TResult> matchFunc1, Func<TDerivedType2, TResult> matchFunc2, Func<TDerivedType3, TResult> matchFunc3, Func<TBaseType, TResult>? defaultFunc = null)
25public static TResult? TypeSwitch<TBaseType, TDerivedType1, TDerivedType2, TDerivedType3, TDerivedType4, TResult>(this TBaseType obj, Func<TDerivedType1, TResult> matchFunc1, Func<TDerivedType2, TResult> matchFunc2, Func<TDerivedType3, TResult> matchFunc3, Func<TDerivedType4, TResult> matchFunc4, Func<TBaseType, TResult>? defaultFunc = null)
41public static TResult? TypeSwitch<TBaseType, TDerivedType1, TDerivedType2, TDerivedType3, TDerivedType4, TDerivedType5, TResult>(this TBaseType obj, Func<TDerivedType1, TResult> matchFunc1, Func<TDerivedType2, TResult> matchFunc2, Func<TDerivedType3, TResult> matchFunc3, Func<TDerivedType4, TResult> matchFunc4, Func<TDerivedType5, TResult> matchFunc5, Func<TBaseType, TResult>? defaultFunc = null)
59public static TResult? TypeSwitch<TBaseType, TDerivedType1, TDerivedType2, TDerivedType3, TDerivedType4, TDerivedType5, TDerivedType6, TResult>(this TBaseType obj, Func<TDerivedType1, TResult> matchFunc1, Func<TDerivedType2, TResult> matchFunc2, Func<TDerivedType3, TResult> matchFunc3, Func<TDerivedType4, TResult> matchFunc4, Func<TDerivedType5, TResult> matchFunc5, Func<TDerivedType6, TResult> matchFunc6, Func<TBaseType, TResult>? defaultFunc = null)
79public static TResult? TypeSwitch<TBaseType, TDerivedType1, TDerivedType2, TDerivedType3, TDerivedType4, TDerivedType5, TDerivedType6, TDerivedType7, TDerivedType8, TDerivedType9, TDerivedType10, TDerivedType11, TDerivedType12, TDerivedType13, TDerivedType14, TDerivedType15, TDerivedType16, TResult>(this TBaseType obj, Func<TDerivedType1, TResult> matchFunc1, Func<TDerivedType2, TResult> matchFunc2, Func<TDerivedType3, TResult> matchFunc3, Func<TDerivedType4, TResult> matchFunc4, Func<TDerivedType5, TResult> matchFunc5, Func<TDerivedType6, TResult> matchFunc6, Func<TDerivedType7, TResult> matchFunc7, Func<TDerivedType8, TResult> matchFunc8, Func<TDerivedType9, TResult> matchFunc9, Func<TDerivedType10, TResult> matchFunc10, Func<TDerivedType11, TResult> matchFunc11, Func<TDerivedType12, TResult> matchFunc12, Func<TDerivedType13, TResult> matchFunc13, Func<TDerivedType14, TResult> matchFunc14, Func<TDerivedType15, TResult> matchFunc15, Func<TDerivedType16, TResult> matchFunc16, Func<TBaseType, TResult>? defaultFunc = null)
119public static TResult? TypeSwitch<TBaseType, TDerivedType1, TDerivedType2, TDerivedType3, TDerivedType4, TDerivedType5, TDerivedType6, TDerivedType7, TDerivedType8, TDerivedType9, TDerivedType10, TDerivedType11, TDerivedType12, TDerivedType13, TDerivedType14, TDerivedType15, TDerivedType16, TDerivedType17, TResult>(this TBaseType obj, Func<TDerivedType1, TResult> matchFunc1, Func<TDerivedType2, TResult> matchFunc2, Func<TDerivedType3, TResult> matchFunc3, Func<TDerivedType4, TResult> matchFunc4, Func<TDerivedType5, TResult> matchFunc5, Func<TDerivedType6, TResult> matchFunc6, Func<TDerivedType7, TResult> matchFunc7, Func<TDerivedType8, TResult> matchFunc8, Func<TDerivedType9, TResult> matchFunc9, Func<TDerivedType10, TResult> matchFunc10, Func<TDerivedType11, TResult> matchFunc11, Func<TDerivedType12, TResult> matchFunc12, Func<TDerivedType13, TResult> matchFunc13, Func<TDerivedType14, TResult> matchFunc14, Func<TDerivedType15, TResult> matchFunc15, Func<TDerivedType16, TResult> matchFunc16, Func<TDerivedType17, TResult> matchFunc17, Func<TBaseType, TResult>? defaultFunc = null)
161public static TResult? TypeSwitch<TBaseType, TDerivedType1, TDerivedType2, TDerivedType3, TDerivedType4, TDerivedType5, TDerivedType6, TDerivedType7, TDerivedType8, TDerivedType9, TDerivedType10, TDerivedType11, TDerivedType12, TDerivedType13, TDerivedType14, TDerivedType15, TDerivedType16, TDerivedType17, TDerivedType18, TDerivedType19, TDerivedType20, TDerivedType21, TDerivedType22, TResult>(this TBaseType obj, Func<TDerivedType1, TResult> matchFunc1, Func<TDerivedType2, TResult> matchFunc2, Func<TDerivedType3, TResult> matchFunc3, Func<TDerivedType4, TResult> matchFunc4, Func<TDerivedType5, TResult> matchFunc5, Func<TDerivedType6, TResult> matchFunc6, Func<TDerivedType7, TResult> matchFunc7, Func<TDerivedType8, TResult> matchFunc8, Func<TDerivedType9, TResult> matchFunc9, Func<TDerivedType10, TResult> matchFunc10, Func<TDerivedType11, TResult> matchFunc11, Func<TDerivedType12, TResult> matchFunc12, Func<TDerivedType13, TResult> matchFunc13, Func<TDerivedType14, TResult> matchFunc14, Func<TDerivedType15, TResult> matchFunc15, Func<TDerivedType16, TResult> matchFunc16, Func<TDerivedType17, TResult> matchFunc17, Func<TDerivedType18, TResult> matchFunc18, Func<TDerivedType19, TResult> matchFunc19, Func<TDerivedType20, TResult> matchFunc20, Func<TDerivedType21, TResult> matchFunc21, Func<TDerivedType22, TResult> matchFunc22, Func<TBaseType, TResult>? defaultFunc = null)
213public static TResult? TypeSwitch<TBaseType, TDerivedType1, TDerivedType2, TDerivedType3, TDerivedType4, TDerivedType5, TDerivedType6, TDerivedType7, TDerivedType8, TDerivedType9, TDerivedType10, TDerivedType11, TDerivedType12, TDerivedType13, TDerivedType14, TDerivedType15, TDerivedType16, TDerivedType17, TDerivedType18, TDerivedType19, TDerivedType20, TDerivedType21, TDerivedType22, TDerivedType23, TDerivedType24, TDerivedType25, TDerivedType26, TDerivedType27, TDerivedType28, TDerivedType29, TDerivedType30, TDerivedType31, TDerivedType32, TDerivedType33, TDerivedType34, TDerivedType35, TDerivedType36, TDerivedType37, TDerivedType38, TDerivedType39, TResult>(this TBaseType obj, Func<TDerivedType1, TResult> matchFunc1, Func<TDerivedType2, TResult> matchFunc2, Func<TDerivedType3, TResult> matchFunc3, Func<TDerivedType4, TResult> matchFunc4, Func<TDerivedType5, TResult> matchFunc5, Func<TDerivedType6, TResult> matchFunc6, Func<TDerivedType7, TResult> matchFunc7, Func<TDerivedType8, TResult> matchFunc8, Func<TDerivedType9, TResult> matchFunc9, Func<TDerivedType10, TResult> matchFunc10, Func<TDerivedType11, TResult> matchFunc11, Func<TDerivedType12, TResult> matchFunc12, Func<TDerivedType13, TResult> matchFunc13, Func<TDerivedType14, TResult> matchFunc14, Func<TDerivedType15, TResult> matchFunc15, Func<TDerivedType16, TResult> matchFunc16, Func<TDerivedType17, TResult> matchFunc17, Func<TDerivedType18, TResult> matchFunc18, Func<TDerivedType19, TResult> matchFunc19, Func<TDerivedType20, TResult> matchFunc20, Func<TDerivedType21, TResult> matchFunc21, Func<TDerivedType22, TResult> matchFunc22, Func<TDerivedType23, TResult> matchFunc23, Func<TDerivedType24, TResult> matchFunc24, Func<TDerivedType25, TResult> matchFunc25, Func<TDerivedType26, TResult> matchFunc26, Func<TDerivedType27, TResult> matchFunc27, Func<TDerivedType28, TResult> matchFunc28, Func<TDerivedType29, TResult> matchFunc29, Func<TDerivedType30, TResult> matchFunc30, Func<TDerivedType31, TResult> matchFunc31, Func<TDerivedType32, TResult> matchFunc32, Func<TDerivedType33, TResult> matchFunc33, Func<TDerivedType34, TResult> matchFunc34, Func<TDerivedType35, TResult> matchFunc35, Func<TDerivedType36, TResult> matchFunc36, Func<TDerivedType37, TResult> matchFunc37, Func<TDerivedType38, TResult> matchFunc38, Func<TDerivedType39, TResult> matchFunc39, Func<TBaseType, TResult>? defaultFunc = null)
299public static TResult? TypeSwitch<TBaseType, TDerivedType1, TDerivedType2, TDerivedType3, TDerivedType4, TDerivedType5, TDerivedType6, TDerivedType7, TDerivedType8, TDerivedType9, TDerivedType10, TDerivedType11, TDerivedType12, TDerivedType13, TDerivedType14, TDerivedType15, TDerivedType16, TDerivedType17, TDerivedType18, TDerivedType19, TDerivedType20, TDerivedType21, TDerivedType22, TDerivedType23, TDerivedType24, TDerivedType25, TDerivedType26, TDerivedType27, TDerivedType28, TDerivedType29, TDerivedType30, TDerivedType31, TDerivedType32, TDerivedType33, TDerivedType34, TDerivedType35, TDerivedType36, TDerivedType37, TDerivedType38, TDerivedType39, TDerivedType40, TResult>(this TBaseType obj, Func<TDerivedType1, TResult> matchFunc1, Func<TDerivedType2, TResult> matchFunc2, Func<TDerivedType3, TResult> matchFunc3, Func<TDerivedType4, TResult> matchFunc4, Func<TDerivedType5, TResult> matchFunc5, Func<TDerivedType6, TResult> matchFunc6, Func<TDerivedType7, TResult> matchFunc7, Func<TDerivedType8, TResult> matchFunc8, Func<TDerivedType9, TResult> matchFunc9, Func<TDerivedType10, TResult> matchFunc10, Func<TDerivedType11, TResult> matchFunc11, Func<TDerivedType12, TResult> matchFunc12, Func<TDerivedType13, TResult> matchFunc13, Func<TDerivedType14, TResult> matchFunc14, Func<TDerivedType15, TResult> matchFunc15, Func<TDerivedType16, TResult> matchFunc16, Func<TDerivedType17, TResult> matchFunc17, Func<TDerivedType18, TResult> matchFunc18, Func<TDerivedType19, TResult> matchFunc19, Func<TDerivedType20, TResult> matchFunc20, Func<TDerivedType21, TResult> matchFunc21, Func<TDerivedType22, TResult> matchFunc22, Func<TDerivedType23, TResult> matchFunc23, Func<TDerivedType24, TResult> matchFunc24, Func<TDerivedType25, TResult> matchFunc25, Func<TDerivedType26, TResult> matchFunc26, Func<TDerivedType27, TResult> matchFunc27, Func<TDerivedType28, TResult> matchFunc28, Func<TDerivedType29, TResult> matchFunc29, Func<TDerivedType30, TResult> matchFunc30, Func<TDerivedType31, TResult> matchFunc31, Func<TDerivedType32, TResult> matchFunc32, Func<TDerivedType33, TResult> matchFunc33, Func<TDerivedType34, TResult> matchFunc34, Func<TDerivedType35, TResult> matchFunc35, Func<TDerivedType36, TResult> matchFunc36, Func<TDerivedType37, TResult> matchFunc37, Func<TDerivedType38, TResult> matchFunc38, Func<TDerivedType39, TResult> matchFunc39, Func<TDerivedType40, TResult> matchFunc40, Func<TBaseType, TResult>? defaultFunc = null)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\SyntaxNodeExtensions.cs (6)
104this SyntaxNode node, TextSpan searchSpan, Func<SyntaxNode, bool> predicate)
129public static bool CheckParent<T>([NotNullWhen(returnValue: true)] this SyntaxNode? node, Func<T, bool> valueChecker) where T : SyntaxNode
145public static bool IsChildNode<TParent>(this SyntaxNode node, Func<TParent, SyntaxNode?> childGetter)
162public static bool IsFoundUnder<TParent>(this SyntaxNode node, Func<TParent, SyntaxNode?> childGetter)
201public static SyntaxNode? FindInnermostCommonNode(this IEnumerable<SyntaxNode> nodes, Func<SyntaxNode, bool> predicate)
806public static TNode? FirstAncestorOrSelfUntil<TNode>(this SyntaxNode? node, Func<SyntaxNode, bool> predicate)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\SyntaxTokenExtensions.cs (5)
15public static SyntaxNode? GetAncestor(this SyntaxToken token, Func<SyntaxNode, bool>? predicate)
18public static T? GetAncestor<T>(this SyntaxToken token, Func<T, bool>? predicate = null) where T : SyntaxNode
21public static T GetRequiredAncestor<T>(this SyntaxToken token, Func<T, bool>? predicate = null) where T : SyntaxNode
32public static IEnumerable<SyntaxNode> GetAncestors(this SyntaxToken token, Func<SyntaxNode, bool> predicate)
42public static bool CheckParent<T>(this SyntaxToken token, Func<T, bool> valueChecker) where T : SyntaxNode
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Options\PublicOptionFactory.cs (8)
38private sealed class StorageMapping(IOption2 internalOption, Func<object?, object?> toPublicValue, Func<object?, object?> toInternalValue) : OptionStorageMapping(internalOption)
47private static OptionDefinition<TPublicValue> ToPublicOptionDefinition<T, TPublicValue>(this OptionDefinition<T> definition, IOption2 internalOption, Func<T, TPublicValue> toPublicValue, Func<TPublicValue, T> toInternalValue)
56public static Option2<T> WithPublicOption<T, TPublicValue>(this Option2<T> option, string feature, string name, Func<T, TPublicValue> toPublicValue, Func<TPublicValue, T> toInternalValue)
66public static PerLanguageOption2<T> WithPublicOption<T, TPublicValue>(this PerLanguageOption2<T> option, string feature, string name, Func<T, TPublicValue> toPublicValue, Func<TPublicValue, T> toInternalValue)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\TopologicalSorter.cs (8)
13public static IEnumerable<T> TopologicalSort<T>(this IEnumerable<T> items, Func<T, IEnumerable<T>> itemsBefore)
26public static IEnumerable<T> TopologicalSort<T>(this IEnumerable<T> items, Func<T, IEnumerable<T>> itemsBefore, Func<T, IEnumerable<T>> itemsAfter)
29var combinedItemsBefore = CreateCombinedItemsBefore(items, itemsBefore, itemsAfter);
35Func<T, IEnumerable<T>> itemsBefore,
50private static Func<T, IEnumerable<T>> CreateCombinedItemsBefore<T>(IEnumerable<T> items, Func<T, IEnumerable<T>> itemsBefore, Func<T, IEnumerable<T>> itemsAfter)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Extensions\SyntaxEditorExtensions.cs (4)
29Func<TType, (TNode semanticNode, IEnumerable<TNode> additionalNodes)> selector,
52Func<TType, TNode> selector,
96Func<TType, (TNode semanticNode, IEnumerable<TNode> additionalNodes)> selector,
153Func<TType, (TNode semanticNode, IEnumerable<TNode> additionalNodes)> selector,
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Simplification\AbstractSimplificationService.cs (6)
35protected static readonly Func<SyntaxNode, bool> s_containsAnnotations = n => n.ContainsAnnotations;
36protected static readonly Func<SyntaxNodeOrToken, bool> s_hasSimplifierAnnotation = n => n.HasAnnotation(Simplifier.Annotation);
40protected abstract ImmutableArray<NodeOrTokenToReduce> GetNodesAndTokensToReduce(SyntaxNode root, Func<SyntaxNodeOrToken, bool> isNodeOrTokenOutsideSimplifySpans);
51public abstract SyntaxNode Expand(SyntaxNode node, SemanticModel semanticModel, SyntaxAnnotation? annotationForReplacedAliasIdentifier, Func<SyntaxNode, bool>? expandInsideNode, bool expandParameter, CancellationToken cancellationToken);
52public abstract SyntaxToken Expand(SyntaxToken token, SemanticModel semanticModel, Func<SyntaxNode, bool>? expandInsideNode, CancellationToken cancellationToken);
275Func<SyntaxNodeOrToken, bool> isNodeOrTokenOutsideSimplifySpan)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Utilities\NameGenerator.cs (6)
43Func<string, bool>? canUse = null,
63Func<string, bool>? canUse = null,
86Func<string, bool>? canUse = null,
134public static string GenerateUniqueName(string baseName, Func<string, bool> canUse)
140public static string GenerateUniqueName(string baseName, string extension, Func<string, bool> canUse)
160public static string GenerateUniqueName(IEnumerable<string> baseNames, Func<string, bool> canUse)
Storage\SQLite\v2\SQLitePersistentStorage_Threading.cs (3)
16Func<TArg, TResult> func, TArg arg,
31private Task<TResult> PerformReadAsync<TArg, TResult>(Func<TArg, TResult> func, TArg arg, CancellationToken cancellationToken) where TArg : struct
46public Task<TResult> PerformWriteAsync<TArg, TResult>(Func<TArg, TResult> func, TArg arg, CancellationToken cancellationToken) where TArg : struct
Workspace\Workspace.cs (5)
200/// <inheritdoc cref="SetCurrentSolution(Func{Solution, Solution}, Func{Solution, Solution, ValueTuple{WorkspaceChangeKind, ProjectId?, DocumentId?}}, Action{Solution, Solution}?, Action{Solution, Solution}?)"/>
202Func<Solution, Solution> transformation,
231Func<Solution, Solution> transformation,
251Func<Solution, Solution> transformation,
758Func<WorkspaceEventOptions, bool> shouldRaise,
Microsoft.CodeAnalysis.Workspaces.MSBuild (2)
Microsoft.CodeAnalysis.Workspaces.MSBuild.BuildHost (123)
src\Compilers\Core\Portable\FileSystem\FileUtilities.cs (4)
47Func<string, bool> fileExists)
322public static T RethrowExceptionsAsIOException<T, TArg>(Func<TArg, T> operation, TArg arg)
339public static async Task<T> RethrowExceptionsAsIOExceptionAsync<T, TArg>(Func<TArg, Task<T>> operation, TArg arg)
355internal static Stream CreateFileStreamChecked(Func<string, Stream> factory, string path, string? paramName = null)
src\Compilers\Core\Portable\InternalUtilities\InterlockedOperations.cs (5)
46public static T Initialize<T, TArg>([NotNull] ref T? target, Func<TArg, T> valueFactory, TArg arg)
66public static int Initialize<TArg>(ref int target, int uninitializedValue, Func<TArg, int> valueFactory, TArg arg)
103public static T? Initialize<T, TArg>([NotNull] ref StrongBox<T?>? target, Func<TArg, T?> valueFactory, TArg arg)
183public static ImmutableArray<T> Initialize<T, TArg>(ref ImmutableArray<T> target, Func<TArg, ImmutableArray<T>> createArray, TArg arg)
193private static ImmutableArray<T> Initialize_Slow<T, TArg>(ref ImmutableArray<T> target, Func<TArg, ImmutableArray<T>> createArray, TArg arg)
src\Dependencies\Collections\Extensions\IEnumerableExtensions.cs (30)
164public static T? FirstOrNull<T>(this IEnumerable<T> source, Func<T, bool> predicate)
182public static T? SingleOrNull<T>(this IEnumerable<T> source, Func<T, bool> predicate)
261public static bool HasDuplicates<TItem, TValue>(this IEnumerable<TItem> source, Func<TItem, TValue> selector)
271/// <seealso cref="Microsoft.CodeAnalysis.ImmutableArrayExtensions.HasDuplicates{TItem, TValue}(ImmutableArray{TItem}, Func{TItem, TValue}, IEqualityComparer{TValue})"/>
273public static bool HasDuplicates<TItem, TValue>(this IEnumerable<TItem> source, Func<TItem, TValue> selector, IEqualityComparer<TValue> comparer)
321private static readonly Func<object, bool> s_notNullTest = x => x != null;
331return source.Where((Func<T?, bool>)s_notNullTest)!;
376public static ImmutableArray<T> WhereAsArray<T>(this IEnumerable<T> values, Func<T, bool> predicate)
407public static ImmutableArray<TResult> SelectAsArray<TSource, TResult>(this IEnumerable<TSource>? source, Func<TSource, TResult> selector)
417public static ImmutableArray<TResult> SelectAsArray<TItem, TResult>(this IEnumerable<TItem>? source, Func<TItem, bool> predicate, Func<TItem, TResult> selector)
461public static ImmutableArray<TResult> SelectAsArray<TSource, TResult>(this IReadOnlyCollection<TSource>? source, Func<TSource, TResult> selector)
485public static ImmutableArray<TResult> SelectManyAsArray<TSource, TResult>(this IEnumerable<TSource>? source, Func<TSource, IEnumerable<TResult>> selector)
507public static ImmutableArray<TResult> SelectManyAsArray<TItem, TResult>(this IReadOnlyCollection<TItem>? source, Func<TItem, IEnumerable<TResult>> selector)
533public static ImmutableArray<TResult> SelectManyAsArray<TSource, TResult>(this IEnumerable<TSource>? source, Func<TSource, OneOrMany<TResult>> selector)
547public static async ValueTask<ImmutableArray<TResult>> SelectAsArrayAsync<TItem, TResult>(this IEnumerable<TItem> source, Func<TItem, ValueTask<TResult>> selector)
764internal static Dictionary<K, ImmutableArray<T>> ToMultiDictionary<K, T>(this IEnumerable<T> data, Func<T, K> keySelector, IEqualityComparer<K>? comparer = null)
815public static readonly Func<T, T> Identity = t => t;
816public static readonly Func<T, bool> True = t => true;
840/// Alias for <see cref="System.Linq.Enumerable.Any{TSource}(IEnumerable{TSource}, Func{TSource, bool})"/>
842public static bool Contains<T>(this IEnumerable<T> sequence, Func<T, bool> predicate)
846/// Variant of <see cref="System.Linq.Enumerable.Count{TSource}(IEnumerable{TSource}, Func{TSource, bool})"/>
861/// Variant of <see cref="System.Linq.Enumerable.FirstOrDefault{TSource}(IEnumerable{TSource}, Func{TSource, bool})"/>
875/// Variant of <see cref="System.Linq.Enumerable.Any{TSource}(IEnumerable{TSource}, Func{TSource, bool})"/>
889/// Variant of <see cref="System.Linq.Enumerable.OrderBy{TSource, TKey}(IEnumerable{TSource}, Func{TSource, TKey}, IComparer{TKey}?)"/>
895/// Variant of <see cref="System.Linq.Enumerable.OrderByDescending{TSource, TKey}(IEnumerable{TSource}, Func{TSource, TKey}, IComparer{TKey}?)"/>
901/// Variant of <see cref="System.Linq.Enumerable.OrderBy{TSource, TKey}(IEnumerable{TSource}, Func{TSource, TKey}, IComparer{TKey}?)"/>
907/// Variant of <see cref="System.Linq.Enumerable.OrderByDescending{TSource, TKey}(IEnumerable{TSource}, Func{TSource, TKey}, IComparer{TKey}?)"/>
913/// Variant of <see cref="System.Linq.Enumerable.ThenBy{TSource, TKey}(IOrderedEnumerable{TSource}, Func{TSource, TKey}, IComparer{TKey}?)"/>
919/// Variant of <see cref="System.Linq.Enumerable.ThenBy{TSource, TKey}(IOrderedEnumerable{TSource}, Func{TSource, TKey}, IComparer{TKey}?)"/>
src\Dependencies\Collections\Extensions\IListExtensions.cs (4)
21public static bool HasDuplicates<TItem, TValue>(this IReadOnlyList<TItem> list, Func<TItem, TValue> selector)
31/// <seealso cref="ImmutableArrayExtensions.HasDuplicates{TItem, TValue}(System.Collections.Immutable.ImmutableArray{TItem}, Func{TItem, TValue}, IEqualityComparer{TValue})"/>
32/// <seealso cref="Roslyn.Utilities.EnumerableExtensions.HasDuplicates{TItem, TValue}(IEnumerable{TItem}, Func{TItem, TValue}, IEqualityComparer{TValue})"/>
34internal static bool HasDuplicates<TItem, TValue>(this IReadOnlyList<TItem> list, Func<TItem, TValue> selector, IEqualityComparer<TValue> comparer)
src\Dependencies\Collections\Extensions\ImmutableArrayExtensions.cs (27)
138public static ImmutableArray<TResult> SelectAsArray<TItem, TResult>(this ImmutableArray<TItem> items, Func<TItem, TResult> map)
198public static ImmutableArray<TResult> SelectAsArray<TItem, TResult>(this ImmutableArray<TItem> array, Func<TItem, bool> predicate, Func<TItem, TResult> selector)
247public static ImmutableArray<TResult> SelectManyAsArray<TItem, TResult>(this ImmutableArray<TItem> array, Func<TItem, IEnumerable<TResult>> selector)
267public static ImmutableArray<TResult> SelectManyAsArray<TItem, TResult>(this ImmutableArray<TItem> array, Func<TItem, ImmutableArray<TResult>> selector)
287public static ImmutableArray<TResult> SelectManyAsArray<TItem, TResult>(this ImmutableArray<TItem> array, Func<TItem, OneOrMany<TResult>> selector)
308public static ImmutableArray<TResult> SelectManyAsArray<TItem, TResult>(this ImmutableArray<TItem> array, Func<TItem, bool> predicate, Func<TItem, IEnumerable<TResult>> selector)
332public static ImmutableArray<TResult> SelectManyAsArray<TItem, TResult>(this ImmutableArray<TItem> array, Func<TItem, bool> predicate, Func<TItem, ImmutableArray<TResult>> selector)
356public static ImmutableArray<TResult> SelectManyAsArray<TItem, TResult>(this ImmutableArray<TItem> array, Func<TItem, bool> predicate, Func<TItem, OneOrMany<TResult>> selector)
493public static ImmutableArray<T> WhereAsArray<T>(this ImmutableArray<T> array, Func<T, bool> predicate)
504private static ImmutableArray<T> WhereAsArrayImpl<T, TArg>(ImmutableArray<T> array, Func<T, bool>? predicateWithoutArg, Func<T, TArg, bool>? predicateWithArg, TArg arg)
573public static async Task<bool> AnyAsync<T>(this ImmutableArray<T> array, Func<T, Task<bool>> predicateAsync)
595public static async ValueTask<T?> FirstOrDefaultAsync<T>(this ImmutableArray<T> array, Func<T, Task<bool>> predicateAsync)
757public static bool HasDuplicates<TItem, TValue>(this ImmutableArray<TItem> array, Func<TItem, TValue> selector)
767/// <seealso cref="Roslyn.Utilities.EnumerableExtensions.HasDuplicates{TItem, TValue}(IEnumerable{TItem}, Func{TItem, TValue}, IEqualityComparer{TValue})"/>
769internal static bool HasDuplicates<TItem, TValue>(this ImmutableArray<TItem> array, Func<TItem, TValue> selector, IEqualityComparer<TValue> comparer)
990/// Variant of <see cref="System.Linq.ImmutableArrayExtensions.FirstOrDefault{T}(ImmutableArray{T}, Func{T, bool})"/>
1004/// Variant of <see cref="System.Linq.ImmutableArrayExtensions.Single{T}(ImmutableArray{T}, Func{T, bool})"/>
1066/// Specialization of <see cref="System.Linq.Enumerable.Count{TSource}(IEnumerable{TSource}, Func{TSource, bool})"/> for <see cref="ImmutableArray{T}"/>.
1068public static int Count<T>(this ImmutableArray<T> items, Func<T, bool> predicate)
1086public static int Sum<T>(this ImmutableArray<T> items, Func<T, int> selector)
1213/// Variant of <see cref="System.Linq.ImmutableArrayExtensions.Any{T}(ImmutableArray{T}, Func{T, bool})"/>.
1227/// Variant of <see cref="System.Linq.ImmutableArrayExtensions.All{T}(ImmutableArray{T}, Func{T, bool})"/>.
1257public static bool Contains<T>(this ImmutableArray<T> array, Func<T, bool> predicate)
src\Dependencies\Collections\RoslynImmutableInterlocked.cs (7)
33public static bool Update<T>(ref ImmutableSegmentedList<T> location, Func<ImmutableSegmentedList<T>, ImmutableSegmentedList<T>> transformer)
154public static bool Update<T>(ref ImmutableSegmentedHashSet<T> location, Func<ImmutableSegmentedHashSet<T>, ImmutableSegmentedHashSet<T>> transformer)
276public static bool Update<TKey, TValue>(ref ImmutableSegmentedDictionary<TKey, TValue> location, Func<ImmutableSegmentedDictionary<TKey, TValue>, ImmutableSegmentedDictionary<TKey, TValue>> transformer)
410/// <inheritdoc cref="ImmutableInterlocked.GetOrAdd{TKey, TValue}(ref ImmutableDictionary{TKey, TValue}, TKey, Func{TKey, TValue})"/>
411public static TValue GetOrAdd<TKey, TValue>(ref ImmutableSegmentedDictionary<TKey, TValue> location, TKey key, Func<TKey, TValue> valueFactory)
458/// <inheritdoc cref="ImmutableInterlocked.AddOrUpdate{TKey, TValue}(ref ImmutableDictionary{TKey, TValue}, TKey, Func{TKey, TValue}, Func{TKey, TValue, TValue})"/>
459public static TValue AddOrUpdate<TKey, TValue>(ref ImmutableSegmentedDictionary<TKey, TValue> location, TKey key, Func<TKey, TValue> addValueFactory, Func<TKey, TValue, TValue> updateValueFactory)
src\Dependencies\Collections\Segmented\ImmutableSegmentedDictionary.cs (6)
68public static ImmutableSegmentedDictionary<TKey, TValue> ToImmutableSegmentedDictionary<TSource, TKey, TValue>(this IEnumerable<TSource> source, Func<TSource, TKey> keySelector, Func<TSource, TValue> elementSelector)
72public static ImmutableSegmentedDictionary<TKey, TValue> ToImmutableSegmentedDictionary<TSource, TKey, TValue>(this IEnumerable<TSource> source, Func<TSource, TKey> keySelector, Func<TSource, TValue> elementSelector, IEqualityComparer<TKey>? keyComparer)
86public static ImmutableSegmentedDictionary<TKey, TSource> ToImmutableSegmentedDictionary<TSource, TKey>(this IEnumerable<TSource> source, Func<TSource, TKey> keySelector)
90public static ImmutableSegmentedDictionary<TKey, TSource> ToImmutableSegmentedDictionary<TSource, TKey>(this IEnumerable<TSource> source, Func<TSource, TKey> keySelector, IEqualityComparer<TKey>? keyComparer)
src\Dependencies\PooledObjects\ArrayBuilder.cs (7)
457public void FreeAll(Func<T, ArrayBuilder<T>?> getNested)
560internal Dictionary<K, ImmutableArray<T>> ToDictionary<K>(Func<T, K> keySelector, IEqualityComparer<K>? comparer = null)
608public void AddRange<U>(ArrayBuilder<U> items, Func<U, T> selector)
745public ImmutableArray<S> SelectDistinct<S>(Func<T, S> selector)
763public bool Any(Func<T, bool> predicate)
787public bool All(Func<T, bool> predicate)
817public ImmutableArray<TResult> SelectAsArray<TResult>(Func<T, TResult> map)
src\Dependencies\PooledObjects\PooledDelegates.cs (9)
200public static Releaser GetPooledFunction<TArg, TResult>(Func<TArg, TResult> unboundFunction, TArg argument, out Func<TResult> boundFunction)
201=> GetPooledDelegate<FuncWithBoundArgument<TArg, TResult>, TArg, Func<TArg, TResult>, Func<TResult>>(unboundFunction, argument, out boundFunction);
204/// Equivalent to <see cref="GetPooledFunction{TArg, TResult}(Func{TArg, TResult}, TArg, out Func{TResult})"/>,
216/// Gets a <see cref="Func{T, TResult}"/> delegate, which calls <paramref name="unboundFunction"/> with the
246public static Releaser GetPooledFunction<T1, TArg, TResult>(Func<T1, TArg, TResult> unboundFunction, TArg argument, out Func<T1, TResult> boundFunction)
247=> GetPooledDelegate<FuncWithBoundArgument<T1, TArg, TResult>, TArg, Func<T1, TArg, TResult>, Func<T1, TResult>>(unboundFunction, argument, out boundFunction);
412: AbstractDelegateWithBoundArgument<FuncWithBoundArgument<TArg, TResult>, TArg, Func<TArg, TResult>, Func<TResult>>
432: AbstractDelegateWithBoundArgument<FuncWithBoundArgument<T1, TArg, TResult>, TArg, Func<T1, TArg, TResult>, Func<T1, TResult>>
434protected override Func<T1, TResult> Bind()
Microsoft.CodeAnalysis.Workspaces.MSBuild.UnitTests (9)
Microsoft.CodeAnalysis.Workspaces.Test.Utilities (1)
Microsoft.CodeAnalysis.Workspaces.UnitTests (17)
ObjectSerializationTests.cs (3)
55private static T RoundTrip<T>(T value, Action<ObjectWriter, T> writeAction, Func<ObjectReader, T> readAction, bool recursive)
69private static void TestRoundTrip<T>(T value, Action<ObjectWriter, T> writeAction, Func<ObjectReader, T> readAction, bool recursive)
75private static void TestRoundTrip<T>(T value, Action<ObjectWriter, T> writeAction, Func<ObjectReader, T> readAction)
SolutionTests\SolutionTestHelpers.cs (2)
24public static void TestProperty<T, TValue>(T instance, Func<T, TValue, T> factory, Func<T, TValue> getter, TValue validNonDefaultValue, bool defaultThrows = false)
46public static void TestListProperty<T, TValue>(T instance, Func<T, IEnumerable<TValue>, T> factory, Func<T, IEnumerable<TValue>> getter, TValue item, bool allowDuplicates)
SymbolKeyTests.cs (4)
1437IEnumerable<ISymbol> symbols, Compilation compilation, Func<ISymbol, object> fnId = null, bool useSymbolEquivalence = false)
1444ISymbol symbol, Compilation compilation, Func<ISymbol, object> fnId = null, bool useSymbolEquivalence = false)
1493SemanticModel model, Func<SyntaxNode, bool> predicate = null)
1502List<ISymbol> list, Func<SyntaxNode, bool> predicate)
Microsoft.CommonLanguageServerProtocol.Framework.Example (1)
Microsoft.CommonLanguageServerProtocol.Framework.Package (3)
Microsoft.CSharp (1)
Microsoft.Data.Analysis (11)
Microsoft.DotNet.Build.Tasks.Feed.Tests (2)
Microsoft.DotNet.Build.Tasks.Packaging (7)
Microsoft.DotNet.Build.Tasks.Packaging.Tests (1)
Microsoft.DotNet.GenFacades (1)
Microsoft.DotNet.Helix.Sdk (1)
Microsoft.DotNet.Internal.SymbolHelper (1)
Microsoft.DotNet.NuGetRepack.Tests (9)
TestHelpers\AssertEx.cs (7)
198string itemSeparator = null, Func<T, string> itemInspector = null)
279public static void None<T>(IEnumerable<T> actual, Func<T, bool> predicate)
291public static void Any<T>(IEnumerable<T> actual, Func<T, bool> predicate)
297public static void All<T>(IEnumerable<T> actual, Func<T, bool> predicate)
313public static string ToString<T>(IEnumerable<T> list, string separator = ", ", Func<T, string> itemInspector = null)
424Func<T, string> itemInspector = escapeQuotes ? new Func<T, string>(t => t.ToString().Replace("\"", "\"\"")) : null;
432Func<T, string> itemInspector = null,
Microsoft.DotNet.RemoteExecutor (3)
Microsoft.DotNet.SourceBuild.Tasks (2)
Microsoft.DotNet.SwaggerGenerator.CodeGenerator (1)
Microsoft.DotNet.XliffTasks (1)
Microsoft.DotNet.XUnitAssert.Tests (2)
Microsoft.Extensions.AI (20)
Microsoft.Extensions.AI.Abstractions (14)
Functions\AIFunctionFactory.cs (6)
378/// an instance method and a <see cref="Func{AIFunctionArguments,Object}"/> for constructing an instance of
466Func<AIFunctionArguments, object> createInstanceFunc,
532Func<AIFunctionArguments, object> createInstanceFunc,
560Func<AIFunctionArguments, object> createInstanceFunc,
570public Func<AIFunctionArguments, object>? CreateInstanceFunc { get; }
1070Func<ParameterInfo, AIFunctionFactoryOptions.ParameterBindingOptions>? GetBindParameterOptions,
Microsoft.Extensions.AI.Abstractions.Tests (4)
Microsoft.Extensions.AI.Evaluation (5)
Microsoft.Extensions.AI.Evaluation.Reporting (6)
Microsoft.Extensions.AI.Evaluation.Reporting.Azure (1)
Microsoft.Extensions.AI.Integration.Tests (1)
Microsoft.Extensions.AI.Tests (28)
ChatCompletion\FunctionInvokingChatClientTests.cs (18)
116Func<ChatClientBuilder, ChatClientBuilder> configure = builder =>
149Func<ChatClientBuilder, ChatClientBuilder> configure = builder =>
216Func<ChatClientBuilder, ChatClientBuilder> configure = b => b.Use(
264Func<ChatClientBuilder, ChatClientBuilder> configure = b => b.Use(
338Func<ChatClientBuilder, ChatClientBuilder> configure = b => b.Use(
360Func<ChatClientBuilder, ChatClientBuilder> configurePipeline = pipeline => pipeline
402Func<ChatClientBuilder, ChatClientBuilder> configurePipeline = pipeline => pipeline
483Func<ChatClientBuilder, ChatClientBuilder> configurePipeline = pipeline => pipeline
594Func<ChatClientBuilder, ChatClientBuilder> configure = b => b.Use(
621Func<ChatClientBuilder, ChatClientBuilder> configure = b =>
628async Task InvokeAsync(Func<IServiceProvider, Task> work)
677Func<ChatClientBuilder, ChatClientBuilder> configure = b => b.Use(c =>
1051Func<ChatClientBuilder, ChatClientBuilder> configurePipeline = builder => builder
1074Func<ChatClientBuilder, ChatClientBuilder> configure = b => b.Use(
1137Func<ChatClientBuilder, ChatClientBuilder> configure = b => b.Use(
1169Func<ChatClientBuilder, ChatClientBuilder> configure = b => b.Use(s => new FunctionInvokingChatClient(s) { TerminateOnUnknownCalls = false });
1195Func<ChatClientBuilder, ChatClientBuilder>? configurePipeline = null,
1265Func<ChatClientBuilder, ChatClientBuilder>? configurePipeline = null,
Microsoft.Extensions.Caching.Abstractions (8)
Hybrid\HybridCache.cs (4)
45public ValueTask<T> GetOrCreateAsync<T>(string key, Func<CancellationToken, ValueTask<T>> factory,
62Func<CancellationToken, ValueTask<T>> factory,
102Func<CancellationToken, ValueTask<T>> factory,
147public static readonly Func<Func<CancellationToken, ValueTask<T>>, CancellationToken, ValueTask<T>> Instance = static (callback, ct) => callback(ct);
MemoryCacheExtensions.cs (4)
170public static TItem? GetOrCreate<TItem>(this IMemoryCache cache, object key, Func<ICacheEntry, TItem> factory)
184public static TItem? GetOrCreate<TItem>(this IMemoryCache cache, object key, Func<ICacheEntry, TItem> factory, MemoryCacheEntryOptions? createOptions)
210public static Task<TItem?> GetOrCreateAsync<TItem>(this IMemoryCache cache, object key, Func<ICacheEntry, Task<TItem>> factory)
224public static async Task<TItem?> GetOrCreateAsync<TItem>(this IMemoryCache cache, object key, Func<ICacheEntry, Task<TItem>> factory, MemoryCacheEntryOptions? createOptions)
Microsoft.Extensions.Caching.Hybrid.Tests (3)
Microsoft.Extensions.Caching.Memory (2)
Microsoft.Extensions.Configuration.Abstractions (1)
Microsoft.Extensions.Configuration.KeyPerFile (1)
Microsoft.Extensions.Configuration.Xml (2)
Microsoft.Extensions.DependencyInjection (35)
ServiceLookup\Expressions\ExpressionResolverBuilder.cs (11)
35delegateType: typeof(Func<object?, object?>),
45private readonly ConcurrentDictionary<ServiceCacheKey, Func<ServiceProviderEngineScope, object>> _scopeResolverCache;
47private readonly Func<ServiceCacheKey, ServiceCallSite, Func<ServiceProviderEngineScope, object>> _buildTypeDelegate;
52_scopeResolverCache = new ConcurrentDictionary<ServiceCacheKey, Func<ServiceProviderEngineScope, object>>();
56public Func<ServiceProviderEngineScope, object> Build(ServiceCallSite callSite)
71public Func<ServiceProviderEngineScope, object> BuildNoCache(ServiceCallSite callSite)
73Expression<Func<ServiceProviderEngineScope, object>> expression = BuildExpression(callSite);
78private Expression<Func<ServiceProviderEngineScope, object>> BuildExpression(ServiceCallSite callSite)
82return Expression.Lambda<Func<ServiceProviderEngineScope, object>>(
91return Expression.Lambda<Func<ServiceProviderEngineScope, object>>(
209Func<ServiceProviderEngineScope, object> lambda = Build(callSite);
ServiceLookup\ILEmit\ILEmitResolverBuilder.cs (7)
42public Func<IServiceProvider, object>[]? Factories;
47public Func<ServiceProviderEngineScope, object?> Lambda;
66public Func<ServiceProviderEngineScope, object?> Build(ServiceCallSite callSite)
128Lambda = (Func<ServiceProviderEngineScope, object?>)dynamicMethod.CreateDelegate(typeof(Func<ServiceProviderEngineScope, object?>), runtimeContext),
248argument.Factories ??= new List<Func<IServiceProvider, object>>();
255argument.Generator.Emit(OpCodes.Ldelem, typeof(Func<IServiceProvider, object>));
Microsoft.Extensions.DependencyInjection.Abstractions (30)
ServiceCollectionServiceExtensions.cs (10)
49Func<IServiceProvider, object> implementationFactory)
123Func<IServiceProvider, TService> implementationFactory)
146Func<IServiceProvider, TImplementation> implementationFactory)
191Func<IServiceProvider, object> implementationFactory)
265Func<IServiceProvider, TService> implementationFactory)
288Func<IServiceProvider, TImplementation> implementationFactory)
334Func<IServiceProvider, object> implementationFactory)
408Func<IServiceProvider, TService> implementationFactory)
431Func<IServiceProvider, TImplementation> implementationFactory)
499Func<IServiceProvider, object> implementationFactory,
ServiceDescriptor.cs (14)
91Func<IServiceProvider, object> factory,
121Func<IServiceProvider, object> nullKeyedFactory = sp => factory(sp, null);
224public Func<IServiceProvider, object>? ImplementationFactory => IsKeyedService ? null : (Func<IServiceProvider, object>?) _implementationFactory;
432Func<IServiceProvider, TImplementation> implementationFactory)
471public static ServiceDescriptor Transient<TService>(Func<IServiceProvider, TService> implementationFactory)
504public static ServiceDescriptor Transient(Type service, Func<IServiceProvider, object> implementationFactory)
603Func<IServiceProvider, TImplementation> implementationFactory)
642public static ServiceDescriptor Scoped<TService>(Func<IServiceProvider, TService> implementationFactory)
675public static ServiceDescriptor Scoped(Type service, Func<IServiceProvider, object> implementationFactory)
781Func<IServiceProvider, TImplementation> implementationFactory)
820public static ServiceDescriptor Singleton<TService>(Func<IServiceProvider, TService> implementationFactory)
857Func<IServiceProvider, object> implementationFactory)
1016public static ServiceDescriptor Describe(Type serviceType, Func<IServiceProvider, object> implementationFactory, ServiceLifetime lifetime)
Microsoft.Extensions.Diagnostics.HealthChecks (10)
Microsoft.Extensions.Diagnostics.HealthChecks.Abstractions (4)
Microsoft.Extensions.Diagnostics.Probes (4)
Microsoft.Extensions.Diagnostics.Probes.Tests (1)
Microsoft.Extensions.Diagnostics.Testing (4)
Microsoft.Extensions.Features (3)
Microsoft.Extensions.Hosting (4)
Microsoft.Extensions.Hosting.Abstractions (2)
Microsoft.Extensions.Hosting.Testing (1)
Microsoft.Extensions.Hosting.Testing.Tests (1)
Microsoft.Extensions.Http (23)
DependencyInjection\HttpClientBuilderExtensions.cs (8)
103public static IHttpClientBuilder AddHttpMessageHandler(this IHttpClientBuilder builder, Func<IServiceProvider, DelegatingHandler> configureHandler)
184public static IHttpClientBuilder ConfigurePrimaryHttpMessageHandler(this IHttpClientBuilder builder, Func<IServiceProvider, HttpMessageHandler> configureHandler)
472/// Calling <see cref="HttpClientBuilderExtensions.AddTypedClient{TClient}(IHttpClientBuilder,Func{HttpClient,TClient})"/>
476public static IHttpClientBuilder AddTypedClient<TClient>(this IHttpClientBuilder builder, Func<HttpClient, TClient> factory)
485internal static IHttpClientBuilder AddTypedClientCore<TClient>(this IHttpClientBuilder builder, Func<HttpClient, TClient> factory, bool validateSingleType)
551/// Sets the <see cref="Func{T, R}"/> which determines whether to redact the HTTP header value given its corresponding header name before logging.
554/// <param name="shouldRedactHeaderValue">The <see cref="Func{T, R}"/> which determines whether to redact the HTTP header value given its corresponding header name before logging.</param>
558public static IHttpClientBuilder RedactLoggedHeaders(this IHttpClientBuilder builder, Func<string, bool> shouldRedactHeaderValue)
Logging\LogHelper.cs (5)
33public static readonly Func<string, bool> ShouldRedactHeaderValue = (header) => true;
68public static void LogRequestStart(this ILogger logger, HttpRequestMessage request, Func<string, bool> shouldRedactHeaderValue)
87public static void LogRequestEnd(this ILogger logger, HttpResponseMessage response, TimeSpan duration, Func<string, bool> shouldRedactHeaderValue)
111public static void LogRequestPipelineStart(this ILogger logger, HttpRequestMessage request, string? formattedUri, Func<string, bool> shouldRedactHeaderValue)
126public static void LogRequestPipelineEnd(this ILogger logger, HttpResponseMessage response, TimeSpan duration, Func<string, bool> shouldRedactHeaderValue)
Microsoft.Extensions.Http.Polly (6)
Microsoft.Extensions.Http.Polly.Tests (4)
Microsoft.Extensions.Http.Resilience (23)
Resilience\Internal\PipelineKeyProviderHelper.cs (5)
21public static void SelectPipelineBy(IServiceCollection services, string pipelineName, Func<IServiceProvider, Func<HttpRequestMessage, string>> selectorFactory)
26public static Func<HttpRequestMessage, string>? GetPipelineKeyProvider(this IServiceProvider provider, string pipelineName)
31private static void UsePipelineKeyProvider(IServiceCollection services, string pipelineName, Func<IServiceProvider, Func<HttpRequestMessage, string>> factory)
Microsoft.Extensions.Http.Resilience.Tests (2)
Microsoft.Extensions.Localization (2)
Microsoft.Extensions.Logging (8)
FilterLoggingBuilderExtensions.cs (8)
48public static ILoggingBuilder AddFilter(this ILoggingBuilder builder, Func<LogLevel, bool> levelFilter) =>
58public static ILoggingBuilder AddFilter<T>(this ILoggingBuilder builder, Func<LogLevel, bool> levelFilter) where T : ILoggerProvider =>
89public static ILoggingBuilder AddFilter(this ILoggingBuilder builder, string? category, Func<LogLevel, bool> levelFilter) =>
100public static ILoggingBuilder AddFilter<T>(this ILoggingBuilder builder, string? category, Func<LogLevel, bool> levelFilter) where T : ILoggerProvider =>
137public static LoggerFilterOptions AddFilter(this LoggerFilterOptions builder, Func<LogLevel, bool> levelFilter) =>
147public static LoggerFilterOptions AddFilter<T>(this LoggerFilterOptions builder, Func<LogLevel, bool> levelFilter) where T : ILoggerProvider =>
178public static LoggerFilterOptions AddFilter(this LoggerFilterOptions builder, string? category, Func<LogLevel, bool> levelFilter) =>
189public static LoggerFilterOptions AddFilter<T>(this LoggerFilterOptions builder, string? category, Func<LogLevel, bool> levelFilter) where T : ILoggerProvider =>
Microsoft.Extensions.Logging.Abstractions (1)
Microsoft.Extensions.Logging.AzureAppServices (3)
Microsoft.Extensions.ML (1)
Microsoft.Extensions.ObjectPool (1)
Microsoft.Extensions.Options (4)
Microsoft.Extensions.ServiceDiscovery (1)
Microsoft.Extensions.ServiceDiscovery.Dns (2)
Microsoft.Extensions.ServiceDiscovery.Dns.Tests (14)
Microsoft.Extensions.ServiceDiscovery.Tests (1)
Microsoft.Extensions.Telemetry (10)
Microsoft.Extensions.Validation.GeneratorTests (11)
ValidationsGeneratorTestBase.cs (11)
182var factory = HostFactoryResolver.ResolveHostFactory(assembly,
250public static Func<string[], TWebHost> ResolveWebHostFactory<TWebHost>(Assembly assembly)
255public static Func<string[], TWebHostBuilder> ResolveWebHostBuilderFactory<TWebHostBuilder>(Assembly assembly)
260public static Func<string[], THostBuilder> ResolveHostBuilderFactory<THostBuilder>(Assembly assembly)
271public static Func<string[], object> ResolveHostFactory(Assembly assembly,
285private static Func<string[], T> ResolveFactory<T>(Assembly assembly, string name)
312public static Func<string[], IServiceProvider> ResolveServiceProviderFactory(Assembly assembly, TimeSpan waitTimeout = default)
315var webHostFactory = ResolveWebHostFactory<object>(assembly);
325var webHostBuilderFactory = ResolveWebHostBuilderFactory<object>(assembly);
336var hostBuilderFactory = ResolveHostBuilderFactory<object>(assembly);
347var hostFactory = ResolveHostFactory(assembly, waitTimeout: waitTimeout);
Microsoft.Extensions.Validation.ValidationsGenerator (1)
Microsoft.Extensions.WebEncoders (2)
Microsoft.Gen.ComplianceReports (2)
Microsoft.Gen.ContextualOptions (2)
Microsoft.Gen.Logging (3)
Microsoft.Gen.MetadataExtractor (2)
Microsoft.Gen.Metrics (2)
Microsoft.Gen.MetricsReports (2)
Microsoft.Interop.ComInterfaceGenerator (11)
Analyzers\RuntimeComApiUsageWithSourceGeneratedComAnalyzer.cs (11)
34List<Func<ITypeSymbol, bool>> sourceGeneratedComRecognizers = new();
53var methodsOfInterest = new Dictionary<ISymbol, ImmutableArray<Func<IInvocationOperation, (ITypeSymbol, Location)?>>>(SymbolEqualityComparer.Default);
55var firstArgumentTypeLookup = CreateArgumentTypeLookup(0);
108if (methodsOfInterest.TryGetValue(operation.TargetMethod.OriginalDefinition, out ImmutableArray<Func<IInvocationOperation, (ITypeSymbol, Location)?>> discoverers))
110foreach (Func<IInvocationOperation, (ITypeSymbol, Location)?> discoverer in discoverers)
115foreach (var recognizer in sourceGeneratedComRecognizers)
156foreach (var recognizer in sourceGeneratedComRecognizers)
169foreach (var recognizer in sourceGeneratedComRecognizers)
200static Func<IInvocationOperation, (ITypeSymbol Type, Location location)?> CreateArgumentTypeLookup(int ordinal) => invocation => invocation.GetArgumentByOrdinal(ordinal).Value switch
206static Func<IInvocationOperation, (ITypeSymbol Type, Location location)?> CreateTypeArgumentTypeLookup(int ordinal) => invocation =>
235static Func<IInvocationOperation, (ITypeSymbol Type, Location location)?> CreateTypeOfArgumentTypeLookup(int ordinal) => invocation => invocation.GetArgumentByOrdinal(ordinal).Value switch
Microsoft.Interop.SourceGeneration (12)
ManualTypeMarshallingHelper.cs (6)
117Func<ITypeSymbol, MarshallingInfo> getMarshallingInfo,
127Func<ITypeSymbol, MarshallingInfo> getMarshallingInfo,
150Func<ITypeSymbol, MarshallingInfo> getMarshallingInfoForElement,
410Func<ITypeSymbol, MarshallingInfo> getMarshallingInfo)
453private static CustomTypeMarshallerData? GetStatelessMarshallerDataForType(ITypeSymbol marshallerType, MarshalMode mode, ITypeSymbol managedType, bool isLinearCollectionMarshaller, Compilation compilation, Func<ITypeSymbol, MarshallingInfo>? getMarshallingInfo)
553Func<ITypeSymbol, MarshallingInfo>? getMarshallingInfo)
Microsoft.JSInterop (3)
Microsoft.Maui (15)
Microsoft.Maui.Controls (64)
AnimationExtensions.cs (4)
85 public static int Insert(this IAnimationManager animationManager, Func<long, bool> step)
170 public static void Animate<T>(this IAnimatable self, string name, Func<double, T> transform, Action<T> callback,
208 public static Func<double, double> Interpolate(double start, double end = 1.0f, double reverseVal = 0.0f, bool reverse = false)
255 static void AnimateInternal<T>(IAnimatable self, IAnimationManager animationManager, string name, Func<double, T> transform, Action<T> callback,
EnumerableExtensions.cs (5)
8 public static bool HasChildGesturesFor<T>(this IEnumerable<GestureElement>? elements, Func<T, bool>? predicate = null) where T : GestureRecognizer
29 public static IEnumerable<T> GetChildGesturesFor<T>(this IEnumerable<GestureElement>? elements, Func<T, bool>? predicate = null) where T : GestureRecognizer
49 public static IEnumerable<T> GetGesturesFor<T>(this IEnumerable<IGestureRecognizer>? gestures, Func<T, bool>? predicate = null) where T : GestureRecognizer
65 internal static bool HasAnyGesturesFor<T>(this IEnumerable<IGestureRecognizer>? gestures, Func<T, bool>? predicate = null) where T : GestureRecognizer
68 internal static T? FirstGestureOrDefault<T>(this IEnumerable<IGestureRecognizer>? gestures, Func<T, bool>? predicate = null) where T : GestureRecognizer
PointerGestureRecognizer.cs (5)
189 internal void SendPointerEntered(View sender, Func<IElement?, Point?>? getPosition, PlatformPointerEventArgs? platformArgs = null)
202 internal void SendPointerExited(View sender, Func<IElement?, Point?>? getPosition, PlatformPointerEventArgs? platformArgs = null)
215 internal void SendPointerMoved(View sender, Func<IElement?, Point?>? getPosition, PlatformPointerEventArgs? platformArgs = null)
228 internal void SendPointerPressed(View sender, Func<IElement?, Point?>? getPosition, PlatformPointerEventArgs? platformArgs = null)
241 internal void SendPointerReleased(View sender, Func<IElement?, Point?>? getPosition, PlatformPointerEventArgs? platformArgs = null)
TypedBinding.cs (10)
96 Func<TSource, TProperty> getter,
106 handlers: new Tuple<Func<TSource, object>, string>[]
122 readonly Func<TSource, (TProperty value, bool success)> _getter;
126 public TypedBinding(Func<TSource, (TProperty value, bool success)> getter, Action<TSource, TProperty> setter, Tuple<Func<TSource, object>, string>[] handlers)
213 Tuple<Func<TSource, object>, string>[] handlers = _handlers == null ? null : new Tuple<Func<TSource, object>, string>[_handlers.Length];
220 handlers[i] = new Tuple<Func<TSource, object>, string>(_handlers[i].PartGetter, _handlers[i].PropertyName);
459 public Func<TSource, object> PartGetter { get; }
490 public PropertyChangedProxy(Func<TSource, object> partGetter, string propertyName, BindingBase binding)
Microsoft.Maui.Controls.Build.Tasks (19)
ModuleDefinitionExtensions.cs (5)
25 static MethodReference ImportCtorReference(this ModuleDefinition module, XamlCache cache, TypeReference type, TypeReference[] classArguments, Func<MethodDefinition, bool> predicate)
102 static MethodReference ImportPropertyGetterReference(this ModuleDefinition module, XamlCache cache, TypeReference type, string propertyName, Func<PropertyDefinition, bool> predicate = null, bool flatten = false, bool caseSensitive = true)
123 static MethodReference ImportPropertySetterReference(this ModuleDefinition module, XamlCache cache, TypeReference type, string propertyName, Func<PropertyDefinition, bool> predicate = null)
143 static MethodReference ImportMethodReference(this ModuleDefinition module, XamlCache cache, TypeReference type, string methodName, Func<MethodDefinition, bool> predicate = null, TypeReference[] classArguments = null)
235 static FieldReference ImportFieldReference(this ModuleDefinition module, XamlCache cache, TypeReference type, string fieldName, Func<FieldDefinition, bool> predicate = null, bool caseSensitive = true)
NodeILExtensions.cs (4)
101 Func<TypeReference[], IEnumerable<Instruction>> pushServiceProvider, bool boxValueTypes, bool unboxValueTypes)
122 Func<TypeReference[], IEnumerable<Instruction>> pushServiceProvider, bool boxValueTypes, bool unboxValueTypes)
136 static T TryFormat<T>(Func<string, T> func, IXmlLineInfo lineInfo, string str)
149 TypeReference targetTypeRef, TypeReference typeConverter, Func<TypeReference[], IEnumerable<Instruction>> pushServiceProvider,
TypeReferenceExtensions.cs (4)
62 public static PropertyDefinition GetProperty(this TypeReference typeRef, XamlCache cache, Func<PropertyDefinition, bool> predicate,
87 public static EventDefinition GetEvent(this TypeReference typeRef, XamlCache cache, Func<EventDefinition, bool> predicate,
124 public static FieldDefinition GetField(this TypeReference typeRef, XamlCache cache, Func<FieldDefinition, bool> predicate,
269 Func<MethodDefinition, bool> predicate, ModuleDefinition module)
XamlCache.cs (6)
23 static TValue GetOrAdd<TKey, TValue>(Dictionary<TKey, TValue> dictionary, TKey key, Func<TKey, TValue> valueFactory)
32 public IList<XmlnsDefinitionAttribute> GetXmlsDefinitions(ModuleDefinition module, Func<ModuleDefinition, IList<XmlnsDefinitionAttribute>> valueFactory) =>
38 public FieldReference GetOrAddFieldReference((ModuleDefinition module, string fieldRefKey) key, Func<(ModuleDefinition module, string fieldRefKey), FieldReference> valueFactory) =>
44 public TypeReference GetOrAddTypeReference(ModuleDefinition module, string typeKey, Func<(ModuleDefinition module, string typeKey), TypeReference> valueFactory) =>
47 public MethodReference GetOrAddMethodReference(ModuleDefinition module, string methodRefKey, Func<(ModuleDefinition module, string methodRefKey), MethodReference> valueFactory) =>
50 public TypeDefinition GetOrAddTypeDefinition(ModuleDefinition module, (string assemblyName, string clrNamespace, string typeName) type, Func<(ModuleDefinition module, (string assemblyName, string clrNamespace, string typeName)), TypeDefinition> valueFactory) =>
Microsoft.Maui.Controls.Compatibility (1)
Microsoft.Maui.Controls.SourceGen (1)
Microsoft.Maui.Controls.Xaml (3)
Microsoft.ML.AutoML (4)
Microsoft.ML.Core (32)
Utilities\FuncInstanceMethodInfo1`3.cs (5)
15/// Represents the <see cref="MethodInfo"/> for a generic function corresponding to <see cref="Func{T, TResult}"/>,
32public FuncInstanceMethodInfo1(Func<T, TResult> function)
57public static FuncInstanceMethodInfo1<TTarget, T, TResult> Create(Expression<Func<TTarget, Func<T, TResult>>> expression)
75Contracts.CheckParam((Type)((ConstantExpression)methodCallExpression.Arguments[0]).Value == typeof(Func<T, TResult>), nameof(expression), "Unexpected expression form");
Utilities\FuncInstanceMethodInfo3`3.cs (5)
15/// Represents the <see cref="MethodInfo"/> for a generic function corresponding to <see cref="Func{T, TResult}"/>,
32public FuncInstanceMethodInfo3(Func<T, TResult> function)
57public static FuncInstanceMethodInfo3<TTarget, T, TResult> Create(Expression<Func<TTarget, Func<T, TResult>>> expression)
75Contracts.CheckParam((Type)((ConstantExpression)methodCallExpression.Arguments[0]).Value == typeof(Func<T, TResult>), nameof(expression), "Unexpected expression form");
Utilities\Utils.cs (6)
390public static int FindIndexSorted<T>(this T[] input, int min, int lim, Func<T, bool> func)
742public static T[] BuildArray<T>(int length, Func<int, T> func)
767public static void BuildSubsetMaps(DataViewSchema schema, Func<DataViewSchema.Column, bool> pred, out int[] map, out int[] invMap)
802public static void BuildSubsetMaps(int lim, Func<int, bool> pred, out int[] map, out int[] invMap)
1267public static int Count<TSource>(this ReadOnlySpan<TSource> source, Func<TSource, bool> predicate)
1280public static bool All<TSource>(this ReadOnlySpan<TSource> source, Func<TSource, bool> predicate)
Microsoft.ML.Data (268)
DataLoadSave\LegacyCompositeDataLoader.cs (3)
322ILegacyDataLoader srcLoader, Func<string, bool> isTransformTagAccepted)
347public static IDataView LoadSelectedTransforms(ModelLoadContext ctx, IDataView srcView, IHostEnvironment env, Func<string, bool> isTransformTagAccepted)
450private static ILegacyDataLoader LoadTransforms(ModelLoadContext ctx, ILegacyDataLoader srcLoader, IHost host, Func<string, bool> isTransformTagAccepted)
DataLoadSave\Text\TextLoaderParser.cs (21)
28private static readonly FuncInstanceMethodInfo1<ValueCreatorCache, PrimitiveDataViewType, Func<RowSet, ColumnPipe>> _getCreatorOneCoreMethodInfo
29= FuncInstanceMethodInfo1<ValueCreatorCache, PrimitiveDataViewType, Func<RowSet, ColumnPipe>>.Create(target => target.GetCreatorOneCore<int>);
31private static readonly FuncInstanceMethodInfo1<ValueCreatorCache, PrimitiveDataViewType, Func<RowSet, ColumnPipe>> _getCreatorVecCoreMethodInfo
32= FuncInstanceMethodInfo1<ValueCreatorCache, PrimitiveDataViewType, Func<RowSet, ColumnPipe>>.Create(target => target.GetCreatorVecCore<int>);
59private readonly Func<RowSet, ColumnPipe>[] _creatorsOne;
60private readonly Func<RowSet, ColumnPipe>[] _creatorsVec;
69_creatorsOne = new Func<RowSet, ColumnPipe>[InternalDataKindExtensions.KindCount];
70_creatorsVec = new Func<RowSet, ColumnPipe>[InternalDataKindExtensions.KindCount];
79private Func<RowSet, ColumnPipe> GetCreatorOneCore(PrimitiveDataViewType type)
84private Func<RowSet, ColumnPipe> GetCreatorOneCore<T>(PrimitiveDataViewType type)
92private Func<RowSet, ColumnPipe> GetCreatorVecCore(PrimitiveDataViewType type)
97private Func<RowSet, ColumnPipe> GetCreatorVecCore<T>(PrimitiveDataViewType type)
105public Func<RowSet, ColumnPipe> GetCreatorOne(KeyDataViewType key)
111public Func<RowSet, ColumnPipe> GetCreatorVec(KeyDataViewType key)
117public Func<RowSet, ColumnPipe> GetCreatorOne(InternalDataKind kind)
124public Func<RowSet, ColumnPipe> GetCreatorVec(InternalDataKind kind)
666private readonly Func<RowSet, ColumnPipe>[] _creator;
678_creator = new Func<RowSet, ColumnPipe>[_infos.Length];
693var mapOne = new Dictionary<InternalDataKind, Func<RowSet, ColumnPipe>>();
694var mapVec = new Dictionary<InternalDataKind, Func<RowSet, ColumnPipe>>();
717var fn = vectorType != null ?
DataView\ArrayDataViewBuilder.cs (5)
237var predicate = RowCursorUtils.FromColumnsToPredicate(columnsNeeded, Schema);
245var predicate = RowCursorUtils.FromColumnsToPredicate(columnsNeeded, Schema);
265public Cursor(IChannelProvider provider, DataView view, Func<int, bool> predicate, Random rand)
453public VectorColumn(PrimitiveDataViewType itemType, TIn[] values, Func<TIn, int> lengthFunc)
462private static DataViewType InferType(PrimitiveDataViewType itemType, TIn[] values, Func<TIn, int> lengthFunc)
DataView\CacheDataView.cs (12)
213var predicate = RowCursorUtils.FromColumnsToPredicate(columnsNeeded, Schema);
243private DataViewRowCursor GetRowCursorWaiterCore<TWaiter>(TWaiter waiter, Func<int, bool> predicate, Random rand)
259var predicate = RowCursorUtils.FromColumnsToPredicate(columnsNeeded, Schema);
272private DataViewRowCursor[] GetRowCursorSetWaiterCore<TWaiter>(TWaiter waiter, Func<int, bool> predicate, int n, Random rand)
293private DataViewRowCursor CreateCursor<TIndex>(Func<int, bool> predicate, TIndex index)
300public RowSeeker GetSeeker(Func<int, bool> predicate)
313private RowSeeker GetSeeker<TWaiter>(Func<int, bool> predicate, TWaiter waiter)
460public RowCursor(CacheDataView parent, Func<int, bool> predicate, TIndex index)
550public RowSeekerCore(CacheDataView parent, Func<int, bool> predicate, TWaiter waiter)
657private WaiterWaiter(CacheDataView parent, Func<int, bool> pred)
695public static Wrapper Create(CacheDataView parent, Func<int, bool> pred)
1155protected RowCursorSeekerBase(CacheDataView parent, Func<int, bool> predicate)
DataView\DataViewConstructionUtils.cs (10)
215public InputRowBase(IHostEnvironment env, DataViewSchema schema, InternalSchemaDefinition schemaDef, Delegate[] peeks, Func<int, bool> predicate)
308private Delegate CreateConvertingArrayGetterDelegate<TSrc, TDst>(Delegate peekDel, Func<TSrc, TDst> convert)
324private Delegate CreateConvertingGetterDelegate<TSrc, TDst>(Delegate peekDel, Func<TSrc, TDst> convert)
543Func<int, bool> predicate)
622var predicate = RowCursorUtils.FromColumnsToPredicate(columnsNeeded, Schema);
637Func<int, bool> predicate, Random rand)
705var predicate = RowCursorUtils.FromColumnsToPredicate(columnsNeeded, Schema);
714public Cursor(IHostEnvironment env, StreamingDataView<TRow> dataView, Func<int, bool> predicate)
775var predicate = RowCursorUtils.FromColumnsToPredicate(columnsNeeded, Schema);
783public Cursor(IHostEnvironment env, SingleRowLoopDataView<TRow> dataView, Func<int, bool> predicate)
DataView\LambdaFilter.cs (7)
104protected override bool? ShouldUseParallelCursors(Func<int, bool> predicate)
114var predicate = RowCursorUtils.FromColumnsToPredicate(columnsNeeded, OutputSchema);
117Func<int, bool> inputPred = GetActive(predicate, out active);
128var predicate = RowCursorUtils.FromColumnsToPredicate(columnsNeeded, OutputSchema);
131Func<int, bool> inputPred = GetActive(predicate, out active);
143private Func<int, bool> GetActive(Func<int, bool> predicate, out bool[] active)
DataView\RowToRowMapperTransform.cs (15)
34Func<int, bool> GetDependencies(Func<int, bool> activeOutput);
43Delegate[] CreateGetters(DataViewRow input, Func<int, bool> activeOutput, out Action disposer);
74private readonly Func<DataViewSchema, IRowMapper> _mapperFactory;
95public RowToRowMapperTransform(IHostEnvironment env, IDataView input, IRowMapper mapper, Func<DataViewSchema, IRowMapper> mapperFactory)
147private bool[] GetActive(Func<int, bool> predicate, out IEnumerable<DataViewSchema.Column> inputColumns)
157var predicateOut = GetActiveOutputColumns(active);
160var predicateIn = _mapper.GetDependencies(predicateOut);
168private Func<int, bool> GetActiveOutputColumns(bool[] active)
181protected override bool? ShouldUseParallelCursors(Func<int, bool> predicate)
191var predicate = RowCursorUtils.FromColumnsToPredicate(columnsNeeded, OutputSchema);
201var predicate = RowCursorUtils.FromColumnsToPredicate(columnsNeeded, OutputSchema);
242var predicate = RowCursorUtils.FromColumnsToPredicate(dependingColumns, OutputSchema);
263var pred = GetActiveOutputColumns(activeArr);
371var pred = parent.GetActiveOutputColumns(active);
DataView\Transposer.cs (12)
833var predicate = RowCursorUtils.FromColumnsToPredicate(columnsNeeded, Schema);
836var srcPred = CreateInputPredicate(predicate, out activeSplitters);
846var predicate = RowCursorUtils.FromColumnsToPredicate(columnsNeeded, Schema);
849var srcPred = CreateInputPredicate(predicate, out activeSplitters);
866private Func<int, bool> CreateInputPredicate(Func<int, bool> pred, out bool[] activeSplitters)
962public abstract DataViewRow Bind(DataViewRow row, Func<int, bool> pred);
1022public override DataViewRow Bind(DataViewRow row, Func<int, bool> pred)
1116public override DataViewRow Bind(DataViewRow row, Func<int, bool> pred)
1140public RowImpl(ColumnSplitter<T> parent, DataViewRow input, Func<int, bool> pred)
1269public Cursor(IChannelProvider provider, DataViewSlicer slicer, DataViewRowCursor input, Func<int, bool> pred, bool[] activeSplitters)
1281Func<int, bool> defaultPred = null;
DataView\TypedCursor.cs (7)
178public RowCursor<TRow> GetCursor(Func<int, bool> additionalColumnsPredicate, int? randomSeed = null)
184var deps = GetDependencies(additionalColumnsPredicate);
191public Func<int, bool> GetDependencies(Func<int, bool> additionalColumnsPredicate)
203public RowCursor<TRow>[] GetCursorSet(Func<int, bool> additionalColumnsPredicate, int n, Random rand)
424private Action<TRow> CreateConvertingVBufferSetter<TSrc, TDst>(DataViewRow input, int col, Delegate poke, Delegate peek, Func<TSrc, TDst> convert)
484private static Action<TRow> CreateConvertingActionSetter<TSrc, TDst>(DataViewRow input, int col, Delegate poke, Func<TSrc, TDst> convert)
Evaluators\EvaluatorBase.cs (17)
34Func<int, bool> activeCols = GetActiveCols(data.Schema);
76private Func<int, bool> GetActiveCols(RoleMappedSchema schema)
78Func<int, bool> pred = GetActiveColsCore(schema);
91private protected virtual Func<int, bool> GetActiveColsCore(RoleMappedSchema schema)
116Func<string, TAgg> createAgg = stratName => GetAggregatorCore(schema, stratName);
131Func<int, bool> activeColsIndices, TAgg aggregator, AggregatorDictionaryBase[] dictionaries)
341private protected readonly Func<string, TAgg> CreateAgg;
348private protected AggregatorDictionaryBase(RoleMappedSchema schema, string stratCol, Func<string, TAgg> createAgg)
365Func<string, TAgg> createAgg)
379DataViewType stratType, Func<string, TAgg> createAgg)
406public GenericAggregatorDictionary(RoleMappedSchema schema, string stratCol, DataViewType stratType, Func<string, TAgg> createAgg)
525Func<int, bool> IRowMapper.GetDependencies(Func<int, bool> activeOutput)
529private protected abstract Func<int, bool> GetDependenciesCore(Func<int, bool> activeOutput);
537Delegate[] IRowMapper.CreateGetters(DataViewRow input, Func<int, bool> activeCols, out Action disposer)
541private protected abstract Delegate[] CreateGettersCore(DataViewRow input, Func<int, bool> activeCols, out Action disposer);
Evaluators\EvaluatorUtils.cs (7)
30private static volatile Dictionary<string, Func<IHostEnvironment, IMamlEvaluator>> _knownEvaluatorFactories;
32public static Dictionary<string, Func<IHostEnvironment, IMamlEvaluator>> Instance
36Dictionary<string, Func<IHostEnvironment, IMamlEvaluator>> result = _knownEvaluatorFactories;
39var tmp = new Dictionary<string, Func<IHostEnvironment, IMamlEvaluator>>
164int colScore, string valueKind, Func<DataViewType, bool> testType)
923Func<IDataView, IDataView> selectDropNonVarLenthCol =
991private static List<string> GetMetricNames(IChannel ch, DataViewSchema schema, DataViewRow row, Func<int, bool> ignoreCol,
Scorers\PredictedLabelScorerBase.cs (7)
127Func<DataViewType, bool> outputTypeMatches, Func<DataViewType, ISchemaBoundRowMapper, DataViewType> getPredColType)
259public override Func<int, bool> GetActiveMapperColumns(bool[] active)
266var pred = base.GetActiveMapperColumns(active);
284Func<DataViewType, bool> outputTypeMatches, Func<DataViewType, ISchemaBoundRowMapper, DataViewType> getPredColType, string predictedLabelColumnName = DefaultColumnNames.PredictedLabel)
318Func<DataViewType, bool> outputTypeMatches, Func<DataViewType, ISchemaBoundRowMapper, DataViewType> getPredColType)
396protected override bool WantParallelCursors(Func<int, bool> predicate)
404protected override Delegate[] GetGetters(DataViewRow output, Func<int, bool> predicate)
Scorers\RowToRowScorerBase.cs (9)
97var predicateMapper = bindings.GetActiveMapperColumns(active);
98Func<int, bool> localMapper = predicateMapper;
115protected sealed override bool? ShouldUseParallelCursors(Func<int, bool> predicate)
127protected abstract bool WantParallelCursors(Func<int, bool> predicate);
146var predicate = RowCursorUtils.FromColumnsToPredicate(columnsNeeded, OutputSchema);
172Func<int, bool> activeInfos = iinfo => activeIndices.Contains(bindings.MapIinfoToCol(iinfo));
188protected abstract Delegate[] GetGetters(DataViewRow output, Func<int, bool> predicate);
190protected static Delegate[] GetGettersFromRow(DataViewRow row, Func<int, bool> predicate)
475public virtual Func<int, bool> GetActiveMapperColumns(bool[] active)
Transforms\NAFilter.cs (7)
200protected override bool? ShouldUseParallelCursors(Func<int, bool> predicate)
210var predicate = RowCursorUtils.FromColumnsToPredicate(columnsNeeded, OutputSchema);
212Func<int, bool> inputPred = GetActive(predicate, out bool[] active);
222var predicate = RowCursorUtils.FromColumnsToPredicate(columnsNeeded, OutputSchema);
224Func<int, bool> inputPred = GetActive(predicate, out bool[] active);
237private Func<int, bool> GetActive(Func<int, bool> predicate, out bool[] active)
Transforms\RangeFilter.cs (12)
201protected override bool? ShouldUseParallelCursors(Func<int, bool> predicate)
212var predicate = RowCursorUtils.FromColumnsToPredicate(columnsNeeded, OutputSchema);
213Func<int, bool> inputPred = GetActive(predicate, out bool[] active);
225var predicate = RowCursorUtils.FromColumnsToPredicate(columnsNeeded, OutputSchema);
226Func<int, bool> inputPred = GetActive(predicate, out bool[] active);
249private Func<int, bool> GetActive(Func<int, bool> predicate, out bool[] active)
270protected readonly Func<Double, bool> CheckBounds;
283CheckBounds = Parent._complement ? (Func<Double, bool>)TestNotCC : TestCC;
285CheckBounds = Parent._complement ? (Func<Double, bool>)TestNotCO : TestCO;
290CheckBounds = Parent._complement ? (Func<Double, bool>)TestNotOC : TestOC;
292CheckBounds = Parent._complement ? (Func<Double, bool>)TestNotOO : TestOO;
Transforms\RowToRowTransformerBase.cs (6)
78public virtual Delegate[] CreateGetters(DataViewRow input, Func<int, bool> activeOutput, out Action disposer)
107protected abstract Delegate MakeGetter(DataViewRow input, int iinfo, Func<int, bool> activeOutput, out Action disposer);
109Func<int, bool> IRowMapper.GetDependencies(Func<int, bool> activeOutput)
113private protected abstract Func<int, bool> GetDependenciesCore(Func<int, bool> activeOutput);
Transforms\TransformBase.cs (13)
69var predicate = RowCursorUtils.FromColumnsToPredicate(columnsNeeded, OutputSchema);
94protected abstract bool? ShouldUseParallelCursors(Func<int, bool> predicate);
328ITransposeDataView transposedInput, Func<DataViewType, string> testType)
365ITransposeDataView transposeInput, Func<DataViewType, string> testType)
499IDataView input, Func<DataViewType, string> testType)
513IDataView input, Func<DataViewType, string> testType)
527IDataView input, Func<DataViewType, string> testType)
544IDataView newInput, Func<DataViewType, string> checkType)
716protected sealed override bool? ShouldUseParallelCursors(Func<int, bool> predicate)
728protected virtual bool WantParallelCursors(Func<int, bool> predicate)
738Func<int, bool> needCol = c => columnsNeeded == null ? false : columnsNeeded.Any(x => x.Index == c);
750var predicate = RowCursorUtils.FromColumnsToPredicate(columnsNeeded, OutputSchema);
821Func<int, bool> activeInfos =
Utilities\ColumnCursor.cs (6)
65Delegate convert = (Func<ReadOnlyMemory<char>, string>)((ReadOnlyMemory<char> txt) => txt.ToString());
66Func<IDataView, int, Func<int, T>, IEnumerable<T>> del = GetColumnConvert;
86Delegate convert = (Func<ReadOnlyMemory<char>, string>)((ReadOnlyMemory<char> txt) => txt.ToString());
87Func<IDataView, int, Func<int, long>, IEnumerable<long[]>> del = GetColumnArrayConvert;
116private static IEnumerable<TOut> GetColumnConvert<TOut, TData>(IDataView data, int col, Func<TData, TOut> convert)
156private static IEnumerable<TOut[]> GetColumnArrayConvert<TOut, TData>(IDataView data, int col, Func<TData, TOut> convert)
Microsoft.ML.DataView (1)
Microsoft.ML.Ensemble (1)
Microsoft.ML.GenAI.Samples (1)
Microsoft.ML.ImageAnalytics (7)
ImageLoader.cs (3)
206protected override Delegate MakeGetter(DataViewRow input, int iinfo, Func<int, bool> activeOutput, out Action disposer)
216private Delegate MakeGetterImageDataViewType(DataViewRow input, int iinfo, Func<int, bool> activeOutput, out Action disposer)
263private Delegate MakeGetterVectorDataViewByteType(DataViewRow input, int iinfo, Func<int, bool> activeOutput, out Action disposer)
Microsoft.ML.InternalCodeAnalyzer (2)
Microsoft.ML.Mkl.Components (1)
Microsoft.ML.OnnxConverter (1)
Microsoft.ML.OnnxTransformer (23)
Microsoft.ML.Parquet (1)
Microsoft.ML.PCA (1)
Microsoft.ML.StandardTrainers (10)
Microsoft.ML.TensorFlow (5)
TensorflowTransform.cs (5)
641private Delegate CreateGetter(DataViewRow input, int iinfo, Func<int, bool> activeOutput, OutputCache outputCache)
653public override Delegate[] CreateGetters(DataViewRow input, Func<int, bool> activeOutput, out Action disposer)
698protected override Delegate MakeGetter(DataViewRow input, int iinfo, Func<int, bool> activeOutput, out Action disposer)
779private protected override Func<int, bool> GetDependenciesCore(Func<int, bool> activeOutput)
Microsoft.ML.TestFramework (2)
Microsoft.ML.Tests (6)
Microsoft.ML.TimeSeries (35)
SequentialTransformerBase.cs (16)
573protected override bool? ShouldUseParallelCursors(Func<int, bool> predicate)
612var active = RowCursorUtils.FromColumnsToPredicate(activeColumns, OutputSchema);
810private bool[] GetActive(Func<int, bool> predicate, out Func<int, bool> predicateInput)
820var predicateOut = GetActiveOutputColumns(active);
837private IEnumerable<DataViewSchema.Column> GetActive(Func<int, bool> predicate)
839Func<int, bool> predicateInput;
845private Func<int, bool> GetActiveOutputColumns(bool[] active)
858protected override bool? ShouldUseParallelCursors(Func<int, bool> predicate)
868Func<int, bool> predicateInput;
869var predicate = RowCursorUtils.FromColumnsToPredicate(columnsNeeded, OutputSchema);
879Func<int, bool> predicateInput;
880var predicate = RowCursorUtils.FromColumnsToPredicate(columnsNeeded, OutputSchema);
922var predicate = RowCursorUtils.FromColumnsToPredicate(dependingColumns, OutputSchema);
937var pred = GetActiveOutputColumns(activeArr);
1030var pred = parent.GetActiveOutputColumns(active);
Microsoft.ML.Tokenizers (1)
Microsoft.ML.Tokenizers.Data.Tests (3)
src\Common\tests\RetryHelper.cs (3)
15private static readonly Func<int, int> _defaultBackoffFunc = i => Math.Min(i * 100, 60_000);
24public static void Execute(Action test, int maxAttempts = 5, Func<int, int>? backoffFunc = null, Predicate<Exception>? retryWhen = null, [CallerMemberName] string? testName = null)
74public static async Task ExecuteAsync(Func<Task> test, int maxAttempts = 5, Func<int, int>? backoffFunc = null, Predicate<Exception>? retryWhen = null, [CallerMemberName] string? testName = null)
Microsoft.ML.Tokenizers.Tests (3)
src\Common\tests\RetryHelper.cs (3)
15private static readonly Func<int, int> _defaultBackoffFunc = i => Math.Min(i * 100, 60_000);
24public static void Execute(Action test, int maxAttempts = 5, Func<int, int>? backoffFunc = null, Predicate<Exception>? retryWhen = null, [CallerMemberName] string? testName = null)
74public static async Task ExecuteAsync(Func<Task> test, int maxAttempts = 5, Func<int, int>? backoffFunc = null, Predicate<Exception>? retryWhen = null, [CallerMemberName] string? testName = null)
Microsoft.ML.TorchSharp (17)
Microsoft.ML.Transforms (81)
Microsoft.ML.Vision (3)
Microsoft.VisualBasic.Tests (1)
Microsoft.VisualStudio.LanguageServices (40)
TableDataSource\Suppression\VisualStudioSuppressionFixService.cs (10)
78var shouldFixInProject = GetShouldFixInProjectDelegate(_vsHierarchyItemManager, _projectMap, projectHierarchy);
97var shouldFixInProject = GetShouldFixInProjectDelegate(_vsHierarchyItemManager, _projectMap, projectHierarchy);
115var shouldFixInProject = GetShouldFixInProjectDelegate(_vsHierarchyItemManager, _projectMap, projectHierarchy);
126private static Func<Project, bool> GetShouldFixInProjectDelegate(IVsHierarchyItemManager vsHierarchyItemManager, IHierarchyItemToProjectIdMap projectMap, IVsHierarchy? projectHierarchy)
172Func<Project, bool> shouldFixInProject,
183private bool ApplySuppressionFix(IEnumerable<DiagnosticData>? diagnosticsToFix, Func<Project, bool> shouldFixInProject, bool filterStaleDiagnostics, bool isAddSuppression, bool isSuppressionInSource, bool onlyCompilerDiagnostics, bool showPreviewChangesDialog)
191Func<Project, bool> shouldFixInProject,
387Func<CancellationToken, Task> action, string waitDialogTitle, string waitDialogMessage)
448private async Task<ImmutableDictionary<Document, ImmutableArray<Diagnostic>>> GetDocumentDiagnosticsToFixAsync(IEnumerable<DiagnosticData> diagnosticsToFix, Func<Project, bool> shouldFixInProject, bool filterStaleDiagnostics, CancellationToken cancellationToken)
541private async Task<ImmutableDictionary<Project, ImmutableArray<Diagnostic>>> GetProjectDiagnosticsToFixAsync(IEnumerable<DiagnosticData> diagnosticsToFix, Func<Project, bool> shouldFixInProject, bool filterStaleDiagnostics, CancellationToken cancellationToken)
Workspace\VisualStudioDocumentNavigationService.cs (10)
158Func<Document, Task<TextSpan>> getTextSpanForMappingAsync,
159Func<SourceText, VsTextSpan> getVsTextSpan,
163var callback = await GetNavigationCallbackAsync(
179private async Task<Func<CancellationToken, Task<bool>>?> GetNavigationCallbackAsync(
182Func<Document, Task<TextSpan>> getTextSpanForMappingAsync,
183Func<SourceText, VsTextSpan> getVsTextSpan,
219var getSpanForCallback = IsSecondaryBuffer(documentIdToNavigate)
240private Func<CancellationToken, Task<bool>>? GetNavigationCallback(
243Func<SourceText, VsTextSpan> getVsTextSpan)
292private async Task<Func<CancellationToken, Task<bool>>?> GetNavigableLocationForMappedFileAsync(
Microsoft.VisualStudio.LanguageServices.CSharp (5)
CodeModel\CSharpCodeModelService.cs (5)
3070protected override int GetAttributeIndexInContainer(SyntaxNode containerNode, Func<SyntaxNode, bool> predicate)
3100protected override int GetAttributeArgumentIndexInContainer(SyntaxNode containerNode, Func<SyntaxNode, bool> predicate)
3115protected override int GetImportIndexInContainer(SyntaxNode containerNode, Func<SyntaxNode, bool> predicate)
3130protected override int GetParameterIndexInContainer(SyntaxNode containerNode, Func<SyntaxNode, bool> predicate)
3145protected override int GetMemberIndexInContainer(SyntaxNode containerNode, Func<SyntaxNode, bool> predicate)
Microsoft.VisualStudio.LanguageServices.CSharp.UnitTests (3)
Microsoft.VisualStudio.LanguageServices.Implementation (12)
CodeModel\AbstractCodeModelService.cs (8)
85protected SyntaxToken GetTokenWithoutAnnotation(SyntaxToken current, Func<SyntaxToken, SyntaxToken> nextTokenGetter)
853Func<SyntaxNode, bool> predicate);
872Func<SyntaxNode, bool> predicate);
886Func<SyntaxNode, bool> predicate);
900Func<SyntaxNode, bool> predicate);
918Func<SyntaxNode, bool> predicate);
939Func<SyntaxNode, Func<SyntaxNode, bool>, int> getIndexInContainer,
940Func<SyntaxNode, IEnumerable<SyntaxNode>> getChildNodes)
Microsoft.VisualStudio.LanguageServices.Xaml (1)
mscorlib (1)
netstandard (1)
OpenIdConnectSample (1)
PresentationCore (14)
PresentationFramework (52)
MS\Internal\Data\ViewManager.cs (3)
493internal ViewRecord GetViewRecord(object collection, CollectionViewSource cvs, Type collectionViewType, bool createView, Func<object, object> GetSourceItem)
619private CollectionRecord EnsureCollectionRecord(object collection, Func<object, object> GetSourceItem = null)
680private ViewRecord GetExistingView(object collection, CollectionViewSource cvs, Type collectionViewType, Func<object, object> GetSourceItem)
MS\Internal\WindowsRuntime\Generated\WinRT\Marshalers.cs (32)
356public static readonly Func<T, object> CreateMarshaler;
357private static Func<T, object> BindCreateMarshaler()
360return Expression.Lambda<Func<T, object>>(
365public static readonly Func<object, object> GetAbi;
366private static Func<object, object> BindGetAbi()
369return Expression.Lambda<Func<object, object>>(
386public static readonly Func<object, T> FromAbi;
387private static Func<object, T> BindFromAbi()
390return Expression.Lambda<Func<object, T>>(
395public static readonly Func<T, object> FromManaged;
396private static Func<T, object> BindFromManaged()
399return Expression.Lambda<Func<T, object>>(
629public static unsafe MarshalerArray CreateMarshalerArray(T[] array, Func<T, IObjectReference> createMarshaler)
664public static unsafe T[] FromAbiArray(object box, Func<IntPtr, T> fromAbi)
680public static unsafe (int length, IntPtr data) FromManagedArray(T[] array, Func<T, IntPtr> fromManaged)
780private static Func<T, IObjectReference> _ToAbi;
781private static Func<IntPtr, T> _FromAbi;
782private static Func<IObjectReference, IObjectReference> _As;
870private static Func<IntPtr, T> BindFromAbi()
875return Expression.Lambda<Func<IntPtr, T>>(
880private static Func<T, IObjectReference> BindToAbi()
883return Expression.Lambda<Func<T, IObjectReference>>(
889private static Func<IObjectReference, IObjectReference> BindAs()
893return Expression.Lambda<Func<IObjectReference, IObjectReference>>(
1103public static readonly Func<T, object> CreateMarshaler;
1104public static readonly Func<object, object> GetAbi;
1106public static readonly Func<object, T> FromAbi;
1107public static readonly Func<T, object> FromManaged;
1111public static readonly Func<T[], object> CreateMarshalerArray;
1112public static readonly Func<object, (int, IntPtr)> GetAbiArray;
1113public static readonly Func<object, T[]> FromAbiArray;
1114public static readonly Func<T[], (int, IntPtr)> FromManagedArray;
Replay (1)
Roslyn.Diagnostics.Analyzers (444)
src\Compilers\Core\Portable\FileSystem\FileUtilities.cs (4)
47Func<string, bool> fileExists)
322public static T RethrowExceptionsAsIOException<T, TArg>(Func<TArg, T> operation, TArg arg)
339public static async Task<T> RethrowExceptionsAsIOExceptionAsync<T, TArg>(Func<TArg, Task<T>> operation, TArg arg)
355internal static Stream CreateFileStreamChecked(Func<string, Stream> factory, string path, string? paramName = null)
src\Compilers\Core\Portable\InternalUtilities\InterlockedOperations.cs (5)
46public static T Initialize<T, TArg>([NotNull] ref T? target, Func<TArg, T> valueFactory, TArg arg)
66public static int Initialize<TArg>(ref int target, int uninitializedValue, Func<TArg, int> valueFactory, TArg arg)
103public static T? Initialize<T, TArg>([NotNull] ref StrongBox<T?>? target, Func<TArg, T?> valueFactory, TArg arg)
183public static ImmutableArray<T> Initialize<T, TArg>(ref ImmutableArray<T> target, Func<TArg, ImmutableArray<T>> createArray, TArg arg)
193private static ImmutableArray<T> Initialize_Slow<T, TArg>(ref ImmutableArray<T> target, Func<TArg, ImmutableArray<T>> createArray, TArg arg)
src\Compilers\Core\Portable\SourceGeneration\GeneratedCodeUtilities.cs (4)
49SyntaxTree tree, Func<SyntaxTrivia, bool> isComment, CancellationToken cancellationToken)
55internal static bool IsGeneratedCode(string? filePath, SyntaxNode root, Func<SyntaxTrivia, bool> isComment)
88private static bool BeginsWithAutoGeneratedComment(SyntaxNode root, Func<SyntaxTrivia, bool> isComment)
118SyntaxTree tree, Func<SyntaxTrivia, bool> isComment, CancellationToken cancellationToken)
src\Dependencies\Collections\Extensions\IEnumerableExtensions.cs (30)
164public static T? FirstOrNull<T>(this IEnumerable<T> source, Func<T, bool> predicate)
182public static T? SingleOrNull<T>(this IEnumerable<T> source, Func<T, bool> predicate)
261public static bool HasDuplicates<TItem, TValue>(this IEnumerable<TItem> source, Func<TItem, TValue> selector)
271/// <seealso cref="Microsoft.CodeAnalysis.ImmutableArrayExtensions.HasDuplicates{TItem, TValue}(ImmutableArray{TItem}, Func{TItem, TValue}, IEqualityComparer{TValue})"/>
273public static bool HasDuplicates<TItem, TValue>(this IEnumerable<TItem> source, Func<TItem, TValue> selector, IEqualityComparer<TValue> comparer)
321private static readonly Func<object, bool> s_notNullTest = x => x != null;
331return source.Where((Func<T?, bool>)s_notNullTest)!;
376public static ImmutableArray<T> WhereAsArray<T>(this IEnumerable<T> values, Func<T, bool> predicate)
407public static ImmutableArray<TResult> SelectAsArray<TSource, TResult>(this IEnumerable<TSource>? source, Func<TSource, TResult> selector)
417public static ImmutableArray<TResult> SelectAsArray<TItem, TResult>(this IEnumerable<TItem>? source, Func<TItem, bool> predicate, Func<TItem, TResult> selector)
461public static ImmutableArray<TResult> SelectAsArray<TSource, TResult>(this IReadOnlyCollection<TSource>? source, Func<TSource, TResult> selector)
485public static ImmutableArray<TResult> SelectManyAsArray<TSource, TResult>(this IEnumerable<TSource>? source, Func<TSource, IEnumerable<TResult>> selector)
507public static ImmutableArray<TResult> SelectManyAsArray<TItem, TResult>(this IReadOnlyCollection<TItem>? source, Func<TItem, IEnumerable<TResult>> selector)
533public static ImmutableArray<TResult> SelectManyAsArray<TSource, TResult>(this IEnumerable<TSource>? source, Func<TSource, OneOrMany<TResult>> selector)
547public static async ValueTask<ImmutableArray<TResult>> SelectAsArrayAsync<TItem, TResult>(this IEnumerable<TItem> source, Func<TItem, ValueTask<TResult>> selector)
764internal static Dictionary<K, ImmutableArray<T>> ToMultiDictionary<K, T>(this IEnumerable<T> data, Func<T, K> keySelector, IEqualityComparer<K>? comparer = null)
815public static readonly Func<T, T> Identity = t => t;
816public static readonly Func<T, bool> True = t => true;
840/// Alias for <see cref="System.Linq.Enumerable.Any{TSource}(IEnumerable{TSource}, Func{TSource, bool})"/>
842public static bool Contains<T>(this IEnumerable<T> sequence, Func<T, bool> predicate)
846/// Variant of <see cref="System.Linq.Enumerable.Count{TSource}(IEnumerable{TSource}, Func{TSource, bool})"/>
861/// Variant of <see cref="System.Linq.Enumerable.FirstOrDefault{TSource}(IEnumerable{TSource}, Func{TSource, bool})"/>
875/// Variant of <see cref="System.Linq.Enumerable.Any{TSource}(IEnumerable{TSource}, Func{TSource, bool})"/>
889/// Variant of <see cref="System.Linq.Enumerable.OrderBy{TSource, TKey}(IEnumerable{TSource}, Func{TSource, TKey}, IComparer{TKey}?)"/>
895/// Variant of <see cref="System.Linq.Enumerable.OrderByDescending{TSource, TKey}(IEnumerable{TSource}, Func{TSource, TKey}, IComparer{TKey}?)"/>
901/// Variant of <see cref="System.Linq.Enumerable.OrderBy{TSource, TKey}(IEnumerable{TSource}, Func{TSource, TKey}, IComparer{TKey}?)"/>
907/// Variant of <see cref="System.Linq.Enumerable.OrderByDescending{TSource, TKey}(IEnumerable{TSource}, Func{TSource, TKey}, IComparer{TKey}?)"/>
913/// Variant of <see cref="System.Linq.Enumerable.ThenBy{TSource, TKey}(IOrderedEnumerable{TSource}, Func{TSource, TKey}, IComparer{TKey}?)"/>
919/// Variant of <see cref="System.Linq.Enumerable.ThenBy{TSource, TKey}(IOrderedEnumerable{TSource}, Func{TSource, TKey}, IComparer{TKey}?)"/>
src\Dependencies\Collections\Extensions\IListExtensions.cs (4)
21public static bool HasDuplicates<TItem, TValue>(this IReadOnlyList<TItem> list, Func<TItem, TValue> selector)
31/// <seealso cref="ImmutableArrayExtensions.HasDuplicates{TItem, TValue}(System.Collections.Immutable.ImmutableArray{TItem}, Func{TItem, TValue}, IEqualityComparer{TValue})"/>
32/// <seealso cref="Roslyn.Utilities.EnumerableExtensions.HasDuplicates{TItem, TValue}(IEnumerable{TItem}, Func{TItem, TValue}, IEqualityComparer{TValue})"/>
34internal static bool HasDuplicates<TItem, TValue>(this IReadOnlyList<TItem> list, Func<TItem, TValue> selector, IEqualityComparer<TValue> comparer)
src\Dependencies\Collections\Extensions\ImmutableArrayExtensions.cs (27)
138public static ImmutableArray<TResult> SelectAsArray<TItem, TResult>(this ImmutableArray<TItem> items, Func<TItem, TResult> map)
198public static ImmutableArray<TResult> SelectAsArray<TItem, TResult>(this ImmutableArray<TItem> array, Func<TItem, bool> predicate, Func<TItem, TResult> selector)
247public static ImmutableArray<TResult> SelectManyAsArray<TItem, TResult>(this ImmutableArray<TItem> array, Func<TItem, IEnumerable<TResult>> selector)
267public static ImmutableArray<TResult> SelectManyAsArray<TItem, TResult>(this ImmutableArray<TItem> array, Func<TItem, ImmutableArray<TResult>> selector)
287public static ImmutableArray<TResult> SelectManyAsArray<TItem, TResult>(this ImmutableArray<TItem> array, Func<TItem, OneOrMany<TResult>> selector)
308public static ImmutableArray<TResult> SelectManyAsArray<TItem, TResult>(this ImmutableArray<TItem> array, Func<TItem, bool> predicate, Func<TItem, IEnumerable<TResult>> selector)
332public static ImmutableArray<TResult> SelectManyAsArray<TItem, TResult>(this ImmutableArray<TItem> array, Func<TItem, bool> predicate, Func<TItem, ImmutableArray<TResult>> selector)
356public static ImmutableArray<TResult> SelectManyAsArray<TItem, TResult>(this ImmutableArray<TItem> array, Func<TItem, bool> predicate, Func<TItem, OneOrMany<TResult>> selector)
493public static ImmutableArray<T> WhereAsArray<T>(this ImmutableArray<T> array, Func<T, bool> predicate)
504private static ImmutableArray<T> WhereAsArrayImpl<T, TArg>(ImmutableArray<T> array, Func<T, bool>? predicateWithoutArg, Func<T, TArg, bool>? predicateWithArg, TArg arg)
573public static async Task<bool> AnyAsync<T>(this ImmutableArray<T> array, Func<T, Task<bool>> predicateAsync)
595public static async ValueTask<T?> FirstOrDefaultAsync<T>(this ImmutableArray<T> array, Func<T, Task<bool>> predicateAsync)
757public static bool HasDuplicates<TItem, TValue>(this ImmutableArray<TItem> array, Func<TItem, TValue> selector)
767/// <seealso cref="Roslyn.Utilities.EnumerableExtensions.HasDuplicates{TItem, TValue}(IEnumerable{TItem}, Func{TItem, TValue}, IEqualityComparer{TValue})"/>
769internal static bool HasDuplicates<TItem, TValue>(this ImmutableArray<TItem> array, Func<TItem, TValue> selector, IEqualityComparer<TValue> comparer)
990/// Variant of <see cref="System.Linq.ImmutableArrayExtensions.FirstOrDefault{T}(ImmutableArray{T}, Func{T, bool})"/>
1004/// Variant of <see cref="System.Linq.ImmutableArrayExtensions.Single{T}(ImmutableArray{T}, Func{T, bool})"/>
1066/// Specialization of <see cref="System.Linq.Enumerable.Count{TSource}(IEnumerable{TSource}, Func{TSource, bool})"/> for <see cref="ImmutableArray{T}"/>.
1068public static int Count<T>(this ImmutableArray<T> items, Func<T, bool> predicate)
1086public static int Sum<T>(this ImmutableArray<T> items, Func<T, int> selector)
1213/// Variant of <see cref="System.Linq.ImmutableArrayExtensions.Any{T}(ImmutableArray{T}, Func{T, bool})"/>.
1227/// Variant of <see cref="System.Linq.ImmutableArrayExtensions.All{T}(ImmutableArray{T}, Func{T, bool})"/>.
1257public static bool Contains<T>(this ImmutableArray<T> array, Func<T, bool> predicate)
src\Dependencies\Collections\RoslynImmutableInterlocked.cs (7)
33public static bool Update<T>(ref ImmutableSegmentedList<T> location, Func<ImmutableSegmentedList<T>, ImmutableSegmentedList<T>> transformer)
154public static bool Update<T>(ref ImmutableSegmentedHashSet<T> location, Func<ImmutableSegmentedHashSet<T>, ImmutableSegmentedHashSet<T>> transformer)
276public static bool Update<TKey, TValue>(ref ImmutableSegmentedDictionary<TKey, TValue> location, Func<ImmutableSegmentedDictionary<TKey, TValue>, ImmutableSegmentedDictionary<TKey, TValue>> transformer)
410/// <inheritdoc cref="ImmutableInterlocked.GetOrAdd{TKey, TValue}(ref ImmutableDictionary{TKey, TValue}, TKey, Func{TKey, TValue})"/>
411public static TValue GetOrAdd<TKey, TValue>(ref ImmutableSegmentedDictionary<TKey, TValue> location, TKey key, Func<TKey, TValue> valueFactory)
458/// <inheritdoc cref="ImmutableInterlocked.AddOrUpdate{TKey, TValue}(ref ImmutableDictionary{TKey, TValue}, TKey, Func{TKey, TValue}, Func{TKey, TValue, TValue})"/>
459public static TValue AddOrUpdate<TKey, TValue>(ref ImmutableSegmentedDictionary<TKey, TValue> location, TKey key, Func<TKey, TValue> addValueFactory, Func<TKey, TValue, TValue> updateValueFactory)
src\Dependencies\Collections\Segmented\ImmutableSegmentedDictionary.cs (6)
68public static ImmutableSegmentedDictionary<TKey, TValue> ToImmutableSegmentedDictionary<TSource, TKey, TValue>(this IEnumerable<TSource> source, Func<TSource, TKey> keySelector, Func<TSource, TValue> elementSelector)
72public static ImmutableSegmentedDictionary<TKey, TValue> ToImmutableSegmentedDictionary<TSource, TKey, TValue>(this IEnumerable<TSource> source, Func<TSource, TKey> keySelector, Func<TSource, TValue> elementSelector, IEqualityComparer<TKey>? keyComparer)
86public static ImmutableSegmentedDictionary<TKey, TSource> ToImmutableSegmentedDictionary<TSource, TKey>(this IEnumerable<TSource> source, Func<TSource, TKey> keySelector)
90public static ImmutableSegmentedDictionary<TKey, TSource> ToImmutableSegmentedDictionary<TSource, TKey>(this IEnumerable<TSource> source, Func<TSource, TKey> keySelector, IEqualityComparer<TKey>? keyComparer)
src\Dependencies\PooledObjects\ArrayBuilder.cs (7)
457public void FreeAll(Func<T, ArrayBuilder<T>?> getNested)
560internal Dictionary<K, ImmutableArray<T>> ToDictionary<K>(Func<T, K> keySelector, IEqualityComparer<K>? comparer = null)
608public void AddRange<U>(ArrayBuilder<U> items, Func<U, T> selector)
745public ImmutableArray<S> SelectDistinct<S>(Func<T, S> selector)
763public bool Any(Func<T, bool> predicate)
787public bool All(Func<T, bool> predicate)
817public ImmutableArray<TResult> SelectAsArray<TResult>(Func<T, TResult> map)
src\Dependencies\PooledObjects\PooledDelegates.cs (9)
200public static Releaser GetPooledFunction<TArg, TResult>(Func<TArg, TResult> unboundFunction, TArg argument, out Func<TResult> boundFunction)
201=> GetPooledDelegate<FuncWithBoundArgument<TArg, TResult>, TArg, Func<TArg, TResult>, Func<TResult>>(unboundFunction, argument, out boundFunction);
204/// Equivalent to <see cref="GetPooledFunction{TArg, TResult}(Func{TArg, TResult}, TArg, out Func{TResult})"/>,
216/// Gets a <see cref="Func{T, TResult}"/> delegate, which calls <paramref name="unboundFunction"/> with the
246public static Releaser GetPooledFunction<T1, TArg, TResult>(Func<T1, TArg, TResult> unboundFunction, TArg argument, out Func<T1, TResult> boundFunction)
247=> GetPooledDelegate<FuncWithBoundArgument<T1, TArg, TResult>, TArg, Func<T1, TArg, TResult>, Func<T1, TResult>>(unboundFunction, argument, out boundFunction);
412: AbstractDelegateWithBoundArgument<FuncWithBoundArgument<TArg, TResult>, TArg, Func<TArg, TResult>, Func<TResult>>
432: AbstractDelegateWithBoundArgument<FuncWithBoundArgument<T1, TArg, TResult>, TArg, Func<T1, TArg, TResult>, Func<T1, TResult>>
434protected override Func<T1, TResult> Bind()
src\Dependencies\Threading\ParallelExtensions.NetFramework.cs (7)
122Func<object, Task> taskBody = static async o =>
287Func<object, Task> taskBody = static async o =>
395private readonly Func<object, Task> _taskBody;
418protected ForEachAsyncState(Func<object, Task> taskBody, bool needsLock, int dop, TaskScheduler scheduler, CancellationToken cancellationToken, Func<TSource, CancellationToken, ValueTask> body)
584IEnumerable<TSource> source, Func<object, Task> taskBody,
610IAsyncEnumerable<TSource> source, Func<object, Task> taskBody,
637T fromExclusive, T toExclusive, Func<object, Task> taskBody,
src\RoslynAnalyzers\Utilities\Compiler\Lightup\LightupHelpers.cs (6)
19internal static Func<TOperation, TProperty> CreateOperationPropertyAccessor<TOperation, TProperty>(Type? type, string propertyName, TProperty fallbackResult)
23internal static Func<TSyntax, TProperty> CreateSyntaxPropertyAccessor<TSyntax, TProperty>(Type? type, string propertyName, TProperty fallbackResult)
27internal static Func<TSymbol, TProperty> CreateSymbolPropertyAccessor<TSymbol, TProperty>(Type? type, string propertyName, TProperty fallbackResult)
31private static Func<T, TProperty> CreatePropertyAccessor<T, TProperty>(Type? type, string parameterName, string propertyName, TProperty fallbackResult)
50Expression<Func<T, TProperty>> expression = Expression.Lambda<Func<T, TProperty>>(result, parameter);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\ObjectExtensions.TypeSwitch.cs (161)
11public static TResult? TypeSwitch<TBaseType, TDerivedType1, TDerivedType2, TDerivedType3, TResult>(this TBaseType obj, Func<TDerivedType1, TResult> matchFunc1, Func<TDerivedType2, TResult> matchFunc2, Func<TDerivedType3, TResult> matchFunc3, Func<TBaseType, TResult>? defaultFunc = null)
25public static TResult? TypeSwitch<TBaseType, TDerivedType1, TDerivedType2, TDerivedType3, TDerivedType4, TResult>(this TBaseType obj, Func<TDerivedType1, TResult> matchFunc1, Func<TDerivedType2, TResult> matchFunc2, Func<TDerivedType3, TResult> matchFunc3, Func<TDerivedType4, TResult> matchFunc4, Func<TBaseType, TResult>? defaultFunc = null)
41public static TResult? TypeSwitch<TBaseType, TDerivedType1, TDerivedType2, TDerivedType3, TDerivedType4, TDerivedType5, TResult>(this TBaseType obj, Func<TDerivedType1, TResult> matchFunc1, Func<TDerivedType2, TResult> matchFunc2, Func<TDerivedType3, TResult> matchFunc3, Func<TDerivedType4, TResult> matchFunc4, Func<TDerivedType5, TResult> matchFunc5, Func<TBaseType, TResult>? defaultFunc = null)
59public static TResult? TypeSwitch<TBaseType, TDerivedType1, TDerivedType2, TDerivedType3, TDerivedType4, TDerivedType5, TDerivedType6, TResult>(this TBaseType obj, Func<TDerivedType1, TResult> matchFunc1, Func<TDerivedType2, TResult> matchFunc2, Func<TDerivedType3, TResult> matchFunc3, Func<TDerivedType4, TResult> matchFunc4, Func<TDerivedType5, TResult> matchFunc5, Func<TDerivedType6, TResult> matchFunc6, Func<TBaseType, TResult>? defaultFunc = null)
79public static TResult? TypeSwitch<TBaseType, TDerivedType1, TDerivedType2, TDerivedType3, TDerivedType4, TDerivedType5, TDerivedType6, TDerivedType7, TDerivedType8, TDerivedType9, TDerivedType10, TDerivedType11, TDerivedType12, TDerivedType13, TDerivedType14, TDerivedType15, TDerivedType16, TResult>(this TBaseType obj, Func<TDerivedType1, TResult> matchFunc1, Func<TDerivedType2, TResult> matchFunc2, Func<TDerivedType3, TResult> matchFunc3, Func<TDerivedType4, TResult> matchFunc4, Func<TDerivedType5, TResult> matchFunc5, Func<TDerivedType6, TResult> matchFunc6, Func<TDerivedType7, TResult> matchFunc7, Func<TDerivedType8, TResult> matchFunc8, Func<TDerivedType9, TResult> matchFunc9, Func<TDerivedType10, TResult> matchFunc10, Func<TDerivedType11, TResult> matchFunc11, Func<TDerivedType12, TResult> matchFunc12, Func<TDerivedType13, TResult> matchFunc13, Func<TDerivedType14, TResult> matchFunc14, Func<TDerivedType15, TResult> matchFunc15, Func<TDerivedType16, TResult> matchFunc16, Func<TBaseType, TResult>? defaultFunc = null)
119public static TResult? TypeSwitch<TBaseType, TDerivedType1, TDerivedType2, TDerivedType3, TDerivedType4, TDerivedType5, TDerivedType6, TDerivedType7, TDerivedType8, TDerivedType9, TDerivedType10, TDerivedType11, TDerivedType12, TDerivedType13, TDerivedType14, TDerivedType15, TDerivedType16, TDerivedType17, TResult>(this TBaseType obj, Func<TDerivedType1, TResult> matchFunc1, Func<TDerivedType2, TResult> matchFunc2, Func<TDerivedType3, TResult> matchFunc3, Func<TDerivedType4, TResult> matchFunc4, Func<TDerivedType5, TResult> matchFunc5, Func<TDerivedType6, TResult> matchFunc6, Func<TDerivedType7, TResult> matchFunc7, Func<TDerivedType8, TResult> matchFunc8, Func<TDerivedType9, TResult> matchFunc9, Func<TDerivedType10, TResult> matchFunc10, Func<TDerivedType11, TResult> matchFunc11, Func<TDerivedType12, TResult> matchFunc12, Func<TDerivedType13, TResult> matchFunc13, Func<TDerivedType14, TResult> matchFunc14, Func<TDerivedType15, TResult> matchFunc15, Func<TDerivedType16, TResult> matchFunc16, Func<TDerivedType17, TResult> matchFunc17, Func<TBaseType, TResult>? defaultFunc = null)
161public static TResult? TypeSwitch<TBaseType, TDerivedType1, TDerivedType2, TDerivedType3, TDerivedType4, TDerivedType5, TDerivedType6, TDerivedType7, TDerivedType8, TDerivedType9, TDerivedType10, TDerivedType11, TDerivedType12, TDerivedType13, TDerivedType14, TDerivedType15, TDerivedType16, TDerivedType17, TDerivedType18, TDerivedType19, TDerivedType20, TDerivedType21, TDerivedType22, TResult>(this TBaseType obj, Func<TDerivedType1, TResult> matchFunc1, Func<TDerivedType2, TResult> matchFunc2, Func<TDerivedType3, TResult> matchFunc3, Func<TDerivedType4, TResult> matchFunc4, Func<TDerivedType5, TResult> matchFunc5, Func<TDerivedType6, TResult> matchFunc6, Func<TDerivedType7, TResult> matchFunc7, Func<TDerivedType8, TResult> matchFunc8, Func<TDerivedType9, TResult> matchFunc9, Func<TDerivedType10, TResult> matchFunc10, Func<TDerivedType11, TResult> matchFunc11, Func<TDerivedType12, TResult> matchFunc12, Func<TDerivedType13, TResult> matchFunc13, Func<TDerivedType14, TResult> matchFunc14, Func<TDerivedType15, TResult> matchFunc15, Func<TDerivedType16, TResult> matchFunc16, Func<TDerivedType17, TResult> matchFunc17, Func<TDerivedType18, TResult> matchFunc18, Func<TDerivedType19, TResult> matchFunc19, Func<TDerivedType20, TResult> matchFunc20, Func<TDerivedType21, TResult> matchFunc21, Func<TDerivedType22, TResult> matchFunc22, Func<TBaseType, TResult>? defaultFunc = null)
213public static TResult? TypeSwitch<TBaseType, TDerivedType1, TDerivedType2, TDerivedType3, TDerivedType4, TDerivedType5, TDerivedType6, TDerivedType7, TDerivedType8, TDerivedType9, TDerivedType10, TDerivedType11, TDerivedType12, TDerivedType13, TDerivedType14, TDerivedType15, TDerivedType16, TDerivedType17, TDerivedType18, TDerivedType19, TDerivedType20, TDerivedType21, TDerivedType22, TDerivedType23, TDerivedType24, TDerivedType25, TDerivedType26, TDerivedType27, TDerivedType28, TDerivedType29, TDerivedType30, TDerivedType31, TDerivedType32, TDerivedType33, TDerivedType34, TDerivedType35, TDerivedType36, TDerivedType37, TDerivedType38, TDerivedType39, TResult>(this TBaseType obj, Func<TDerivedType1, TResult> matchFunc1, Func<TDerivedType2, TResult> matchFunc2, Func<TDerivedType3, TResult> matchFunc3, Func<TDerivedType4, TResult> matchFunc4, Func<TDerivedType5, TResult> matchFunc5, Func<TDerivedType6, TResult> matchFunc6, Func<TDerivedType7, TResult> matchFunc7, Func<TDerivedType8, TResult> matchFunc8, Func<TDerivedType9, TResult> matchFunc9, Func<TDerivedType10, TResult> matchFunc10, Func<TDerivedType11, TResult> matchFunc11, Func<TDerivedType12, TResult> matchFunc12, Func<TDerivedType13, TResult> matchFunc13, Func<TDerivedType14, TResult> matchFunc14, Func<TDerivedType15, TResult> matchFunc15, Func<TDerivedType16, TResult> matchFunc16, Func<TDerivedType17, TResult> matchFunc17, Func<TDerivedType18, TResult> matchFunc18, Func<TDerivedType19, TResult> matchFunc19, Func<TDerivedType20, TResult> matchFunc20, Func<TDerivedType21, TResult> matchFunc21, Func<TDerivedType22, TResult> matchFunc22, Func<TDerivedType23, TResult> matchFunc23, Func<TDerivedType24, TResult> matchFunc24, Func<TDerivedType25, TResult> matchFunc25, Func<TDerivedType26, TResult> matchFunc26, Func<TDerivedType27, TResult> matchFunc27, Func<TDerivedType28, TResult> matchFunc28, Func<TDerivedType29, TResult> matchFunc29, Func<TDerivedType30, TResult> matchFunc30, Func<TDerivedType31, TResult> matchFunc31, Func<TDerivedType32, TResult> matchFunc32, Func<TDerivedType33, TResult> matchFunc33, Func<TDerivedType34, TResult> matchFunc34, Func<TDerivedType35, TResult> matchFunc35, Func<TDerivedType36, TResult> matchFunc36, Func<TDerivedType37, TResult> matchFunc37, Func<TDerivedType38, TResult> matchFunc38, Func<TDerivedType39, TResult> matchFunc39, Func<TBaseType, TResult>? defaultFunc = null)
299public static TResult? TypeSwitch<TBaseType, TDerivedType1, TDerivedType2, TDerivedType3, TDerivedType4, TDerivedType5, TDerivedType6, TDerivedType7, TDerivedType8, TDerivedType9, TDerivedType10, TDerivedType11, TDerivedType12, TDerivedType13, TDerivedType14, TDerivedType15, TDerivedType16, TDerivedType17, TDerivedType18, TDerivedType19, TDerivedType20, TDerivedType21, TDerivedType22, TDerivedType23, TDerivedType24, TDerivedType25, TDerivedType26, TDerivedType27, TDerivedType28, TDerivedType29, TDerivedType30, TDerivedType31, TDerivedType32, TDerivedType33, TDerivedType34, TDerivedType35, TDerivedType36, TDerivedType37, TDerivedType38, TDerivedType39, TDerivedType40, TResult>(this TBaseType obj, Func<TDerivedType1, TResult> matchFunc1, Func<TDerivedType2, TResult> matchFunc2, Func<TDerivedType3, TResult> matchFunc3, Func<TDerivedType4, TResult> matchFunc4, Func<TDerivedType5, TResult> matchFunc5, Func<TDerivedType6, TResult> matchFunc6, Func<TDerivedType7, TResult> matchFunc7, Func<TDerivedType8, TResult> matchFunc8, Func<TDerivedType9, TResult> matchFunc9, Func<TDerivedType10, TResult> matchFunc10, Func<TDerivedType11, TResult> matchFunc11, Func<TDerivedType12, TResult> matchFunc12, Func<TDerivedType13, TResult> matchFunc13, Func<TDerivedType14, TResult> matchFunc14, Func<TDerivedType15, TResult> matchFunc15, Func<TDerivedType16, TResult> matchFunc16, Func<TDerivedType17, TResult> matchFunc17, Func<TDerivedType18, TResult> matchFunc18, Func<TDerivedType19, TResult> matchFunc19, Func<TDerivedType20, TResult> matchFunc20, Func<TDerivedType21, TResult> matchFunc21, Func<TDerivedType22, TResult> matchFunc22, Func<TDerivedType23, TResult> matchFunc23, Func<TDerivedType24, TResult> matchFunc24, Func<TDerivedType25, TResult> matchFunc25, Func<TDerivedType26, TResult> matchFunc26, Func<TDerivedType27, TResult> matchFunc27, Func<TDerivedType28, TResult> matchFunc28, Func<TDerivedType29, TResult> matchFunc29, Func<TDerivedType30, TResult> matchFunc30, Func<TDerivedType31, TResult> matchFunc31, Func<TDerivedType32, TResult> matchFunc32, Func<TDerivedType33, TResult> matchFunc33, Func<TDerivedType34, TResult> matchFunc34, Func<TDerivedType35, TResult> matchFunc35, Func<TDerivedType36, TResult> matchFunc36, Func<TDerivedType37, TResult> matchFunc37, Func<TDerivedType38, TResult> matchFunc38, Func<TDerivedType39, TResult> matchFunc39, Func<TDerivedType40, TResult> matchFunc40, Func<TBaseType, TResult>? defaultFunc = null)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\SyntaxNodeExtensions.cs (6)
104this SyntaxNode node, TextSpan searchSpan, Func<SyntaxNode, bool> predicate)
129public static bool CheckParent<T>([NotNullWhen(returnValue: true)] this SyntaxNode? node, Func<T, bool> valueChecker) where T : SyntaxNode
145public static bool IsChildNode<TParent>(this SyntaxNode node, Func<TParent, SyntaxNode?> childGetter)
162public static bool IsFoundUnder<TParent>(this SyntaxNode node, Func<TParent, SyntaxNode?> childGetter)
201public static SyntaxNode? FindInnermostCommonNode(this IEnumerable<SyntaxNode> nodes, Func<SyntaxNode, bool> predicate)
806public static TNode? FirstAncestorOrSelfUntil<TNode>(this SyntaxNode? node, Func<SyntaxNode, bool> predicate)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\SyntaxTokenExtensions.cs (5)
15public static SyntaxNode? GetAncestor(this SyntaxToken token, Func<SyntaxNode, bool>? predicate)
18public static T? GetAncestor<T>(this SyntaxToken token, Func<T, bool>? predicate = null) where T : SyntaxNode
21public static T GetRequiredAncestor<T>(this SyntaxToken token, Func<T, bool>? predicate = null) where T : SyntaxNode
32public static IEnumerable<SyntaxNode> GetAncestors(this SyntaxToken token, Func<SyntaxNode, bool> predicate)
42public static bool CheckParent<T>(this SyntaxToken token, Func<T, bool> valueChecker) where T : SyntaxNode
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Options\PublicOptionFactory.cs (4)
17public static Option2<T> WithPublicOption<T, TPublicValue>(this Option2<T> option, string feature, string name, Func<T, TPublicValue> toPublicValue, Func<TPublicValue, T> toInternalValue)
20public static PerLanguageOption2<T> WithPublicOption<T, TPublicValue>(this PerLanguageOption2<T> option, string feature, string name, Func<T, TPublicValue> toPublicValue, Func<TPublicValue, T> toInternalValue)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\TopologicalSorter.cs (8)
13public static IEnumerable<T> TopologicalSort<T>(this IEnumerable<T> items, Func<T, IEnumerable<T>> itemsBefore)
26public static IEnumerable<T> TopologicalSort<T>(this IEnumerable<T> items, Func<T, IEnumerable<T>> itemsBefore, Func<T, IEnumerable<T>> itemsAfter)
29var combinedItemsBefore = CreateCombinedItemsBefore(items, itemsBefore, itemsAfter);
35Func<T, IEnumerable<T>> itemsBefore,
50private static Func<T, IEnumerable<T>> CreateCombinedItemsBefore<T>(IEnumerable<T> items, Func<T, IEnumerable<T>> itemsBefore, Func<T, IEnumerable<T>> itemsAfter)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Extensions\SyntaxEditorExtensions.cs (4)
29Func<TType, (TNode semanticNode, IEnumerable<TNode> additionalNodes)> selector,
52Func<TType, TNode> selector,
96Func<TType, (TNode semanticNode, IEnumerable<TNode> additionalNodes)> selector,
153Func<TType, (TNode semanticNode, IEnumerable<TNode> additionalNodes)> selector,
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Simplification\AbstractSimplificationService.cs (6)
35protected static readonly Func<SyntaxNode, bool> s_containsAnnotations = n => n.ContainsAnnotations;
36protected static readonly Func<SyntaxNodeOrToken, bool> s_hasSimplifierAnnotation = n => n.HasAnnotation(Simplifier.Annotation);
40protected abstract ImmutableArray<NodeOrTokenToReduce> GetNodesAndTokensToReduce(SyntaxNode root, Func<SyntaxNodeOrToken, bool> isNodeOrTokenOutsideSimplifySpans);
51public abstract SyntaxNode Expand(SyntaxNode node, SemanticModel semanticModel, SyntaxAnnotation? annotationForReplacedAliasIdentifier, Func<SyntaxNode, bool>? expandInsideNode, bool expandParameter, CancellationToken cancellationToken);
52public abstract SyntaxToken Expand(SyntaxToken token, SemanticModel semanticModel, Func<SyntaxNode, bool>? expandInsideNode, CancellationToken cancellationToken);
275Func<SyntaxNodeOrToken, bool> isNodeOrTokenOutsideSimplifySpan)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Utilities\NameGenerator.cs (6)
43Func<string, bool>? canUse = null,
63Func<string, bool>? canUse = null,
86Func<string, bool>? canUse = null,
134public static string GenerateUniqueName(string baseName, Func<string, bool> canUse)
140public static string GenerateUniqueName(string baseName, string extension, Func<string, bool> canUse)
160public static string GenerateUniqueName(IEnumerable<string> baseNames, Func<string, bool> canUse)
Roslyn.Diagnostics.CSharp.Analyzers (17)
Roslyn.Test.PdbUtilities (16)
EditAndContinue\EditAndContinueTest.cs (6)
34protected abstract Func<SyntaxNode, SyntaxNode> GetEquivalentNodesMap(ISymbol left, ISymbol right);
38internal TSelf AddBaseline(string source, Action<GenerationVerifier>? validator = null, Func<MethodDefinitionHandle, EditAndContinueMethodDebugInformation>? debugInformationProvider = null)
76internal TSelf AddGeneration(string source, Func<SourceWithMarkedNodes, SemanticEditDescription[]> edits, Action<GenerationVerifier> validator, EmitDifferenceOptions? options = null)
82private TSelf AddGeneration(string source, Func<SourceWithMarkedNodes, SemanticEditDescription[]> edits, Action<GenerationVerifier> validator, DiagnosticDescription[] expectedErrors, EmitDifferenceOptions? options = null)
180var syntaxMapFromMarkers = oldSource.MarkedSpans.IsEmpty ? null : SourceWithMarkedNodes.GetSyntaxMap(oldSource, newSource, unmappedNodes);
189Func<SyntaxNode, SyntaxNode?>? syntaxMap;
Roslyn.VisualStudio.DiagnosticsWindow (3)
Roslyn.VisualStudio.Next.UnitTests (4)
RunTests (1)
SemanticSearch.BuildTask (2)
Shared (8)
Shared.Tests (4)
Sockets.BindTests (4)
Sockets.FunctionalTests (3)
System.Collections.Immutable (47)
System\Collections\Immutable\ImmutableDictionary.cs (8)
182public static ImmutableDictionary<TKey, TValue> ToImmutableDictionary<TSource, TKey, TValue>(this IEnumerable<TSource> source, Func<TSource, TKey> keySelector, Func<TSource, TValue> elementSelector, IEqualityComparer<TKey>? keyComparer, IEqualityComparer<TValue>? valueComparer) where TKey : notnull
215public static ImmutableDictionary<TKey, TValue> ToImmutableDictionary<TSource, TKey, TValue>(this IEnumerable<TSource> source, Func<TSource, TKey> keySelector, Func<TSource, TValue> elementSelector, IEqualityComparer<TKey>? keyComparer) where TKey : notnull
228public static ImmutableDictionary<TKey, TSource> ToImmutableDictionary<TSource, TKey>(this IEnumerable<TSource> source, Func<TSource, TKey> keySelector) where TKey : notnull
242public static ImmutableDictionary<TKey, TSource> ToImmutableDictionary<TSource, TKey>(this IEnumerable<TSource> source, Func<TSource, TKey> keySelector, IEqualityComparer<TKey>? keyComparer) where TKey : notnull
257public static ImmutableDictionary<TKey, TValue> ToImmutableDictionary<TSource, TKey, TValue>(this IEnumerable<TSource> source, Func<TSource, TKey> keySelector, Func<TSource, TValue> elementSelector) where TKey : notnull
System\Collections\Immutable\ImmutableInterlocked.cs (4)
34public static bool Update<T>(ref T location, Func<T, T> transformer) where T : class?
123public static bool Update<T>(ref ImmutableArray<T> location, Func<ImmutableArray<T>, ImmutableArray<T>> transformer)
283public static TValue GetOrAdd<TKey, TValue>(ref ImmutableDictionary<TKey, TValue> location, TKey key, Func<TKey, TValue> valueFactory) where TKey : notnull
344public static TValue AddOrUpdate<TKey, TValue>(ref ImmutableDictionary<TKey, TValue> location, TKey key, Func<TKey, TValue> addValueFactory, Func<TKey, TValue, TValue> updateValueFactory) where TKey : notnull
System\Collections\Immutable\ImmutableSortedDictionary.cs (6)
138public static ImmutableSortedDictionary<TKey, TValue> ToImmutableSortedDictionary<TSource, TKey, TValue>(this IEnumerable<TSource> source, Func<TSource, TKey> keySelector, Func<TSource, TValue> elementSelector, IComparer<TKey>? keyComparer, IEqualityComparer<TValue>? valueComparer) where TKey : notnull
171public static ImmutableSortedDictionary<TKey, TValue> ToImmutableSortedDictionary<TSource, TKey, TValue>(this IEnumerable<TSource> source, Func<TSource, TKey> keySelector, Func<TSource, TValue> elementSelector, IComparer<TKey>? keyComparer) where TKey : notnull
186public static ImmutableSortedDictionary<TKey, TValue> ToImmutableSortedDictionary<TSource, TKey, TValue>(this IEnumerable<TSource> source, Func<TSource, TKey> keySelector, Func<TSource, TValue> elementSelector) where TKey : notnull
System\Linq\ImmutableArrayExtensions.cs (19)
24public static IEnumerable<TResult> Select<T, TResult>(this ImmutableArray<T> immutableArray, Func<T, TResult> selector)
53Func<TSource, IEnumerable<TCollection>> collectionSelector,
82public static IEnumerable<T> Where<T>(this ImmutableArray<T> immutableArray, Func<T, bool> predicate)
109public static bool Any<T>(this ImmutableArray<T> immutableArray, Func<T, bool> predicate)
135public static bool All<T>(this ImmutableArray<T> immutableArray, Func<T, bool> predicate)
296public static TResult Aggregate<TAccumulate, TResult, T>(this ImmutableArray<T> immutableArray, TAccumulate seed, Func<TAccumulate, T, TAccumulate> func, Func<TAccumulate, TResult> resultSelector)
330public static T First<T>(this ImmutableArray<T> immutableArray, Func<T, bool> predicate)
375public static T? FirstOrDefault<T>(this ImmutableArray<T> immutableArray, Func<T, bool> predicate)
408public static T Last<T>(this ImmutableArray<T> immutableArray, Func<T, bool> predicate)
439public static T? LastOrDefault<T>(this ImmutableArray<T> immutableArray, Func<T, bool> predicate)
471public static T Single<T>(this ImmutableArray<T> immutableArray, Func<T, bool> predicate)
514public static T? SingleOrDefault<T>(this ImmutableArray<T> immutableArray, Func<T, bool> predicate)
545public static Dictionary<TKey, T> ToDictionary<TKey, T>(this ImmutableArray<T> immutableArray, Func<T, TKey> keySelector) where TKey : notnull
560public static Dictionary<TKey, TElement> ToDictionary<TKey, TElement, T>(this ImmutableArray<T> immutableArray, Func<T, TKey> keySelector, Func<T, TElement> elementSelector) where TKey : notnull
574public static Dictionary<TKey, T> ToDictionary<TKey, T>(this ImmutableArray<T> immutableArray, Func<T, TKey> keySelector, IEqualityComparer<TKey>? comparer) where TKey : notnull
598public static Dictionary<TKey, TElement> ToDictionary<TKey, TElement, T>(this ImmutableArray<T> immutableArray, Func<T, TKey> keySelector, Func<T, TElement> elementSelector, IEqualityComparer<TKey>? comparer) where TKey : notnull
700Func<TSource, IEnumerable<TCollection>> collectionSelector,
System.ComponentModel.Annotations (6)
System.ComponentModel.Composition (47)
System\ComponentModel\Composition\ConstraintServices.cs (7)
23public static Expression<Func<ExportDefinition, bool>> CreateConstraint(string contractName, string? requiredTypeIdentity, IEnumerable<KeyValuePair<string, Type>> requiredMetadata, CreationPolicy requiredCreationPolicy)
52Expression<Func<ExportDefinition, bool>> constraint = Expression.Lambda<Func<ExportDefinition, bool>>(constraintBody, parameter);
186public static Expression<Func<ExportDefinition, bool>> CreatePartCreatorConstraint(Expression<Func<ExportDefinition, bool>> baseConstraint, ImportDefinition productImportDefinition)
213Expression<Func<ExportDefinition, bool>> constraint =
214Expression.Lambda<Func<ExportDefinition, bool>>(
System\ComponentModel\Composition\ExportServices.cs (6)
47internal static Func<Export, object> CreateStronglyTypedLazyFactory(Type? exportType, Type? metadataViewType)
61return (Func<Export, object>)Delegate.CreateDelegate(typeof(Func<Export, object>), genericMethod);
64internal static Func<Export, Lazy<object, object>> CreateSemiStronglyTypedLazyFactory(Type? exportType, Type? metadataViewType)
70return (Func<Export, Lazy<object, object>>)Delegate.CreateDelegate(typeof(Func<Export, Lazy<object, object>>), genericMethod);
System\ComponentModel\Composition\Primitives\ImportDefinition.cs (7)
19private readonly Expression<Func<ExportDefinition, bool>>? _constraint;
24private Func<ExportDefinition, bool>? _compiledConstraint;
49/// A <see cref="Expression{TDelegate}"/> containing a <see cref="Func{T, TResult}"/>
81public ImportDefinition(Expression<Func<ExportDefinition, bool>> constraint, string? contractName, ImportCardinality cardinality, bool isRecomposable, bool isPrerequisite)
89public ImportDefinition(Expression<Func<ExportDefinition, bool>> constraint, string? contractName, ImportCardinality cardinality, bool isRecomposable, bool isPrerequisite, IDictionary<string, object?>? metadata)
188/// A <see cref="Expression{TDelegate}"/> containing a <see cref="Func{T, TResult}"/>
200public virtual Expression<Func<ExportDefinition, bool>> Constraint
System\ComponentModel\Composition\ReflectionModel\ImportType.cs (6)
21private Func<Export, object>? _castSingleValue;
25internal static Dictionary<Type, Func<Export, object>?>? _castSingleValueCache;
27private static Dictionary<Type, Func<Export, object>?> CastSingleValueCache
31return _castSingleValueCache ??= new Dictionary<Type, Func<Export, object>?>();
69public Func<Export, object>? CastExport
163private static bool TryGetCastFunction(Type genericType, bool isOpenGeneric, Type[] arguments, out Func<Export, object>? castFunction)
System.ComponentModel.Composition.Registration (29)
System\ComponentModel\Composition\Registration\PartBuilder.cs (7)
21private List<Tuple<string, Func<Type, object>>> _metadataItemFuncs;
24private Func<ConstructorInfo[], ConstructorInfo> _constructorFilter;
74public PartBuilder SelectConstructor(Func<ConstructorInfo[], ConstructorInfo> constructorFilter)
79public PartBuilder SelectConstructor(Func<ConstructorInfo[], ConstructorInfo> constructorFilter,
194public PartBuilder AddMetadata(string name, Func<Type, object> itemFunc)
196_metadataItemFuncs ??= new List<Tuple<string, Func<Type, object>>>();
286foreach (Tuple<string, Func<Type, object>> item in _metadataItemFuncs)
System\ComponentModel\Composition\Registration\PartBuilderOfT.cs (18)
18public PropertyExpressionAdapter(Expression<Func<T, object>> propertyFilter,
42private static PropertyInfo SelectProperties(Expression<Func<T, object>> propertyFilter)
60private static Expression<Func<T, object>> Reduce(Expression<Func<T, object>> expr)
64expr = (Expression<Func<T, object>>)expr.Reduce();
75public ConstructorExpressionAdapter(Expression<Func<ParameterImportBuilder, T>> selectConstructor)
94private void ParseSelectConstructor(Expression<Func<ParameterImportBuilder, T>> constructorFilter)
133private static Expression<Func<ParameterImportBuilder, T>> Reduce(Expression<Func<ParameterImportBuilder, T>> expr)
148public PartBuilder<T> SelectConstructor(Expression<Func<ParameterImportBuilder, T>> constructorFilter)
159public PartBuilder<T> ExportProperty(Expression<Func<T, object>> propertyFilter)
165Expression<Func<T, object>> propertyFilter,
176public PartBuilder<T> ExportProperty<TContract>(Expression<Func<T, object>> propertyFilter)
181public PartBuilder<T> ExportProperty<TContract>(Expression<Func<T, object>> propertyFilter,
192public PartBuilder<T> ImportProperty(Expression<Func<T, object>> propertyFilter)
197public PartBuilder<T> ImportProperty(Expression<Func<T, object>> propertyFilter,
208public PartBuilder<T> ImportProperty<TContract>(Expression<Func<T, object>> propertyFilter)
213public PartBuilder<T> ImportProperty<TContract>(Expression<Func<T, object>> propertyFilter,
System.ComponentModel.TypeConverter (2)
System.Composition.Convention (40)
System\Composition\Convention\ExportConventionBuilder.cs (6)
21private List<Tuple<string, Func<Type, object>>> _metadataItemFuncs;
22private Func<Type, string> _getContractNameFromPartType;
71public ExportConventionBuilder AsContractName(Func<Type, string> getContractNameFromPartType)
105public ExportConventionBuilder AddMetadata(string name, Func<Type, object> getValueFromPartType)
115_metadataItemFuncs ??= new List<Tuple<string, Func<Type, object>>>();
139foreach (Tuple<string, Func<Type, object>> item in _metadataItemFuncs)
System\Composition\Convention\ImportConventionBuilder.cs (6)
20private Func<Type, string> _getContractNameFromPartType;
22private List<Tuple<string, Func<Type, object>>> _metadataConstraintItemFuncs;
48public ImportConventionBuilder AsContractName(Func<Type, string> getContractNameFromPartType)
113public ImportConventionBuilder AddMetadataConstraint(string name, Func<Type, object> getConstraintValueFromPartType)
123_metadataConstraintItemFuncs ??= new List<Tuple<string, Func<Type, object>>>();
163foreach (Tuple<string, Func<Type, object>> item in _metadataConstraintItemFuncs)
System\Composition\Convention\PartConventionBuilder.cs (7)
26private List<Tuple<string, Func<Type, object>>> _metadataItemFuncs;
29private Func<IEnumerable<ConstructorInfo>, ConstructorInfo> _constructorFilter;
107public PartConventionBuilder SelectConstructor(Func<IEnumerable<ConstructorInfo>, ConstructorInfo> constructorSelector)
121public PartConventionBuilder SelectConstructor(Func<IEnumerable<ConstructorInfo>, ConstructorInfo> constructorSelector,
384public PartConventionBuilder AddPartMetadata(string name, Func<Type, object> getValueFromPartType)
394_metadataItemFuncs ??= new List<Tuple<string, Func<Type, object>>>();
484foreach (Tuple<string, Func<Type, object>> item in _metadataItemFuncs)
System\Composition\Convention\PartConventionBuilderOfT.cs (21)
48private static Expression<Func<T, object>> Reduce(Expression<Func<T, object>> expr)
52expr = (Expression<Func<T, object>>)expr.Reduce();
74Expression<Func<T, object>> propertySelector,
98private static PropertyInfo SelectProperties(Expression<Func<T, object>> propertySelector)
116private static Expression<Func<T, object>> Reduce(Expression<Func<T, object>> expr)
120expr = (Expression<Func<T, object>>)expr.Reduce();
131public ConstructorExpressionAdapter(Expression<Func<ParameterImportConventionBuilder, T>> selectConstructor)
154private void ParseSelectConstructor(Expression<Func<ParameterImportConventionBuilder, T>> constructorSelector)
190private static Expression<Func<ParameterImportConventionBuilder, T>> Reduce(Expression<Func<ParameterImportConventionBuilder, T>> expr)
209public PartConventionBuilder<T> SelectConstructor(Expression<Func<ParameterImportConventionBuilder, T>> constructorSelector)
223public PartConventionBuilder<T> ExportProperty(Expression<Func<T, object>> propertySelector)
235Expression<Func<T, object>> propertySelector,
252public PartConventionBuilder<T> ExportProperty<TContract>(Expression<Func<T, object>> propertySelector)
265Expression<Func<T, object>> propertySelector,
280public PartConventionBuilder<T> ImportProperty(Expression<Func<T, object>> propertySelector)
292Expression<Func<T, object>> propertySelector,
308public PartConventionBuilder<T> ImportProperty<TContract>(Expression<Func<T, object>> propertySelector)
321Expression<Func<T, object>> propertySelector,
System.Composition.Hosting (6)
System.Configuration.ConfigurationManager (6)
System.Core (1)
System.Data.Common (42)
System\Data\EnumerableRowCollection.cs (13)
38private readonly List<Func<TRow, bool>> _listOfPredicates;
43private readonly Func<TRow, TRow>? _selector;
83_listOfPredicates = new List<Func<TRow, bool>>();
94_listOfPredicates = new List<Func<TRow, bool>>();
102internal EnumerableRowCollection(EnumerableRowCollection<TRow>? source, IEnumerable<TRow> enumerableRows, Func<TRow, TRow>? selector)
114_listOfPredicates = new List<Func<TRow, bool>>(source._listOfPredicates);
120_listOfPredicates = new List<Func<TRow, bool>>();
156Func<DataRow, bool>? finalPredicate = null; // Conjunction of all .Where(..) predicates
170foreach (Func<TRow, bool> pred in _listOfPredicates)
197foreach (Func<TRow, bool> pred in _listOfPredicates)
278internal void AddPredicate(Func<TRow, bool> pred)
287internal void AddSortExpression<TKey>(Func<TRow, TKey> keySelector, bool isDescending, bool isOrderBy)
295internal void AddSortExpression<TKey>(Func<TRow, TKey> keySelector, IComparer<TKey> comparer, bool isDescending, bool isOrderBy)
System\Data\EnumerableRowCollectionExtensions.cs (11)
19public static EnumerableRowCollection<TRow> Where<TRow>(this EnumerableRowCollection<TRow> source, Func<TRow, bool> predicate)
30public static OrderedEnumerableRowCollection<TRow> OrderBy<TRow, TKey>(this EnumerableRowCollection<TRow> source, Func<TRow, TKey> keySelector)
42public static OrderedEnumerableRowCollection<TRow> OrderBy<TRow, TKey>(this EnumerableRowCollection<TRow> source, Func<TRow, TKey> keySelector, IComparer<TKey> comparer)
53public static OrderedEnumerableRowCollection<TRow> OrderByDescending<TRow, TKey>(this EnumerableRowCollection<TRow> source, Func<TRow, TKey> keySelector)
65public static OrderedEnumerableRowCollection<TRow> OrderByDescending<TRow, TKey>(this EnumerableRowCollection<TRow> source, Func<TRow, TKey> keySelector, IComparer<TKey> comparer)
77public static OrderedEnumerableRowCollection<TRow> ThenBy<TRow, TKey>(this OrderedEnumerableRowCollection<TRow> source, Func<TRow, TKey> keySelector)
89public static OrderedEnumerableRowCollection<TRow> ThenBy<TRow, TKey>(this OrderedEnumerableRowCollection<TRow> source, Func<TRow, TKey> keySelector, IComparer<TKey> comparer)
101public static OrderedEnumerableRowCollection<TRow> ThenByDescending<TRow, TKey>(this OrderedEnumerableRowCollection<TRow> source, Func<TRow, TKey> keySelector)
113public static OrderedEnumerableRowCollection<TRow> ThenByDescending<TRow, TKey>(this OrderedEnumerableRowCollection<TRow> source, Func<TRow, TKey> keySelector, IComparer<TKey> comparer)
127public static EnumerableRowCollection<S> Select<TRow, S>(this EnumerableRowCollection<TRow> source, Func<TRow, S> selector)
134return new EnumerableRowCollection<S>(((object)source) as EnumerableRowCollection<S>, typedEnumerable, ((object)selector) as Func<S, S>);
System\Data\TypedTableBaseExtensions.cs (6)
18public static EnumerableRowCollection<TRow> Where<TRow>(this TypedTableBase<TRow> source, Func<TRow, bool> predicate) where TRow : DataRow
28public static OrderedEnumerableRowCollection<TRow> OrderBy<TRow, TKey>(this TypedTableBase<TRow> source, Func<TRow, TKey> keySelector) where TRow : DataRow
40Func<TRow, TKey> keySelector,
51public static OrderedEnumerableRowCollection<TRow> OrderByDescending<TRow, TKey>(this TypedTableBase<TRow> source, Func<TRow, TKey> keySelector) where TRow : DataRow
63Func<TRow, TKey> keySelector,
77public static EnumerableRowCollection<S> Select<TRow, S>(this TypedTableBase<TRow> source, Func<TRow, S> selector) where TRow : DataRow
System.Data.Odbc (1)
System.Diagnostics.DiagnosticSource (7)
System.Formats.Asn1 (1)
System.Linq (371)
System\Linq\AggregateBy.cs (11)
24/// This method is comparable to the <see cref="GroupBy{TSource, TKey}(IEnumerable{TSource}, Func{TSource, TKey})"/> methods
29Func<TSource, TKey> keySelector,
68/// This method is comparable to the <see cref="GroupBy{TSource, TKey}(IEnumerable{TSource}, Func{TSource, TKey})"/> methods
73Func<TSource, TKey> keySelector,
74Func<TKey, TAccumulate> seedSelector,
103private static IEnumerable<KeyValuePair<TKey, TAccumulate>> AggregateByIterator<TSource, TKey, TAccumulate>(IEnumerable<TSource> source, Func<TSource, TKey> keySelector, TAccumulate seed, Func<TAccumulate, TSource, TAccumulate> func, IEqualityComparer<TKey>? keyComparer) where TKey : notnull
117static Dictionary<TKey, TAccumulate> PopulateDictionary(IEnumerator<TSource> enumerator, Func<TSource, TKey> keySelector, TAccumulate seed, Func<TAccumulate, TSource, TAccumulate> func, IEqualityComparer<TKey>? keyComparer)
135private static IEnumerable<KeyValuePair<TKey, TAccumulate>> AggregateByIterator<TSource, TKey, TAccumulate>(IEnumerable<TSource> source, Func<TSource, TKey> keySelector, Func<TKey, TAccumulate> seedSelector, Func<TAccumulate, TSource, TAccumulate> func, IEqualityComparer<TKey>? keyComparer) where TKey : notnull
149static Dictionary<TKey, TAccumulate> PopulateDictionary(IEnumerator<TSource> enumerator, Func<TSource, TKey> keySelector, Func<TKey, TAccumulate> seedSelector, Func<TAccumulate, TSource, TAccumulate> func, IEqualityComparer<TKey>? keyComparer)
System\Linq\Average.cs (12)
169public static double Average<TSource>(this IEnumerable<TSource> source, Func<TSource, int> selector) => Average<TSource, int, long, double>(source, selector);
171public static double Average<TSource>(this IEnumerable<TSource> source, Func<TSource, long> selector) => Average<TSource, long, long, double>(source, selector);
173public static float Average<TSource>(this IEnumerable<TSource> source, Func<TSource, float> selector) => (float)Average<TSource, float, double, double>(source, selector);
175public static double Average<TSource>(this IEnumerable<TSource> source, Func<TSource, double> selector) => Average<TSource, double, double, double>(source, selector);
177public static decimal Average<TSource>(this IEnumerable<TSource> source, Func<TSource, decimal> selector) => Average<TSource, decimal, decimal, decimal>(source, selector);
179private static TResult Average<TSource, TSelector, TAccumulator, TResult>(this IEnumerable<TSource> source, Func<TSource, TSelector> selector)
213public static double? Average<TSource>(this IEnumerable<TSource> source, Func<TSource, int?> selector) => Average<TSource, int, long, double>(source, selector);
215public static double? Average<TSource>(this IEnumerable<TSource> source, Func<TSource, long?> selector) => Average<TSource, long, long, double>(source, selector);
217public static float? Average<TSource>(this IEnumerable<TSource> source, Func<TSource, float?> selector) => Average<TSource, float, double, double>(source, selector) is double result ? (float)result : null;
219public static double? Average<TSource>(this IEnumerable<TSource> source, Func<TSource, double?> selector) => Average<TSource, double, double, double>(source, selector);
221public static decimal? Average<TSource>(this IEnumerable<TSource> source, Func<TSource, decimal?> selector) => Average<TSource, decimal, decimal, decimal>(source, selector);
223private static TResult? Average<TSource, TSelector, TAccumulator, TResult>(this IEnumerable<TSource> source, Func<TSource, TSelector?> selector)
System\Linq\CountBy.cs (3)
20public static IEnumerable<KeyValuePair<TKey, int>> CountBy<TSource, TKey>(this IEnumerable<TSource> source, Func<TSource, TKey> keySelector, IEqualityComparer<TKey>? keyComparer = null) where TKey : notnull
39private static IEnumerable<KeyValuePair<TKey, int>> CountByIterator<TSource, TKey>(IEnumerable<TSource> source, Func<TSource, TKey> keySelector, IEqualityComparer<TKey>? keyComparer) where TKey : notnull
54private static Dictionary<TKey, int> BuildCountDictionary<TSource, TKey>(IEnumerator<TSource> enumerator, Func<TSource, TKey> keySelector, IEqualityComparer<TKey>? keyComparer) where TKey : notnull
System\Linq\Distinct.cs (5)
37/// <para>The <see cref="DistinctBy{TSource, TKey}(IEnumerable{TSource}, Func{TSource, TKey})" /> method returns an unordered sequence that contains no duplicate values. The default equality comparer, <see cref="EqualityComparer{T}.Default" />, is used to compare values.</para>
39public static IEnumerable<TSource> DistinctBy<TSource, TKey>(this IEnumerable<TSource> source, Func<TSource, TKey> keySelector) => DistinctBy(source, keySelector, null);
51/// <para>The <see cref="DistinctBy{TSource, TKey}(IEnumerable{TSource}, Func{TSource, TKey}, IEqualityComparer{TKey}?)" /> method returns an unordered sequence that contains no duplicate values. If <paramref name="comparer" /> is <see langword="null" />, the default equality comparer, <see cref="EqualityComparer{T}.Default" />, is used to compare values.</para>
53public static IEnumerable<TSource> DistinctBy<TSource, TKey>(this IEnumerable<TSource> source, Func<TSource, TKey> keySelector, IEqualityComparer<TKey>? comparer)
72private static IEnumerable<TSource> DistinctByIterator<TSource, TKey>(IEnumerable<TSource> source, Func<TSource, TKey> keySelector, IEqualityComparer<TKey>? comparer)
System\Linq\Except.cs (3)
49public static IEnumerable<TSource> ExceptBy<TSource, TKey>(this IEnumerable<TSource> first, IEnumerable<TKey> second, Func<TSource, TKey> keySelector) => ExceptBy(first, second, keySelector, null);
61public static IEnumerable<TSource> ExceptBy<TSource, TKey>(this IEnumerable<TSource> first, IEnumerable<TKey> second, Func<TSource, TKey> keySelector, IEqualityComparer<TKey>? comparer)
92private static IEnumerable<TSource> ExceptByIterator<TSource, TKey>(IEnumerable<TSource> first, IEnumerable<TKey> second, Func<TSource, TKey> keySelector, IEqualityComparer<TKey>? comparer)
System\Linq\First.cs (4)
22public static TSource First<TSource>(this IEnumerable<TSource> source, Func<TSource, bool> predicate)
48public static TSource? FirstOrDefault<TSource>(this IEnumerable<TSource> source, Func<TSource, bool> predicate) =>
58public static TSource FirstOrDefault<TSource>(this IEnumerable<TSource> source, Func<TSource, bool> predicate, TSource defaultValue)
101private static TSource? TryGetFirst<TSource>(this IEnumerable<TSource> source, Func<TSource, bool> predicate, out bool found)
System\Linq\Grouping.cs (24)
12public static IEnumerable<IGrouping<TKey, TSource>> GroupBy<TSource, TKey>(this IEnumerable<TSource> source, Func<TSource, TKey> keySelector) =>
15public static IEnumerable<IGrouping<TKey, TSource>> GroupBy<TSource, TKey>(this IEnumerable<TSource> source, Func<TSource, TKey> keySelector, IEqualityComparer<TKey>? comparer)
35public static IEnumerable<IGrouping<TKey, TElement>> GroupBy<TSource, TKey, TElement>(this IEnumerable<TSource> source, Func<TSource, TKey> keySelector, Func<TSource, TElement> elementSelector) =>
38public static IEnumerable<IGrouping<TKey, TElement>> GroupBy<TSource, TKey, TElement>(this IEnumerable<TSource> source, Func<TSource, TKey> keySelector, Func<TSource, TElement> elementSelector, IEqualityComparer<TKey>? comparer)
63public static IEnumerable<TResult> GroupBy<TSource, TKey, TResult>(this IEnumerable<TSource> source, Func<TSource, TKey> keySelector, Func<TKey, IEnumerable<TSource>, TResult> resultSelector) =>
66public static IEnumerable<TResult> GroupBy<TSource, TKey, TResult>(this IEnumerable<TSource> source, Func<TSource, TKey> keySelector, Func<TKey, IEnumerable<TSource>, TResult> resultSelector, IEqualityComparer<TKey>? comparer)
91public static IEnumerable<TResult> GroupBy<TSource, TKey, TElement, TResult>(this IEnumerable<TSource> source, Func<TSource, TKey> keySelector, Func<TSource, TElement> elementSelector, Func<TKey, IEnumerable<TElement>, TResult> resultSelector) =>
94public static IEnumerable<TResult> GroupBy<TSource, TKey, TElement, TResult>(this IEnumerable<TSource> source, Func<TSource, TKey> keySelector, Func<TSource, TElement> elementSelector, Func<TKey, IEnumerable<TElement>, TResult> resultSelector, IEqualityComparer<TKey>? comparer)
127private readonly Func<TSource, TKey> _keySelector;
128private readonly Func<TSource, TElement> _elementSelector;
135public GroupByResultIterator(IEnumerable<TSource> source, Func<TSource, TKey> keySelector, Func<TSource, TElement> elementSelector, Func<TKey, IEnumerable<TElement>, TResult> resultSelector, IEqualityComparer<TKey>? comparer)
185private readonly Func<TSource, TKey> _keySelector;
192public GroupByResultIterator(IEnumerable<TSource> source, Func<TSource, TKey> keySelector, Func<TKey, IEnumerable<TSource>, TResult> resultSelector, IEqualityComparer<TKey>? comparer)
241private readonly Func<TSource, TKey> _keySelector;
242private readonly Func<TSource, TElement> _elementSelector;
248public GroupByIterator(IEnumerable<TSource> source, Func<TSource, TKey> keySelector, Func<TSource, TElement> elementSelector, IEqualityComparer<TKey>? comparer)
296private readonly Func<TSource, TKey> _keySelector;
302public GroupByIterator(IEnumerable<TSource> source, Func<TSource, TKey> keySelector, IEqualityComparer<TKey>? comparer)
System\Linq\GroupJoin.cs (6)
10public static IEnumerable<TResult> GroupJoin<TOuter, TInner, TKey, TResult>(this IEnumerable<TOuter> outer, IEnumerable<TInner> inner, Func<TOuter, TKey> outerKeySelector, Func<TInner, TKey> innerKeySelector, Func<TOuter, IEnumerable<TInner>, TResult> resultSelector) =>
13public static IEnumerable<TResult> GroupJoin<TOuter, TInner, TKey, TResult>(this IEnumerable<TOuter> outer, IEnumerable<TInner> inner, Func<TOuter, TKey> outerKeySelector, Func<TInner, TKey> innerKeySelector, Func<TOuter, IEnumerable<TInner>, TResult> resultSelector, IEqualityComparer<TKey>? comparer)
48private static IEnumerable<TResult> GroupJoinIterator<TOuter, TInner, TKey, TResult>(IEnumerable<TOuter> outer, IEnumerable<TInner> inner, Func<TOuter, TKey> outerKeySelector, Func<TInner, TKey> innerKeySelector, Func<TOuter, IEnumerable<TInner>, TResult> resultSelector, IEqualityComparer<TKey>? comparer)
System\Linq\Intersect.cs (3)
41public static IEnumerable<TSource> IntersectBy<TSource, TKey>(this IEnumerable<TSource> first, IEnumerable<TKey> second, Func<TSource, TKey> keySelector) => IntersectBy(first, second, keySelector, null);
58public static IEnumerable<TSource> IntersectBy<TSource, TKey>(this IEnumerable<TSource> first, IEnumerable<TKey> second, Func<TSource, TKey> keySelector, IEqualityComparer<TKey>? comparer)
89private static IEnumerable<TSource> IntersectByIterator<TSource, TKey>(IEnumerable<TSource> first, IEnumerable<TKey> second, Func<TSource, TKey> keySelector, IEqualityComparer<TKey>? comparer)
System\Linq\Join.cs (26)
26/// The following code example demonstrates how to use <see cref="Join{TOuter, TInner, TKey, TResult}(IEnumerable{TOuter}, IEnumerable{TInner}, Func{TOuter, TKey}, Func{TInner, TKey}, Func{TOuter, TInner, TResult})" /> to perform an inner join of two sequences based on a common key.
96/// <see cref="Join{TOuter, TInner, TKey, TResult}(IEnumerable{TOuter}, IEnumerable{TInner}, Func{TOuter, TKey}, Func{TInner, TKey}, Func{TOuter, TInner, TResult})" />
100/// In relational database terms, the <see cref="Join{TOuter, TInner, TKey, TResult}(IEnumerable{TOuter}, IEnumerable{TInner}, Func{TOuter, TKey}, Func{TInner, TKey}, Func{TOuter, TInner, TResult})" /> method implements an inner equijoin.
104/// <see cref="LeftJoin{TOuter, TInner, TKey, TResult}(IEnumerable{TOuter}, IEnumerable{TInner}, Func{TOuter, TKey}, Func{TInner, TKey}, Func{TOuter, TInner, TResult})" /> method,
106/// <see cref="RightJoin{TOuter, TInner, TKey, TResult}(IEnumerable{TOuter}, IEnumerable{TInner}, Func{TOuter, TKey}, Func{TInner, TKey}, Func{TOuter, TInner, TResult})" /> method,
110public static IEnumerable<TResult> Join<TOuter, TInner, TKey, TResult>(this IEnumerable<TOuter> outer, IEnumerable<TInner> inner, Func<TOuter, TKey> outerKeySelector, Func<TInner, TKey> innerKeySelector, Func<TOuter, TInner, TResult> resultSelector) =>
130/// The following code example demonstrates how to use <see cref="Join{TOuter, TInner, TKey, TResult}(IEnumerable{TOuter}, IEnumerable{TInner}, Func{TOuter, TKey}, Func{TInner, TKey}, Func{TOuter, TInner, TResult}, IEqualityComparer{TKey})" /> to perform an inner join of two sequences based on a common key.
200/// <see cref="Join{TOuter, TInner, TKey, TResult}(IEnumerable{TOuter}, IEnumerable{TInner}, Func{TOuter, TKey}, Func{TInner, TKey}, Func{TOuter, TInner, TResult}, IEqualityComparer{TKey})" />
204/// In relational database terms, the <see cref="Join{TOuter, TInner, TKey, TResult}(IEnumerable{TOuter}, IEnumerable{TInner}, Func{TOuter, TKey}, Func{TInner, TKey}, Func{TOuter, TInner, TResult}, IEqualityComparer{TKey})" /> method implements an inner equijoin.
208/// <see cref="LeftJoin{TOuter, TInner, TKey, TResult}(IEnumerable{TOuter}, IEnumerable{TInner}, Func{TOuter, TKey}, Func{TInner, TKey}, Func{TOuter, TInner, TResult}, IEqualityComparer{TKey})" /> method,
210/// <see cref="RightJoin{TOuter, TInner, TKey, TResult}(IEnumerable{TOuter}, IEnumerable{TInner}, Func{TOuter, TKey}, Func{TInner, TKey}, Func{TOuter, TInner, TResult}, IEqualityComparer{TKey})" /> method,
214public static IEnumerable<TResult> Join<TOuter, TInner, TKey, TResult>(this IEnumerable<TOuter> outer, IEnumerable<TInner> inner, Func<TOuter, TKey> outerKeySelector, Func<TInner, TKey> innerKeySelector, Func<TOuter, TInner, TResult> resultSelector, IEqualityComparer<TKey>? comparer)
249private static IEnumerable<TResult> JoinIterator<TOuter, TInner, TKey, TResult>(IEnumerable<TOuter> outer, IEnumerable<TInner> inner, Func<TOuter, TKey> outerKeySelector, Func<TInner, TKey> innerKeySelector, Func<TOuter, TInner, TResult> resultSelector, IEqualityComparer<TKey>? comparer)
System\Linq\Last.cs (4)
22public static TSource Last<TSource>(this IEnumerable<TSource> source, Func<TSource, bool> predicate)
48public static TSource? LastOrDefault<TSource>(this IEnumerable<TSource> source, Func<TSource, bool> predicate)
58public static TSource LastOrDefault<TSource>(this IEnumerable<TSource> source, Func<TSource, bool> predicate, TSource defaultValue)
108private static TSource? TryGetLast<TSource>(this IEnumerable<TSource> source, Func<TSource, bool> predicate, out bool found)
System\Linq\LeftJoin.cs (22)
26/// The following code example demonstrates how to use <see cref="LeftJoin{TOuter, TInner, TKey, TResult}(IEnumerable{TOuter}, IEnumerable{TInner}, Func{TOuter, TKey}, Func{TInner, TKey}, Func{TOuter, TInner, TResult})" /> to perform aa left outer join of two sequences based on a common key.
97/// <see cref="LeftJoin{TOuter, TInner, TKey, TResult}(IEnumerable{TOuter}, IEnumerable{TInner}, Func{TOuter, TKey}, Func{TInner, TKey}, Func{TOuter, TInner, TResult})" />
101/// In relational database terms, the <see cref="LeftJoin{TOuter, TInner, TKey, TResult}(IEnumerable{TOuter}, IEnumerable{TInner}, Func{TOuter, TKey}, Func{TInner, TKey}, Func{TOuter, TInner, TResult})" /> method implements an outer left equijoin.
105/// <see cref="Join{TOuter, TInner, TKey, TResult}(IEnumerable{TOuter}, IEnumerable{TInner}, Func{TOuter, TKey}, Func{TInner, TKey}, Func{TOuter, TInner, TResult})" /> method.
109public static IEnumerable<TResult> LeftJoin<TOuter, TInner, TKey, TResult>(this IEnumerable<TOuter> outer, IEnumerable<TInner> inner, Func<TOuter, TKey> outerKeySelector, Func<TInner, TKey> innerKeySelector, Func<TOuter, TInner?, TResult> resultSelector) =>
129/// The following code example demonstrates how to use <see cref="LeftJoin{TOuter, TInner, TKey, TResult}(IEnumerable{TOuter}, IEnumerable{TInner}, Func{TOuter, TKey}, Func{TInner, TKey}, Func{TOuter, TInner, TResult}, IEqualityComparer{TKey})" /> to perform aa left outer join of two sequences based on a common key.
200/// <see cref="LeftJoin{TOuter, TInner, TKey, TResult}(IEnumerable{TOuter}, IEnumerable{TInner}, Func{TOuter, TKey}, Func{TInner, TKey}, Func{TOuter, TInner, TResult}, IEqualityComparer{TKey})" />
204/// In relational database terms, the <see cref="LeftJoin{TOuter, TInner, TKey, TResult}(IEnumerable{TOuter}, IEnumerable{TInner}, Func{TOuter, TKey}, Func{TInner, TKey}, Func{TOuter, TInner, TResult}, IEqualityComparer{TKey})" /> method implements an outer left equijoin.
208/// <see cref="Join{TOuter, TInner, TKey, TResult}(IEnumerable{TOuter}, IEnumerable{TInner}, Func{TOuter, TKey}, Func{TInner, TKey}, Func{TOuter, TInner, TResult}, IEqualityComparer{TKey})" /> method.
212public static IEnumerable<TResult> LeftJoin<TOuter, TInner, TKey, TResult>(this IEnumerable<TOuter> outer, IEnumerable<TInner> inner, Func<TOuter, TKey> outerKeySelector, Func<TInner, TKey> innerKeySelector, Func<TOuter, TInner?, TResult> resultSelector, IEqualityComparer<TKey>? comparer)
247private static IEnumerable<TResult> LeftJoinIterator<TOuter, TInner, TKey, TResult>(IEnumerable<TOuter> outer, IEnumerable<TInner> inner, Func<TOuter, TKey> outerKeySelector, Func<TInner, TKey> innerKeySelector, Func<TOuter, TInner?, TResult> resultSelector, IEqualityComparer<TKey>? comparer)
System\Linq\Lookup.cs (10)
12public static ILookup<TKey, TSource> ToLookup<TSource, TKey>(this IEnumerable<TSource> source, Func<TSource, TKey> keySelector) =>
15public static ILookup<TKey, TSource> ToLookup<TSource, TKey>(this IEnumerable<TSource> source, Func<TSource, TKey> keySelector, IEqualityComparer<TKey>? comparer)
35public static ILookup<TKey, TElement> ToLookup<TSource, TKey, TElement>(this IEnumerable<TSource> source, Func<TSource, TKey> keySelector, Func<TSource, TElement> elementSelector) =>
38public static ILookup<TKey, TElement> ToLookup<TSource, TKey, TElement>(this IEnumerable<TSource> source, Func<TSource, TKey> keySelector, Func<TSource, TElement> elementSelector, IEqualityComparer<TKey>? comparer)
82internal static Lookup<TKey, TElement> Create<TSource>(IEnumerable<TSource> source, Func<TSource, TKey> keySelector, Func<TSource, TElement> elementSelector, IEqualityComparer<TKey>? comparer)
97internal static Lookup<TKey, TElement> Create(IEnumerable<TElement> source, Func<TElement, TKey> keySelector, IEqualityComparer<TKey>? comparer)
111internal static Lookup<TKey, TElement> CreateForJoin(IEnumerable<TElement> source, Func<TElement, TKey> keySelector, IEqualityComparer<TKey>? comparer)
System\Linq\Max.cs (17)
407public static TSource? MaxBy<TSource, TKey>(this IEnumerable<TSource> source, Func<TSource, TKey> keySelector) => MaxBy(source, keySelector, null);
421public static TSource? MaxBy<TSource, TKey>(this IEnumerable<TSource> source, Func<TSource, TKey> keySelector, IComparer<TKey>? comparer)
516public static int Max<TSource>(this IEnumerable<TSource> source, Func<TSource, int> selector) => MaxInteger(source, selector);
518public static int? Max<TSource>(this IEnumerable<TSource> source, Func<TSource, int?> selector) => MaxInteger(source, selector);
520public static long Max<TSource>(this IEnumerable<TSource> source, Func<TSource, long> selector) => MaxInteger(source, selector);
522public static long? Max<TSource>(this IEnumerable<TSource> source, Func<TSource, long?> selector) => MaxInteger(source, selector);
524private static TResult MaxInteger<TSource, TResult>(this IEnumerable<TSource> source, Func<TSource, TResult> selector) where TResult : struct, IBinaryInteger<TResult>
556private static TResult? MaxInteger<TSource, TResult>(this IEnumerable<TSource> source, Func<TSource, TResult?> selector) where TResult : struct, IBinaryInteger<TResult>
621public static float Max<TSource>(this IEnumerable<TSource> source, Func<TSource, float> selector) => MaxFloat(source, selector);
623public static float? Max<TSource>(this IEnumerable<TSource> source, Func<TSource, float?> selector) => MaxFloat(source, selector);
625public static double Max<TSource>(this IEnumerable<TSource> source, Func<TSource, double> selector) => MaxFloat(source, selector);
627public static double? Max<TSource>(this IEnumerable<TSource> source, Func<TSource, double?> selector) => MaxFloat(source, selector);
629private static TResult MaxFloat<TSource, TResult>(this IEnumerable<TSource> source, Func<TSource, TResult> selector) where TResult : struct, IFloatingPointIeee754<TResult>
671private static TResult? MaxFloat<TSource, TResult>(this IEnumerable<TSource> source, Func<TSource, TResult?> selector) where TResult : struct, IFloatingPointIeee754<TResult>
728public static decimal Max<TSource>(this IEnumerable<TSource> source, Func<TSource, decimal> selector)
760public static decimal? Max<TSource>(this IEnumerable<TSource> source, Func<TSource, decimal?> selector)
800public static TResult? Max<TSource, TResult>(this IEnumerable<TSource> source, Func<TSource, TResult> selector)
System\Linq\Min.cs (17)
386public static TSource? MinBy<TSource, TKey>(this IEnumerable<TSource> source, Func<TSource, TKey> keySelector) => MinBy(source, keySelector, comparer: null);
400public static TSource? MinBy<TSource, TKey>(this IEnumerable<TSource> source, Func<TSource, TKey> keySelector, IComparer<TKey>? comparer)
495public static int Min<TSource>(this IEnumerable<TSource> source, Func<TSource, int> selector) => MinInteger(source, selector);
497public static int? Min<TSource>(this IEnumerable<TSource> source, Func<TSource, int?> selector) => MinInteger(source, selector);
499public static long Min<TSource>(this IEnumerable<TSource> source, Func<TSource, long> selector) => MinInteger(source, selector);
501public static long? Min<TSource>(this IEnumerable<TSource> source, Func<TSource, long?> selector) => MinInteger(source, selector);
503private static TResult MinInteger<TSource, TResult>(this IEnumerable<TSource> source, Func<TSource, TResult> selector) where TResult : struct, IBinaryInteger<TResult>
535private static TResult? MinInteger<TSource, TResult>(this IEnumerable<TSource> source, Func<TSource, TResult?> selector) where TResult : struct, IBinaryInteger<TResult>
582public static float Min<TSource>(this IEnumerable<TSource> source, Func<TSource, float> selector) => MinFloat(source, selector);
584public static float? Min<TSource>(this IEnumerable<TSource> source, Func<TSource, float?> selector) => MinFloat(source, selector);
586public static double Min<TSource>(this IEnumerable<TSource> source, Func<TSource, double> selector) => MinFloat(source, selector);
588public static double? Min<TSource>(this IEnumerable<TSource> source, Func<TSource, double?> selector) => MinFloat(source, selector);
590private static TResult MinFloat<TSource, TResult>(this IEnumerable<TSource> source, Func<TSource, TResult> selector) where TResult : struct, IFloatingPointIeee754<TResult>
640private static TResult? MinFloat<TSource, TResult>(this IEnumerable<TSource> source, Func<TSource, TResult?> selector) where TResult : struct, IFloatingPointIeee754<TResult>
692public static decimal Min<TSource>(this IEnumerable<TSource> source, Func<TSource, decimal> selector)
724public static decimal? Min<TSource>(this IEnumerable<TSource> source, Func<TSource, decimal?> selector)
764public static TResult? Min<TSource, TResult>(this IEnumerable<TSource> source, Func<TSource, TResult> selector)
System\Linq\OrderBy.cs (9)
50public static IOrderedEnumerable<TSource> OrderBy<TSource, TKey>(this IEnumerable<TSource> source, Func<TSource, TKey> keySelector)
53public static IOrderedEnumerable<TSource> OrderBy<TSource, TKey>(this IEnumerable<TSource> source, Func<TSource, TKey> keySelector, IComparer<TKey>? comparer)
95public static IOrderedEnumerable<TSource> OrderByDescending<TSource, TKey>(this IEnumerable<TSource> source, Func<TSource, TKey> keySelector) =>
98public static IOrderedEnumerable<TSource> OrderByDescending<TSource, TKey>(this IEnumerable<TSource> source, Func<TSource, TKey> keySelector, IComparer<TKey>? comparer) =>
101public static IOrderedEnumerable<TSource> ThenBy<TSource, TKey>(this IOrderedEnumerable<TSource> source, Func<TSource, TKey> keySelector)
111public static IOrderedEnumerable<TSource> ThenBy<TSource, TKey>(this IOrderedEnumerable<TSource> source, Func<TSource, TKey> keySelector, IComparer<TKey>? comparer)
121public static IOrderedEnumerable<TSource> ThenByDescending<TSource, TKey>(this IOrderedEnumerable<TSource> source, Func<TSource, TKey> keySelector)
131public static IOrderedEnumerable<TSource> ThenByDescending<TSource, TKey>(this IOrderedEnumerable<TSource> source, Func<TSource, TKey> keySelector, IComparer<TKey>? comparer)
168IOrderedEnumerable<TElement> CreateOrderedEnumerable<TKey>(Func<TElement, TKey> keySelector, IComparer<TKey>? comparer, bool descending);
System\Linq\OrderedEnumerable.cs (11)
29IOrderedEnumerable<TElement> IOrderedEnumerable<TElement>.CreateOrderedEnumerable<TKey>(Func<TElement, TKey> keySelector, IComparer<TKey>? comparer, bool descending) =>
32public TElement? TryGetLast(Func<TElement, bool> predicate, out bool found)
67private readonly Func<TElement, TKey> _keySelector;
73internal OrderedIterator(IEnumerable<TElement> source, Func<TElement, TKey> keySelector, IComparer<TKey>? comparer, bool descending, OrderedIterator<TElement>? parent) :
259protected readonly Func<TElement, TKey> _keySelector;
264public CachingComparer(Func<TElement, TKey> keySelector, IComparer<TKey> comparer, bool descending)
293public CachingComparerWithChild(Func<TElement, TKey> keySelector, IComparer<TKey> comparer, bool descending, CachingComparer<TElement> child)
331internal static readonly Func<TElement, TElement> IdentityFunc = e => e;
383private readonly Func<TElement, TKey> _keySelector;
389internal EnumerableSorter(Func<TElement, TKey> keySelector, IComparer<TKey> comparer, bool descending, EnumerableSorter<TElement>? next)
399Func<TElement, TKey> keySelector = _keySelector;
System\Linq\RightJoin.cs (22)
26/// The following code example demonstrates how to use <see cref="RightJoin{TOuter, TInner, TKey, TResult}(IEnumerable{TOuter}, IEnumerable{TInner}, Func{TOuter, TKey}, Func{TInner, TKey}, Func{TOuter, TInner, TResult})" /> to perform aa left outer join of two sequences based on a common key.
96/// <see cref="RightJoin{TOuter, TInner, TKey, TResult}(IEnumerable{TOuter}, IEnumerable{TInner}, Func{TOuter, TKey}, Func{TInner, TKey}, Func{TOuter, TInner, TResult})" />
100/// In relational database terms, the <see cref="RightJoin{TOuter, TInner, TKey, TResult}(IEnumerable{TOuter}, IEnumerable{TInner}, Func{TOuter, TKey}, Func{TInner, TKey}, Func{TOuter, TInner, TResult})" /> method implements an outer right equijoin.
104/// <see cref="Join{TOuter, TInner, TKey, TResult}(IEnumerable{TOuter}, IEnumerable{TInner}, Func{TOuter, TKey}, Func{TInner, TKey}, Func{TOuter, TInner, TResult})" /> method.
108public static IEnumerable<TResult> RightJoin<TOuter, TInner, TKey, TResult>(this IEnumerable<TOuter> outer, IEnumerable<TInner> inner, Func<TOuter, TKey> outerKeySelector, Func<TInner, TKey> innerKeySelector, Func<TOuter?, TInner, TResult> resultSelector) =>
128/// The following code example demonstrates how to use <see cref="RightJoin{TOuter, TInner, TKey, TResult}(IEnumerable{TOuter}, IEnumerable{TInner}, Func{TOuter, TKey}, Func{TInner, TKey}, Func{TOuter, TInner, TResult}, IEqualityComparer{TKey})" /> to perform aa left outer join of two sequences based on a common key.
198/// <see cref="RightJoin{TOuter, TInner, TKey, TResult}(IEnumerable{TOuter}, IEnumerable{TInner}, Func{TOuter, TKey}, Func{TInner, TKey}, Func{TOuter, TInner, TResult}, IEqualityComparer{TKey})" />
202/// In relational database terms, the <see cref="RightJoin{TOuter, TInner, TKey, TResult}(IEnumerable{TOuter}, IEnumerable{TInner}, Func{TOuter, TKey}, Func{TInner, TKey}, Func{TOuter, TInner, TResult}, IEqualityComparer{TKey})" /> method implements an outer right equijoin.
206/// <see cref="Join{TOuter, TInner, TKey, TResult}(IEnumerable{TOuter}, IEnumerable{TInner}, Func{TOuter, TKey}, Func{TInner, TKey}, Func{TOuter, TInner, TResult}, IEqualityComparer{TKey})" /> method.
210public static IEnumerable<TResult> RightJoin<TOuter, TInner, TKey, TResult>(this IEnumerable<TOuter> outer, IEnumerable<TInner> inner, Func<TOuter, TKey> outerKeySelector, Func<TInner, TKey> innerKeySelector, Func<TOuter?, TInner, TResult> resultSelector, IEqualityComparer<TKey>? comparer)
245private static IEnumerable<TResult> RightJoinIterator<TOuter, TInner, TKey, TResult>(IEnumerable<TOuter> outer, IEnumerable<TInner> inner, Func<TOuter, TKey> outerKeySelector, Func<TInner, TKey> innerKeySelector, Func<TOuter?, TInner, TResult> resultSelector, IEqualityComparer<TKey>? comparer)
System\Linq\Select.cs (13)
14this IEnumerable<TSource> source, Func<TSource, TResult> selector)
115private readonly Func<TSource, TResult> _selector;
118public IEnumerableSelectIterator(IEnumerable<TSource> source, Func<TSource, TResult> selector)
163public override IEnumerable<TResult2> Select<TResult2>(Func<TResult, TResult2> selector) =>
176private readonly Func<TSource, TResult> _selector;
178public ArraySelectIterator(TSource[] source, Func<TSource, TResult> selector)
206public override IEnumerable<TResult2> Select<TResult2>(Func<TResult, TResult2> selector) =>
219private readonly Func<TSource, TResult> _selector;
222public ListSelectIterator(List<TSource> source, Func<TSource, TResult> selector)
256public override IEnumerable<TResult2> Select<TResult2>(Func<TResult, TResult2> selector) =>
269private readonly Func<TSource, TResult> _selector;
272public IListSelectIterator(IList<TSource> source, Func<TSource, TResult> selector)
318public override IEnumerable<TResult2> Select<TResult2>(Func<TResult, TResult2> selector) =>
System\Linq\Select.SpeedOpt.cs (19)
22Func<TSource, TResult> selector = _selector;
39Func<TSource, TResult> selector = _selector;
164private static void Fill(ReadOnlySpan<TSource> source, Span<TResult> destination, Func<TSource, TResult> func)
254private readonly Func<T, TResult> _selector;
256public RangeSelectIterator(T start, T end, Func<T, TResult> selector)
287public override IEnumerable<TResult2> Select<TResult2>(Func<TResult, TResult2> selector) =>
307private static void Fill(Span<TResult> results, T start, Func<T, TResult> func)
420private static void Fill(ReadOnlySpan<TSource> source, Span<TResult> destination, Func<TSource, TResult> func)
538private static void Fill(IList<TSource> source, Span<TResult> results, Func<TSource, TResult> func)
637private readonly Func<TSource, TResult> _selector;
640public IteratorSelectIterator(Iterator<TSource> source, Func<TSource, TResult> selector)
685public override IEnumerable<TResult2> Select<TResult2>(Func<TResult, TResult2> selector) =>
733Func<TSource, TResult> selector = _selector;
773Func<TSource, TResult> selector = _selector;
806private static void Fill(Iterator<TSource> source, Span<TResult> results, Func<TSource, TResult> func)
849private readonly Func<TSource, TResult> _selector;
853public IListSkipTakeSelectIterator(IList<TSource> source, Func<TSource, TResult> selector, int minIndexInclusive, int maxIndexInclusive)
885public override IEnumerable<TResult2> Select<TResult2>(Func<TResult, TResult2> selector) =>
981private static void Fill(IList<TSource> source, Span<TResult> destination, Func<TSource, TResult> func, int sourceIndex)
System\Linq\SelectMany.cs (5)
11public static IEnumerable<TResult> SelectMany<TSource, TResult>(this IEnumerable<TSource> source, Func<TSource, IEnumerable<TResult>> selector)
110public static IEnumerable<TResult> SelectMany<TSource, TCollection, TResult>(this IEnumerable<TSource> source, Func<TSource, IEnumerable<TCollection>> collectionSelector, Func<TSource, TCollection, TResult> resultSelector)
135private static IEnumerable<TResult> SelectManyIterator<TSource, TCollection, TResult>(IEnumerable<TSource> source, Func<TSource, IEnumerable<TCollection>> collectionSelector, Func<TSource, TCollection, TResult> resultSelector)
149private readonly Func<TSource, IEnumerable<TResult>> _selector;
153internal SelectManySingleSelectorIterator(IEnumerable<TSource> source, Func<TSource, IEnumerable<TResult>> selector)
System\Linq\Single.cs (4)
21public static TSource Single<TSource>(this IEnumerable<TSource> source, Func<TSource, bool> predicate)
48public static TSource? SingleOrDefault<TSource>(this IEnumerable<TSource> source, Func<TSource, bool> predicate)
59public static TSource SingleOrDefault<TSource>(this IEnumerable<TSource> source, Func<TSource, bool> predicate, TSource defaultValue)
106private static TSource? TryGetSingle<TSource>(this IEnumerable<TSource> source, Func<TSource, bool> predicate, out bool found)
System\Linq\Sum.cs (12)
225public static int Sum<TSource>(this IEnumerable<TSource> source, Func<TSource, int> selector) => Sum<TSource, int, int>(source, selector);
227public static long Sum<TSource>(this IEnumerable<TSource> source, Func<TSource, long> selector) => Sum<TSource, long, long>(source, selector);
229public static float Sum<TSource>(this IEnumerable<TSource> source, Func<TSource, float> selector) => Sum<TSource, float, double>(source, selector);
231public static double Sum<TSource>(this IEnumerable<TSource> source, Func<TSource, double> selector) => Sum<TSource, double, double>(source, selector);
233public static decimal Sum<TSource>(this IEnumerable<TSource> source, Func<TSource, decimal> selector) => Sum<TSource, decimal, decimal>(source, selector);
235private static TResult Sum<TSource, TResult, TAccumulator>(this IEnumerable<TSource> source, Func<TSource, TResult> selector)
259public static int? Sum<TSource>(this IEnumerable<TSource> source, Func<TSource, int?> selector) => Sum<TSource, int, int>(source, selector);
261public static long? Sum<TSource>(this IEnumerable<TSource> source, Func<TSource, long?> selector) => Sum<TSource, long, long>(source, selector);
263public static float? Sum<TSource>(this IEnumerable<TSource> source, Func<TSource, float?> selector) => Sum<TSource, float, double>(source, selector);
265public static double? Sum<TSource>(this IEnumerable<TSource> source, Func<TSource, double?> selector) => Sum<TSource, double, double>(source, selector);
267public static decimal? Sum<TSource>(this IEnumerable<TSource> source, Func<TSource, decimal?> selector) => Sum<TSource, decimal, decimal>(source, selector);
269private static TResult? Sum<TSource, TResult, TAccumulator>(this IEnumerable<TSource> source, Func<TSource, TResult?> selector)
System\Linq\ToCollection.cs (9)
136public static Dictionary<TKey, TSource> ToDictionary<TSource, TKey>(this IEnumerable<TSource> source, Func<TSource, TKey> keySelector) where TKey : notnull =>
139public static Dictionary<TKey, TSource> ToDictionary<TSource, TKey>(this IEnumerable<TSource> source, Func<TSource, TKey> keySelector, IEqualityComparer<TKey>? comparer) where TKey : notnull
179private static Dictionary<TKey, TSource> SpanToDictionary<TSource, TKey>(ReadOnlySpan<TSource> source, Func<TSource, TKey> keySelector, IEqualityComparer<TKey>? comparer) where TKey : notnull
189public static Dictionary<TKey, TElement> ToDictionary<TSource, TKey, TElement>(this IEnumerable<TSource> source, Func<TSource, TKey> keySelector, Func<TSource, TElement> elementSelector) where TKey : notnull =>
192public static Dictionary<TKey, TElement> ToDictionary<TSource, TKey, TElement>(this IEnumerable<TSource> source, Func<TSource, TKey> keySelector, Func<TSource, TElement> elementSelector, IEqualityComparer<TKey>? comparer) where TKey : notnull
237private static Dictionary<TKey, TElement> SpanToDictionary<TSource, TKey, TElement>(ReadOnlySpan<TSource> source, Func<TSource, TKey> keySelector, Func<TSource, TElement> elementSelector, IEqualityComparer<TKey>? comparer) where TKey : notnull
System\Linq\Union.cs (3)
42public static IEnumerable<TSource> UnionBy<TSource, TKey>(this IEnumerable<TSource> first, IEnumerable<TSource> second, Func<TSource, TKey> keySelector) => UnionBy(first, second, keySelector, null);
58public static IEnumerable<TSource> UnionBy<TSource, TKey>(this IEnumerable<TSource> first, IEnumerable<TSource> second, Func<TSource, TKey> keySelector, IEqualityComparer<TKey>? comparer)
76private static IEnumerable<TSource> UnionByIterator<TSource, TKey>(IEnumerable<TSource> first, IEnumerable<TSource> second, Func<TSource, TKey> keySelector, IEqualityComparer<TKey>? comparer)
System\Linq\Utilities.cs (6)
56public static Func<TSource, bool> CombinePredicates<TSource>(Func<TSource, bool> predicate1, Func<TSource, bool> predicate2) =>
70public static Func<TSource, TResult> CombineSelectors<TSource, TMiddle, TResult>(Func<TSource, TMiddle> selector1, Func<TMiddle, TResult> selector2) =>
System\Linq\Where.cs (28)
12public static IEnumerable<TSource> Where<TSource>(this IEnumerable<TSource> source, Func<TSource, bool> predicate)
97private readonly Func<TSource, bool> _predicate;
100public IEnumerableWhereIterator(IEnumerable<TSource> source, Func<TSource, bool> predicate)
148public override IEnumerable<TResult> Select<TResult>(Func<TSource, TResult> selector) =>
151public override IEnumerable<TSource> Where(Func<TSource, bool> predicate) =>
162private readonly Func<TSource, bool> _predicate;
164public ArrayWhereIterator(TSource[] source, Func<TSource, bool> predicate)
195public override IEnumerable<TResult> Select<TResult>(Func<TSource, TResult> selector) =>
198public override IEnumerable<TSource> Where(Func<TSource, bool> predicate) =>
209private readonly Func<TSource, bool> _predicate;
212public ListWhereIterator(List<TSource> source, Func<TSource, bool> predicate)
249public override IEnumerable<TResult> Select<TResult>(Func<TSource, TResult> selector) =>
252public override IEnumerable<TSource> Where(Func<TSource, bool> predicate) =>
264private readonly Func<TSource, bool> _predicate;
265private readonly Func<TSource, TResult> _selector;
267public ArrayWhereSelectIterator(TSource[] source, Func<TSource, bool> predicate, Func<TSource, TResult> selector)
300public override IEnumerable<TResult2> Select<TResult2>(Func<TResult, TResult2> selector) =>
312private readonly Func<TSource, bool> _predicate;
313private readonly Func<TSource, TResult> _selector;
316public ListWhereSelectIterator(List<TSource> source, Func<TSource, bool> predicate, Func<TSource, TResult> selector)
355public override IEnumerable<TResult2> Select<TResult2>(Func<TResult, TResult2> selector) =>
367private readonly Func<TSource, bool> _predicate;
368private readonly Func<TSource, TResult> _selector;
371public IEnumerableWhereSelectIterator(IEnumerable<TSource> source, Func<TSource, bool> predicate, Func<TSource, TResult> selector)
422public override IEnumerable<TResult2> Select<TResult2>(Func<TResult, TResult2> selector) =>
System\Linq\Where.SpeedOpt.cs (39)
41Func<TSource, bool> predicate = _predicate;
61Func<TSource, bool> predicate = _predicate;
78Func<TSource, bool> predicate = _predicate;
99Func<TSource, bool> predicate = _predicate;
132Func<TSource, bool> predicate = _predicate;
155Func<TSource, bool> predicate = _predicate;
173public static int GetCount(bool onlyIfCheap, ReadOnlySpan<TSource> source, Func<TSource, bool> predicate)
198public static TSource[] ToArray(ReadOnlySpan<TSource> source, Func<TSource, bool> predicate)
219public static List<TSource> ToList(ReadOnlySpan<TSource> source, Func<TSource, bool> predicate)
240Func<TSource, bool> predicate = _predicate;
258Func<TSource, bool> predicate = _predicate;
277Func<TSource, bool> predicate = _predicate;
300Func<TSource, bool> predicate = _predicate;
324Func<TSource, bool> predicate = _predicate;
342Func<TSource, bool> predicate = _predicate;
361Func<TSource, bool> predicate = _predicate;
384Func<TSource, bool> predicate = _predicate;
402public static int GetCount(bool onlyIfCheap, ReadOnlySpan<TSource> source, Func<TSource, bool> predicate, Func<TSource, TResult> selector)
431public static TResult[] ToArray(ReadOnlySpan<TSource> source, Func<TSource, bool> predicate, Func<TSource, TResult> selector)
452public static List<TResult> ToList(ReadOnlySpan<TSource> source, Func<TSource, bool> predicate, Func<TSource, TResult> selector)
473public static TResult? TryGetFirst(ReadOnlySpan<TSource> source, Func<TSource, bool> predicate, Func<TSource, TResult> selector, out bool found)
490public static TResult? TryGetLast(ReadOnlySpan<TSource> source, Func<TSource, bool> predicate, Func<TSource, TResult> selector, out bool found)
507public static TResult? TryGetElementAt(ReadOnlySpan<TSource> source, Func<TSource, bool> predicate, Func<TSource, TResult> selector, int index, out bool found)
532public static bool Contains(ReadOnlySpan<TSource> source, Func<TSource, bool> predicate, Func<TSource, TResult> selector, TResult value)
597Func<TSource, bool> predicate = _predicate;
598Func<TSource, TResult> selector = _selector;
618Func<TSource, bool> predicate = _predicate;
619Func<TSource, TResult> selector = _selector;
636Func<TSource, bool> predicate = _predicate;
657Func<TSource, bool> predicate = _predicate;
690Func<TSource, bool> predicate = _predicate;
713Func<TSource, bool> predicate = _predicate;
System.Linq.AsyncEnumerable (115)
System\Linq\AggregateBy.cs (6)
35Func<TSource, TKey> keySelector,
51Func<TSource, TKey> keySelector,
173Func<TSource, TKey> keySelector,
174Func<TKey, TAccumulate> seedSelector,
189Func<TSource, TKey> keySelector,
190Func<TKey, TAccumulate> seedSelector,
System\Linq\DistinctBy.cs (3)
23/// <para>The <see cref="DistinctBy{TSource, TKey}(IAsyncEnumerable{TSource}, Func{TSource, TKey}, IEqualityComparer{TKey}?)" /> method returns an unordered sequence that contains no duplicate values. If <paramref name="comparer" /> is <see langword="null" />, the default equality comparer, <see cref="EqualityComparer{T}.Default" />, is used to compare values.</para>
29Func<TSource, TKey> keySelector,
41Func<TSource, TKey> keySelector,
System\Linq\GroupBy.cs (12)
29Func<TSource, TKey> keySelector,
41Func<TSource, TKey> keySelector,
110Func<TSource, TKey> keySelector,
111Func<TSource, TElement> elementSelector,
124Func<TSource, TKey> keySelector,
125Func<TSource, TElement> elementSelector,
203Func<TSource, TKey> keySelector,
217Func<TSource, TKey> keySelector,
303Func<TSource, TKey> keySelector,
304Func<TSource, TElement> elementSelector,
319Func<TSource, TKey> keySelector,
320Func<TSource, TElement> elementSelector,
System\Linq\LastAsync.cs (5)
63Func<TSource, bool> predicate,
73Func<TSource, bool> predicate,
216Func<TSource, bool> predicate,
245Func<TSource, bool> predicate,
256Func<TSource, bool> predicate,
System\Linq\OrderBy.cs (9)
35Func<TSource, TKey> keySelector,
90Func<TSource, TKey> keySelector,
134Func<TSource, TKey> keySelector,
172Func<TSource, TKey> keySelector,
210public IOrderedAsyncEnumerable<TElement> CreateOrderedAsyncEnumerable<TKey>(Func<TElement, TKey> keySelector, IComparer<TKey>? comparer, bool descending) =>
229Debug.Assert(keySelector is Func<TElement, TKey> or Func<TElement, CancellationToken, ValueTask<TKey>>);
278internal static readonly Func<TElement, TElement> IdentityFunc = e => e;
333if (keySelector is Func<TElement, TKey> syncSelector)
443IOrderedAsyncEnumerable<TElement> CreateOrderedAsyncEnumerable<TKey>(Func<TElement, TKey> keySelector, IComparer<TKey>? comparer, bool descending);
System\Linq\SelectMany.cs (10)
29Func<TSource, IEnumerable<TResult>> selector)
40Func<TSource, IEnumerable<TResult>> selector,
109Func<TSource, IAsyncEnumerable<TResult>> selector)
120Func<TSource, IAsyncEnumerable<TResult>> selector,
282Func<TSource, IEnumerable<TCollection>> collectionSelector,
295Func<TSource, IEnumerable<TCollection>> collectionSelector,
382Func<TSource, IAsyncEnumerable<TCollection>> collectionSelector,
395Func<TSource, IAsyncEnumerable<TCollection>> collectionSelector,
432Func<TSource, IAsyncEnumerable<TCollection>> collectionSelector,
445Func<TSource, IAsyncEnumerable<TCollection>> collectionSelector,
System\Linq\SingleAsync.cs (5)
67Func<TSource, bool> predicate,
77Func<TSource, bool> predicate,
232Func<TSource, bool> predicate,
270Func<TSource, bool> predicate,
281Func<TSource, bool> predicate,
System\Linq\ToDictionaryAsync.cs (6)
78Func<TSource, TKey> keySelector,
89Func<TSource, TKey> keySelector,
160Func<TSource, TKey> keySelector,
161Func<TSource, TElement> elementSelector,
173Func<TSource, TKey> keySelector,
174Func<TSource, TElement> elementSelector,
System\Linq\ToLookupAsync.cs (7)
30Func<TSource, TKey> keySelector,
41Func<TSource, TKey> keySelector,
129Func<TSource, TKey> keySelector,
130Func<TSource, TElement> elementSelector,
142Func<TSource, TKey> keySelector,
143Func<TSource, TElement> elementSelector,
282Func<TElement, TKey> keySelector,
System.Linq.Expressions (34)
System\Dynamic\Utils\DelegateHelpers.cs (11)
19internal static Delegate CreateObjectArrayDelegate(Type delegateType, Func<object?[], object?> handler)
37Func<object?[], object?> invoker);
42private static readonly MethodInfo s_FuncInvoke = typeof(Func<object?[], object?>).GetMethod("Invoke")!;
48public static void ActionThunk(Func<object?[], object?> handler)
53public static void ActionThunk1<T1>(Func<object?[], object?> handler, T1 t1)
58public static void ActionThunk2<T1, T2>(Func<object?[], object?> handler, T1 t1, T2 t2)
63public static TReturn FuncThunk<TReturn>(Func<object?[], object> handler)
68public static TReturn FuncThunk1<T1, TReturn>(Func<object?[], object> handler, T1 t1)
73public static TReturn FuncThunk2<T1, T2, TReturn>(Func<object?[], object> handler, T1 t1, T2 t2)
172private static Delegate CreateObjectArrayDelegateRefEmit(Type delegateType, Func<object?[], object?> handler)
208paramTypes[0] = typeof(Func<object[], object>);
System\Runtime\CompilerServices\CallSite.cs (6)
54private static volatile CacheDict<Type, Func<CallSiteBinder, CallSite>>? s_siteCtors;
93CacheDict<Type, Func<CallSiteBinder, CallSite>>? ctors = s_siteCtors;
97s_siteCtors = ctors = new CacheDict<Type, Func<CallSiteBinder, CallSite>>(100);
100if (!ctors.TryGetValue(delegateType, out Func<CallSiteBinder, CallSite>? ctor))
110ctor = (Func<CallSiteBinder, CallSite>)method.CreateDelegate(typeof(Func<CallSiteBinder, CallSite>));
System.Linq.Parallel (180)
System\Linq\Parallel\QueryOperators\Unary\GroupByQueryOperator.cs (12)
32private readonly Func<TSource, TGroupKey> _keySelector; // Key selection function.
33private readonly Func<TSource, TElement>? _elementSelector; // Optional element selection function.
51Func<TSource, TGroupKey> keySelector,
52Func<TSource, TElement>? elementSelector,
363private readonly Func<TSource, TElement> _elementSelector; // Function to select elements.
371IEqualityComparer<TGroupKey>? keyComparer, Func<TSource, TElement> elementSelector, CancellationToken cancellationToken) :
426private readonly Func<TSource, TGroupKey> _keySelector; // The key selection routine.
443Func<TSource, TGroupKey> keySelector, IEqualityComparer<TGroupKey>? keyComparer, IComparer<TOrderKey> orderComparer,
539Func<TSource, TGroupKey> keySelector, IEqualityComparer<TGroupKey>? keyComparer, IComparer<TOrderKey> orderComparer,
605private readonly Func<TSource, TElement> _elementSelector; // Function to select elements.
612Func<TSource, TGroupKey> keySelector, Func<TSource, TElement> elementSelector, IEqualityComparer<TGroupKey>? keyComparer, IComparer<TOrderKey> orderComparer,
System\Linq\Parallel\QueryOperators\Unary\SortQueryOperator.cs (6)
25private readonly Func<TInputOutput, TSortKey> _keySelector; // Key selector used when sorting.
32internal SortQueryOperator(IEnumerable<TInputOutput> source, Func<TInputOutput, TSortKey> keySelector,
55Func<TInputOutput, TKey2> key2Selector, IComparer<TKey2>? key2Comparer, bool descending)
65Func<TInputOutput, Pair<TSortKey, TKey2>> pairKeySelector =
171private readonly Func<TInputOutput, TSortKey> _keySelector; // Key selector used when sorting.
178Func<TInputOutput, TSortKey> keySelector)
System\Linq\Parallel\QueryOperators\Unary\TakeOrSkipWhileQueryOperator.cs (4)
45private readonly Func<TResult, bool>? _predicate;
67Func<TResult, bool>? predicate,
208private readonly Func<TResult, bool>? _predicate; // The actual predicate function.
229QueryOperatorEnumerator<TResult, TKey> source, Func<TResult, bool>? predicate, Func<TResult, TKey, bool>? indexedPredicate, bool take,
System\Linq\Parallel\Utils\ExchangeUtilities.cs (2)
90PartitionedStream<TElement, TIgnoreKey> source, Func<TElement, THashKey>? keySelector, IEqualityComparer<THashKey>? keyComparer,
98PartitionedStream<TElement, TOrderKey> source, Func<TElement, THashKey>? keySelector, IEqualityComparer<THashKey>? keyComparer,
System\Linq\ParallelEnumerable.cs (109)
527public static ParallelQuery<TSource> Where<TSource>(this ParallelQuery<TSource> source, Func<TSource, bool> predicate)
571this ParallelQuery<TSource> source, Func<TSource, TResult> selector)
684Func<TOuter, TKey> outerKeySelector, Func<TInner, TKey> innerKeySelector,
714Func<TOuter, TKey> outerKeySelector, Func<TInner, TKey> innerKeySelector,
744Func<TOuter, TKey> outerKeySelector, Func<TInner, TKey> innerKeySelector,
781Func<TOuter, TKey> outerKeySelector, Func<TInner, TKey> innerKeySelector,
816Func<TOuter, TKey> outerKeySelector, Func<TInner, TKey> innerKeySelector,
847Func<TOuter, TKey> outerKeySelector, Func<TInner, TKey> innerKeySelector,
878Func<TOuter, TKey> outerKeySelector, Func<TInner, TKey> innerKeySelector,
916Func<TOuter, TKey> outerKeySelector, Func<TInner, TKey> innerKeySelector,
942this ParallelQuery<TSource> source, Func<TSource, IEnumerable<TResult>> selector)
994this ParallelQuery<TSource> source, Func<TSource, IEnumerable<TCollection>> collectionSelector,
1065this ParallelQuery<TSource> source, Func<TSource, TKey> keySelector)
1093this ParallelQuery<TSource> source, Func<TSource, TKey> keySelector, IComparer<TKey>? comparer)
1120this ParallelQuery<TSource> source, Func<TSource, TKey> keySelector)
1147this ParallelQuery<TSource> source, Func<TSource, TKey> keySelector, IComparer<TKey>? comparer)
1177this OrderedParallelQuery<TSource> source, Func<TSource, TKey> keySelector)
1208this OrderedParallelQuery<TSource> source, Func<TSource, TKey> keySelector, IComparer<TKey>? comparer)
1238this OrderedParallelQuery<TSource> source, Func<TSource, TKey> keySelector)
1269this OrderedParallelQuery<TSource> source, Func<TSource, TKey> keySelector, IComparer<TKey>? comparer)
1297this ParallelQuery<TSource> source, Func<TSource, TKey> keySelector)
1316this ParallelQuery<TSource> source, Func<TSource, TKey> keySelector, IEqualityComparer<TKey>? comparer)
1343this ParallelQuery<TSource> source, Func<TSource, TKey> keySelector, Func<TSource, TElement> elementSelector)
1369this ParallelQuery<TSource> source, Func<TSource, TKey> keySelector, Func<TSource, TElement> elementSelector, IEqualityComparer<TKey>? comparer)
1408this ParallelQuery<TSource> source, Func<TSource, TKey> keySelector, Func<TKey, IEnumerable<TSource>, TResult> resultSelector)
1436this ParallelQuery<TSource> source, Func<TSource, TKey> keySelector, Func<TKey, IEnumerable<TSource>, TResult> resultSelector, IEqualityComparer<TKey>? comparer)
1466this ParallelQuery<TSource> source, Func<TSource, TKey> keySelector, Func<TSource, TElement> elementSelector, Func<TKey, IEnumerable<TElement>, TResult> resultSelector)
1497this ParallelQuery<TSource> source, Func<TSource, TKey> keySelector, Func<TSource, TElement> elementSelector, Func<TKey, IEnumerable<TElement>, TResult> resultSelector, IEqualityComparer<TKey>? comparer)
1701Func<TAccumulate, TResult> resultSelector)
1757Func<TAccumulate, TAccumulate, TAccumulate> combineAccumulatorsFunc, Func<TAccumulate, TResult> resultSelector)
1813Func<TAccumulate, TResult> resultSelector)
1890public static int Count<TSource>(this ParallelQuery<TSource> source, Func<TSource, bool> predicate)
1957public static long LongCount<TSource>(this ParallelQuery<TSource> source, Func<TSource, bool> predicate)
2210public static int Sum<TSource>(this ParallelQuery<TSource> source, Func<TSource, int> selector)
2234public static int? Sum<TSource>(this ParallelQuery<TSource> source, Func<TSource, int?> selector)
2258public static long Sum<TSource>(this ParallelQuery<TSource> source, Func<TSource, long> selector)
2282public static long? Sum<TSource>(this ParallelQuery<TSource> source, Func<TSource, long?> selector)
2304public static float Sum<TSource>(this ParallelQuery<TSource> source, Func<TSource, float> selector)
2326public static float? Sum<TSource>(this ParallelQuery<TSource> source, Func<TSource, float?> selector)
2348public static double Sum<TSource>(this ParallelQuery<TSource> source, Func<TSource, double> selector)
2370public static double? Sum<TSource>(this ParallelQuery<TSource> source, Func<TSource, double?> selector)
2394public static decimal Sum<TSource>(this ParallelQuery<TSource> source, Func<TSource, decimal> selector)
2418public static decimal? Sum<TSource>(this ParallelQuery<TSource> source, Func<TSource, decimal?> selector)
2707public static int Min<TSource>(this ParallelQuery<TSource> source, Func<TSource, int> selector)
2729public static int? Min<TSource>(this ParallelQuery<TSource> source, Func<TSource, int?> selector)
2754public static long Min<TSource>(this ParallelQuery<TSource> source, Func<TSource, long> selector)
2776public static long? Min<TSource>(this ParallelQuery<TSource> source, Func<TSource, long?> selector)
2801public static float Min<TSource>(this ParallelQuery<TSource> source, Func<TSource, float> selector)
2823public static float? Min<TSource>(this ParallelQuery<TSource> source, Func<TSource, float?> selector)
2848public static double Min<TSource>(this ParallelQuery<TSource> source, Func<TSource, double> selector)
2870public static double? Min<TSource>(this ParallelQuery<TSource> source, Func<TSource, double?> selector)
2895public static decimal Min<TSource>(this ParallelQuery<TSource> source, Func<TSource, decimal> selector)
2917public static decimal? Min<TSource>(this ParallelQuery<TSource> source, Func<TSource, decimal?> selector)
2943public static TResult? Min<TSource, TResult>(this ParallelQuery<TSource> source, Func<TSource, TResult> selector)
3221public static int Max<TSource>(this ParallelQuery<TSource> source, Func<TSource, int> selector)
3243public static int? Max<TSource>(this ParallelQuery<TSource> source, Func<TSource, int?> selector)
3268public static long Max<TSource>(this ParallelQuery<TSource> source, Func<TSource, long> selector)
3290public static long? Max<TSource>(this ParallelQuery<TSource> source, Func<TSource, long?> selector)
3315public static float Max<TSource>(this ParallelQuery<TSource> source, Func<TSource, float> selector)
3337public static float? Max<TSource>(this ParallelQuery<TSource> source, Func<TSource, float?> selector)
3362public static double Max<TSource>(this ParallelQuery<TSource> source, Func<TSource, double> selector)
3384public static double? Max<TSource>(this ParallelQuery<TSource> source, Func<TSource, double?> selector)
3409public static decimal Max<TSource>(this ParallelQuery<TSource> source, Func<TSource, decimal> selector)
3431public static decimal? Max<TSource>(this ParallelQuery<TSource> source, Func<TSource, decimal?> selector)
3457public static TResult? Max<TSource, TResult>(this ParallelQuery<TSource> source, Func<TSource, TResult> selector)
3721public static double Average<TSource>(this ParallelQuery<TSource> source, Func<TSource, int> selector)
3745public static double? Average<TSource>(this ParallelQuery<TSource> source, Func<TSource, int?> selector)
3772public static double Average<TSource>(this ParallelQuery<TSource> source, Func<TSource, long> selector)
3796public static double? Average<TSource>(this ParallelQuery<TSource> source, Func<TSource, long?> selector)
3821public static float Average<TSource>(this ParallelQuery<TSource> source, Func<TSource, float> selector)
3843public static float? Average<TSource>(this ParallelQuery<TSource> source, Func<TSource, float?> selector)
3868public static double Average<TSource>(this ParallelQuery<TSource> source, Func<TSource, double> selector)
3890public static double? Average<TSource>(this ParallelQuery<TSource> source, Func<TSource, double?> selector)
3915public static decimal Average<TSource>(this ParallelQuery<TSource> source, Func<TSource, decimal> selector)
3937public static decimal? Average<TSource>(this ParallelQuery<TSource> source, Func<TSource, decimal?> selector)
3964public static bool Any<TSource>(this ParallelQuery<TSource> source, Func<TSource, bool> predicate)
4016public static bool All<TSource>(this ParallelQuery<TSource> source, Func<TSource, bool> predicate)
4133public static ParallelQuery<TSource> TakeWhile<TSource>(this ParallelQuery<TSource> source, Func<TSource, bool> predicate)
4215public static ParallelQuery<TSource> SkipWhile<TSource>(this ParallelQuery<TSource> source, Func<TSource, bool> predicate)
4930this ParallelQuery<TSource> source, Func<TSource, TKey> keySelector) where TKey : notnull
4959this ParallelQuery<TSource> source, Func<TSource, TKey> keySelector, IEqualityComparer<TKey>? comparer) where TKey : notnull
5021this ParallelQuery<TSource> source, Func<TSource, TKey> keySelector, Func<TSource, TElement> elementSelector) where TKey : notnull
5056this ParallelQuery<TSource> source, Func<TSource, TKey> keySelector, Func<TSource, TElement> elementSelector, IEqualityComparer<TKey>? comparer) where TKey : notnull
5113this ParallelQuery<TSource> source, Func<TSource, TKey> keySelector) where TKey : notnull
5138this ParallelQuery<TSource> source, Func<TSource, TKey> keySelector, IEqualityComparer<TKey>? comparer) where TKey : notnull
5192this ParallelQuery<TSource> source, Func<TSource, TKey> keySelector, Func<TSource, TElement> elementSelector) where TKey : notnull
5224this ParallelQuery<TSource> source, Func<TSource, TKey> keySelector, Func<TSource, TElement> elementSelector, IEqualityComparer<TKey>? comparer) where TKey : notnull
5438public static TSource First<TSource>(this ParallelQuery<TSource> source, Func<TSource, bool> predicate)
5523public static TSource? FirstOrDefault<TSource>(this ParallelQuery<TSource> source, Func<TSource, bool> predicate)
5614public static TSource Last<TSource>(this ParallelQuery<TSource> source, Func<TSource, bool> predicate)
5697public static TSource? LastOrDefault<TSource>(this ParallelQuery<TSource> source, Func<TSource, bool> predicate)
5774public static TSource Single<TSource>(this ParallelQuery<TSource> source, Func<TSource, bool> predicate)
5831public static TSource? SingleOrDefault<TSource>(this ParallelQuery<TSource> source, Func<TSource, bool> predicate)
System.Linq.Queryable (252)
System\Linq\Queryable.cs (252)
48public static IQueryable<TSource> Where<TSource>(this IQueryable<TSource> source, Expression<Func<TSource, bool>> predicate)
56new Func<IQueryable<TSource>, Expression<Func<TSource, bool>>, IQueryable<TSource>>(Where).Method,
98public static IQueryable<TResult> Select<TSource, TResult>(this IQueryable<TSource> source, Expression<Func<TSource, TResult>> selector)
106new Func<IQueryable<TSource>, Expression<Func<TSource, TResult>>, IQueryable<TResult>>(Select).Method,
124public static IQueryable<TResult> SelectMany<TSource, TResult>(this IQueryable<TSource> source, Expression<Func<TSource, IEnumerable<TResult>>> selector)
132new Func<IQueryable<TSource>, Expression<Func<TSource, IEnumerable<TResult>>>, IQueryable<TResult>>(SelectMany).Method,
164public static IQueryable<TResult> SelectMany<TSource, TCollection, TResult>(this IQueryable<TSource> source, Expression<Func<TSource, IEnumerable<TCollection>>> collectionSelector, Expression<Func<TSource, TCollection, TResult>> resultSelector)
173new Func<IQueryable<TSource>, Expression<Func<TSource, IEnumerable<TCollection>>>, Expression<Func<TSource, TCollection, TResult>>, IQueryable<TResult>>(SelectMany).Method,
199/// The following code example demonstrates how to use <see cref="Join{TOuter, TInner, TKey, TResult}(IQueryable{TOuter}, IEnumerable{TInner}, Expression{Func{TOuter, TKey}}, Expression{Func{TInner, TKey}}, Expression{Func{TOuter, TInner, TResult}})" /> to perform an inner join of two sequences based on a common key.
259/// This method has at least one parameter of type <see cref="Expression{TDelegate}" /> whose type argument is one of the <see cref="Func{T,TResult}" /> types.
263/// The <see cref="Join{TOuter, TInner, TKey, TResult}(IQueryable{TOuter}, IEnumerable{TInner}, Expression{Func{TOuter, TKey}}, Expression{Func{TInner, TKey}}, Expression{Func{TOuter, TInner, TResult}})" /> method
265/// <see cref="Join{TOuter, TInner, TKey, TResult}(IQueryable{TOuter}, IEnumerable{TInner}, Expression{Func{TOuter, TKey}}, Expression{Func{TInner, TKey}}, Expression{Func{TOuter, TInner, TResult}})" />
271/// <see cref="Join{TOuter, TInner, TKey, TResult}(IQueryable{TOuter}, IEnumerable{TInner}, Expression{Func{TOuter, TKey}}, Expression{Func{TInner, TKey}}, Expression{Func{TOuter, TInner, TResult}})" />
281public static IQueryable<TResult> Join<TOuter, TInner, TKey, TResult>(this IQueryable<TOuter> outer, IEnumerable<TInner> inner, Expression<Func<TOuter, TKey>> outerKeySelector, Expression<Func<TInner, TKey>> innerKeySelector, Expression<Func<TOuter, TInner, TResult>> resultSelector)
292new Func<IQueryable<TOuter>, IEnumerable<TInner>, Expression<Func<TOuter, TKey>>, Expression<Func<TInner, TKey>>, Expression<Func<TOuter, TInner, TResult>>, IQueryable<TResult>>(Join).Method,
313/// The following code example demonstrates how to use <see cref="Join{TOuter, TInner, TKey, TResult}(IQueryable{TOuter}, IEnumerable{TInner}, Expression{Func{TOuter, TKey}}, Expression{Func{TInner, TKey}}, Expression{Func{TOuter, TInner, TResult}}, IEqualityComparer{TKey})" /> to perform an inner join of two sequences based on a common key.
374/// This method has at least one parameter of type <see cref="Expression{TDelegate}" /> whose type argument is one of the <see cref="Func{T,TResult}" /> types.
378/// The <see cref="Join{TOuter, TInner, TKey, TResult}(IQueryable{TOuter}, IEnumerable{TInner}, Expression{Func{TOuter, TKey}}, Expression{Func{TInner, TKey}}, Expression{Func{TOuter, TInner, TResult}}, IEqualityComparer{TKey})" /> method
380/// <see cref="Join{TOuter, TInner, TKey, TResult}(IQueryable{TOuter}, IEnumerable{TInner}, Expression{Func{TOuter, TKey}}, Expression{Func{TInner, TKey}}, Expression{Func{TOuter, TInner, TResult}}, IEqualityComparer{TKey})" />
386/// <see cref="Join{TOuter, TInner, TKey, TResult}(IQueryable{TOuter}, IEnumerable{TInner}, Expression{Func{TOuter, TKey}}, Expression{Func{TInner, TKey}}, Expression{Func{TOuter, TInner, TResult}}, IEqualityComparer{TKey})" />
396public static IQueryable<TResult> Join<TOuter, TInner, TKey, TResult>(this IQueryable<TOuter> outer, IEnumerable<TInner> inner, Expression<Func<TOuter, TKey>> outerKeySelector, Expression<Func<TInner, TKey>> innerKeySelector, Expression<Func<TOuter, TInner, TResult>> resultSelector, IEqualityComparer<TKey>? comparer)
407new Func<IQueryable<TOuter>, IEnumerable<TInner>, Expression<Func<TOuter, TKey>>, Expression<Func<TInner, TKey>>, Expression<Func<TOuter, TInner, TResult>>, IEqualityComparer<TKey>, IQueryable<TResult>>(Join).Method,
412public static IQueryable<TResult> GroupJoin<TOuter, TInner, TKey, TResult>(this IQueryable<TOuter> outer, IEnumerable<TInner> inner, Expression<Func<TOuter, TKey>> outerKeySelector, Expression<Func<TInner, TKey>> innerKeySelector, Expression<Func<TOuter, IEnumerable<TInner>, TResult>> resultSelector)
423new Func<IQueryable<TOuter>, IEnumerable<TInner>, Expression<Func<TOuter, TKey>>, Expression<Func<TInner, TKey>>, Expression<Func<TOuter, IEnumerable<TInner>, TResult>>, IQueryable<TResult>>(GroupJoin).Method,
428public static IQueryable<TResult> GroupJoin<TOuter, TInner, TKey, TResult>(this IQueryable<TOuter> outer, IEnumerable<TInner> inner, Expression<Func<TOuter, TKey>> outerKeySelector, Expression<Func<TInner, TKey>> innerKeySelector, Expression<Func<TOuter, IEnumerable<TInner>, TResult>> resultSelector, IEqualityComparer<TKey>? comparer)
439new Func<IQueryable<TOuter>, IEnumerable<TInner>, Expression<Func<TOuter, TKey>>, Expression<Func<TInner, TKey>>, Expression<Func<TOuter, IEnumerable<TInner>, TResult>>, IEqualityComparer<TKey>, IQueryable<TResult>>(GroupJoin).Method,
459/// The following code example demonstrates how to use <see cref="LeftJoin{TOuter, TInner, TKey, TResult}(IQueryable{TOuter}, IEnumerable{TInner}, Expression{Func{TOuter, TKey}}, Expression{Func{TInner, TKey}}, Expression{Func{TOuter, TInner, TResult}}, IEqualityComparer{TKey})" /> to perform an inner join of two sequences based on a common key.
520/// This method has at least one parameter of type <see cref="Expression{TDelegate}" /> whose type argument is one of the <see cref="Func{T,TResult}" /> types.
524/// The <see cref="LeftJoin{TOuter, TInner, TKey, TResult}(IQueryable{TOuter}, IEnumerable{TInner}, Expression{Func{TOuter, TKey}}, Expression{Func{TInner, TKey}}, Expression{Func{TOuter, TInner, TResult}})" /> method
526/// <see cref="LeftJoin{TOuter, TInner, TKey, TResult}(IQueryable{TOuter}, IEnumerable{TInner}, Expression{Func{TOuter, TKey}}, Expression{Func{TInner, TKey}}, Expression{Func{TOuter, TInner, TResult}})" />
532/// <see cref="LeftJoin{TOuter, TInner, TKey, TResult}(IQueryable{TOuter}, IEnumerable{TInner}, Expression{Func{TOuter, TKey}}, Expression{Func{TInner, TKey}}, Expression{Func{TOuter, TInner, TResult}})" />
542public static IQueryable<TResult> LeftJoin<TOuter, TInner, TKey, TResult>(this IQueryable<TOuter> outer, IEnumerable<TInner> inner, Expression<Func<TOuter, TKey>> outerKeySelector, Expression<Func<TInner, TKey>> innerKeySelector, Expression<Func<TOuter, TInner?, TResult>> resultSelector)
553new Func<IQueryable<TOuter>, IEnumerable<TInner>, Expression<Func<TOuter, TKey>>, Expression<Func<TInner, TKey>>, Expression<Func<TOuter, TInner?, TResult>>, IQueryable<TResult>>(LeftJoin).Method,
574/// The following code example demonstrates how to use <see cref="LeftJoin{TOuter, TInner, TKey, TResult}(IQueryable{TOuter}, IEnumerable{TInner}, Expression{Func{TOuter, TKey}}, Expression{Func{TInner, TKey}}, Expression{Func{TOuter, TInner, TResult}}, IEqualityComparer{TKey})" /> to perform an inner join of two sequences based on a common key.
635/// This method has at least one parameter of type <see cref="Expression{TDelegate}" /> whose type argument is one of the <see cref="Func{T,TResult}" /> types.
639/// The <see cref="LeftJoin{TOuter, TInner, TKey, TResult}(IQueryable{TOuter}, IEnumerable{TInner}, Expression{Func{TOuter, TKey}}, Expression{Func{TInner, TKey}}, Expression{Func{TOuter, TInner, TResult}}, IEqualityComparer{TKey})" /> method
641/// <see cref="LeftJoin{TOuter, TInner, TKey, TResult}(IQueryable{TOuter}, IEnumerable{TInner}, Expression{Func{TOuter, TKey}}, Expression{Func{TInner, TKey}}, Expression{Func{TOuter, TInner, TResult}}, IEqualityComparer{TKey})" />
647/// <see cref="LeftJoin{TOuter, TInner, TKey, TResult}(IQueryable{TOuter}, IEnumerable{TInner}, Expression{Func{TOuter, TKey}}, Expression{Func{TInner, TKey}}, Expression{Func{TOuter, TInner, TResult}}, IEqualityComparer{TKey})" />
657public static IQueryable<TResult> LeftJoin<TOuter, TInner, TKey, TResult>(this IQueryable<TOuter> outer, IEnumerable<TInner> inner, Expression<Func<TOuter, TKey>> outerKeySelector, Expression<Func<TInner, TKey>> innerKeySelector, Expression<Func<TOuter, TInner?, TResult>> resultSelector, IEqualityComparer<TKey>? comparer)
668new Func<IQueryable<TOuter>, IEnumerable<TInner>, Expression<Func<TOuter, TKey>>, Expression<Func<TInner, TKey>>, Expression<Func<TOuter, TInner?, TResult>>, IEqualityComparer<TKey>, IQueryable<TResult>>(LeftJoin).Method,
681/// of the <see cref="Func{T,TResult}"/> types.
718/// of the <see cref="Func{T,TResult}"/> types.
746public static IOrderedQueryable<TSource> OrderBy<TSource, TKey>(this IQueryable<TSource> source, Expression<Func<TSource, TKey>> keySelector)
754new Func<IQueryable<TSource>, Expression<Func<TSource, TKey>>, IOrderedQueryable<TSource>>(OrderBy).Method,
759public static IOrderedQueryable<TSource> OrderBy<TSource, TKey>(this IQueryable<TSource> source, Expression<Func<TSource, TKey>> keySelector, IComparer<TKey>? comparer)
767new Func<IQueryable<TSource>, Expression<Func<TSource, TKey>>, IComparer<TKey>, IOrderedQueryable<TSource>>(OrderBy).Method,
780/// of the <see cref="Func{T,TResult}"/> types.
817/// of the <see cref="Func{T,TResult}"/> types.
845public static IOrderedQueryable<TSource> OrderByDescending<TSource, TKey>(this IQueryable<TSource> source, Expression<Func<TSource, TKey>> keySelector)
853new Func<IQueryable<TSource>, Expression<Func<TSource, TKey>>, IOrderedQueryable<TSource>>(OrderByDescending).Method,
858public static IOrderedQueryable<TSource> OrderByDescending<TSource, TKey>(this IQueryable<TSource> source, Expression<Func<TSource, TKey>> keySelector, IComparer<TKey>? comparer)
866new Func<IQueryable<TSource>, Expression<Func<TSource, TKey>>, IComparer<TKey>, IOrderedQueryable<TSource>>(OrderByDescending).Method,
886/// The following code example demonstrates how to use <see cref="RightJoin{TOuter, TInner, TKey, TResult}(IQueryable{TOuter}, IEnumerable{TInner}, Expression{Func{TOuter, TKey}}, Expression{Func{TInner, TKey}}, Expression{Func{TOuter, TInner, TResult}}, IEqualityComparer{TKey})" /> to perform an inner join of two sequences based on a common key.
946/// This method has at least one parameter of type <see cref="Expression{TDelegate}" /> whose type argument is one of the <see cref="Func{T,TResult}" /> types.
950/// The <see cref="RightJoin{TOuter, TInner, TKey, TResult}(IQueryable{TOuter}, IEnumerable{TInner}, Expression{Func{TOuter, TKey}}, Expression{Func{TInner, TKey}}, Expression{Func{TOuter, TInner, TResult}})" /> method
952/// <see cref="RightJoin{TOuter, TInner, TKey, TResult}(IQueryable{TOuter}, IEnumerable{TInner}, Expression{Func{TOuter, TKey}}, Expression{Func{TInner, TKey}}, Expression{Func{TOuter, TInner, TResult}})" />
958/// <see cref="RightJoin{TOuter, TInner, TKey, TResult}(IQueryable{TOuter}, IEnumerable{TInner}, Expression{Func{TOuter, TKey}}, Expression{Func{TInner, TKey}}, Expression{Func{TOuter, TInner, TResult}})" />
968public static IQueryable<TResult> RightJoin<TOuter, TInner, TKey, TResult>(this IQueryable<TOuter> outer, IEnumerable<TInner> inner, Expression<Func<TOuter, TKey>> outerKeySelector, Expression<Func<TInner, TKey>> innerKeySelector, Expression<Func<TOuter?, TInner, TResult>> resultSelector)
979new Func<IQueryable<TOuter>, IEnumerable<TInner>, Expression<Func<TOuter, TKey>>, Expression<Func<TInner, TKey>>, Expression<Func<TOuter?, TInner, TResult>>, IQueryable<TResult>>(RightJoin).Method,
1000/// The following code example demonstrates how to use <see cref="RightJoin{TOuter, TInner, TKey, TResult}(IQueryable{TOuter}, IEnumerable{TInner}, Expression{Func{TOuter, TKey}}, Expression{Func{TInner, TKey}}, Expression{Func{TOuter, TInner, TResult}}, IEqualityComparer{TKey})" /> to perform an inner join of two sequences based on a common key.
1060/// This method has at least one parameter of type <see cref="Expression{TDelegate}" /> whose type argument is one of the <see cref="Func{T,TResult}" /> types.
1064/// The <see cref="RightJoin{TOuter, TInner, TKey, TResult}(IQueryable{TOuter}, IEnumerable{TInner}, Expression{Func{TOuter, TKey}}, Expression{Func{TInner, TKey}}, Expression{Func{TOuter, TInner, TResult}}, IEqualityComparer{TKey})" /> method
1066/// <see cref="RightJoin{TOuter, TInner, TKey, TResult}(IQueryable{TOuter}, IEnumerable{TInner}, Expression{Func{TOuter, TKey}}, Expression{Func{TInner, TKey}}, Expression{Func{TOuter, TInner, TResult}}, IEqualityComparer{TKey})" />
1072/// <see cref="RightJoin{TOuter, TInner, TKey, TResult}(IQueryable{TOuter}, IEnumerable{TInner}, Expression{Func{TOuter, TKey}}, Expression{Func{TInner, TKey}}, Expression{Func{TOuter, TInner, TResult}}, IEqualityComparer{TKey})" />
1082public static IQueryable<TResult> RightJoin<TOuter, TInner, TKey, TResult>(this IQueryable<TOuter> outer, IEnumerable<TInner> inner, Expression<Func<TOuter, TKey>> outerKeySelector, Expression<Func<TInner, TKey>> innerKeySelector, Expression<Func<TOuter?, TInner, TResult>> resultSelector, IEqualityComparer<TKey>? comparer)
1093new Func<IQueryable<TOuter>, IEnumerable<TInner>, Expression<Func<TOuter, TKey>>, Expression<Func<TInner, TKey>>, Expression<Func<TOuter?, TInner, TResult>>, IEqualityComparer<TKey>, IQueryable<TResult>>(RightJoin).Method,
1098public static IOrderedQueryable<TSource> ThenBy<TSource, TKey>(this IOrderedQueryable<TSource> source, Expression<Func<TSource, TKey>> keySelector)
1106new Func<IOrderedQueryable<TSource>, Expression<Func<TSource, TKey>>, IOrderedQueryable<TSource>>(ThenBy).Method,
1111public static IOrderedQueryable<TSource> ThenBy<TSource, TKey>(this IOrderedQueryable<TSource> source, Expression<Func<TSource, TKey>> keySelector, IComparer<TKey>? comparer)
1119new Func<IOrderedQueryable<TSource>, Expression<Func<TSource, TKey>>, IComparer<TKey>, IOrderedQueryable<TSource>>(ThenBy).Method,
1124public static IOrderedQueryable<TSource> ThenByDescending<TSource, TKey>(this IOrderedQueryable<TSource> source, Expression<Func<TSource, TKey>> keySelector)
1132new Func<IOrderedQueryable<TSource>, Expression<Func<TSource, TKey>>, IOrderedQueryable<TSource>>(ThenByDescending).Method,
1137public static IOrderedQueryable<TSource> ThenByDescending<TSource, TKey>(this IOrderedQueryable<TSource> source, Expression<Func<TSource, TKey>> keySelector, IComparer<TKey>? comparer)
1145new Func<IOrderedQueryable<TSource>, Expression<Func<TSource, TKey>>, IComparer<TKey>, IOrderedQueryable<TSource>>(ThenByDescending).Method,
1180public static IQueryable<TSource> TakeWhile<TSource>(this IQueryable<TSource> source, Expression<Func<TSource, bool>> predicate)
1188new Func<IQueryable<TSource>, Expression<Func<TSource, bool>>, IQueryable<TSource>>(TakeWhile).Method,
1218public static IQueryable<TSource> SkipWhile<TSource>(this IQueryable<TSource> source, Expression<Func<TSource, bool>> predicate)
1226new Func<IQueryable<TSource>, Expression<Func<TSource, bool>>, IQueryable<TSource>>(SkipWhile).Method,
1244public static IQueryable<IGrouping<TKey, TSource>> GroupBy<TSource, TKey>(this IQueryable<TSource> source, Expression<Func<TSource, TKey>> keySelector)
1252new Func<IQueryable<TSource>, Expression<Func<TSource, TKey>>, IQueryable<IGrouping<TKey, TSource>>>(GroupBy).Method,
1257public static IQueryable<IGrouping<TKey, TElement>> GroupBy<TSource, TKey, TElement>(this IQueryable<TSource> source, Expression<Func<TSource, TKey>> keySelector, Expression<Func<TSource, TElement>> elementSelector)
1266new Func<IQueryable<TSource>, Expression<Func<TSource, TKey>>, Expression<Func<TSource, TElement>>, IQueryable<IGrouping<TKey, TElement>>>(GroupBy).Method,
1271public static IQueryable<IGrouping<TKey, TSource>> GroupBy<TSource, TKey>(this IQueryable<TSource> source, Expression<Func<TSource, TKey>> keySelector, IEqualityComparer<TKey>? comparer)
1279new Func<IQueryable<TSource>, Expression<Func<TSource, TKey>>, IEqualityComparer<TKey>, IQueryable<IGrouping<TKey, TSource>>>(GroupBy).Method,
1284public static IQueryable<IGrouping<TKey, TElement>> GroupBy<TSource, TKey, TElement>(this IQueryable<TSource> source, Expression<Func<TSource, TKey>> keySelector, Expression<Func<TSource, TElement>> elementSelector, IEqualityComparer<TKey>? comparer)
1293new Func<IQueryable<TSource>, Expression<Func<TSource, TKey>>, Expression<Func<TSource, TElement>>, IEqualityComparer<TKey>, IQueryable<IGrouping<TKey, TElement>>>(GroupBy).Method,
1298public static IQueryable<TResult> GroupBy<TSource, TKey, TElement, TResult>(this IQueryable<TSource> source, Expression<Func<TSource, TKey>> keySelector, Expression<Func<TSource, TElement>> elementSelector, Expression<Func<TKey, IEnumerable<TElement>, TResult>> resultSelector)
1308new Func<IQueryable<TSource>, Expression<Func<TSource, TKey>>, Expression<Func<TSource, TElement>>, Expression<Func<TKey, IEnumerable<TElement>, TResult>>, IQueryable<TResult>>(GroupBy).Method,
1313public static IQueryable<TResult> GroupBy<TSource, TKey, TResult>(this IQueryable<TSource> source, Expression<Func<TSource, TKey>> keySelector, Expression<Func<TKey, IEnumerable<TSource>, TResult>> resultSelector)
1322new Func<IQueryable<TSource>, Expression<Func<TSource, TKey>>, Expression<Func<TKey, IEnumerable<TSource>, TResult>>, IQueryable<TResult>>(GroupBy).Method,
1327public static IQueryable<TResult> GroupBy<TSource, TKey, TResult>(this IQueryable<TSource> source, Expression<Func<TSource, TKey>> keySelector, Expression<Func<TKey, IEnumerable<TSource>, TResult>> resultSelector, IEqualityComparer<TKey>? comparer)
1336new Func<IQueryable<TSource>, Expression<Func<TSource, TKey>>, Expression<Func<TKey, IEnumerable<TSource>, TResult>>, IEqualityComparer<TKey>, IQueryable<TResult>>(GroupBy).Method,
1341public static IQueryable<TResult> GroupBy<TSource, TKey, TElement, TResult>(this IQueryable<TSource> source, Expression<Func<TSource, TKey>> keySelector, Expression<Func<TSource, TElement>> elementSelector, Expression<Func<TKey, IEnumerable<TElement>, TResult>> resultSelector, IEqualityComparer<TKey>? comparer)
1351new Func<IQueryable<TSource>, Expression<Func<TSource, TKey>>, Expression<Func<TSource, TElement>>, Expression<Func<TKey, IEnumerable<TElement>, TResult>>, IEqualityComparer<TKey>, IQueryable<TResult>>(GroupBy).Method,
1387public static IQueryable<TSource> DistinctBy<TSource, TKey>(this IQueryable<TSource> source, Expression<Func<TSource, TKey>> keySelector)
1395new Func<IQueryable<TSource>, Expression<Func<TSource, TKey>>, IQueryable<TSource>>(DistinctBy).Method,
1408public static IQueryable<TSource> DistinctBy<TSource, TKey>(this IQueryable<TSource> source, Expression<Func<TSource, TKey>> keySelector, IEqualityComparer<TKey>? comparer)
1416new Func<IQueryable<TSource>, Expression<Func<TSource, TKey>>, IEqualityComparer<TKey>, IQueryable<TSource>>(DistinctBy).Method,
1544public static IQueryable<TSource> UnionBy<TSource, TKey>(this IQueryable<TSource> source1, IEnumerable<TSource> source2, Expression<Func<TSource, TKey>> keySelector)
1553new Func<IQueryable<TSource>, IEnumerable<TSource>, Expression<Func<TSource, TKey>>, IQueryable<TSource>>(UnionBy).Method,
1567public static IQueryable<TSource> UnionBy<TSource, TKey>(this IQueryable<TSource> source1, IEnumerable<TSource> source2, Expression<Func<TSource, TKey>> keySelector, IEqualityComparer<TKey>? comparer)
1576new Func<IQueryable<TSource>, IEnumerable<TSource>, Expression<Func<TSource, TKey>>, IEqualityComparer<TKey>, IQueryable<TSource>>(UnionBy).Method,
1637public static IQueryable<TSource> IntersectBy<TSource, TKey>(this IQueryable<TSource> source1, IEnumerable<TKey> source2, Expression<Func<TSource, TKey>> keySelector)
1646new Func<IQueryable<TSource>, IEnumerable<TKey>, Expression<Func<TSource, TKey>>, IQueryable<TSource>>(IntersectBy).Method,
1662public static IQueryable<TSource> IntersectBy<TSource, TKey>(this IQueryable<TSource> source1, IEnumerable<TKey> source2, Expression<Func<TSource, TKey>> keySelector, IEqualityComparer<TKey>? comparer)
1671new Func<IQueryable<TSource>, IEnumerable<TKey>, Expression<Func<TSource, TKey>>, IEqualityComparer<TKey>, IQueryable<TSource>>(IntersectBy).Method,
1716public static IQueryable<TSource> ExceptBy<TSource, TKey>(this IQueryable<TSource> source1, IEnumerable<TKey> source2, Expression<Func<TSource, TKey>> keySelector)
1725new Func<IQueryable<TSource>, IEnumerable<TKey>, Expression<Func<TSource, TKey>>, IQueryable<TSource>>(ExceptBy).Method,
1742public static IQueryable<TSource> ExceptBy<TSource, TKey>(this IQueryable<TSource> source1, IEnumerable<TKey> source2, Expression<Func<TSource, TKey>> keySelector, IEqualityComparer<TKey>? comparer)
1751new Func<IQueryable<TSource>, IEnumerable<TKey>, Expression<Func<TSource, TKey>>, IEqualityComparer<TKey>, IQueryable<TSource>>(ExceptBy).Method,
1771public static TSource First<TSource>(this IQueryable<TSource> source, Expression<Func<TSource, bool>> predicate)
1779new Func<IQueryable<TSource>, Expression<Func<TSource, bool>>, TSource>(First).Method,
1814public static TSource? FirstOrDefault<TSource>(this IQueryable<TSource> source, Expression<Func<TSource, bool>> predicate)
1822new Func<IQueryable<TSource>, Expression<Func<TSource, bool>>, TSource?>(FirstOrDefault).Method,
1834public static TSource FirstOrDefault<TSource>(this IQueryable<TSource> source, Expression<Func<TSource, bool>> predicate, TSource defaultValue)
1842new Func<IQueryable<TSource>, Expression<Func<TSource, bool>>, TSource, TSource>(FirstOrDefault).Method,
1859public static TSource Last<TSource>(this IQueryable<TSource> source, Expression<Func<TSource, bool>> predicate)
1867new Func<IQueryable<TSource>, Expression<Func<TSource, bool>>, TSource>(Last).Method,
1902public static TSource? LastOrDefault<TSource>(this IQueryable<TSource> source, Expression<Func<TSource, bool>> predicate)
1910new Func<IQueryable<TSource>, Expression<Func<TSource, bool>>, TSource?>(LastOrDefault).Method,
1922public static TSource LastOrDefault<TSource>(this IQueryable<TSource> source, Expression<Func<TSource, bool>> predicate, TSource defaultValue)
1930new Func<IQueryable<TSource>, Expression<Func<TSource, bool>>, TSource, TSource>(LastOrDefault).Method,
1948public static TSource Single<TSource>(this IQueryable<TSource> source, Expression<Func<TSource, bool>> predicate)
1956new Func<IQueryable<TSource>, Expression<Func<TSource, bool>>, TSource>(Single).Method,
1992public static TSource? SingleOrDefault<TSource>(this IQueryable<TSource> source, Expression<Func<TSource, bool>> predicate)
2000new Func<IQueryable<TSource>, Expression<Func<TSource, bool>>, TSource?>(SingleOrDefault).Method,
2013public static TSource SingleOrDefault<TSource>(this IQueryable<TSource> source, Expression<Func<TSource, bool>> predicate, TSource defaultValue)
2021new Func<IQueryable<TSource>, Expression<Func<TSource, bool>>, TSource, TSource>(SingleOrDefault).Method,
2205public static bool Any<TSource>(this IQueryable<TSource> source, Expression<Func<TSource, bool>> predicate)
2213new Func<IQueryable<TSource>, Expression<Func<TSource, bool>>, bool>(Any).Method,
2218public static bool All<TSource>(this IQueryable<TSource> source, Expression<Func<TSource, bool>> predicate)
2226new Func<IQueryable<TSource>, Expression<Func<TSource, bool>>, bool>(All).Method,
2243public static int Count<TSource>(this IQueryable<TSource> source, Expression<Func<TSource, bool>> predicate)
2251new Func<IQueryable<TSource>, Expression<Func<TSource, bool>>, int>(Count).Method,
2264public static IQueryable<KeyValuePair<TKey, int>> CountBy<TSource, TKey>(this IQueryable<TSource> source, Expression<Func<TSource, TKey>> keySelector, IEqualityComparer<TKey>? comparer = null) where TKey : notnull
2272new Func<IQueryable<TSource>, Expression<Func<TSource, TKey>>, IEqualityComparer<TKey>, IQueryable<KeyValuePair<TKey, int>>>(CountBy).Method,
2289public static long LongCount<TSource>(this IQueryable<TSource> source, Expression<Func<TSource, bool>> predicate)
2297new Func<IQueryable<TSource>, Expression<Func<TSource, bool>>, long>(LongCount).Method,
2334public static TResult? Min<TSource, TResult>(this IQueryable<TSource> source, Expression<Func<TSource, TResult>> selector)
2342new Func<IQueryable<TSource>, Expression<Func<TSource, TResult>>, TResult?>(Min).Method,
2355public static TSource? MinBy<TSource, TKey>(this IQueryable<TSource> source, Expression<Func<TSource, TKey>> keySelector)
2363new Func<IQueryable<TSource>, Expression<Func<TSource, TKey>>, TSource?>(MinBy).Method,
2381public static TSource? MinBy<TSource, TKey>(this IQueryable<TSource> source, Expression<Func<TSource, TKey>> keySelector, IComparer<TSource>? comparer)
2389new Func<IQueryable<TSource>, Expression<Func<TSource, TKey>>, IComparer<TSource>, TSource?>(MinBy).Method,
2405public static TSource? MinBy<TSource, TKey>(this IQueryable<TSource> source, Expression<Func<TSource, TKey>> keySelector, IComparer<TKey>? comparer)
2413new Func<IQueryable<TSource>, Expression<Func<TSource, TKey>>, IComparer<TKey>, TSource?>(MinBy).Method,
2451public static TResult? Max<TSource, TResult>(this IQueryable<TSource> source, Expression<Func<TSource, TResult>> selector)
2459new Func<IQueryable<TSource>, Expression<Func<TSource, TResult>>, TResult?>(Max).Method,
2472public static TSource? MaxBy<TSource, TKey>(this IQueryable<TSource> source, Expression<Func<TSource, TKey>> keySelector)
2480new Func<IQueryable<TSource>, Expression<Func<TSource, TKey>>, TSource?>(MaxBy).Method,
2498public static TSource? MaxBy<TSource, TKey>(this IQueryable<TSource> source, Expression<Func<TSource, TKey>> keySelector, IComparer<TSource>? comparer)
2506new Func<IQueryable<TSource>, Expression<Func<TSource, TKey>>, IComparer<TSource>, TSource?>(MaxBy).Method,
2522public static TSource? MaxBy<TSource, TKey>(this IQueryable<TSource> source, Expression<Func<TSource, TKey>> keySelector, IComparer<TKey>? comparer)
2530new Func<IQueryable<TSource>, Expression<Func<TSource, TKey>>, IComparer<TKey>, TSource?>(MaxBy).Method,
2657public static int Sum<TSource>(this IQueryable<TSource> source, Expression<Func<TSource, int>> selector)
2665new Func<IQueryable<TSource>, Expression<Func<TSource, int>>, int>(Sum).Method,
2670public static int? Sum<TSource>(this IQueryable<TSource> source, Expression<Func<TSource, int?>> selector)
2678new Func<IQueryable<TSource>, Expression<Func<TSource, int?>>, int?>(Sum).Method,
2683public static long Sum<TSource>(this IQueryable<TSource> source, Expression<Func<TSource, long>> selector)
2691new Func<IQueryable<TSource>, Expression<Func<TSource, long>>, long>(Sum).Method,
2696public static long? Sum<TSource>(this IQueryable<TSource> source, Expression<Func<TSource, long?>> selector)
2704new Func<IQueryable<TSource>, Expression<Func<TSource, long?>>, long?>(Sum).Method,
2709public static float Sum<TSource>(this IQueryable<TSource> source, Expression<Func<TSource, float>> selector)
2717new Func<IQueryable<TSource>, Expression<Func<TSource, float>>, float>(Sum).Method,
2722public static float? Sum<TSource>(this IQueryable<TSource> source, Expression<Func<TSource, float?>> selector)
2730new Func<IQueryable<TSource>, Expression<Func<TSource, float?>>, float?>(Sum).Method,
2735public static double Sum<TSource>(this IQueryable<TSource> source, Expression<Func<TSource, double>> selector)
2743new Func<IQueryable<TSource>, Expression<Func<TSource, double>>, double>(Sum).Method,
2748public static double? Sum<TSource>(this IQueryable<TSource> source, Expression<Func<TSource, double?>> selector)
2756new Func<IQueryable<TSource>, Expression<Func<TSource, double?>>, double?>(Sum).Method,
2761public static decimal Sum<TSource>(this IQueryable<TSource> source, Expression<Func<TSource, decimal>> selector)
2769new Func<IQueryable<TSource>, Expression<Func<TSource, decimal>>, decimal>(Sum).Method,
2774public static decimal? Sum<TSource>(this IQueryable<TSource> source, Expression<Func<TSource, decimal?>> selector)
2782new Func<IQueryable<TSource>, Expression<Func<TSource, decimal?>>, decimal?>(Sum).Method,
2907public static double Average<TSource>(this IQueryable<TSource> source, Expression<Func<TSource, int>> selector)
2915new Func<IQueryable<TSource>, Expression<Func<TSource, int>>, double>(Average).Method,
2920public static double? Average<TSource>(this IQueryable<TSource> source, Expression<Func<TSource, int?>> selector)
2928new Func<IQueryable<TSource>, Expression<Func<TSource, int?>>, double?>(Average).Method,
2933public static float Average<TSource>(this IQueryable<TSource> source, Expression<Func<TSource, float>> selector)
2941new Func<IQueryable<TSource>, Expression<Func<TSource, float>>, float>(Average).Method,
2946public static float? Average<TSource>(this IQueryable<TSource> source, Expression<Func<TSource, float?>> selector)
2954new Func<IQueryable<TSource>, Expression<Func<TSource, float?>>, float?>(Average).Method,
2959public static double Average<TSource>(this IQueryable<TSource> source, Expression<Func<TSource, long>> selector)
2967new Func<IQueryable<TSource>, Expression<Func<TSource, long>>, double>(Average).Method,
2972public static double? Average<TSource>(this IQueryable<TSource> source, Expression<Func<TSource, long?>> selector)
2980new Func<IQueryable<TSource>, Expression<Func<TSource, long?>>, double?>(Average).Method,
2985public static double Average<TSource>(this IQueryable<TSource> source, Expression<Func<TSource, double>> selector)
2993new Func<IQueryable<TSource>, Expression<Func<TSource, double>>, double>(Average).Method,
2998public static double? Average<TSource>(this IQueryable<TSource> source, Expression<Func<TSource, double?>> selector)
3006new Func<IQueryable<TSource>, Expression<Func<TSource, double?>>, double?>(Average).Method,
3011public static decimal Average<TSource>(this IQueryable<TSource> source, Expression<Func<TSource, decimal>> selector)
3019new Func<IQueryable<TSource>, Expression<Func<TSource, decimal>>, decimal>(Average).Method,
3024public static decimal? Average<TSource>(this IQueryable<TSource> source, Expression<Func<TSource, decimal?>> selector)
3032new Func<IQueryable<TSource>, Expression<Func<TSource, decimal?>>, decimal?>(Average).Method,
3063public static TResult Aggregate<TSource, TAccumulate, TResult>(this IQueryable<TSource> source, TAccumulate seed, Expression<Func<TAccumulate, TSource, TAccumulate>> func, Expression<Func<TAccumulate, TResult>> selector)
3072new Func<IQueryable<TSource>, TAccumulate, Expression<Func<TAccumulate, TSource, TAccumulate>>, Expression<Func<TAccumulate, TResult>>, TResult>(Aggregate).Method,
3089/// This method is comparable to the <see cref="GroupBy{TSource, TKey}(IQueryable{TSource}, Expression{Func{TSource, TKey}})"/> methods
3093public static IQueryable<KeyValuePair<TKey, TAccumulate>> AggregateBy<TSource, TKey, TAccumulate>(this IQueryable<TSource> source, Expression<Func<TSource, TKey>> keySelector, TAccumulate seed, Expression<Func<TAccumulate, TSource, TAccumulate>> func, IEqualityComparer<TKey>? keyComparer = null) where TKey : notnull
3102new Func<IQueryable<TSource>, Expression<Func<TSource, TKey>>, TAccumulate, Expression<Func<TAccumulate, TSource, TAccumulate>>, IEqualityComparer<TKey>, IQueryable<KeyValuePair<TKey, TAccumulate>>>(AggregateBy).Method,
3119/// This method is comparable to the <see cref="GroupBy{TSource, TKey}(IQueryable{TSource}, Expression{Func{TSource, TKey}})"/> methods
3123public static IQueryable<KeyValuePair<TKey, TAccumulate>> AggregateBy<TSource, TKey, TAccumulate>(this IQueryable<TSource> source, Expression<Func<TSource, TKey>> keySelector, Expression<Func<TKey, TAccumulate>> seedSelector, Expression<Func<TAccumulate, TSource, TAccumulate>> func, IEqualityComparer<TKey>? keyComparer = null) where TKey : notnull
3133new Func<IQueryable<TSource>, Expression<Func<TSource, TKey>>, Expression<Func<TKey, TAccumulate>>, Expression<Func<TAccumulate, TSource, TAccumulate>>, IEqualityComparer<TKey>, IQueryable<KeyValuePair<TKey, TAccumulate>>>(AggregateBy).Method,
System.Net.Http (3)
System.Net.HttpListener (9)
System\Net\Windows\CookieExtensions.cs (9)
13private static Func<Cookie, string>? s_toServerStringFunc;
17s_toServerStringFunc ??= (Func<Cookie, string>)typeof(Cookie).GetMethod("ToServerString", BindingFlags.Instance | BindingFlags.NonPublic)?.CreateDelegate(typeof(Func<Cookie, string>))!;
22private static Func<Cookie, Cookie>? s_cloneFunc;
26s_cloneFunc ??= (Func<Cookie, Cookie>)typeof(Cookie).GetMethod("Clone", BindingFlags.Instance | BindingFlags.NonPublic)?.CreateDelegate(typeof(Func<Cookie, Cookie>))!;
40private static Func<Cookie, CookieVariant>? s_getVariantFunc;
44s_getVariantFunc ??= (Func<Cookie, CookieVariant>)typeof(Cookie).GetProperty("Variant", BindingFlags.Instance | BindingFlags.NonPublic)?.GetGetMethod(true)?.CreateDelegate(typeof(Func<Cookie, CookieVariant>))!;
System.Net.Quic (3)
System.Net.Security (2)
System.Net.WebClient (1)
System.Net.WebHeaderCollection (5)
System.Private.CoreLib (159)
src\libraries\System.Private.CoreLib\src\System\Diagnostics\Tracing\TraceLogging\PropertyValue.cs (31)
103public static Func<object?, PropertyValue> GetFactory(Type type)
158public static Func<PropertyValue, PropertyValue> GetPropertyGetter(PropertyInfo property)
172private static Func<PropertyValue, PropertyValue> GetBoxedValueTypePropertyGetter(PropertyInfo property)
179Func<object?, PropertyValue> factory = GetFactory(type);
193private static Func<PropertyValue, PropertyValue> GetReferenceTypePropertyGetter(PropertyInfo property)
201public abstract Func<PropertyValue, PropertyValue> GetPropertyGetter(PropertyInfo property);
207return property.GetMethod!.CreateDelegate(typeof(Func<,>).MakeGenericType(property.DeclaringType!, propertyType));
213private static Func<TContainer, TProperty> GetGetMethod<TProperty>(PropertyInfo property) where TProperty : struct =>
214property.GetMethod!.CreateDelegate<Func<TContainer, TProperty>>();
216public override Func<PropertyValue, PropertyValue> GetPropertyGetter(PropertyInfo property)
222var getter = (Func<TContainer, object?>)GetGetMethod(property, type);
230if (type == typeof(bool)) { var f = GetGetMethod<bool>(property); return container => new PropertyValue(f((TContainer)container.ReferenceValue!)); }
231if (type == typeof(byte)) { var f = GetGetMethod<byte>(property); return container => new PropertyValue(f((TContainer)container.ReferenceValue!)); }
232if (type == typeof(sbyte)) { var f = GetGetMethod<sbyte>(property); return container => new PropertyValue(f((TContainer)container.ReferenceValue!)); }
233if (type == typeof(char)) { var f = GetGetMethod<char>(property); return container => new PropertyValue(f((TContainer)container.ReferenceValue!)); }
234if (type == typeof(short)) { var f = GetGetMethod<short>(property); return container => new PropertyValue(f((TContainer)container.ReferenceValue!)); }
235if (type == typeof(ushort)) { var f = GetGetMethod<ushort>(property); return container => new PropertyValue(f((TContainer)container.ReferenceValue!)); }
236if (type == typeof(int)) { var f = GetGetMethod<int>(property); return container => new PropertyValue(f((TContainer)container.ReferenceValue!)); }
237if (type == typeof(uint)) { var f = GetGetMethod<uint>(property); return container => new PropertyValue(f((TContainer)container.ReferenceValue!)); }
238if (type == typeof(long)) { var f = GetGetMethod<long>(property); return container => new PropertyValue(f((TContainer)container.ReferenceValue!)); }
239if (type == typeof(ulong)) { var f = GetGetMethod<ulong>(property); return container => new PropertyValue(f((TContainer)container.ReferenceValue!)); }
240if (type == typeof(IntPtr)) { var f = GetGetMethod<IntPtr>(property); return container => new PropertyValue(f((TContainer)container.ReferenceValue!)); }
241if (type == typeof(UIntPtr)) { var f = GetGetMethod<UIntPtr>(property); return container => new PropertyValue(f((TContainer)container.ReferenceValue!)); }
242if (type == typeof(float)) { var f = GetGetMethod<float>(property); return container => new PropertyValue(f((TContainer)container.ReferenceValue!)); }
243if (type == typeof(double)) { var f = GetGetMethod<double>(property); return container => new PropertyValue(f((TContainer)container.ReferenceValue!)); }
244if (type == typeof(Guid)) { var f = GetGetMethod<Guid>(property); return container => new PropertyValue(f((TContainer)container.ReferenceValue!)); }
245if (type == typeof(DateTime)) { var f = GetGetMethod<DateTime>(property); return container => new PropertyValue(f((TContainer)container.ReferenceValue!)); }
246if (type == typeof(DateTimeOffset)) { var f = GetGetMethod<DateTimeOffset>(property); return container => new PropertyValue(f((TContainer)container.ReferenceValue!)); }
247if (type == typeof(TimeSpan)) { var f = GetGetMethod<TimeSpan>(property); return container => new PropertyValue(f((TContainer)container.ReferenceValue!)); }
248if (type == typeof(decimal)) { var f = GetGetMethod<decimal>(property); return container => new PropertyValue(f((TContainer)container.ReferenceValue!)); }
src\libraries\System.Private.CoreLib\src\System\Threading\Tasks\Future.cs (12)
193public Task(Func<object?, TResult> function, object? state)
214public Task(Func<object?, TResult> function, object? state, CancellationToken cancellationToken)
239public Task(Func<object?, TResult> function, object? state, TaskCreationOptions creationOptions)
269public Task(Func<object?, TResult> function, object? state, CancellationToken cancellationToken, TaskCreationOptions creationOptions)
328internal static Task<TResult> StartNew(Task? parent, Func<object?, TResult> function, object? state, CancellationToken cancellationToken,
490if (m_action is Func<object?, TResult> funcWithState)
996public Task<TNewResult> ContinueWith<TNewResult>(Func<Task<TResult>, TNewResult> continuationFunction)
1025public Task<TNewResult> ContinueWith<TNewResult>(Func<Task<TResult>, TNewResult> continuationFunction, CancellationToken cancellationToken)
1055public Task<TNewResult> ContinueWith<TNewResult>(Func<Task<TResult>, TNewResult> continuationFunction, TaskScheduler scheduler)
1097public Task<TNewResult> ContinueWith<TNewResult>(Func<Task<TResult>, TNewResult> continuationFunction, TaskContinuationOptions continuationOptions)
1150public Task<TNewResult> ContinueWith<TNewResult>(Func<Task<TResult>, TNewResult> continuationFunction, CancellationToken cancellationToken,
1157internal Task<TNewResult> ContinueWith<TNewResult>(Func<Task<TResult>, TNewResult> continuationFunction, TaskScheduler scheduler,
src\libraries\System.Private.CoreLib\src\System\Threading\Tasks\FutureFactory.cs (47)
377public Task<TResult> StartNew(Func<object?, TResult> function, object? state)
406public Task<TResult> StartNew(Func<object?, TResult> function, object? state, CancellationToken cancellationToken)
437public Task<TResult> StartNew(Func<object?, TResult> function, object? state, TaskCreationOptions creationOptions)
479public Task<TResult> StartNew(Func<object?, TResult> function, object? state, CancellationToken cancellationToken, TaskCreationOptions creationOptions, TaskScheduler scheduler)
492Func<IAsyncResult, TResult>? endFunction,
560public Task<TResult> FromAsync(IAsyncResult asyncResult, Func<IAsyncResult, TResult> endMethod)
586Func<IAsyncResult, TResult> endMethod,
619Func<IAsyncResult, TResult> endMethod,
630Func<IAsyncResult, TResult>? endFunction,
715Func<IAsyncResult, TResult> endMethod, object? state)
744Func<IAsyncResult, TResult> endMethod, object? state, TaskCreationOptions creationOptions)
752Func<IAsyncResult, TResult>? endFunction, Action<IAsyncResult>? endAction,
826Func<IAsyncResult, TResult> endMethod,
860Func<IAsyncResult, TResult> endMethod,
869Func<IAsyncResult, TResult>? endFunction, Action<IAsyncResult>? endAction,
947Func<IAsyncResult, TResult> endMethod,
985Func<IAsyncResult, TResult> endMethod,
994Func<IAsyncResult, TResult>? endFunction, Action<IAsyncResult>? endAction,
1076Func<IAsyncResult, TResult> endMethod,
1118Func<IAsyncResult, TResult> endMethod,
1127Func<IAsyncResult, TResult>? endFunction, Action<IAsyncResult>? endAction,
1348public Task<TResult> ContinueWhenAll(Task[] tasks, Func<Task[], TResult> continuationFunction)
1376public Task<TResult> ContinueWhenAll(Task[] tasks, Func<Task[], TResult> continuationFunction, CancellationToken cancellationToken)
1410public Task<TResult> ContinueWhenAll(Task[] tasks, Func<Task[], TResult> continuationFunction, TaskContinuationOptions continuationOptions)
1454public Task<TResult> ContinueWhenAll(Task[] tasks, Func<Task[], TResult> continuationFunction,
1479public Task<TResult> ContinueWhenAll<TAntecedentResult>(Task<TAntecedentResult>[] tasks, Func<Task<TAntecedentResult>[], TResult> continuationFunction)
1508public Task<TResult> ContinueWhenAll<TAntecedentResult>(Task<TAntecedentResult>[] tasks, Func<Task<TAntecedentResult>[], TResult> continuationFunction,
1544public Task<TResult> ContinueWhenAll<TAntecedentResult>(Task<TAntecedentResult>[] tasks, Func<Task<TAntecedentResult>[], TResult> continuationFunction,
1590public Task<TResult> ContinueWhenAll<TAntecedentResult>(Task<TAntecedentResult>[] tasks, Func<Task<TAntecedentResult>[], TResult> continuationFunction,
1602Func<Task<TAntecedentResult>[], TResult>? continuationFunction, Action<Task<TAntecedentResult>[]>? continuationAction,
1629static (starter, continuationFunction) => ((Func<Task<TAntecedentResult>[], TResult>)continuationFunction!)(starter.Result),
1649Func<Task[], TResult>? continuationFunction, Action<Task[]>? continuationAction,
1679Debug.Assert(state is Func<Task[], TResult>);
1680return ((Func<Task[], TResult>)state)(completedTasks.Result);
1718public Task<TResult> ContinueWhenAny(Task[] tasks, Func<Task, TResult> continuationFunction)
1746public Task<TResult> ContinueWhenAny(Task[] tasks, Func<Task, TResult> continuationFunction, CancellationToken cancellationToken)
1780public Task<TResult> ContinueWhenAny(Task[] tasks, Func<Task, TResult> continuationFunction, TaskContinuationOptions continuationOptions)
1824public Task<TResult> ContinueWhenAny(Task[] tasks, Func<Task, TResult> continuationFunction,
1849public Task<TResult> ContinueWhenAny<TAntecedentResult>(Task<TAntecedentResult>[] tasks, Func<Task<TAntecedentResult>, TResult> continuationFunction)
1878public Task<TResult> ContinueWhenAny<TAntecedentResult>(Task<TAntecedentResult>[] tasks, Func<Task<TAntecedentResult>, TResult> continuationFunction,
1914public Task<TResult> ContinueWhenAny<TAntecedentResult>(Task<TAntecedentResult>[] tasks, Func<Task<TAntecedentResult>, TResult> continuationFunction,
1960public Task<TResult> ContinueWhenAny<TAntecedentResult>(Task<TAntecedentResult>[] tasks, Func<Task<TAntecedentResult>, TResult> continuationFunction,
1971Func<Task, TResult>? continuationFunction, Action<Task>? continuationAction,
1999Debug.Assert(state is Func<Task, TResult>);
2000return ((Func<Task, TResult>)state)(completedTask.Result);
2022Func<Task<TAntecedentResult>, TResult>? continuationFunction, Action<Task<TAntecedentResult>>? continuationAction,
2047static (starter, continuationFunction) => ((Func<Task<TAntecedentResult>, TResult>)continuationFunction!)(starter.Result),
src\libraries\System.Private.CoreLib\src\System\Threading\Tasks\Task.cs (6)
4005public Task<TResult> ContinueWith<TResult>(Func<Task, TResult> continuationFunction)
4034public Task<TResult> ContinueWith<TResult>(Func<Task, TResult> continuationFunction, CancellationToken cancellationToken)
4064public Task<TResult> ContinueWith<TResult>(Func<Task, TResult> continuationFunction, TaskScheduler scheduler)
4100public Task<TResult> ContinueWith<TResult>(Func<Task, TResult> continuationFunction, TaskContinuationOptions continuationOptions)
4146public Task<TResult> ContinueWith<TResult>(Func<Task, TResult> continuationFunction, CancellationToken cancellationToken,
4153private Task<TResult> ContinueWith<TResult>(Func<Task, TResult> continuationFunction, TaskScheduler scheduler,
src\libraries\System.Private.CoreLib\src\System\Threading\Tasks\TaskContinuation.cs (4)
64Debug.Assert(function is Func<Task, TResult> || function is Func<Task, object?, TResult>,
86if (m_action is Func<Task, TResult> func)
156Debug.Assert(function is Func<Task<TAntecedentResult>, TResult> || function is Func<Task<TAntecedentResult>, object?, TResult>,
178if (m_action is Func<Task<TAntecedentResult>, TResult> func)
src\libraries\System.Private.CoreLib\src\System\Threading\Tasks\TaskFactory.cs (31)
654public Task<TResult> StartNew<TResult>(Func<object?, TResult> function, object? state)
687public Task<TResult> StartNew<TResult>(Func<object?, TResult> function, object? state, CancellationToken cancellationToken)
721public Task<TResult> StartNew<TResult>(Func<object?, TResult> function, object? state, TaskCreationOptions creationOptions)
766public Task<TResult> StartNew<TResult>(Func<object?, TResult> function, object? state, CancellationToken cancellationToken,
1154IAsyncResult asyncResult, Func<IAsyncResult, TResult> endMethod)
1182IAsyncResult asyncResult, Func<IAsyncResult, TResult> endMethod, TaskCreationOptions creationOptions)
1214IAsyncResult asyncResult, Func<IAsyncResult, TResult> endMethod, TaskCreationOptions creationOptions, TaskScheduler scheduler)
1241Func<IAsyncResult, TResult> endMethod, object? state)
1273Func<IAsyncResult, TResult> endMethod, object? state, TaskCreationOptions creationOptions)
1304Func<IAsyncResult, TResult> endMethod, TArg1 arg1, object? state)
1339Func<IAsyncResult, TResult> endMethod, TArg1 arg1, object? state, TaskCreationOptions creationOptions)
1373Func<IAsyncResult, TResult> endMethod, TArg1 arg1, TArg2 arg2, object? state)
1413Func<IAsyncResult, TResult> endMethod, TArg1 arg1, TArg2 arg2, object? state, TaskCreationOptions creationOptions)
1452Func<IAsyncResult, TResult> endMethod, TArg1 arg1, TArg2 arg2, TArg3 arg3, object? state)
1496Func<IAsyncResult, TResult> endMethod, TArg1 arg1, TArg2 arg2, TArg3 arg3, object? state, TaskCreationOptions creationOptions)
1969public Task<TResult> ContinueWhenAll<TResult>(Task[] tasks, Func<Task[], TResult> continuationFunction)
2002public Task<TResult> ContinueWhenAll<TResult>(Task[] tasks, Func<Task[], TResult> continuationFunction, CancellationToken cancellationToken)
2040public Task<TResult> ContinueWhenAll<TResult>(Task[] tasks, Func<Task[], TResult> continuationFunction, TaskContinuationOptions continuationOptions)
2088public Task<TResult> ContinueWhenAll<TResult>(Task[] tasks, Func<Task[], TResult> continuationFunction, CancellationToken cancellationToken,
2118public Task<TResult> ContinueWhenAll<TAntecedentResult, TResult>(Task<TAntecedentResult>[] tasks, Func<Task<TAntecedentResult>[], TResult> continuationFunction)
2151public Task<TResult> ContinueWhenAll<TAntecedentResult, TResult>(Task<TAntecedentResult>[] tasks, Func<Task<TAntecedentResult>[], TResult> continuationFunction,
2191public Task<TResult> ContinueWhenAll<TAntecedentResult, TResult>(Task<TAntecedentResult>[] tasks, Func<Task<TAntecedentResult>[], TResult> continuationFunction,
2241public Task<TResult> ContinueWhenAll<TAntecedentResult, TResult>(Task<TAntecedentResult>[] tasks, Func<Task<TAntecedentResult>[], TResult> continuationFunction,
2549public Task<TResult> ContinueWhenAny<TResult>(Task[] tasks, Func<Task, TResult> continuationFunction)
2581public Task<TResult> ContinueWhenAny<TResult>(Task[] tasks, Func<Task, TResult> continuationFunction, CancellationToken cancellationToken)
2619public Task<TResult> ContinueWhenAny<TResult>(Task[] tasks, Func<Task, TResult> continuationFunction, TaskContinuationOptions continuationOptions)
2667public Task<TResult> ContinueWhenAny<TResult>(Task[] tasks, Func<Task, TResult> continuationFunction, CancellationToken cancellationToken,
2696public Task<TResult> ContinueWhenAny<TAntecedentResult, TResult>(Task<TAntecedentResult>[] tasks, Func<Task<TAntecedentResult>, TResult> continuationFunction)
2729public Task<TResult> ContinueWhenAny<TAntecedentResult, TResult>(Task<TAntecedentResult>[] tasks, Func<Task<TAntecedentResult>, TResult> continuationFunction,
2769public Task<TResult> ContinueWhenAny<TAntecedentResult, TResult>(Task<TAntecedentResult>[] tasks, Func<Task<TAntecedentResult>, TResult> continuationFunction,
2819public Task<TResult> ContinueWhenAny<TAntecedentResult, TResult>(Task<TAntecedentResult>[] tasks, Func<Task<TAntecedentResult>, TResult> continuationFunction,
System.Private.DataContractSerialization (11)
System.Private.Windows.Core (15)
System\Private\Windows\Ole\IDataObjectInternal.cs (4)
96/// <inheritdoc cref="TryGetData{T}(string, Func{TypeName, Type}, bool, out T)"/>
103/// <inheritdoc cref="TryGetData{T}(string, Func{TypeName, Type}, bool, out T)"/>
112/// <inheritdoc cref="TryGetData{T}(string, Func{TypeName, Type}, bool, out T)"/>
151Func<TypeName, Type?> resolver,
Windows\Win32\System\Com\WinFormsComWrappers.cs (3)
59internal static HRESULT UnwrapAndInvoke<TThis, TInterface>(TThis* @this, Func<TInterface, HRESULT> func)
74internal static TReturnType UnwrapAndInvoke<TThis, TInterface, TReturnType>(TThis* @this, Func<TInterface, TReturnType> func)
95/// <inheritdoc cref="UnwrapAndInvoke{TThis, TInterface}(TThis*, Func{TInterface, HRESULT})"/>
System.Private.Windows.Core.Tests (9)
System\Private\Windows\Ole\BinaryFormatUtilitesTestsBase.cs (5)
46Func<TypeName, Type>? resolver,
64protected bool ReadObjectFromStream<T>(bool restrictDeserialization, Func<TypeName, Type>? resolver, out T? @object)
76protected bool TryReadObjectFromStream<T>(Func<TypeName, Type>? resolver, out T? @object)
82protected bool ReadPredefinedObjectFromStream<T>(Func<TypeName, Type>? resolver, out T? @object)
119protected bool RoundTripOfType<T>(object value, Func<TypeName, Type>? resolver, out T? @object)
System.Private.Xml (15)
System\Xml\AsyncHelper.cs (6)
53public static Task CallTaskFuncWhenFinishAsync<TArg>(this Task task, Func<TArg, Task> func, TArg arg)
60private static async Task CallTaskFuncWhenFinishCoreAsync<TArg>(Task task, Func<TArg, Task> func, TArg arg)
66public static Task<bool> CallBoolTaskFuncWhenFinishAsync<TArg>(this Task task, Func<TArg, Task<bool>> func, TArg arg)
73private static async Task<bool> CallBoolTaskFuncWhenFinishCoreAsync<TArg>(this Task task, Func<TArg, Task<bool>> func, TArg arg)
79public static Task<bool> ContinueBoolTaskFuncWhenFalseAsync<TArg>(this Task<bool> task, Func<TArg, Task<bool>> func, TArg arg)
91private static async Task<bool> ContinueBoolTaskFuncWhenFalseCoreAsync<TArg>(Task<bool> task, Func<TArg, Task<bool>> func, TArg arg)
System.Reflection.Context (9)
System.Reflection.Metadata (12)
System.Reflection.MetadataLoadContext (9)
System.Resources.Writer (1)
System.Runtime (1)
System.Runtime.InteropServices.JavaScript (2)
System.Security.Claims (2)
System.Security.Cryptography (9)
System.Security.Cryptography.Pkcs (1)
System.Security.Cryptography.Xml (3)
System.ServiceModel.Federation (2)
System.ServiceModel.Http (2)
System.ServiceModel.Primitives (18)
Internals\System\Runtime\ActionItem.cs (7)
34public static void Schedule(Func<object, Task> callback, object state)
80private static void ScheduleCallback(Func<object, Task> callback, object state)
94private void ScheduleCallback(Func<object, Task> callback)
102private static Func<object, Task> s_invokeAsyncCallback;
122public static Func<object, Task> InvokeAsyncCallbackFunc
149private Func<object, Task> _asyncCallback;
171public DefaultActionItem(Func<object, Task> callback, object state)
System.Text.Json (76)
System\Text\Json\Serialization\Metadata\FSharpCoreReflectionProxy.cs (12)
147public Func<TFSharpOption, T> CreateFSharpOptionValueGetter<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicMethods)] TFSharpOption, T>()
151return CreateDelegate<Func<TFSharpOption, T>>(valueGetter);
156public Func<TElement?, TFSharpOption> CreateFSharpOptionSomeConstructor<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicMethods)] TFSharpOption, TElement>()
160return CreateDelegate<Func<TElement?, TFSharpOption>>(methodInfo);
175public Func<TElement?, TFSharpOption> CreateFSharpValueOptionSomeConstructor<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicMethods)] TFSharpOption, TElement>()
179return CreateDelegate<Func<TElement?, TFSharpOption>>(methodInfo);
184public Func<IEnumerable<TElement>, TFSharpList> CreateFSharpListConstructor<TFSharpList, TElement>()
187return CreateDelegate<Func<IEnumerable<TElement>, TFSharpList>>(EnsureMemberExists(_fsharpListCtor, "Microsoft.FSharp.Collections.ListModule.OfSeq<T>(IEnumerable<T> source)").MakeGenericMethod(typeof(TElement)));
192public Func<IEnumerable<TElement>, TFSharpSet> CreateFSharpSetConstructor<TFSharpSet, TElement>()
195return CreateDelegate<Func<IEnumerable<TElement>, TFSharpSet>>(EnsureMemberExists(_fsharpSetCtor, "Microsoft.FSharp.Collections.SetModule.OfSeq<T>(IEnumerable<T> source)").MakeGenericMethod(typeof(TElement)));
200public Func<IEnumerable<Tuple<TKey, TValue>>, TFSharpMap> CreateFSharpMapConstructor<TFSharpMap, TKey, TValue>()
203return CreateDelegate<Func<IEnumerable<Tuple<TKey, TValue>>, TFSharpMap>>(EnsureMemberExists(_fsharpMapCtor, "Microsoft.FSharp.Collections.MapModule.OfSeq<TKey, TValue>(IEnumerable<Tuple<TKey, TValue>> source)").MakeGenericMethod(typeof(TKey), typeof(TValue)));
System\Text\Json\Serialization\Metadata\ReflectionEmitMemberAccessor.cs (10)
71public override Func<object[], T> CreateParameterizedConstructor<T>(ConstructorInfo constructor) =>
72CreateDelegate<Func<object[], T>>(CreateParameterizedConstructor(constructor));
182public override Func<IEnumerable<TElement>, TCollection> CreateImmutableEnumerableCreateRangeDelegate<TCollection, TElement>() =>
183CreateDelegate<Func<IEnumerable<TElement>, TCollection>>(
206public override Func<IEnumerable<KeyValuePair<TKey, TValue>>, TCollection> CreateImmutableDictionaryCreateRangeDelegate<TCollection, TKey, TValue>() =>
207CreateDelegate<Func<IEnumerable<KeyValuePair<TKey, TValue>>, TCollection>>(
230public override Func<object, TProperty> CreatePropertyGetter<TProperty>(PropertyInfo propertyInfo) =>
231CreateDelegate<Func<object, TProperty>>(CreatePropertyGetter(propertyInfo, typeof(TProperty)));
314public override Func<object, TProperty> CreateFieldGetter<TProperty>(FieldInfo fieldInfo) =>
315CreateDelegate<Func<object, TProperty>>(CreateFieldGetter(fieldInfo, typeof(TProperty)));
System\Text\Json\Serialization\Metadata\ReflectionMemberAccessor.cs (9)
39public override Func<object[], T> CreateParameterizedConstructor<T>(ConstructorInfo constructor)
129public override Func<IEnumerable<TElement>, TCollection> CreateImmutableEnumerableCreateRangeDelegate<TCollection, TElement>()
132return (Func<IEnumerable<TElement>, TCollection>)createRange.CreateDelegate(
133typeof(Func<IEnumerable<TElement>, TCollection>));
136public override Func<IEnumerable<KeyValuePair<TKey, TValue>>, TCollection> CreateImmutableDictionaryCreateRangeDelegate<TCollection, TKey, TValue>()
139return (Func<IEnumerable<KeyValuePair<TKey, TValue>>, TCollection>)createRange.CreateDelegate(
140typeof(Func<IEnumerable<KeyValuePair<TKey, TValue>>, TCollection>));
143public override Func<object, TProperty> CreatePropertyGetter<TProperty>(PropertyInfo propertyInfo)
163public override Func<object, TProperty> CreateFieldGetter<TProperty>(FieldInfo fieldInfo) =>
System.Text.Json.SourceGeneration (2)
System.Text.RegularExpressions (1)
System.Text.RegularExpressions.Generator (1)
System.Threading.Channels (1)
System.Threading.RateLimiting (14)
System.Threading.Tasks.Dataflow (40)
Blocks\TransformBlock.cs (14)
20/// <summary>Provides a dataflow block that invokes a provided <see cref="System.Func{TInput,TOutput}"/> delegate for every data element received.</summary>
44/// <summary>Initializes the <see cref="TransformBlock{TInput,TOutput}"/> with the specified <see cref="System.Func{TInput,TOutput}"/>.</summary>
47public TransformBlock(Func<TInput, TOutput> transform) :
52/// Initializes the <see cref="TransformBlock{TInput,TOutput}"/> with the specified <see cref="System.Func{TInput,TOutput}"/> and
59public TransformBlock(Func<TInput, TOutput> transform, ExecutionDataflowBlockOptions dataflowBlockOptions) :
63/// <summary>Initializes the <see cref="TransformBlock{TInput,TOutput}"/> with the specified <see cref="System.Func{TInput,TOutput}"/>.</summary>
66public TransformBlock(Func<TInput, Task<TOutput>> transform) :
71/// Initializes the <see cref="TransformBlock{TInput,TOutput}"/> with the specified <see cref="System.Func{TInput,TOutput}"/>
78public TransformBlock(Func<TInput, Task<TOutput>> transform, ExecutionDataflowBlockOptions dataflowBlockOptions) :
83/// Initializes the <see cref="TransformBlock{TInput,TOutput}"/> with the specified <see cref="System.Func{TInput,TOutput}"/>
91private TransformBlock(Func<TInput, TOutput>? transformSync, Func<TInput, Task<TOutput>>? transformAsync, ExecutionDataflowBlockOptions dataflowBlockOptions)
171private void ProcessMessage(Func<TInput, TOutput> transform, KeyValuePair<TInput, long> messageWithId)
223private void ProcessMessageWithTask(Func<TInput, Task<TOutput>> transform, KeyValuePair<TInput, long> messageWithId)
Blocks\TransformManyBlock.cs (7)
22/// <summary>Provides a dataflow block that invokes a provided <see cref="System.Func{T,TResult}"/> delegate for every data element received.</summary>
55public TransformManyBlock(Func<TInput, IEnumerable<TOutput>> transform) :
68public TransformManyBlock(Func<TInput, IEnumerable<TOutput>> transform, ExecutionDataflowBlockOptions dataflowBlockOptions)
80public TransformManyBlock(Func<TInput, Task<IEnumerable<TOutput>>> transform) :
92public TransformManyBlock(Func<TInput, Task<IEnumerable<TOutput>>> transform, ExecutionDataflowBlockOptions dataflowBlockOptions)
170private void ProcessMessage(Func<TInput, IEnumerable<TOutput>> transformFunction, KeyValuePair<TInput, long> messageWithId)
195private void ProcessMessageWithTask(Func<TInput, Task<IEnumerable<TOutput>>> function, KeyValuePair<TInput, long> messageWithId)
System.Threading.Tasks.Parallel (8)
System\Threading\Tasks\Parallel.ForEachAsync.cs (8)
96Func<object, Task> taskBody = static async o =>
260Func<object, Task> taskBody = static async o =>
415Func<object, Task> taskBody = static async o =>
519private readonly Func<object, Task> _taskBody;
540protected ForEachAsyncState(Func<object, Task> taskBody, bool needsLock, int dop, TaskScheduler scheduler, CancellationToken cancellationToken, Func<TSource, CancellationToken, ValueTask> body)
691IEnumerable<TSource> source, Func<object, Task> taskBody,
713IAsyncEnumerable<TSource> source, Func<object, Task> taskBody,
736T fromExclusive, T toExclusive, Func<object, Task> taskBody,
System.Windows.Controls.Ribbon (5)
Microsoft\Windows\Controls\Ribbon\RibbonHelper.cs (3)
541internal static bool NavigateToFirstItem(ItemsControl itemsControl, Action<int> bringIntoViewCallback, Func<FrameworkElement, bool> additionalCheck)
552internal static bool NavigateToLastItem(ItemsControl itemsControl, Action<int> bringIntoViewCallback, Func<FrameworkElement, bool> additionalCheck)
563internal static FrameworkElement FindContainer(ItemsControl itemsControl, int startIndex, int direction, Action<int> bringIntoViewCallback, Func<FrameworkElement, bool> additionalCheck)
System.Windows.Forms (33)
System.Windows.Forms.Primitives.TestUtilities (1)
System.Windows.Forms.Tests (42)
System.Windows.Forms.TestUtilities (9)
System.Windows.Forms.UI.IntegrationTests (5)
System.Xaml (15)
System\Xaml\XamlTypeName.cs (6)
150internal static string ConvertListToStringInternal(IList<XamlTypeName> typeNameList, Func<string, string> prefixGenerator)
157internal static void ConvertListToStringInternal(StringBuilder result, IList<XamlTypeName> typeNameList, Func<string, string> prefixGenerator)
175internal static XamlTypeName ParseInternal(string typeName, Func<string, string> prefixResolver, out string error)
188internal static IList<XamlTypeName> ParseListInternal(string typeNameList, Func<string, string> prefixResolver, out string error)
195internal string ConvertToStringInternal(Func<string, string> prefixGenerator)
202internal void ConvertToStringInternal(StringBuilder result, Func<string, string> prefixGenerator)
System.Xaml.Tests (23)
Templates.Blazor.Tests (1)
Test.Utilities (393)
src\Compilers\Core\Portable\FileSystem\FileUtilities.cs (4)
47Func<string, bool> fileExists)
322public static T RethrowExceptionsAsIOException<T, TArg>(Func<TArg, T> operation, TArg arg)
339public static async Task<T> RethrowExceptionsAsIOExceptionAsync<T, TArg>(Func<TArg, Task<T>> operation, TArg arg)
355internal static Stream CreateFileStreamChecked(Func<string, Stream> factory, string path, string? paramName = null)
src\Compilers\Core\Portable\InternalUtilities\InterlockedOperations.cs (5)
46public static T Initialize<T, TArg>([NotNull] ref T? target, Func<TArg, T> valueFactory, TArg arg)
66public static int Initialize<TArg>(ref int target, int uninitializedValue, Func<TArg, int> valueFactory, TArg arg)
103public static T? Initialize<T, TArg>([NotNull] ref StrongBox<T?>? target, Func<TArg, T?> valueFactory, TArg arg)
183public static ImmutableArray<T> Initialize<T, TArg>(ref ImmutableArray<T> target, Func<TArg, ImmutableArray<T>> createArray, TArg arg)
193private static ImmutableArray<T> Initialize_Slow<T, TArg>(ref ImmutableArray<T> target, Func<TArg, ImmutableArray<T>> createArray, TArg arg)
src\Compilers\Core\Portable\SourceGeneration\GeneratedCodeUtilities.cs (4)
49SyntaxTree tree, Func<SyntaxTrivia, bool> isComment, CancellationToken cancellationToken)
55internal static bool IsGeneratedCode(string? filePath, SyntaxNode root, Func<SyntaxTrivia, bool> isComment)
88private static bool BeginsWithAutoGeneratedComment(SyntaxNode root, Func<SyntaxTrivia, bool> isComment)
118SyntaxTree tree, Func<SyntaxTrivia, bool> isComment, CancellationToken cancellationToken)
src\Dependencies\Collections\Extensions\IEnumerableExtensions.cs (30)
164public static T? FirstOrNull<T>(this IEnumerable<T> source, Func<T, bool> predicate)
182public static T? SingleOrNull<T>(this IEnumerable<T> source, Func<T, bool> predicate)
261public static bool HasDuplicates<TItem, TValue>(this IEnumerable<TItem> source, Func<TItem, TValue> selector)
271/// <seealso cref="Microsoft.CodeAnalysis.ImmutableArrayExtensions.HasDuplicates{TItem, TValue}(ImmutableArray{TItem}, Func{TItem, TValue}, IEqualityComparer{TValue})"/>
273public static bool HasDuplicates<TItem, TValue>(this IEnumerable<TItem> source, Func<TItem, TValue> selector, IEqualityComparer<TValue> comparer)
321private static readonly Func<object, bool> s_notNullTest = x => x != null;
331return source.Where((Func<T?, bool>)s_notNullTest)!;
376public static ImmutableArray<T> WhereAsArray<T>(this IEnumerable<T> values, Func<T, bool> predicate)
407public static ImmutableArray<TResult> SelectAsArray<TSource, TResult>(this IEnumerable<TSource>? source, Func<TSource, TResult> selector)
417public static ImmutableArray<TResult> SelectAsArray<TItem, TResult>(this IEnumerable<TItem>? source, Func<TItem, bool> predicate, Func<TItem, TResult> selector)
461public static ImmutableArray<TResult> SelectAsArray<TSource, TResult>(this IReadOnlyCollection<TSource>? source, Func<TSource, TResult> selector)
485public static ImmutableArray<TResult> SelectManyAsArray<TSource, TResult>(this IEnumerable<TSource>? source, Func<TSource, IEnumerable<TResult>> selector)
507public static ImmutableArray<TResult> SelectManyAsArray<TItem, TResult>(this IReadOnlyCollection<TItem>? source, Func<TItem, IEnumerable<TResult>> selector)
533public static ImmutableArray<TResult> SelectManyAsArray<TSource, TResult>(this IEnumerable<TSource>? source, Func<TSource, OneOrMany<TResult>> selector)
547public static async ValueTask<ImmutableArray<TResult>> SelectAsArrayAsync<TItem, TResult>(this IEnumerable<TItem> source, Func<TItem, ValueTask<TResult>> selector)
764internal static Dictionary<K, ImmutableArray<T>> ToMultiDictionary<K, T>(this IEnumerable<T> data, Func<T, K> keySelector, IEqualityComparer<K>? comparer = null)
815public static readonly Func<T, T> Identity = t => t;
816public static readonly Func<T, bool> True = t => true;
840/// Alias for <see cref="System.Linq.Enumerable.Any{TSource}(IEnumerable{TSource}, Func{TSource, bool})"/>
842public static bool Contains<T>(this IEnumerable<T> sequence, Func<T, bool> predicate)
846/// Variant of <see cref="System.Linq.Enumerable.Count{TSource}(IEnumerable{TSource}, Func{TSource, bool})"/>
861/// Variant of <see cref="System.Linq.Enumerable.FirstOrDefault{TSource}(IEnumerable{TSource}, Func{TSource, bool})"/>
875/// Variant of <see cref="System.Linq.Enumerable.Any{TSource}(IEnumerable{TSource}, Func{TSource, bool})"/>
889/// Variant of <see cref="System.Linq.Enumerable.OrderBy{TSource, TKey}(IEnumerable{TSource}, Func{TSource, TKey}, IComparer{TKey}?)"/>
895/// Variant of <see cref="System.Linq.Enumerable.OrderByDescending{TSource, TKey}(IEnumerable{TSource}, Func{TSource, TKey}, IComparer{TKey}?)"/>
901/// Variant of <see cref="System.Linq.Enumerable.OrderBy{TSource, TKey}(IEnumerable{TSource}, Func{TSource, TKey}, IComparer{TKey}?)"/>
907/// Variant of <see cref="System.Linq.Enumerable.OrderByDescending{TSource, TKey}(IEnumerable{TSource}, Func{TSource, TKey}, IComparer{TKey}?)"/>
913/// Variant of <see cref="System.Linq.Enumerable.ThenBy{TSource, TKey}(IOrderedEnumerable{TSource}, Func{TSource, TKey}, IComparer{TKey}?)"/>
919/// Variant of <see cref="System.Linq.Enumerable.ThenBy{TSource, TKey}(IOrderedEnumerable{TSource}, Func{TSource, TKey}, IComparer{TKey}?)"/>
src\Dependencies\Collections\Extensions\IListExtensions.cs (4)
21public static bool HasDuplicates<TItem, TValue>(this IReadOnlyList<TItem> list, Func<TItem, TValue> selector)
31/// <seealso cref="ImmutableArrayExtensions.HasDuplicates{TItem, TValue}(System.Collections.Immutable.ImmutableArray{TItem}, Func{TItem, TValue}, IEqualityComparer{TValue})"/>
32/// <seealso cref="Roslyn.Utilities.EnumerableExtensions.HasDuplicates{TItem, TValue}(IEnumerable{TItem}, Func{TItem, TValue}, IEqualityComparer{TValue})"/>
34internal static bool HasDuplicates<TItem, TValue>(this IReadOnlyList<TItem> list, Func<TItem, TValue> selector, IEqualityComparer<TValue> comparer)
src\Dependencies\Collections\Extensions\ImmutableArrayExtensions.cs (27)
138public static ImmutableArray<TResult> SelectAsArray<TItem, TResult>(this ImmutableArray<TItem> items, Func<TItem, TResult> map)
198public static ImmutableArray<TResult> SelectAsArray<TItem, TResult>(this ImmutableArray<TItem> array, Func<TItem, bool> predicate, Func<TItem, TResult> selector)
247public static ImmutableArray<TResult> SelectManyAsArray<TItem, TResult>(this ImmutableArray<TItem> array, Func<TItem, IEnumerable<TResult>> selector)
267public static ImmutableArray<TResult> SelectManyAsArray<TItem, TResult>(this ImmutableArray<TItem> array, Func<TItem, ImmutableArray<TResult>> selector)
287public static ImmutableArray<TResult> SelectManyAsArray<TItem, TResult>(this ImmutableArray<TItem> array, Func<TItem, OneOrMany<TResult>> selector)
308public static ImmutableArray<TResult> SelectManyAsArray<TItem, TResult>(this ImmutableArray<TItem> array, Func<TItem, bool> predicate, Func<TItem, IEnumerable<TResult>> selector)
332public static ImmutableArray<TResult> SelectManyAsArray<TItem, TResult>(this ImmutableArray<TItem> array, Func<TItem, bool> predicate, Func<TItem, ImmutableArray<TResult>> selector)
356public static ImmutableArray<TResult> SelectManyAsArray<TItem, TResult>(this ImmutableArray<TItem> array, Func<TItem, bool> predicate, Func<TItem, OneOrMany<TResult>> selector)
493public static ImmutableArray<T> WhereAsArray<T>(this ImmutableArray<T> array, Func<T, bool> predicate)
504private static ImmutableArray<T> WhereAsArrayImpl<T, TArg>(ImmutableArray<T> array, Func<T, bool>? predicateWithoutArg, Func<T, TArg, bool>? predicateWithArg, TArg arg)
573public static async Task<bool> AnyAsync<T>(this ImmutableArray<T> array, Func<T, Task<bool>> predicateAsync)
595public static async ValueTask<T?> FirstOrDefaultAsync<T>(this ImmutableArray<T> array, Func<T, Task<bool>> predicateAsync)
757public static bool HasDuplicates<TItem, TValue>(this ImmutableArray<TItem> array, Func<TItem, TValue> selector)
767/// <seealso cref="Roslyn.Utilities.EnumerableExtensions.HasDuplicates{TItem, TValue}(IEnumerable{TItem}, Func{TItem, TValue}, IEqualityComparer{TValue})"/>
769internal static bool HasDuplicates<TItem, TValue>(this ImmutableArray<TItem> array, Func<TItem, TValue> selector, IEqualityComparer<TValue> comparer)
990/// Variant of <see cref="System.Linq.ImmutableArrayExtensions.FirstOrDefault{T}(ImmutableArray{T}, Func{T, bool})"/>
1004/// Variant of <see cref="System.Linq.ImmutableArrayExtensions.Single{T}(ImmutableArray{T}, Func{T, bool})"/>
1066/// Specialization of <see cref="System.Linq.Enumerable.Count{TSource}(IEnumerable{TSource}, Func{TSource, bool})"/> for <see cref="ImmutableArray{T}"/>.
1068public static int Count<T>(this ImmutableArray<T> items, Func<T, bool> predicate)
1086public static int Sum<T>(this ImmutableArray<T> items, Func<T, int> selector)
1213/// Variant of <see cref="System.Linq.ImmutableArrayExtensions.Any{T}(ImmutableArray{T}, Func{T, bool})"/>.
1227/// Variant of <see cref="System.Linq.ImmutableArrayExtensions.All{T}(ImmutableArray{T}, Func{T, bool})"/>.
1257public static bool Contains<T>(this ImmutableArray<T> array, Func<T, bool> predicate)
src\Dependencies\Collections\RoslynImmutableInterlocked.cs (7)
33public static bool Update<T>(ref ImmutableSegmentedList<T> location, Func<ImmutableSegmentedList<T>, ImmutableSegmentedList<T>> transformer)
154public static bool Update<T>(ref ImmutableSegmentedHashSet<T> location, Func<ImmutableSegmentedHashSet<T>, ImmutableSegmentedHashSet<T>> transformer)
276public static bool Update<TKey, TValue>(ref ImmutableSegmentedDictionary<TKey, TValue> location, Func<ImmutableSegmentedDictionary<TKey, TValue>, ImmutableSegmentedDictionary<TKey, TValue>> transformer)
410/// <inheritdoc cref="ImmutableInterlocked.GetOrAdd{TKey, TValue}(ref ImmutableDictionary{TKey, TValue}, TKey, Func{TKey, TValue})"/>
411public static TValue GetOrAdd<TKey, TValue>(ref ImmutableSegmentedDictionary<TKey, TValue> location, TKey key, Func<TKey, TValue> valueFactory)
458/// <inheritdoc cref="ImmutableInterlocked.AddOrUpdate{TKey, TValue}(ref ImmutableDictionary{TKey, TValue}, TKey, Func{TKey, TValue}, Func{TKey, TValue, TValue})"/>
459public static TValue AddOrUpdate<TKey, TValue>(ref ImmutableSegmentedDictionary<TKey, TValue> location, TKey key, Func<TKey, TValue> addValueFactory, Func<TKey, TValue, TValue> updateValueFactory)
src\Dependencies\Collections\Segmented\ImmutableSegmentedDictionary.cs (6)
68public static ImmutableSegmentedDictionary<TKey, TValue> ToImmutableSegmentedDictionary<TSource, TKey, TValue>(this IEnumerable<TSource> source, Func<TSource, TKey> keySelector, Func<TSource, TValue> elementSelector)
72public static ImmutableSegmentedDictionary<TKey, TValue> ToImmutableSegmentedDictionary<TSource, TKey, TValue>(this IEnumerable<TSource> source, Func<TSource, TKey> keySelector, Func<TSource, TValue> elementSelector, IEqualityComparer<TKey>? keyComparer)
86public static ImmutableSegmentedDictionary<TKey, TSource> ToImmutableSegmentedDictionary<TSource, TKey>(this IEnumerable<TSource> source, Func<TSource, TKey> keySelector)
90public static ImmutableSegmentedDictionary<TKey, TSource> ToImmutableSegmentedDictionary<TSource, TKey>(this IEnumerable<TSource> source, Func<TSource, TKey> keySelector, IEqualityComparer<TKey>? keyComparer)
src\Dependencies\PooledObjects\ArrayBuilder.cs (7)
457public void FreeAll(Func<T, ArrayBuilder<T>?> getNested)
560internal Dictionary<K, ImmutableArray<T>> ToDictionary<K>(Func<T, K> keySelector, IEqualityComparer<K>? comparer = null)
608public void AddRange<U>(ArrayBuilder<U> items, Func<U, T> selector)
745public ImmutableArray<S> SelectDistinct<S>(Func<T, S> selector)
763public bool Any(Func<T, bool> predicate)
787public bool All(Func<T, bool> predicate)
817public ImmutableArray<TResult> SelectAsArray<TResult>(Func<T, TResult> map)
src\Dependencies\PooledObjects\PooledDelegates.cs (9)
200public static Releaser GetPooledFunction<TArg, TResult>(Func<TArg, TResult> unboundFunction, TArg argument, out Func<TResult> boundFunction)
201=> GetPooledDelegate<FuncWithBoundArgument<TArg, TResult>, TArg, Func<TArg, TResult>, Func<TResult>>(unboundFunction, argument, out boundFunction);
204/// Equivalent to <see cref="GetPooledFunction{TArg, TResult}(Func{TArg, TResult}, TArg, out Func{TResult})"/>,
216/// Gets a <see cref="Func{T, TResult}"/> delegate, which calls <paramref name="unboundFunction"/> with the
246public static Releaser GetPooledFunction<T1, TArg, TResult>(Func<T1, TArg, TResult> unboundFunction, TArg argument, out Func<T1, TResult> boundFunction)
247=> GetPooledDelegate<FuncWithBoundArgument<T1, TArg, TResult>, TArg, Func<T1, TArg, TResult>, Func<T1, TResult>>(unboundFunction, argument, out boundFunction);
412: AbstractDelegateWithBoundArgument<FuncWithBoundArgument<TArg, TResult>, TArg, Func<TArg, TResult>, Func<TResult>>
432: AbstractDelegateWithBoundArgument<FuncWithBoundArgument<T1, TArg, TResult>, TArg, Func<T1, TArg, TResult>, Func<T1, TResult>>
434protected override Func<T1, TResult> Bind()
src\RoslynAnalyzers\Utilities\Compiler\Lightup\LightupHelpers.cs (6)
19internal static Func<TOperation, TProperty> CreateOperationPropertyAccessor<TOperation, TProperty>(Type? type, string propertyName, TProperty fallbackResult)
23internal static Func<TSyntax, TProperty> CreateSyntaxPropertyAccessor<TSyntax, TProperty>(Type? type, string propertyName, TProperty fallbackResult)
27internal static Func<TSymbol, TProperty> CreateSymbolPropertyAccessor<TSymbol, TProperty>(Type? type, string propertyName, TProperty fallbackResult)
31private static Func<T, TProperty> CreatePropertyAccessor<T, TProperty>(Type? type, string parameterName, string propertyName, TProperty fallbackResult)
50Expression<Func<T, TProperty>> expression = Expression.Lambda<Func<T, TProperty>>(result, parameter);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\ObjectExtensions.TypeSwitch.cs (161)
11public static TResult? TypeSwitch<TBaseType, TDerivedType1, TDerivedType2, TDerivedType3, TResult>(this TBaseType obj, Func<TDerivedType1, TResult> matchFunc1, Func<TDerivedType2, TResult> matchFunc2, Func<TDerivedType3, TResult> matchFunc3, Func<TBaseType, TResult>? defaultFunc = null)
25public static TResult? TypeSwitch<TBaseType, TDerivedType1, TDerivedType2, TDerivedType3, TDerivedType4, TResult>(this TBaseType obj, Func<TDerivedType1, TResult> matchFunc1, Func<TDerivedType2, TResult> matchFunc2, Func<TDerivedType3, TResult> matchFunc3, Func<TDerivedType4, TResult> matchFunc4, Func<TBaseType, TResult>? defaultFunc = null)
41public static TResult? TypeSwitch<TBaseType, TDerivedType1, TDerivedType2, TDerivedType3, TDerivedType4, TDerivedType5, TResult>(this TBaseType obj, Func<TDerivedType1, TResult> matchFunc1, Func<TDerivedType2, TResult> matchFunc2, Func<TDerivedType3, TResult> matchFunc3, Func<TDerivedType4, TResult> matchFunc4, Func<TDerivedType5, TResult> matchFunc5, Func<TBaseType, TResult>? defaultFunc = null)
59public static TResult? TypeSwitch<TBaseType, TDerivedType1, TDerivedType2, TDerivedType3, TDerivedType4, TDerivedType5, TDerivedType6, TResult>(this TBaseType obj, Func<TDerivedType1, TResult> matchFunc1, Func<TDerivedType2, TResult> matchFunc2, Func<TDerivedType3, TResult> matchFunc3, Func<TDerivedType4, TResult> matchFunc4, Func<TDerivedType5, TResult> matchFunc5, Func<TDerivedType6, TResult> matchFunc6, Func<TBaseType, TResult>? defaultFunc = null)
79public static TResult? TypeSwitch<TBaseType, TDerivedType1, TDerivedType2, TDerivedType3, TDerivedType4, TDerivedType5, TDerivedType6, TDerivedType7, TDerivedType8, TDerivedType9, TDerivedType10, TDerivedType11, TDerivedType12, TDerivedType13, TDerivedType14, TDerivedType15, TDerivedType16, TResult>(this TBaseType obj, Func<TDerivedType1, TResult> matchFunc1, Func<TDerivedType2, TResult> matchFunc2, Func<TDerivedType3, TResult> matchFunc3, Func<TDerivedType4, TResult> matchFunc4, Func<TDerivedType5, TResult> matchFunc5, Func<TDerivedType6, TResult> matchFunc6, Func<TDerivedType7, TResult> matchFunc7, Func<TDerivedType8, TResult> matchFunc8, Func<TDerivedType9, TResult> matchFunc9, Func<TDerivedType10, TResult> matchFunc10, Func<TDerivedType11, TResult> matchFunc11, Func<TDerivedType12, TResult> matchFunc12, Func<TDerivedType13, TResult> matchFunc13, Func<TDerivedType14, TResult> matchFunc14, Func<TDerivedType15, TResult> matchFunc15, Func<TDerivedType16, TResult> matchFunc16, Func<TBaseType, TResult>? defaultFunc = null)
119public static TResult? TypeSwitch<TBaseType, TDerivedType1, TDerivedType2, TDerivedType3, TDerivedType4, TDerivedType5, TDerivedType6, TDerivedType7, TDerivedType8, TDerivedType9, TDerivedType10, TDerivedType11, TDerivedType12, TDerivedType13, TDerivedType14, TDerivedType15, TDerivedType16, TDerivedType17, TResult>(this TBaseType obj, Func<TDerivedType1, TResult> matchFunc1, Func<TDerivedType2, TResult> matchFunc2, Func<TDerivedType3, TResult> matchFunc3, Func<TDerivedType4, TResult> matchFunc4, Func<TDerivedType5, TResult> matchFunc5, Func<TDerivedType6, TResult> matchFunc6, Func<TDerivedType7, TResult> matchFunc7, Func<TDerivedType8, TResult> matchFunc8, Func<TDerivedType9, TResult> matchFunc9, Func<TDerivedType10, TResult> matchFunc10, Func<TDerivedType11, TResult> matchFunc11, Func<TDerivedType12, TResult> matchFunc12, Func<TDerivedType13, TResult> matchFunc13, Func<TDerivedType14, TResult> matchFunc14, Func<TDerivedType15, TResult> matchFunc15, Func<TDerivedType16, TResult> matchFunc16, Func<TDerivedType17, TResult> matchFunc17, Func<TBaseType, TResult>? defaultFunc = null)
161public static TResult? TypeSwitch<TBaseType, TDerivedType1, TDerivedType2, TDerivedType3, TDerivedType4, TDerivedType5, TDerivedType6, TDerivedType7, TDerivedType8, TDerivedType9, TDerivedType10, TDerivedType11, TDerivedType12, TDerivedType13, TDerivedType14, TDerivedType15, TDerivedType16, TDerivedType17, TDerivedType18, TDerivedType19, TDerivedType20, TDerivedType21, TDerivedType22, TResult>(this TBaseType obj, Func<TDerivedType1, TResult> matchFunc1, Func<TDerivedType2, TResult> matchFunc2, Func<TDerivedType3, TResult> matchFunc3, Func<TDerivedType4, TResult> matchFunc4, Func<TDerivedType5, TResult> matchFunc5, Func<TDerivedType6, TResult> matchFunc6, Func<TDerivedType7, TResult> matchFunc7, Func<TDerivedType8, TResult> matchFunc8, Func<TDerivedType9, TResult> matchFunc9, Func<TDerivedType10, TResult> matchFunc10, Func<TDerivedType11, TResult> matchFunc11, Func<TDerivedType12, TResult> matchFunc12, Func<TDerivedType13, TResult> matchFunc13, Func<TDerivedType14, TResult> matchFunc14, Func<TDerivedType15, TResult> matchFunc15, Func<TDerivedType16, TResult> matchFunc16, Func<TDerivedType17, TResult> matchFunc17, Func<TDerivedType18, TResult> matchFunc18, Func<TDerivedType19, TResult> matchFunc19, Func<TDerivedType20, TResult> matchFunc20, Func<TDerivedType21, TResult> matchFunc21, Func<TDerivedType22, TResult> matchFunc22, Func<TBaseType, TResult>? defaultFunc = null)
213public static TResult? TypeSwitch<TBaseType, TDerivedType1, TDerivedType2, TDerivedType3, TDerivedType4, TDerivedType5, TDerivedType6, TDerivedType7, TDerivedType8, TDerivedType9, TDerivedType10, TDerivedType11, TDerivedType12, TDerivedType13, TDerivedType14, TDerivedType15, TDerivedType16, TDerivedType17, TDerivedType18, TDerivedType19, TDerivedType20, TDerivedType21, TDerivedType22, TDerivedType23, TDerivedType24, TDerivedType25, TDerivedType26, TDerivedType27, TDerivedType28, TDerivedType29, TDerivedType30, TDerivedType31, TDerivedType32, TDerivedType33, TDerivedType34, TDerivedType35, TDerivedType36, TDerivedType37, TDerivedType38, TDerivedType39, TResult>(this TBaseType obj, Func<TDerivedType1, TResult> matchFunc1, Func<TDerivedType2, TResult> matchFunc2, Func<TDerivedType3, TResult> matchFunc3, Func<TDerivedType4, TResult> matchFunc4, Func<TDerivedType5, TResult> matchFunc5, Func<TDerivedType6, TResult> matchFunc6, Func<TDerivedType7, TResult> matchFunc7, Func<TDerivedType8, TResult> matchFunc8, Func<TDerivedType9, TResult> matchFunc9, Func<TDerivedType10, TResult> matchFunc10, Func<TDerivedType11, TResult> matchFunc11, Func<TDerivedType12, TResult> matchFunc12, Func<TDerivedType13, TResult> matchFunc13, Func<TDerivedType14, TResult> matchFunc14, Func<TDerivedType15, TResult> matchFunc15, Func<TDerivedType16, TResult> matchFunc16, Func<TDerivedType17, TResult> matchFunc17, Func<TDerivedType18, TResult> matchFunc18, Func<TDerivedType19, TResult> matchFunc19, Func<TDerivedType20, TResult> matchFunc20, Func<TDerivedType21, TResult> matchFunc21, Func<TDerivedType22, TResult> matchFunc22, Func<TDerivedType23, TResult> matchFunc23, Func<TDerivedType24, TResult> matchFunc24, Func<TDerivedType25, TResult> matchFunc25, Func<TDerivedType26, TResult> matchFunc26, Func<TDerivedType27, TResult> matchFunc27, Func<TDerivedType28, TResult> matchFunc28, Func<TDerivedType29, TResult> matchFunc29, Func<TDerivedType30, TResult> matchFunc30, Func<TDerivedType31, TResult> matchFunc31, Func<TDerivedType32, TResult> matchFunc32, Func<TDerivedType33, TResult> matchFunc33, Func<TDerivedType34, TResult> matchFunc34, Func<TDerivedType35, TResult> matchFunc35, Func<TDerivedType36, TResult> matchFunc36, Func<TDerivedType37, TResult> matchFunc37, Func<TDerivedType38, TResult> matchFunc38, Func<TDerivedType39, TResult> matchFunc39, Func<TBaseType, TResult>? defaultFunc = null)
299public static TResult? TypeSwitch<TBaseType, TDerivedType1, TDerivedType2, TDerivedType3, TDerivedType4, TDerivedType5, TDerivedType6, TDerivedType7, TDerivedType8, TDerivedType9, TDerivedType10, TDerivedType11, TDerivedType12, TDerivedType13, TDerivedType14, TDerivedType15, TDerivedType16, TDerivedType17, TDerivedType18, TDerivedType19, TDerivedType20, TDerivedType21, TDerivedType22, TDerivedType23, TDerivedType24, TDerivedType25, TDerivedType26, TDerivedType27, TDerivedType28, TDerivedType29, TDerivedType30, TDerivedType31, TDerivedType32, TDerivedType33, TDerivedType34, TDerivedType35, TDerivedType36, TDerivedType37, TDerivedType38, TDerivedType39, TDerivedType40, TResult>(this TBaseType obj, Func<TDerivedType1, TResult> matchFunc1, Func<TDerivedType2, TResult> matchFunc2, Func<TDerivedType3, TResult> matchFunc3, Func<TDerivedType4, TResult> matchFunc4, Func<TDerivedType5, TResult> matchFunc5, Func<TDerivedType6, TResult> matchFunc6, Func<TDerivedType7, TResult> matchFunc7, Func<TDerivedType8, TResult> matchFunc8, Func<TDerivedType9, TResult> matchFunc9, Func<TDerivedType10, TResult> matchFunc10, Func<TDerivedType11, TResult> matchFunc11, Func<TDerivedType12, TResult> matchFunc12, Func<TDerivedType13, TResult> matchFunc13, Func<TDerivedType14, TResult> matchFunc14, Func<TDerivedType15, TResult> matchFunc15, Func<TDerivedType16, TResult> matchFunc16, Func<TDerivedType17, TResult> matchFunc17, Func<TDerivedType18, TResult> matchFunc18, Func<TDerivedType19, TResult> matchFunc19, Func<TDerivedType20, TResult> matchFunc20, Func<TDerivedType21, TResult> matchFunc21, Func<TDerivedType22, TResult> matchFunc22, Func<TDerivedType23, TResult> matchFunc23, Func<TDerivedType24, TResult> matchFunc24, Func<TDerivedType25, TResult> matchFunc25, Func<TDerivedType26, TResult> matchFunc26, Func<TDerivedType27, TResult> matchFunc27, Func<TDerivedType28, TResult> matchFunc28, Func<TDerivedType29, TResult> matchFunc29, Func<TDerivedType30, TResult> matchFunc30, Func<TDerivedType31, TResult> matchFunc31, Func<TDerivedType32, TResult> matchFunc32, Func<TDerivedType33, TResult> matchFunc33, Func<TDerivedType34, TResult> matchFunc34, Func<TDerivedType35, TResult> matchFunc35, Func<TDerivedType36, TResult> matchFunc36, Func<TDerivedType37, TResult> matchFunc37, Func<TDerivedType38, TResult> matchFunc38, Func<TDerivedType39, TResult> matchFunc39, Func<TDerivedType40, TResult> matchFunc40, Func<TBaseType, TResult>? defaultFunc = null)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\SyntaxNodeExtensions.cs (6)
104this SyntaxNode node, TextSpan searchSpan, Func<SyntaxNode, bool> predicate)
129public static bool CheckParent<T>([NotNullWhen(returnValue: true)] this SyntaxNode? node, Func<T, bool> valueChecker) where T : SyntaxNode
145public static bool IsChildNode<TParent>(this SyntaxNode node, Func<TParent, SyntaxNode?> childGetter)
162public static bool IsFoundUnder<TParent>(this SyntaxNode node, Func<TParent, SyntaxNode?> childGetter)
201public static SyntaxNode? FindInnermostCommonNode(this IEnumerable<SyntaxNode> nodes, Func<SyntaxNode, bool> predicate)
806public static TNode? FirstAncestorOrSelfUntil<TNode>(this SyntaxNode? node, Func<SyntaxNode, bool> predicate)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\SyntaxTokenExtensions.cs (5)
15public static SyntaxNode? GetAncestor(this SyntaxToken token, Func<SyntaxNode, bool>? predicate)
18public static T? GetAncestor<T>(this SyntaxToken token, Func<T, bool>? predicate = null) where T : SyntaxNode
21public static T GetRequiredAncestor<T>(this SyntaxToken token, Func<T, bool>? predicate = null) where T : SyntaxNode
32public static IEnumerable<SyntaxNode> GetAncestors(this SyntaxToken token, Func<SyntaxNode, bool> predicate)
42public static bool CheckParent<T>(this SyntaxToken token, Func<T, bool> valueChecker) where T : SyntaxNode
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Options\PublicOptionFactory.cs (4)
17public static Option2<T> WithPublicOption<T, TPublicValue>(this Option2<T> option, string feature, string name, Func<T, TPublicValue> toPublicValue, Func<TPublicValue, T> toInternalValue)
20public static PerLanguageOption2<T> WithPublicOption<T, TPublicValue>(this PerLanguageOption2<T> option, string feature, string name, Func<T, TPublicValue> toPublicValue, Func<TPublicValue, T> toInternalValue)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\TopologicalSorter.cs (8)
13public static IEnumerable<T> TopologicalSort<T>(this IEnumerable<T> items, Func<T, IEnumerable<T>> itemsBefore)
26public static IEnumerable<T> TopologicalSort<T>(this IEnumerable<T> items, Func<T, IEnumerable<T>> itemsBefore, Func<T, IEnumerable<T>> itemsAfter)
29var combinedItemsBefore = CreateCombinedItemsBefore(items, itemsBefore, itemsAfter);
35Func<T, IEnumerable<T>> itemsBefore,
50private static Func<T, IEnumerable<T>> CreateCombinedItemsBefore<T>(IEnumerable<T> items, Func<T, IEnumerable<T>> itemsBefore, Func<T, IEnumerable<T>> itemsAfter)
TestProject.IntegrationServiceA (1)
Text.Analyzers (442)
src\Compilers\Core\Portable\FileSystem\FileUtilities.cs (4)
47Func<string, bool> fileExists)
322public static T RethrowExceptionsAsIOException<T, TArg>(Func<TArg, T> operation, TArg arg)
339public static async Task<T> RethrowExceptionsAsIOExceptionAsync<T, TArg>(Func<TArg, Task<T>> operation, TArg arg)
355internal static Stream CreateFileStreamChecked(Func<string, Stream> factory, string path, string? paramName = null)
src\Compilers\Core\Portable\InternalUtilities\InterlockedOperations.cs (5)
46public static T Initialize<T, TArg>([NotNull] ref T? target, Func<TArg, T> valueFactory, TArg arg)
66public static int Initialize<TArg>(ref int target, int uninitializedValue, Func<TArg, int> valueFactory, TArg arg)
103public static T? Initialize<T, TArg>([NotNull] ref StrongBox<T?>? target, Func<TArg, T?> valueFactory, TArg arg)
183public static ImmutableArray<T> Initialize<T, TArg>(ref ImmutableArray<T> target, Func<TArg, ImmutableArray<T>> createArray, TArg arg)
193private static ImmutableArray<T> Initialize_Slow<T, TArg>(ref ImmutableArray<T> target, Func<TArg, ImmutableArray<T>> createArray, TArg arg)
src\Compilers\Core\Portable\SourceGeneration\GeneratedCodeUtilities.cs (4)
49SyntaxTree tree, Func<SyntaxTrivia, bool> isComment, CancellationToken cancellationToken)
55internal static bool IsGeneratedCode(string? filePath, SyntaxNode root, Func<SyntaxTrivia, bool> isComment)
88private static bool BeginsWithAutoGeneratedComment(SyntaxNode root, Func<SyntaxTrivia, bool> isComment)
118SyntaxTree tree, Func<SyntaxTrivia, bool> isComment, CancellationToken cancellationToken)
src\Dependencies\Collections\Extensions\IEnumerableExtensions.cs (30)
164public static T? FirstOrNull<T>(this IEnumerable<T> source, Func<T, bool> predicate)
182public static T? SingleOrNull<T>(this IEnumerable<T> source, Func<T, bool> predicate)
261public static bool HasDuplicates<TItem, TValue>(this IEnumerable<TItem> source, Func<TItem, TValue> selector)
271/// <seealso cref="Microsoft.CodeAnalysis.ImmutableArrayExtensions.HasDuplicates{TItem, TValue}(ImmutableArray{TItem}, Func{TItem, TValue}, IEqualityComparer{TValue})"/>
273public static bool HasDuplicates<TItem, TValue>(this IEnumerable<TItem> source, Func<TItem, TValue> selector, IEqualityComparer<TValue> comparer)
321private static readonly Func<object, bool> s_notNullTest = x => x != null;
331return source.Where((Func<T?, bool>)s_notNullTest)!;
376public static ImmutableArray<T> WhereAsArray<T>(this IEnumerable<T> values, Func<T, bool> predicate)
407public static ImmutableArray<TResult> SelectAsArray<TSource, TResult>(this IEnumerable<TSource>? source, Func<TSource, TResult> selector)
417public static ImmutableArray<TResult> SelectAsArray<TItem, TResult>(this IEnumerable<TItem>? source, Func<TItem, bool> predicate, Func<TItem, TResult> selector)
461public static ImmutableArray<TResult> SelectAsArray<TSource, TResult>(this IReadOnlyCollection<TSource>? source, Func<TSource, TResult> selector)
485public static ImmutableArray<TResult> SelectManyAsArray<TSource, TResult>(this IEnumerable<TSource>? source, Func<TSource, IEnumerable<TResult>> selector)
507public static ImmutableArray<TResult> SelectManyAsArray<TItem, TResult>(this IReadOnlyCollection<TItem>? source, Func<TItem, IEnumerable<TResult>> selector)
533public static ImmutableArray<TResult> SelectManyAsArray<TSource, TResult>(this IEnumerable<TSource>? source, Func<TSource, OneOrMany<TResult>> selector)
547public static async ValueTask<ImmutableArray<TResult>> SelectAsArrayAsync<TItem, TResult>(this IEnumerable<TItem> source, Func<TItem, ValueTask<TResult>> selector)
764internal static Dictionary<K, ImmutableArray<T>> ToMultiDictionary<K, T>(this IEnumerable<T> data, Func<T, K> keySelector, IEqualityComparer<K>? comparer = null)
815public static readonly Func<T, T> Identity = t => t;
816public static readonly Func<T, bool> True = t => true;
840/// Alias for <see cref="System.Linq.Enumerable.Any{TSource}(IEnumerable{TSource}, Func{TSource, bool})"/>
842public static bool Contains<T>(this IEnumerable<T> sequence, Func<T, bool> predicate)
846/// Variant of <see cref="System.Linq.Enumerable.Count{TSource}(IEnumerable{TSource}, Func{TSource, bool})"/>
861/// Variant of <see cref="System.Linq.Enumerable.FirstOrDefault{TSource}(IEnumerable{TSource}, Func{TSource, bool})"/>
875/// Variant of <see cref="System.Linq.Enumerable.Any{TSource}(IEnumerable{TSource}, Func{TSource, bool})"/>
889/// Variant of <see cref="System.Linq.Enumerable.OrderBy{TSource, TKey}(IEnumerable{TSource}, Func{TSource, TKey}, IComparer{TKey}?)"/>
895/// Variant of <see cref="System.Linq.Enumerable.OrderByDescending{TSource, TKey}(IEnumerable{TSource}, Func{TSource, TKey}, IComparer{TKey}?)"/>
901/// Variant of <see cref="System.Linq.Enumerable.OrderBy{TSource, TKey}(IEnumerable{TSource}, Func{TSource, TKey}, IComparer{TKey}?)"/>
907/// Variant of <see cref="System.Linq.Enumerable.OrderByDescending{TSource, TKey}(IEnumerable{TSource}, Func{TSource, TKey}, IComparer{TKey}?)"/>
913/// Variant of <see cref="System.Linq.Enumerable.ThenBy{TSource, TKey}(IOrderedEnumerable{TSource}, Func{TSource, TKey}, IComparer{TKey}?)"/>
919/// Variant of <see cref="System.Linq.Enumerable.ThenBy{TSource, TKey}(IOrderedEnumerable{TSource}, Func{TSource, TKey}, IComparer{TKey}?)"/>
src\Dependencies\Collections\Extensions\IListExtensions.cs (4)
21public static bool HasDuplicates<TItem, TValue>(this IReadOnlyList<TItem> list, Func<TItem, TValue> selector)
31/// <seealso cref="ImmutableArrayExtensions.HasDuplicates{TItem, TValue}(System.Collections.Immutable.ImmutableArray{TItem}, Func{TItem, TValue}, IEqualityComparer{TValue})"/>
32/// <seealso cref="Roslyn.Utilities.EnumerableExtensions.HasDuplicates{TItem, TValue}(IEnumerable{TItem}, Func{TItem, TValue}, IEqualityComparer{TValue})"/>
34internal static bool HasDuplicates<TItem, TValue>(this IReadOnlyList<TItem> list, Func<TItem, TValue> selector, IEqualityComparer<TValue> comparer)
src\Dependencies\Collections\Extensions\ImmutableArrayExtensions.cs (27)
138public static ImmutableArray<TResult> SelectAsArray<TItem, TResult>(this ImmutableArray<TItem> items, Func<TItem, TResult> map)
198public static ImmutableArray<TResult> SelectAsArray<TItem, TResult>(this ImmutableArray<TItem> array, Func<TItem, bool> predicate, Func<TItem, TResult> selector)
247public static ImmutableArray<TResult> SelectManyAsArray<TItem, TResult>(this ImmutableArray<TItem> array, Func<TItem, IEnumerable<TResult>> selector)
267public static ImmutableArray<TResult> SelectManyAsArray<TItem, TResult>(this ImmutableArray<TItem> array, Func<TItem, ImmutableArray<TResult>> selector)
287public static ImmutableArray<TResult> SelectManyAsArray<TItem, TResult>(this ImmutableArray<TItem> array, Func<TItem, OneOrMany<TResult>> selector)
308public static ImmutableArray<TResult> SelectManyAsArray<TItem, TResult>(this ImmutableArray<TItem> array, Func<TItem, bool> predicate, Func<TItem, IEnumerable<TResult>> selector)
332public static ImmutableArray<TResult> SelectManyAsArray<TItem, TResult>(this ImmutableArray<TItem> array, Func<TItem, bool> predicate, Func<TItem, ImmutableArray<TResult>> selector)
356public static ImmutableArray<TResult> SelectManyAsArray<TItem, TResult>(this ImmutableArray<TItem> array, Func<TItem, bool> predicate, Func<TItem, OneOrMany<TResult>> selector)
493public static ImmutableArray<T> WhereAsArray<T>(this ImmutableArray<T> array, Func<T, bool> predicate)
504private static ImmutableArray<T> WhereAsArrayImpl<T, TArg>(ImmutableArray<T> array, Func<T, bool>? predicateWithoutArg, Func<T, TArg, bool>? predicateWithArg, TArg arg)
573public static async Task<bool> AnyAsync<T>(this ImmutableArray<T> array, Func<T, Task<bool>> predicateAsync)
595public static async ValueTask<T?> FirstOrDefaultAsync<T>(this ImmutableArray<T> array, Func<T, Task<bool>> predicateAsync)
757public static bool HasDuplicates<TItem, TValue>(this ImmutableArray<TItem> array, Func<TItem, TValue> selector)
767/// <seealso cref="Roslyn.Utilities.EnumerableExtensions.HasDuplicates{TItem, TValue}(IEnumerable{TItem}, Func{TItem, TValue}, IEqualityComparer{TValue})"/>
769internal static bool HasDuplicates<TItem, TValue>(this ImmutableArray<TItem> array, Func<TItem, TValue> selector, IEqualityComparer<TValue> comparer)
990/// Variant of <see cref="System.Linq.ImmutableArrayExtensions.FirstOrDefault{T}(ImmutableArray{T}, Func{T, bool})"/>
1004/// Variant of <see cref="System.Linq.ImmutableArrayExtensions.Single{T}(ImmutableArray{T}, Func{T, bool})"/>
1066/// Specialization of <see cref="System.Linq.Enumerable.Count{TSource}(IEnumerable{TSource}, Func{TSource, bool})"/> for <see cref="ImmutableArray{T}"/>.
1068public static int Count<T>(this ImmutableArray<T> items, Func<T, bool> predicate)
1086public static int Sum<T>(this ImmutableArray<T> items, Func<T, int> selector)
1213/// Variant of <see cref="System.Linq.ImmutableArrayExtensions.Any{T}(ImmutableArray{T}, Func{T, bool})"/>.
1227/// Variant of <see cref="System.Linq.ImmutableArrayExtensions.All{T}(ImmutableArray{T}, Func{T, bool})"/>.
1257public static bool Contains<T>(this ImmutableArray<T> array, Func<T, bool> predicate)
src\Dependencies\Collections\RoslynImmutableInterlocked.cs (7)
33public static bool Update<T>(ref ImmutableSegmentedList<T> location, Func<ImmutableSegmentedList<T>, ImmutableSegmentedList<T>> transformer)
154public static bool Update<T>(ref ImmutableSegmentedHashSet<T> location, Func<ImmutableSegmentedHashSet<T>, ImmutableSegmentedHashSet<T>> transformer)
276public static bool Update<TKey, TValue>(ref ImmutableSegmentedDictionary<TKey, TValue> location, Func<ImmutableSegmentedDictionary<TKey, TValue>, ImmutableSegmentedDictionary<TKey, TValue>> transformer)
410/// <inheritdoc cref="ImmutableInterlocked.GetOrAdd{TKey, TValue}(ref ImmutableDictionary{TKey, TValue}, TKey, Func{TKey, TValue})"/>
411public static TValue GetOrAdd<TKey, TValue>(ref ImmutableSegmentedDictionary<TKey, TValue> location, TKey key, Func<TKey, TValue> valueFactory)
458/// <inheritdoc cref="ImmutableInterlocked.AddOrUpdate{TKey, TValue}(ref ImmutableDictionary{TKey, TValue}, TKey, Func{TKey, TValue}, Func{TKey, TValue, TValue})"/>
459public static TValue AddOrUpdate<TKey, TValue>(ref ImmutableSegmentedDictionary<TKey, TValue> location, TKey key, Func<TKey, TValue> addValueFactory, Func<TKey, TValue, TValue> updateValueFactory)
src\Dependencies\Collections\Segmented\ImmutableSegmentedDictionary.cs (6)
68public static ImmutableSegmentedDictionary<TKey, TValue> ToImmutableSegmentedDictionary<TSource, TKey, TValue>(this IEnumerable<TSource> source, Func<TSource, TKey> keySelector, Func<TSource, TValue> elementSelector)
72public static ImmutableSegmentedDictionary<TKey, TValue> ToImmutableSegmentedDictionary<TSource, TKey, TValue>(this IEnumerable<TSource> source, Func<TSource, TKey> keySelector, Func<TSource, TValue> elementSelector, IEqualityComparer<TKey>? keyComparer)
86public static ImmutableSegmentedDictionary<TKey, TSource> ToImmutableSegmentedDictionary<TSource, TKey>(this IEnumerable<TSource> source, Func<TSource, TKey> keySelector)
90public static ImmutableSegmentedDictionary<TKey, TSource> ToImmutableSegmentedDictionary<TSource, TKey>(this IEnumerable<TSource> source, Func<TSource, TKey> keySelector, IEqualityComparer<TKey>? keyComparer)
src\Dependencies\PooledObjects\ArrayBuilder.cs (7)
457public void FreeAll(Func<T, ArrayBuilder<T>?> getNested)
560internal Dictionary<K, ImmutableArray<T>> ToDictionary<K>(Func<T, K> keySelector, IEqualityComparer<K>? comparer = null)
608public void AddRange<U>(ArrayBuilder<U> items, Func<U, T> selector)
745public ImmutableArray<S> SelectDistinct<S>(Func<T, S> selector)
763public bool Any(Func<T, bool> predicate)
787public bool All(Func<T, bool> predicate)
817public ImmutableArray<TResult> SelectAsArray<TResult>(Func<T, TResult> map)
src\Dependencies\PooledObjects\PooledDelegates.cs (9)
200public static Releaser GetPooledFunction<TArg, TResult>(Func<TArg, TResult> unboundFunction, TArg argument, out Func<TResult> boundFunction)
201=> GetPooledDelegate<FuncWithBoundArgument<TArg, TResult>, TArg, Func<TArg, TResult>, Func<TResult>>(unboundFunction, argument, out boundFunction);
204/// Equivalent to <see cref="GetPooledFunction{TArg, TResult}(Func{TArg, TResult}, TArg, out Func{TResult})"/>,
216/// Gets a <see cref="Func{T, TResult}"/> delegate, which calls <paramref name="unboundFunction"/> with the
246public static Releaser GetPooledFunction<T1, TArg, TResult>(Func<T1, TArg, TResult> unboundFunction, TArg argument, out Func<T1, TResult> boundFunction)
247=> GetPooledDelegate<FuncWithBoundArgument<T1, TArg, TResult>, TArg, Func<T1, TArg, TResult>, Func<T1, TResult>>(unboundFunction, argument, out boundFunction);
412: AbstractDelegateWithBoundArgument<FuncWithBoundArgument<TArg, TResult>, TArg, Func<TArg, TResult>, Func<TResult>>
432: AbstractDelegateWithBoundArgument<FuncWithBoundArgument<T1, TArg, TResult>, TArg, Func<T1, TArg, TResult>, Func<T1, TResult>>
434protected override Func<T1, TResult> Bind()
src\Dependencies\Threading\ParallelExtensions.NetFramework.cs (7)
122Func<object, Task> taskBody = static async o =>
287Func<object, Task> taskBody = static async o =>
395private readonly Func<object, Task> _taskBody;
418protected ForEachAsyncState(Func<object, Task> taskBody, bool needsLock, int dop, TaskScheduler scheduler, CancellationToken cancellationToken, Func<TSource, CancellationToken, ValueTask> body)
584IEnumerable<TSource> source, Func<object, Task> taskBody,
610IAsyncEnumerable<TSource> source, Func<object, Task> taskBody,
637T fromExclusive, T toExclusive, Func<object, Task> taskBody,
src\RoslynAnalyzers\Utilities\Compiler\Lightup\LightupHelpers.cs (6)
19internal static Func<TOperation, TProperty> CreateOperationPropertyAccessor<TOperation, TProperty>(Type? type, string propertyName, TProperty fallbackResult)
23internal static Func<TSyntax, TProperty> CreateSyntaxPropertyAccessor<TSyntax, TProperty>(Type? type, string propertyName, TProperty fallbackResult)
27internal static Func<TSymbol, TProperty> CreateSymbolPropertyAccessor<TSymbol, TProperty>(Type? type, string propertyName, TProperty fallbackResult)
31private static Func<T, TProperty> CreatePropertyAccessor<T, TProperty>(Type? type, string parameterName, string propertyName, TProperty fallbackResult)
50Expression<Func<T, TProperty>> expression = Expression.Lambda<Func<T, TProperty>>(result, parameter);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\ObjectExtensions.TypeSwitch.cs (161)
11public static TResult? TypeSwitch<TBaseType, TDerivedType1, TDerivedType2, TDerivedType3, TResult>(this TBaseType obj, Func<TDerivedType1, TResult> matchFunc1, Func<TDerivedType2, TResult> matchFunc2, Func<TDerivedType3, TResult> matchFunc3, Func<TBaseType, TResult>? defaultFunc = null)
25public static TResult? TypeSwitch<TBaseType, TDerivedType1, TDerivedType2, TDerivedType3, TDerivedType4, TResult>(this TBaseType obj, Func<TDerivedType1, TResult> matchFunc1, Func<TDerivedType2, TResult> matchFunc2, Func<TDerivedType3, TResult> matchFunc3, Func<TDerivedType4, TResult> matchFunc4, Func<TBaseType, TResult>? defaultFunc = null)
41public static TResult? TypeSwitch<TBaseType, TDerivedType1, TDerivedType2, TDerivedType3, TDerivedType4, TDerivedType5, TResult>(this TBaseType obj, Func<TDerivedType1, TResult> matchFunc1, Func<TDerivedType2, TResult> matchFunc2, Func<TDerivedType3, TResult> matchFunc3, Func<TDerivedType4, TResult> matchFunc4, Func<TDerivedType5, TResult> matchFunc5, Func<TBaseType, TResult>? defaultFunc = null)
59public static TResult? TypeSwitch<TBaseType, TDerivedType1, TDerivedType2, TDerivedType3, TDerivedType4, TDerivedType5, TDerivedType6, TResult>(this TBaseType obj, Func<TDerivedType1, TResult> matchFunc1, Func<TDerivedType2, TResult> matchFunc2, Func<TDerivedType3, TResult> matchFunc3, Func<TDerivedType4, TResult> matchFunc4, Func<TDerivedType5, TResult> matchFunc5, Func<TDerivedType6, TResult> matchFunc6, Func<TBaseType, TResult>? defaultFunc = null)
79public static TResult? TypeSwitch<TBaseType, TDerivedType1, TDerivedType2, TDerivedType3, TDerivedType4, TDerivedType5, TDerivedType6, TDerivedType7, TDerivedType8, TDerivedType9, TDerivedType10, TDerivedType11, TDerivedType12, TDerivedType13, TDerivedType14, TDerivedType15, TDerivedType16, TResult>(this TBaseType obj, Func<TDerivedType1, TResult> matchFunc1, Func<TDerivedType2, TResult> matchFunc2, Func<TDerivedType3, TResult> matchFunc3, Func<TDerivedType4, TResult> matchFunc4, Func<TDerivedType5, TResult> matchFunc5, Func<TDerivedType6, TResult> matchFunc6, Func<TDerivedType7, TResult> matchFunc7, Func<TDerivedType8, TResult> matchFunc8, Func<TDerivedType9, TResult> matchFunc9, Func<TDerivedType10, TResult> matchFunc10, Func<TDerivedType11, TResult> matchFunc11, Func<TDerivedType12, TResult> matchFunc12, Func<TDerivedType13, TResult> matchFunc13, Func<TDerivedType14, TResult> matchFunc14, Func<TDerivedType15, TResult> matchFunc15, Func<TDerivedType16, TResult> matchFunc16, Func<TBaseType, TResult>? defaultFunc = null)
119public static TResult? TypeSwitch<TBaseType, TDerivedType1, TDerivedType2, TDerivedType3, TDerivedType4, TDerivedType5, TDerivedType6, TDerivedType7, TDerivedType8, TDerivedType9, TDerivedType10, TDerivedType11, TDerivedType12, TDerivedType13, TDerivedType14, TDerivedType15, TDerivedType16, TDerivedType17, TResult>(this TBaseType obj, Func<TDerivedType1, TResult> matchFunc1, Func<TDerivedType2, TResult> matchFunc2, Func<TDerivedType3, TResult> matchFunc3, Func<TDerivedType4, TResult> matchFunc4, Func<TDerivedType5, TResult> matchFunc5, Func<TDerivedType6, TResult> matchFunc6, Func<TDerivedType7, TResult> matchFunc7, Func<TDerivedType8, TResult> matchFunc8, Func<TDerivedType9, TResult> matchFunc9, Func<TDerivedType10, TResult> matchFunc10, Func<TDerivedType11, TResult> matchFunc11, Func<TDerivedType12, TResult> matchFunc12, Func<TDerivedType13, TResult> matchFunc13, Func<TDerivedType14, TResult> matchFunc14, Func<TDerivedType15, TResult> matchFunc15, Func<TDerivedType16, TResult> matchFunc16, Func<TDerivedType17, TResult> matchFunc17, Func<TBaseType, TResult>? defaultFunc = null)
161public static TResult? TypeSwitch<TBaseType, TDerivedType1, TDerivedType2, TDerivedType3, TDerivedType4, TDerivedType5, TDerivedType6, TDerivedType7, TDerivedType8, TDerivedType9, TDerivedType10, TDerivedType11, TDerivedType12, TDerivedType13, TDerivedType14, TDerivedType15, TDerivedType16, TDerivedType17, TDerivedType18, TDerivedType19, TDerivedType20, TDerivedType21, TDerivedType22, TResult>(this TBaseType obj, Func<TDerivedType1, TResult> matchFunc1, Func<TDerivedType2, TResult> matchFunc2, Func<TDerivedType3, TResult> matchFunc3, Func<TDerivedType4, TResult> matchFunc4, Func<TDerivedType5, TResult> matchFunc5, Func<TDerivedType6, TResult> matchFunc6, Func<TDerivedType7, TResult> matchFunc7, Func<TDerivedType8, TResult> matchFunc8, Func<TDerivedType9, TResult> matchFunc9, Func<TDerivedType10, TResult> matchFunc10, Func<TDerivedType11, TResult> matchFunc11, Func<TDerivedType12, TResult> matchFunc12, Func<TDerivedType13, TResult> matchFunc13, Func<TDerivedType14, TResult> matchFunc14, Func<TDerivedType15, TResult> matchFunc15, Func<TDerivedType16, TResult> matchFunc16, Func<TDerivedType17, TResult> matchFunc17, Func<TDerivedType18, TResult> matchFunc18, Func<TDerivedType19, TResult> matchFunc19, Func<TDerivedType20, TResult> matchFunc20, Func<TDerivedType21, TResult> matchFunc21, Func<TDerivedType22, TResult> matchFunc22, Func<TBaseType, TResult>? defaultFunc = null)
213public static TResult? TypeSwitch<TBaseType, TDerivedType1, TDerivedType2, TDerivedType3, TDerivedType4, TDerivedType5, TDerivedType6, TDerivedType7, TDerivedType8, TDerivedType9, TDerivedType10, TDerivedType11, TDerivedType12, TDerivedType13, TDerivedType14, TDerivedType15, TDerivedType16, TDerivedType17, TDerivedType18, TDerivedType19, TDerivedType20, TDerivedType21, TDerivedType22, TDerivedType23, TDerivedType24, TDerivedType25, TDerivedType26, TDerivedType27, TDerivedType28, TDerivedType29, TDerivedType30, TDerivedType31, TDerivedType32, TDerivedType33, TDerivedType34, TDerivedType35, TDerivedType36, TDerivedType37, TDerivedType38, TDerivedType39, TResult>(this TBaseType obj, Func<TDerivedType1, TResult> matchFunc1, Func<TDerivedType2, TResult> matchFunc2, Func<TDerivedType3, TResult> matchFunc3, Func<TDerivedType4, TResult> matchFunc4, Func<TDerivedType5, TResult> matchFunc5, Func<TDerivedType6, TResult> matchFunc6, Func<TDerivedType7, TResult> matchFunc7, Func<TDerivedType8, TResult> matchFunc8, Func<TDerivedType9, TResult> matchFunc9, Func<TDerivedType10, TResult> matchFunc10, Func<TDerivedType11, TResult> matchFunc11, Func<TDerivedType12, TResult> matchFunc12, Func<TDerivedType13, TResult> matchFunc13, Func<TDerivedType14, TResult> matchFunc14, Func<TDerivedType15, TResult> matchFunc15, Func<TDerivedType16, TResult> matchFunc16, Func<TDerivedType17, TResult> matchFunc17, Func<TDerivedType18, TResult> matchFunc18, Func<TDerivedType19, TResult> matchFunc19, Func<TDerivedType20, TResult> matchFunc20, Func<TDerivedType21, TResult> matchFunc21, Func<TDerivedType22, TResult> matchFunc22, Func<TDerivedType23, TResult> matchFunc23, Func<TDerivedType24, TResult> matchFunc24, Func<TDerivedType25, TResult> matchFunc25, Func<TDerivedType26, TResult> matchFunc26, Func<TDerivedType27, TResult> matchFunc27, Func<TDerivedType28, TResult> matchFunc28, Func<TDerivedType29, TResult> matchFunc29, Func<TDerivedType30, TResult> matchFunc30, Func<TDerivedType31, TResult> matchFunc31, Func<TDerivedType32, TResult> matchFunc32, Func<TDerivedType33, TResult> matchFunc33, Func<TDerivedType34, TResult> matchFunc34, Func<TDerivedType35, TResult> matchFunc35, Func<TDerivedType36, TResult> matchFunc36, Func<TDerivedType37, TResult> matchFunc37, Func<TDerivedType38, TResult> matchFunc38, Func<TDerivedType39, TResult> matchFunc39, Func<TBaseType, TResult>? defaultFunc = null)
299public static TResult? TypeSwitch<TBaseType, TDerivedType1, TDerivedType2, TDerivedType3, TDerivedType4, TDerivedType5, TDerivedType6, TDerivedType7, TDerivedType8, TDerivedType9, TDerivedType10, TDerivedType11, TDerivedType12, TDerivedType13, TDerivedType14, TDerivedType15, TDerivedType16, TDerivedType17, TDerivedType18, TDerivedType19, TDerivedType20, TDerivedType21, TDerivedType22, TDerivedType23, TDerivedType24, TDerivedType25, TDerivedType26, TDerivedType27, TDerivedType28, TDerivedType29, TDerivedType30, TDerivedType31, TDerivedType32, TDerivedType33, TDerivedType34, TDerivedType35, TDerivedType36, TDerivedType37, TDerivedType38, TDerivedType39, TDerivedType40, TResult>(this TBaseType obj, Func<TDerivedType1, TResult> matchFunc1, Func<TDerivedType2, TResult> matchFunc2, Func<TDerivedType3, TResult> matchFunc3, Func<TDerivedType4, TResult> matchFunc4, Func<TDerivedType5, TResult> matchFunc5, Func<TDerivedType6, TResult> matchFunc6, Func<TDerivedType7, TResult> matchFunc7, Func<TDerivedType8, TResult> matchFunc8, Func<TDerivedType9, TResult> matchFunc9, Func<TDerivedType10, TResult> matchFunc10, Func<TDerivedType11, TResult> matchFunc11, Func<TDerivedType12, TResult> matchFunc12, Func<TDerivedType13, TResult> matchFunc13, Func<TDerivedType14, TResult> matchFunc14, Func<TDerivedType15, TResult> matchFunc15, Func<TDerivedType16, TResult> matchFunc16, Func<TDerivedType17, TResult> matchFunc17, Func<TDerivedType18, TResult> matchFunc18, Func<TDerivedType19, TResult> matchFunc19, Func<TDerivedType20, TResult> matchFunc20, Func<TDerivedType21, TResult> matchFunc21, Func<TDerivedType22, TResult> matchFunc22, Func<TDerivedType23, TResult> matchFunc23, Func<TDerivedType24, TResult> matchFunc24, Func<TDerivedType25, TResult> matchFunc25, Func<TDerivedType26, TResult> matchFunc26, Func<TDerivedType27, TResult> matchFunc27, Func<TDerivedType28, TResult> matchFunc28, Func<TDerivedType29, TResult> matchFunc29, Func<TDerivedType30, TResult> matchFunc30, Func<TDerivedType31, TResult> matchFunc31, Func<TDerivedType32, TResult> matchFunc32, Func<TDerivedType33, TResult> matchFunc33, Func<TDerivedType34, TResult> matchFunc34, Func<TDerivedType35, TResult> matchFunc35, Func<TDerivedType36, TResult> matchFunc36, Func<TDerivedType37, TResult> matchFunc37, Func<TDerivedType38, TResult> matchFunc38, Func<TDerivedType39, TResult> matchFunc39, Func<TDerivedType40, TResult> matchFunc40, Func<TBaseType, TResult>? defaultFunc = null)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\SyntaxNodeExtensions.cs (6)
104this SyntaxNode node, TextSpan searchSpan, Func<SyntaxNode, bool> predicate)
129public static bool CheckParent<T>([NotNullWhen(returnValue: true)] this SyntaxNode? node, Func<T, bool> valueChecker) where T : SyntaxNode
145public static bool IsChildNode<TParent>(this SyntaxNode node, Func<TParent, SyntaxNode?> childGetter)
162public static bool IsFoundUnder<TParent>(this SyntaxNode node, Func<TParent, SyntaxNode?> childGetter)
201public static SyntaxNode? FindInnermostCommonNode(this IEnumerable<SyntaxNode> nodes, Func<SyntaxNode, bool> predicate)
806public static TNode? FirstAncestorOrSelfUntil<TNode>(this SyntaxNode? node, Func<SyntaxNode, bool> predicate)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\SyntaxTokenExtensions.cs (5)
15public static SyntaxNode? GetAncestor(this SyntaxToken token, Func<SyntaxNode, bool>? predicate)
18public static T? GetAncestor<T>(this SyntaxToken token, Func<T, bool>? predicate = null) where T : SyntaxNode
21public static T GetRequiredAncestor<T>(this SyntaxToken token, Func<T, bool>? predicate = null) where T : SyntaxNode
32public static IEnumerable<SyntaxNode> GetAncestors(this SyntaxToken token, Func<SyntaxNode, bool> predicate)
42public static bool CheckParent<T>(this SyntaxToken token, Func<T, bool> valueChecker) where T : SyntaxNode
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Options\PublicOptionFactory.cs (4)
17public static Option2<T> WithPublicOption<T, TPublicValue>(this Option2<T> option, string feature, string name, Func<T, TPublicValue> toPublicValue, Func<TPublicValue, T> toInternalValue)
20public static PerLanguageOption2<T> WithPublicOption<T, TPublicValue>(this PerLanguageOption2<T> option, string feature, string name, Func<T, TPublicValue> toPublicValue, Func<TPublicValue, T> toInternalValue)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\TopologicalSorter.cs (8)
13public static IEnumerable<T> TopologicalSort<T>(this IEnumerable<T> items, Func<T, IEnumerable<T>> itemsBefore)
26public static IEnumerable<T> TopologicalSort<T>(this IEnumerable<T> items, Func<T, IEnumerable<T>> itemsBefore, Func<T, IEnumerable<T>> itemsAfter)
29var combinedItemsBefore = CreateCombinedItemsBefore(items, itemsBefore, itemsAfter);
35Func<T, IEnumerable<T>> itemsBefore,
50private static Func<T, IEnumerable<T>> CreateCombinedItemsBefore<T>(IEnumerable<T> items, Func<T, IEnumerable<T>> itemsBefore, Func<T, IEnumerable<T>> itemsAfter)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Extensions\SyntaxEditorExtensions.cs (4)
29Func<TType, (TNode semanticNode, IEnumerable<TNode> additionalNodes)> selector,
52Func<TType, TNode> selector,
96Func<TType, (TNode semanticNode, IEnumerable<TNode> additionalNodes)> selector,
153Func<TType, (TNode semanticNode, IEnumerable<TNode> additionalNodes)> selector,
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Simplification\AbstractSimplificationService.cs (6)
35protected static readonly Func<SyntaxNode, bool> s_containsAnnotations = n => n.ContainsAnnotations;
36protected static readonly Func<SyntaxNodeOrToken, bool> s_hasSimplifierAnnotation = n => n.HasAnnotation(Simplifier.Annotation);
40protected abstract ImmutableArray<NodeOrTokenToReduce> GetNodesAndTokensToReduce(SyntaxNode root, Func<SyntaxNodeOrToken, bool> isNodeOrTokenOutsideSimplifySpans);
51public abstract SyntaxNode Expand(SyntaxNode node, SemanticModel semanticModel, SyntaxAnnotation? annotationForReplacedAliasIdentifier, Func<SyntaxNode, bool>? expandInsideNode, bool expandParameter, CancellationToken cancellationToken);
52public abstract SyntaxToken Expand(SyntaxToken token, SemanticModel semanticModel, Func<SyntaxNode, bool>? expandInsideNode, CancellationToken cancellationToken);
275Func<SyntaxNodeOrToken, bool> isNodeOrTokenOutsideSimplifySpan)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Utilities\NameGenerator.cs (6)
43Func<string, bool>? canUse = null,
63Func<string, bool>? canUse = null,
86Func<string, bool>? canUse = null,
134public static string GenerateUniqueName(string baseName, Func<string, bool> canUse)
140public static string GenerateUniqueName(string baseName, string extension, Func<string, bool> canUse)
160public static string GenerateUniqueName(IEnumerable<string> baseNames, Func<string, bool> canUse)
UnitTests.Common (1)
vbc (2)
VBCSCompiler (2)
VBCSCompiler.UnitTests (2)
WindowsBase.Tests (1)
WsFedSample (1)
xunit.assert (11)
Sdk\AssertHelper.cs (6)
63 static readonly ConcurrentDictionary<Type, Dictionary<string, Func<object?, object?>>> gettersByType = new ConcurrentDictionary<Type, Dictionary<string, Func<object?, object?>>>();
119 static Dictionary<string, Func<object?, object?>> GetGettersForType([DynamicallyAccessedMembers(
143 .Select(f => new { name = f.Name, getter = (Func<object?, object?>)f.GetValue });
164 .Select(p => new { name = p.Name, getter = (Func<object?, object?>)p.GetValue });
716 Func<object?, object?>? actualGetter;
xunit.console (5)