Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

string1 >= string2 not implemented in Linq to SQL, any workaround?

How do I do string1 >= string2 in Linq to SQL?

like image 421
Jedi Master Spooky Avatar asked Feb 16 '09 14:02

Jedi Master Spooky


1 Answers

If you're looking for => which would normally be written as >= then you cannot do this directly with strings. You can get the same behaviour via CompareTo:

string1.CompareTo(string2) >= 0

In this case, the result being less than or equal to zero means that string1 would be sorted before string2 and therefore is greater.

FYI the => operator in C# is only used in the definition of lambda expressions.

like image 73
Drew Noakes Avatar answered Sep 23 '22 05:09

Drew Noakes