You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Let says that you have the logs of a connection between a client and a server.
All client request start with Q and all server response start with A.
There is also some noise that start with #.
Q> Hy
A> Hello
Q> What's your name ?
#> the fuzz is buzzing
Q> And city ?
A> My name is Bob
Q> And age
#> the buzz is fuzzing
A> I live in Detroit
A> I'm 42
...
That is the input of type IEnumerable<string>
We want to match each Q with it's corresponding A.
With the example data bellow, batches will yield those dictionaries:
{{Key: 'Q', Value: "Q> Hy"}, {Key: 'A', Value: "A> Hello"}},
{{Key: 'Q', Value: "Q> What's your name ?"}, {Key: 'A', Value: "A> My name is Bob"}},
{{Key: 'Q', Value: "Q> And city ?"}, {Key: 'A', Value: "A> I live in Detroit"}},
{{Key: 'Q', Value: "Q> And age"}, {Key: 'A', Value: "A> I'm 42"}},
...
remark
In the example bellow Q always come before A, it may be otherwise, the batches are yield when they have a matching value for each key.
Overload with a static number of keys are possible:
Derived from
Dispatch
#633 which can surely only be chained with aZip
,BatchBy
combineDispatch
andZip
to builds up buckets that are dictionaries.An example of use:
Let says that you have the logs of a connection between a client and a server.
All client request start with
Q
and all server response start withA
.There is also some noise that start with
#
.That is the
input
of typeIEnumerable<string>
We want to match each
Q
with it's correspondingA
.We can do it with
BatchBy
like this:With the example data bellow, batches will yield those dictionaries:
remark
In the example bellow
Q
always come beforeA
, it may be otherwise, the batches are yield when they have a matching value for each key.Overload with a static number of keys are possible:
And can be used like this:
ValueTuple overload are also possibles:
To discuss
Where(v => keySelector(v) == v).Select(resultSelector)
)The text was updated successfully, but these errors were encountered: