0

Taking the answer from this question; how would we modify the logic to perform a "! StartsWith" ? i.e. simply negating the logical result of the expression call.

Stringbean68
  • 65
  • 1
  • 9
  • 2
    How about `Expression.Not`? – thehennyy Oct 18 '18 at 12:41
  • @thehennyy awesome. I was looking in all the wrong places to find a way of doing this. Never thought to search what was available in "Expression". Thanks ! Can you not add your comment as an answer ? :-) – Stringbean68 Oct 18 '18 at 12:56

1 Answers1

1

To build a logial not you can use the Expression.Not method.

Have a look at the msdn for an example:

Creates a UnaryExpression that represents a bitwise complement operation.

https://learn.microsoft.com/en-us/dotnet/api/system.linq.expressions.expression.not?view=netframework-4.7.2

thehennyy
  • 4,020
  • 1
  • 22
  • 31