在SQL的Linq中未实现string1> = string2,是否有任何解决方法? [英] string1 >= string2 not implemented in Linq to SQL, any workaround?
本文介绍了在SQL的Linq中未实现string1> = string2,是否有任何解决方法?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何在Linq中将string1> = string2转换为SQL?
How do I do string1 >= string2 in Linq to SQL?
推荐答案
string1> = string2在C#Linq To Sql中不受支持. String类根本不会覆盖> =运算符.它仅覆盖!=和==运算符.您可以尝试编译以下方法来验证这一点
string1 >= string2 is not supported in C# Linq To Sql. The String class does not override the >= operator at all. It only overrides the != and == operators. You can verify this by trying to compile the following method
public static void Example() {
int val = "foo" >= "bar";
}
如果要与LinqToSql中的字符串进行比较,则应该能够使用静态
If you want to compare to Strings in LinqToSql you should be able to use the static String.Compare(string,string) method.
这篇关于在SQL的Linq中未实现string1> = string2,是否有任何解决方法?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文