Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

182 Add enumerable support for Merge #215

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

Kysluss
Copy link
Contributor

@Kysluss Kysluss commented Jul 31, 2024

Adds a MergeFlat method that will take in collections of TValue in your result set and return them as a single flattened IEnumerable<TValue>

Unfortunately, due to how C# infers type parameters for encapsulating types, you will need to specify the TValue and TArray types where TArray : IEnumerable<TValue>

var result1 = Result.Ok(new string[] { "A", "B" });
var result2 = Result.Ok(new string[] { "C", "D" });
var result3 = Result.Ok(new string[] { "E", "F" });

// Will contain ["A", "B", "C", "D", "E", "F"]
var mergedResult = Result.MergeFlat<string, string[]>(result1, result2, result3);

Closes #182

Kysluss added 2 commits July 31, 2024 19:17
Allows merging of multiple results where each is an IEnumerable<TValue>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Question] Results.Merge() where TValue is a collection
1 participant