namespace PlayWithCollection { class Program { static void Main(string[] args) { ListModel = new List () { "1", "2", "3" }; foreach (var item in Model.Select((value, i) => new { i, value })) { Console.WriteLine("Collection Object Values : " + item.value); Console.WriteLine("Collection Index : " + item.i); } } }
Friday, April 22, 2016
C# Cool Code : Foreach with Index iterator values
Subscribe to:
Post Comments
(
Atom
)
No comments :
Post a Comment