有谁知道 System 或 System.Core 中比较运算符的 .NET 枚举?
System 或 System.Core 中是否有包含所有 ComparisonOperator 的枚举?
我刚刚写了下面的枚举,但它似乎是一个很常见的东西,可能已经存在了。
public enum ComparisonPredicate
{
Equal,
Unequal,
LessThan,
LessThanOrEqualTo,
GreaterThan,
GreaterThanOrEqualTo
}
我在 System.Web.UI 中找到了一个,但是为该 http://msdn.microsoft.com/en -us/library/system.web.ui.webcontrols.validationcompareoperator(v=VS.100).aspx
另外,我已经看过 ExpressionType
,但我不想要范围那么广的东西
Is there an enum in System or System.Core that has all the ComparisonOperators?
I just wrote the following enum, but it seems like a common enough thing that one might already exist.
public enum ComparisonPredicate
{
Equal,
Unequal,
LessThan,
LessThanOrEqualTo,
GreaterThan,
GreaterThanOrEqualTo
}
I found one in System.Web.UI, but it would be more than silly to introduce a dependency for that http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.validationcompareoperator(v=VS.100).aspx
Also, I already looked at ExpressionType
, but I don't want something with that broad of a scope
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
据我所知这样的事情不存在。目前,您最好使用自己的。
AFIK such a thing does not exist. You are probably better off using your own, for now.
这是 Google 上的最高结果,但由于我是在 2018 年写这篇文章,并且在 .Net 4.5+ 领域,正确的答案是:
请参阅 learn.microsoft.com/en-us/dotnet/api/system.enum.equals?view=netframework- 4.7.2
This is the top result on Google however since I am writing this in 2018, and in the area of .Net 4.5+, the correct answer is:
See learn.microsoft.com/en-us/dotnet/api/system.enum.equals?view=netframework-4.7.2
有点晚了,但是.Net 3.5在
System.Linq.Expressions
中引入了ExpressionType
枚举,请参阅http://msdn.microsoft.com/en-us/library/bb361179(v=vs.110).aspx 了解更多详细信息。A bit late, but .Net 3.5 introduced the
ExpressionType
enumeration inSystem.Linq.Expressions
, see http://msdn.microsoft.com/en-us/library/bb361179(v=vs.110).aspx for more details.