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

[Enhancement] DefaultIfEmptyF should be implemented #24

Open
Smurf-IV opened this issue Aug 5, 2019 · 1 comment
Open

[Enhancement] DefaultIfEmptyF should be implemented #24

Smurf-IV opened this issue Aug 5, 2019 · 1 comment

Comments

@Smurf-IV
Copy link

Smurf-IV commented Aug 5, 2019

Both versions of this to work with List<T>, Array[T], Span<T>, ReadOnlySpan<T> and IReadOnlyList<T>

If the source is null or empty, then default to creating an array so that max speed is maintained.

Smurf-IV pushed a commit to Smurf-IV/LinqFaster that referenced this issue Aug 5, 2019
@Smurf-IV
Copy link
Author

Smurf-IV commented Aug 5, 2019

Should this also follow the pattern for the other "Fast" api's e.g WhereSelect
i.e.

public static int MaxOrDefault<T>(this IEnumerable<T> enumeration, Func<T, int> selector)
{
    return enumeration.Any() ? enumeration.Max(selector) : default(int);
}

Smurf-IV pushed a commit to Smurf-IV/LinqFaster that referenced this issue Aug 8, 2019
…er a span

Create jackmott#22: [Question] Span_FirstF and List_FirstF are slower than just calling foreach -> Why?
Span this jackmott#24: [Enhancement] DefaultIfEmptyF should be implemented
Add Span jackmott#25: [Enhancement] Please also target .net4.8 and Benchmark
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

No branches or pull requests

1 participant