以下の問題は何ですか?Except Extension Methodを使用しているときの問題
var newContextElementCollection = new List<NewContextElements>();
var res= from eleCollection in newContextElementCollection
where eleCollection.Property.Except(new List<string> { "Password","Some Other Value" })
select eleCollection;
NewContextElementCollectionクラスは
public class NewContextElements
{
public string Property { get; set; }
public string Value { get; set; }
}
Getting error: Error 1 Instance argument: cannot convert from 'string' to 'System.Linq.IQueryable' Error 2 'string' does not contain a definition for 'Except' and the best extension method overload 'System.Linq.Queryable.Except(System.Linq.IQueryable,
System.Collections.Generic.IEnumerable)' has some invalid arguments
。実際、除外リストはスカラー項目ではなくコレクションになります。新しいリストのように {"パスワード"、 "その他の値"}これをどう扱う? –
@ user1323981 - http://stackoverflow.com/a/853551/1583 – Oded
表示されている例には、同様のエンティティタイプがあります。私の場合、それはしかし異なっている。そのような場合、適合しません(私はそうだと思います)。 –