-2

I have a table with Guid column as primary key.

enter image description here

How can I get the row index of a column using entity framework. For example I want to get the row index of Grapes

4

1 Answer 1

0

You can get the index of the element directly if your list has implemented indexer.

In your case, for example if you want the Grapes index you can do this (I do not recommend using it in tables with many elements because from the point of view of the performance ToList() is bad):

Table test= Table.Where<Table>( x => return x.Name== "Grapes";).Single<Table>();
int index = Table.ToList().IndexOf(test);
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.