I want to convert WorkItemCollection
to a List<WorkItem>
, so that I could convert it further into a dictionary
. Here's the code so far:
var testItemCollectionList = new List<WorkItem>();
WorkItemCollection testItemCollection;
Query query = new Query(project.Store, "Select [Title] From WorkItems", testResults.Select(item => item.TargetId).ToArray());
var car = query.BeginQuery();
testItemCollection = query.EndQuery(car);
testItemCollectionList = ???;
var testItemMapQuery = testItemCollectionList.ToDictionary(w => w, createItemFromQuery);
testItemCollectionList = (from WorkItem mItem in testItemCollection select mItem).ToList();
Since WorkItemCollection
implements IEnumerable
through ReadOnlyList
, you should be able to use .Cast<WorkItem>()
then directly convert to a Dictionary
.
var testItemMapQuery = testItemCollection.Cast<WorkItem>()
.ToDictionary(w => w, createItemFromQuery);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With