[ACCEPTED]-string1 >= string2 not implemented in Linq to SQL, any workaround?-string-comparison
If you're looking for =>
which would normally 7 be written as >=
then you cannot do this directly 6 with strings. You can get the same behaviour 5 via CompareTo:
string1.CompareTo(string2) >= 0
In this case, the result being less 4 than or equal to zero means that string1
would 3 be sorted before string2
and therefore is greater.
FYI 2 the =>
operator in C# is only used in the 1 definition of lambda expressions.
string1 >= string2 is not supported in 7 C# Linq To Sql. The String class does not 6 override the >= operator at all. It 5 only overrides the != and == operators. You 4 can verify this by trying to compile the 3 following method
public static void Example() {
int val = "foo" >= "bar";
}
If you want to compare to 2 Strings in LinqToSql you should be able 1 to use the static String.Compare(string,string) method.
More Related questions
We use cookies to improve the performance of the site. By staying on our site, you agree to the terms of use of cookies.