Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CSHARP

Conditional IQueryable Linq extension

public static IQueryable<T> If<T>(
    this IQueryable<T> source,
    bool condition,
    Func<IQueryable<T>, IQueryable<T>> transform
)
{ 
    return condition? transform(source) : source;
}
 
PREVIOUS NEXT
Tagged: #Conditional #IQueryable #Linq #extension
ADD COMMENT
Topic
Name
6+1 =