1
yeni bir listesini döndürür FDKeyValue<>
Linq: Ben türünde yeni listeye filtre sıralaması ve istiyorum "AccountItem" türünde bir dönüş Verilen farklı türde
ben döngü olmadan bunu çalışıyorum ve ben düşündüm ki böyle bir şey yapabileceğini:
buradavar monthlyList = accountList.Where(x => x.RoleType == "Metric")
.OrderBy(x => x.EntityName)
.Select(new FDKeyValue<long, string>{}
{
"Field", "Field"
}
);
Ben bir döngü
var accountList = DBEntity.ReturnAccountListBySearch((int)this.PageLanguageType, "");
var monthlyList = accountList.Where(x => x.RoleType == "Metric").OrderBy(x => x.EntityName).ToList();
this.MonthlyAccountList = new FDKeyValue<long,string>();
foreach (var item in monthlyList)
{
this.MonthlyAccountList.Add(item.EntityID, item.EntityName);
}
FDKeyValue <> bir koleksiyonun kendisi ve bir Add yöntemine sahip, doğru mu? –
"select" ve "foreach" performansının göz önünde bulundurulması http://stackoverflow.com/questions/5322586/c-sharp-performance-of-linq-vs-foreach-iterator-block – Eldho
FtkeyValue, devralınan bir genel tupledır. LİSTE. Teşekkürler – Killilea