Don’t use a query expression. Use the overload of Select
which passes you an index:
var list = FileList.Select((file, index) => new { Index=index, Filename=file });
More Related Contents:
- Lambda statement for finding sub-string in a string from list of strings [closed]
- Returning IEnumerable vs. IQueryable
- Fluent and Query Expression — Is there any benefit(s) of one over other?
- ‘Contains()’ workaround using Linq to Entities?
- Is a LINQ statement faster than a ‘foreach’ loop?
- linq case statement
- XDocument containing namespaces
- Use own IComparer with Linq OrderBy
- How to convert list of arrays into a multidimensional array
- How to use the IEqualityComparer
- What is the effect of AsEnumerable() on a LINQ Entity?
- Understanding .AsEnumerable() in LINQ to SQL
- Updating an item property within IEnumerable but the property doesn’t stay set?
- Query Microsoft Access MDB Database using LINQ and C#
- Performance of LINQ Any vs FirstOrDefault != null
- LINQ to find series of consecutive numbers
- Linq query with nullable sum
- Dynamic table name in linq [duplicate]
- Recursive LINQ query: select item and all children with subchildren
- C# Select elements in list as List of string
- Join and Include in Entity Framework
- Creating dynamic queries with entity framework
- The data source does not support server-side data paging
- Last and LastOrDefault not supported
- How to group by DateTime.Date in EntityFramework
- How to set property value using Expressions? [duplicate]
- Should the order of LINQ query clauses affect Entity Framework performance?
- Transform IEnumerable asynchronously by awaiting each task
- Map two lists into a dictionary in C#
- How to check if all list items have the same value and return it, or return an “otherValue” if they don’t?