Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post Mar 23, 2012 04:17 PM by dvLes
Mar 23, 2012 12:05 PM|LINK
I have a foreach loop which iterates over a list of ViewModels which contains a property called Task.Id. How do I assign the newly created Task ID from a Linq select statement to the current loop item e.g.
foreach(var item in lstIcmpEcho)
Task<PingReply> icmpEchoResult = (from itemhost in lstIcmpEcho
select new Ping().SendPingAsync(itemhost.Host, _timeout, _buffer, _pingOptions)
//seeking solution too.. item.PingID = Task.Id
Mar 23, 2012 12:39 PM|LINK
this post may be useful .. u can refer from (TopicName)
Advanced: Looking at the Entire Change List for the Transaction
Mar 23, 2012 01:10 PM|LINK
I'm not sure, if you are looking for something like this:
lstIcmpEcho.Select(item => new Ping
PingID = item.Id
Mar 23, 2012 04:17 PM|LINK
Thank you very much for the info. It was almost 100% what I was looking for :).
icmpEchoResult = lstIcmpEcho.Select(c=>
Task<PingReply> _echoReply = new Ping().SendPingAsync(c.Host, _timeout, _buffer, _pingOptions);
c.TaskId = _echoReply.Id;
Thank you once again.