Click here to Skip to main content
15,891,136 members
Please Sign up or sign in to vote.
1.44/5 (5 votes)
See more:
HI Everyone,

If i have the count > 0 then i want to ignore the second record which is similar to fist record .Ignore the Duplicate records.

Is there any link to get it.please guide me.

I have the code as follows:
List<IZteBbh> singleCellRecords = duplicateRecords.Where(item => (item.CombinedMaster as ICombinedMaster).Id.ToString() == cellId).ToList();
                    //// Check for same records.
                    List<IZteBbh> blankRecords = new List<IZteBbh>();
                    for (int count = 0; count < singleCellRecords.Count; count++)
                    {
                        //// Check for blank 
                        bool isBlank = singleCellRecords[count].Ru60Ru02 == string.Empty
                                         && singleCellRecords[count].NumberOfTrxs == 0
                                         && singleCellRecords[count].EquippedTrxs == 0
                                         && singleCellRecords[count].SdcchSlots == 0
                                         && singleCellRecords[count].PdtchTs == 0
                                         && singleCellRecords[count].HrEnable == false
                                         && singleCellRecords[count].AmrThreshold == 0
                                         && singleCellRecords[count].AvailableTchFullHalfChannel == 0
                                         && singleCellRecords[count].DesinedCapacity == 0
                                         && singleCellRecords[count].AvailableTchFr == 0
                                         && singleCellRecords[count].DesinedCapacityFr == 0
                                         && singleCellRecords[count].NoOfSdcchAvailable == 0
                                         && singleCellRecords[count].NoOfSdcchTimeSlots == 0
                                         && singleCellRecords[count].PeakOfSdcchUsed == 0
                                         && singleCellRecords[count].NoOfAvailableTch == 0
                                         && singleCellRecords[count].PeakOfTchOrFUsed == 0
                                         && singleCellRecords[count].NoOfPdch == 0
                                         && singleCellRecords[count].NoOfPdchSwitchable == 0
                                         && singleCellRecords[count].NoOfPdchUsed == 0
                                         && singleCellRecords[count].TotalValidateAttempts == 0
                                         && singleCellRecords[count].TotalEstablishedCalls == 0
                                         && singleCellRecords[count].CssrPerc == 0
                                         && singleCellRecords[count].DroppedCalls == 0
                                         && singleCellRecords[count].DroppedCallsRate == 0
                                         && singleCellRecords[count].HandOverAttempts == 0
                                         && singleCellRecords[count].SuccessfulHandOverAttempts == 0
                                         && singleCellRecords[count].HandOverSuccessRate == 0
                                         && singleCellRecords[count].HandOverFailureRate == 0
                                         && singleCellRecords[count].RandomAccessSuccessRate == 0
                                         && singleCellRecords[count].SdcchBlks == 0
                                         && singleCellRecords[count].SdcchCongInTime == 0
                                         && singleCellRecords[count].TchBlks == 0
                                         && singleCellRecords[count].TchCongInTime == 0
                                         && singleCellRecords[count].CongHandovers == 0
                                         && singleCellRecords[count].DirectedRetryCalls == 0
                                         && singleCellRecords[count].SdcchDrps == 0
                                         && singleCellRecords[count].DynSdcchUsed == 0
                                         && singleCellRecords[count].TchDrps == 0
                                         && singleCellRecords[count].ErlMinDrop == 0
                                         && singleCellRecords[count].Fr == 0
                                         && singleCellRecords[count].Hr == 0
                                         && singleCellRecords[count].AmrFr == 0
                                         && singleCellRecords[count].AmrHr == 0
                                         && singleCellRecords[count].TchAssignSuccessRate == 0
                                         && singleCellRecords[count].VoiceErlangs == 0
                                         && singleCellRecords[count].RadioNtwUtiliztaionRate == 0
                                         && singleCellRecords[count].TbfSuccessRateUl == 0
                                         && singleCellRecords[count].TbfSuccessRateDl == 0
                                         && singleCellRecords[count].UlGprsThroughputRlc == 0
                                         && singleCellRecords[count].DlGprsThroughputRlc == 0
                                         && singleCellRecords[count].UlEGprsThroughputRlc == 0
                                         && singleCellRecords[count].DlEGprsThroughputRlc == 0
                                         && singleCellRecords[count].RrRescCongRateNomDlBlocking == 0
                                         && singleCellRecords[count].RrRescCongRateDeNomDlBlocking == 0
                                         && singleCellRecords[count].RrRescCongRateDlBlockingRate == 0
                                         && singleCellRecords[count].RrRescCongRateNomUlBlocking == 0
                                         && singleCellRecords[count].RrRescCongRateDeNomUlBlocking == 0
                                         && singleCellRecords[count].RrRescCongRateUlBlockingRate == 0
                                         && singleCellRecords[count].AbisRescCongRate == 0
                                         && singleCellRecords[count].UppbdDspRescCongRate == 0
                                         && singleCellRecords[count].GprsRlcPayloadUplink == 0
                                         && singleCellRecords[count].GprsRlcPayloadDownlink == 0
                                         && singleCellRecords[count].EGprsRlcPayloadUplink == 0
                                         && singleCellRecords[count].EGprsRlcPayloadDownlink == 0
                                         && singleCellRecords[count].SdcchBlocking == 0
                                         && singleCellRecords[count].SdcchDrp == 0
                                         && singleCellRecords[count].TtslTchBlkRate == 0
                                         && singleCellRecords[count].NoOfStatTs == 0
                                         && singleCellRecords[count].NoOfDynTs == 0
                                         && singleCellRecords[count].MaxNoOfUsedPdch == 0
                                         && singleCellRecords[count].AvgNoOfUsedPdch == 0
                                         && singleCellRecords[count].NoOfForceConerDynFromPdchToTchByBsc == 0
                                         && singleCellRecords[count].DataErlang == 0
                                         && singleCellRecords[count].VoiceDataErlangs == 0
                                         && singleCellRecords[count].SdBlkNom == 0
                                         && singleCellRecords[count].SdBlkDeNom == 0
                                         && singleCellRecords[count].SdDropNom == 0
                                         && singleCellRecords[count].SdDropDeNom == 0
                                         && singleCellRecords[count].TchBlkNom == 0
                                         && singleCellRecords[count].TchBlkDeNom == 0
                                         && singleCellRecords[count].TchDropNom == 0
                                         && singleCellRecords[count].TchDropDeNom == 0
                                         && singleCellRecords[count].HosrNom == 0
                                         && singleCellRecords[count].HosrDeNom == 0
                                         && singleCellRecords[count].NoOfDynPdchPreemptionForCsService == 0
                                         && singleCellRecords[count].CcrVoiceServicesNom1 == 0
                                         && singleCellRecords[count].CcrVoiceServicesDeNom1 == 0
                                         && singleCellRecords[count].CcrVoiceServicesNom2 == 0
                                         && singleCellRecords[count].CcrVoiceServicesDeNom2 == 0
                                         && singleCellRecords[count].CcrVoiceServicesNom3 == 0
                                         && singleCellRecords[count].CcrVoiceServicesDeNom3 == 0
                                         && singleCellRecords[count].CcrVoiceServicesNom4 == 0
                                         && singleCellRecords[count].CcrVoiceServicesDeNom4 == 0
                                         && singleCellRecords[count].TasrNom == 0
                                         && singleCellRecords[count].TasrDeNom == 0
                                         && singleCellRecords[count].UlQualNom == 0
                                         && singleCellRecords[count].UlQualDeNom == 0
                                         && singleCellRecords[count].DlQualNom == 0
                                         && singleCellRecords[count].DlQualDeNom == 0
                                         && singleCellRecords[count].RachNom == 0
                                         && singleCellRecords[count].RachDeNom == 0;
                        
                        if (isBlank)
                        {
                            ////blankRecords.Add(singleCellRecords[count]);
                            blankRecords.Remove(singleCellRecords[count]);
                        }
                    }

What i need to find is ,if i found any duplicate records with same value ,then i want to ignore the second record.
As in if condition i wrote
C#
if (isBlank)
                        {
                            ////blankRecords.Add(singleCellRecords[count]);
                            blankRecords.Remove(singleCellRecords[count]);
                        }
but how can i ignore the second data from that count.
Please advice

Thanks
Harshal
Posted
Updated 20-May-14 7:05am
v3
Comments
CHill60 20-May-14 8:27am    
Count of what? What control or structure are you using and how are you retrieving the records?
Use the Improve Question link to post the relevant code
Animesh Datta 20-May-14 8:28am    
please improve the question and give some more details
ZurdoDev 20-May-14 8:38am    
What?
ZurdoDev 20-May-14 9:18am    
This still does not make sense. Please click the improve question link and add your relevant code to the question and then delete these comments.
R Harshal 20-May-14 9:47am    
Please have a look.I have modified the code as follows:

I write this as a solution, even it is not yet the solution for you, but maybe follwing will help you to come to a solution.

1.) Please try to describe the "logic" in few words/sentences
2.) After that check if your question still makes sense.
3.) If yes, try to reduce code in your question to the Minimum (to the logic), because nobody here I think is keen on to check whether the problem is one of your tons of comparisons ;)

Regards, Bruno
 
Share this answer
 
Comments
Maciej Los 20-May-14 14:50pm    
+5!
[no name] 21-May-14 2:46am    
Thank you Maciej. Regards, Bruno
R Harshal 21-May-14 5:40am    
Yeah Sure Sir.
sir, try the code below to get distinct records from a list
List<t> withDupes = LoadSomeData();
List<t> noDupes = withDupes.Distinct().ToList();</t></t>
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900