Quantcast
Channel: ADO.NET, Entity Framework, LINQ to SQL, NHibernate
Viewing all articles
Browse latest Browse all 1698

How to set index with one line of LINQ?

$
0
0

I need to get the inner text and then what index it is in the list.

Is there a way to do this inline without me having to foreach over the list and setting it?

     var teamNameOrder = doc.DocumentNode.SelectNodes(string.Format("//*[contains(@class,'{0}')]", "hide-mobile")).Select(s => new { InnerText = s.InnerText, Index = 0 }).ToList();


Viewing all articles
Browse latest Browse all 1698

Trending Articles