我有一些实体
EntityCollection retrievedEntities =(EntityCollection)serviceProxy.RetrieveMultiple(query);
来自retrievedEntities
我想从具有attribule value =某个值(string
或int
)
单个linq查询可以解决这个问题吗?
var q = from p in retrieve.Entities
where p.Attributes.Keys = "new_attribute1" && p.Attributes.Values = "avik"
select p.Attributes.Values;
答案 0 :(得分:2)
根据@Frebin Francis
的建议尝试此操作var q =retrieve.Entities.Where(x=>x.Attributes.Keys== "new_attribute1" && x.Attributes.Values = "avik").Select(x=>x.Attributes.Values)
答案 1 :(得分:0)
我会坚持使用简单明了的foreach循环谢谢
foreach (var p in retrieve.Entities)
{
if(p["new_elementid"]=="some variable or constant ")
temp = (int)p["new_elementid"];
}