IEnumerable question

Hi,
Is there a way IEnumerable can have an index?
I have IEnumerable
I need to get at index positions some values.
I know can loop through, but need to get specific posiiton.

Thank you,

Hi @A_Learner

You can try the below expression to get the index of the item in Ienumerable.

Assign
   itemIndex = myEnumerable.ToList().IndexOf("banana")

Hope it helps!!

1 Like

Hi,

Can you try ElementAt or indexer?

image

Regards,

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.