Avatar of RameshLathu
RameshLathu
Flag for United States of America asked on

C# Collections

Hi Experts,

I have a collection (Collection<PolicyTransaction> LobjThreadPolicyTransactions).

This collection is having a string variable called "PolicyNumber"

In thins list of collection(LobjThreadPolicyTransactions), sometimes, I will be getting same PolicyNumber more than once (Same policy number may have more than one transaction).

I want to check which policy number is repeating and want to keep those records in a separate list.

Basically, I want to get the second repeated item from the collection in VS 2005, in C#.

How to do this? Please help.
C#ASP.NET.NET Programming

Avatar of undefined
Last Comment
RameshLathu

8/22/2022 - Mon
kaufmed

Are you permitted to use LINQ?
RameshLathu

ASKER
No
SOLUTION
kaufmed

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
RameshLathu

ASKER
Thank you, I will check it out and let you know.
I started with Experts Exchange in 2004 and it's been a mainstay of my professional computing life since. It helped me launch a career as a programmer / Oracle data analyst
William Peck
RameshLathu

ASKER
Hi,

I tried to add the code, but the "Contains" is not accepting two parameters. (if (repeats.Contains(tran, comparer))
RameshLathu

ASKER
In 2010, contains will accept two parameter, one is the object and second paramter as comparer. But, I am not getting that option in 2005.
ASKER CERTIFIED SOLUTION
Log in to continue reading
Log In
Sign up - Free for 7 days
Get an unlimited membership to EE for less than $4 a week.
Unlimited question asking, solutions, articles and more.
RameshLathu

ASKER
Thankyou. Its working fine
Get an unlimited membership to EE for less than $4 a week.
Unlimited question asking, solutions, articles and more.