[Proposal]: Support predicate negation i.e. !func #8076
Replies: 2 comments 3 replies
-
Perhaps related to this idea too: #91 |
Beta Was this translation helpful? Give feedback.
-
I wonder if something like this would fall out naturally with method group natural types and extensions: public implicit extension PredicateExtension<T> for Func<T, bool> {
public static Func<T, bool> operator !(Func<T, bool> predicate) {
return x => !predicate(x);
}
} Currently you can't resolve extensions on a method group (otherwise you could write a |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
The
!expr
currently works when theexpr
is a boolean. How about extending that to any boolean returning function? That way instead of writing this for example:this is what you'd write:
I realize that this is very minor and maybe not worth the time it'd take to implement it. But I do find myself wishing for it from time to time so I thought I'd throw it out there.
Beta Was this translation helpful? Give feedback.
All reactions