Link to home
Start Free TrialLog in
Avatar of RameshLathu
RameshLathuFlag 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.
Avatar of kaufmed
kaufmed
Flag of United States of America image

Are you permitted to use LINQ?
Avatar of RameshLathu

ASKER

No
SOLUTION
Avatar of kaufmed
kaufmed
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thank you, I will check it out and let you know.
Hi,

I tried to add the code, but the "Contains" is not accepting two parameters. (if (repeats.Contains(tran, comparer))
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
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thankyou. Its working fine