-
Notifications
You must be signed in to change notification settings - Fork 166
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
PredicateBuilder.New<T>(IEnumerable<T>) #138
PredicateBuilder.New<T>(IEnumerable<T>) #138
Conversation
…ressionStarter<T> instances with Anonymous Types. Usage: ```csharp var ienumerable = new[] { 1, 2, 3, 4, 5, 6, 7, 8, 9, } .Select(x => new { number = x, squared = x * x, }); var predicate = PredicateBuilder.Create(ienumerable); predicate = predicate.Or(x => x.number <= 2); predicate = predicate.Or(x => x.squared >= 64); ```
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please take a look at my comments....
src/LinqKit.Core/PredicateBuilder.cs
Outdated
/// </summary> | ||
/// <typeparam name="T">The type</typeparam> | ||
/// <param name="ienumerable">The value is NOT used. Only serves as a way to provide the generic type.</param> | ||
public static ExpressionStarter<T> Create<T>(IEnumerable<T> ienumerable, Expression<Func<T, bool>> expr = null) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would a better name be New
, just like before?
src/LinqKit.Core/PredicateBuilder.cs
Outdated
/// </summary> | ||
/// <typeparam name="T">The type</typeparam> | ||
/// <param name="ienumerable">The value is NOT used. Only serves as a way to provide the generic type.</param> | ||
public static ExpressionStarter<T> Create<T>(IEnumerable<T> ienumerable, bool defaultExpression) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would a better name be New
, just like before?
[Fact] | ||
public void PredicateBuilder_Create() | ||
{ | ||
var ienumerable = new[] { 1, 2, 3, 4, 5, 6, 7, 8, 9, } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed from |
Possibility to create ExpressionStarter instances with Anonymous Types.
Usage: