You could use FindIndex
string myName = "ComTruise";
int myIndex = MyList.FindIndex(p => p.Name == myName);
Note: FindIndex returns -1 if no item matching the conditions defined by the supplied predicate can be found in the list.
More Related Contents:
- System.Linq.Expression.Compile error
- Remove duplicates in the list using linq
- Sort a list from another list IDs
- When to use Cast() and Oftype() in Linq
- Unable to create a constant value of type Only primitive types or enumeration types are supported in this context
- How to get index using LINQ? [duplicate]
- Using Linq to group a list of objects into a new grouped list of list of objects
- Lambda/Linq with Contains criteria for multiple keywords
- Error: “The specified LINQ expression contains references to queries that are associated with different contexts”
- How to write Asynchronous LINQ query?
- JContainer, JObject, JToken and Linq confusion
- How do you perform a CROSS JOIN with LINQ to SQL?
- LIKE operator in LINQ
- Why can’t I call an extension method from a base class of the extended type?
- Apply function to all elements of collection through LINQ [duplicate]
- Select Multiple Fields from List in Linq
- Linq distinct – Count
- How do I segment the elements iterated over in a foreach loop
- Cannot convert lambda expression to type ‘string’ because it is not a delegate type [duplicate]
- How to specify dynamic field names in a Linq where clause?
- LINQ order by null column where order is ascending and nulls should be last
- Linq Query Group By and Selecting First Items
- How to use LINQ Distinct() with multiple fields
- LINQ query to return a Dictionary
- LINQ: Select where object does not contain items from list
- Creating a LINQ select from multiple tables
- how do access previous item in list using linQ?
- How do I compose Linq Expressions? ie Func
- If Else in LINQ
- Parsing a string C# LINQ expression