Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

3
  • 1
    Alternatively just an long? and return null for your false? Like this return (await Task.WhenAll(ids.Select(i => return await CheckValidIdAsync(id).ConfigureAwait(false) ? i : null))).Where(i => i != null).ToArray() obviously you can use some intermediate variables there Commented Aug 26, 2022 at 0:54
  • @Charlieface I am not a fan of nullable types, because it restricts the T to be value type. A ValueTuple<T, bool> is more generally applicable IMHO. Commented Aug 26, 2022 at 1:01
  • 1
    Fair enough, just thought it might simplify OP's case, the option is there Commented Aug 26, 2022 at 1:03