开发者

Convert object to int in Linq Where clause

开发者 https://www.devze.com 2023-03-25 04:38 出处:网络
I\'m trying to query a collection where a value of a DataColumn is equal to a number. Problem is, I can\'t convert an object to an int within a Linq query.

I'm trying to query a collection where a value of a DataColumn is equal to a number. Problem is, I can't convert an object to an int within a Linq query.

The error fires within the where clause. Any suggestions?

Is there a special syntax I'm not aware o开发者_StackOverflow社区f?

var datos = _dttMasterViewTransaction.AsEnumerable().Where(r => r["JEID"] == FundsID).Select(r => new EntityJESummary()
{
    Test = r["test"]
}).ToList();


Special syntax? Does casting count?

_dttMasterViewTransaction.AsEnumerable().Where(r => (int)r["JEID"] == FundsID)
0

精彩评论

暂无评论...
验证码 换一张
取 消