chciałbym uzyskać tylko pierwszy rekord Zdaję sobie sprawę, The „Take() nie będzie działać.Get pierwszy element listy z kwerendy LINQ
Mam więc Lista że zapytania innej listy
List<string> etchList = new List<string>();
etchList.Add("709");
zapytanie LINQ jest
var query = (from vio in AddPlas
where etchList.Any(vioID => vio.Key.Formatted.Equals(vioID))
select new
{
EtchVectors = vio.Shapes
}).ToList().Take(1);
teraz to „Take (1)” będzie działać tylko wtedy, gdy miałem inne dane w etchList, więc to nie jest to, czego szukam. wyniki dostaję wyglądać to:
Sformatowanych
"clinesegs" 1013,98 5142,96 "LYR3_SIG2"
"clinesegs" 1020,16 5168,33 "LYR3_SIG2"
"clinesegs" 967,03 5151,31 "LYR3_SIG2"
"clinesegs" 971,43 5174,01 "LYR3_SIG2"
życzę aby tylko dostać z powrotem pierwszy „wiersz w liście
"clinesegs" 1013.98 5142.96 "LYR3_SIG2"
EDIT:
Ok ten kod istnieje:
public class AddPla
{
public AddPla()
{
Shapes = new List<Parse>();
}
public Parse Key { get; set; }
public Parse Pla { get; set; }
public Parse Angle { get; set; }
public Parse Default { get; set; }
public List<Parse> Shapes { get; set; }
public Parse DoubleBrace { get; set; }
public Parse Number1 { get; set; }
public Parse Number2 { get; set; }
}
public class Parse
{
public string Formatted { get; set; }
public string Original { get; set; }
}
Potem ta lista
var AddPlas = new List<AddPla>();
Przykro mi, nie był "T próbuję" ukryć "dowolny kod, po prostu nie napisałem pierwotnie myśląc, że to nie jest tak ważne, ale widzisz, jak kształtuje się lista typ –
Więc, czekaj, chcesz dostać pierwsze 'Kształty' z każdego' AddPla'? – gunr2171
Tak, przepraszam za to .... –