美文网首页
解决 No coercion operator is defin

解决 No coercion operator is defin

作者: DF_Sky | 来源:发表于2019-09-30 09:29 被阅读0次

Linq Any转换失败:

var isExist = db.MyDbTable.Any(o => o.Id == id);

//throw No coercion operator is defined between types 'System.Int16' and 'System.Boolean',

          要改成

          var isExist = db.MyDbTable.FirstOrDefault(o => o.Id == id) != null;

亲测 有效

相关文章

网友评论

      本文标题:解决 No coercion operator is defin

      本文链接:https://www.haomeiwen.com/subject/afjcpctx.html