データベースからIDのリストを取得するコードがあります。コードは、以下のLINQを使用して行われます
var resutls = (from v in con.NewsLatter
where v.SendStatus == "Active"
select new { v.Id }).ToList;
NewsLater というテーブルのデータベースからすべての ID を返します。今私がやろうとしているのは、このすべてのIDを入力することです
List<Int32> IdList = new List<Int32>{ //list of id want to fill here in List<Int32> };
var min = IdList .Where(x=>x>12).Min();
return min;
以下のようにこれを埋めようとすると
List<Int32> IdList = new List<Int32> { Convert.ToInt32(resutls) };
var min = IdList .Where(x => x > 12).Min();
return min;
私は例外を得ました:
Unable to cast object of type
'System.Collections.Generic.List`1[<>f__AnonymousType0`1[System.Int32]]' to type
'System.IConvertible'.
ここで何が間違っていたのか、誰にも分かりますか?