LINQ を使用しようとしていますが、次のエラー メッセージが表示され続けます。
演算子 '<' は、型 'Ilistprac.Location' および 'int' のオペランドには適用できません
オーバーライドを試みましたが、エラー メッセージが表示されます。
'Ilistprac.Location.ToInt()': オーバーライドする適切なメソッドが見つかりません
すべての IList インターフェイスも IEnumerable で実装されています (誰かが私に望んでいない限り、ここにはリストされていません)。
class IList2
{
static void Main(string[] args)
{
Locations test = new Locations();
Location loc = new Location();
test.Add2(5);
test.Add2(6);
test.Add2(1);
var lownumes = from n in test where (n < 2) select n;
}
}
public class Location
{
public Location()
{
}
private int _testnumber = 0;
public int testNumber
{
get { return _testnumber; }
set { _testnumber = value;}
}
public class Locations : IList<Location>
{
List<Location> _locs = new List<Location>();
public Locations() { }
public void Add2(int number)
{
Location loc2 = new Location();
loc2.testNumber = number;
_locs.Add(loc2);
}
}