This is kinda theoretical question, I was looking at someone else code (below) and my simple solution was to instantiate the collection outside linq, but I can guess there will be cases where I d want to instantiate the objects inside the query, and perhaps only on a selection of elements. Here s a simplified example of how this was being done (badly).
var pods = (from n in ids
where new Node(Convert.ToInt32(n)).HasValue("propertyName")
select new
{
Id = Convert.ToInt32(n),
Url = new Node(Convert.ToInt32(n)).Url,
Name = new Node(Convert.ToInt32(n)).Title()
}).ToList();
无关的说明:在这种情况下,诺德建筑商正在从一个记忆库获取数据。
我怎样才能改进这一榜样,在每件物体使用lin子时才能即时发射?
Cheers. Murray.