Функция выполняет поиск по последовательности.
using System;
//добавить ссылку
using System.Linq;
using System.Collections.Generic;
class Number {
public int Digit {set; get;}
public string Name {set; get;}
}
class Program {
public static int Main() {
//создание массива из объектов
var ara = new[] {
new Number() {Digit = 1, Name = "one"},
new Number() {Digit = 2, Name = "two"},
new Number() {Digit = 3, Name = "three"},
new Number() {Digit = 4, Name = "four"},
new Number() {Digit = 5, Name = "five"},
};
ILookup<int, Number> lookup = ara.ToLookup(k => k.Digit);
var query = lookup[3];
foreach(var i in query) {
Console.Write("{0} ",i.Name);
}
Console.WriteLine();
Console.ReadKey();
return 0;
}
}
three