I’ve this Collection for example:
1: A
2: B
3: A
4: C
5: A
6: C
I want to get the second repeated item from this collection in a LINQ query,
the required result is: 3:A, 6:C
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
A bit complicated but working:
It returns a list with:
N.B.
The index is 1 lower than your desired solution, (because index is 0-based). But it’s really easy to increment it, even in the first LINQ Select if you want: