6 useful extensions for IEnumerable #60
Replies: 2 comments 6 replies
-
|
Hello, in your Swap method, the random type is not initialized anywhere, but is used |
Beta Was this translation helpful? Give feedback.
4 replies
-
|
Partitioning into two or more collections can also be done using the in-built var evenOdd = numbers.ToLookup(n => n % 2 == 0);
var (even, odd) = (evenOdd[true], evenOdd[false]);The public static (IEnumerable<T> True, IEnumerable<T> False) Partition<T>(
this IEnumerable<T> source,
Func<T, bool> predicate)
{
var partitions = source.ToLookup(predicate);
return (partitions[true], partitions[false]);
} |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
6 useful extensions for IEnumerable
I did already write about some useful extension methods for Task and ValueTask. Today I want to show you some useful extension methods for IEnumerable.
https://steven-giesel.com/blogPost/1b8eaaef-01a3-4799-9a96-f0d37197d175
Beta Was this translation helpful? Give feedback.
All reactions