Search
 
SCRIPT & CODE EXAMPLE
 

CSHARP

async where linq

static async Task<IEnumerable<T>> Where<T>(
    this IEnumerable<T> source, Func<T, Task<bool>> predicate)
{
    var results = new ConcurrentQueue<T>();
    var tasks = source.Select(
        async x =>
        {
            if (await predicate(x))
                results.Enqueue(x);
        });
    await Task.WhenAll(tasks);
    return results;
}


var filteredAddresses = await addresses.Where(MeetsCriteria);

Comment

PREVIOUS NEXT
Code Example
Csharp :: how to find the text position in excel in c# 
Csharp :: how to make a block disappear in unity 
Csharp :: c# get index of item in list 
Csharp :: what is float in c# 
Csharp :: How to create a Blazor server-side application in command prompt 
Csharp :: convert getdate to ist c# 
Csharp :: wpf change foreground c# 
Csharp :: c# calculate checksum of file 
Csharp :: interop C# save as and replace 
Csharp :: serialize xml as array C# 
Csharp :: how to know pm or am C# 
Csharp :: convert string into float C# 
Csharp :: access label from another class c# 
Csharp :: unity mouse button names 
Csharp :: regex only letters and numbers c# 
Csharp :: You can get events when an object is visible within a certain camera, and when it enters or leaves, using these functions: 
Csharp :: c# networkstream read all bytes 
Csharp :: 405 - HTTP verb used to access this page is not allowed 
Csharp :: c# listview add items horizontally 
Csharp :: c# datagridview center cell text 
Csharp :: dctionary literal c# 
Csharp :: c# move directory 
Csharp :: unity interface 
Csharp :: c# new object 
Csharp :: why to make private fields readonly in c# 
Csharp :: c# how to get a securestring from string 
Csharp :: delete all fields that start with mongo 
Csharp :: sqlite execute 
Csharp :: how to get the dynamic year for your web app in mvc 
Csharp :: unity fast sin 
ADD CONTENT
Topic
Content
Source link
Name
2+4 =