System.Linq.Queryable不是一个属性类错误? [英] System.Linq.Queryable is not an attribute class error?
问题描述
我收到一个错误,当添加[Queryable]的错误是类似这样'System.Linq.Queryable'不是一个属性类
I am getting an error when adding [Queryable] the error is similar like this 'System.Linq.Queryable' is not an attribute class
当我试图在[System.Web.Http.Queryable]之前添加命名空间我有另一个错误
when I tried to add namespace before [System.Web.Http.Queryable] I got another error
System.Web.Http.QueryableAttribute类型
System.Web.Http.OData.dll和System.Web.Http.dll
The type System.Web.Http.QueryableAttribute exists in both System.Web.Http.OData.dll and System.Web.Http.dll
如何解决? / p>
How to resolve this?
推荐答案
正如SonerGönül说的。
最可能你有
两个在你的cs文件中使用指令:
As Soner Gönül said. Most probably you have two using directives in your cs file:
using System.Web;
using System.Web.Http;
都定义属性。请删除其中一个命名空间或完全限定您的属性为
both define the attribute. Either remove one of those namespaces or fully qualify your attribute either as
[System.Web.Queryable]
// or
[System.Web.Http.Queryable]
和你需要什么。您将在相应的MSDN文档中找到更多帮助。
Depending what the difference is of both and what you need. You will find more help in the corresponding MSDN documentation of both.
这篇关于System.Linq.Queryable不是一个属性类错误?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!