Click here to Skip to main content
15,894,343 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
hi Team,

One query please ,
i want to delete the last records from the collection.As I am deleting the duplicates records.I am using this:
C#
for (int i = singleCellRecords.Count - singleCellRecords[0]; i >= 0; i--)
{
    if (singleCellRecords.Count > 1)
    {
        singleCellRecords.RemoveAt(i);
        break;
    }
}

but it gives me error as follows
Quote:
Error 15 Operator '-' cannot be applied to operands of type 'int' and 'Kaizen.Entities.Kaizen2G.IZteBbh'

Please kindly revert .what changes i need to do .

Thanks
Harshal
Posted
Updated 21-May-14 6:43am
v3
Comments
Ziee-M 21-May-14 12:42pm    
use convert or parse to be sure the type is int.
Convert.toInt16(singleCellRecords[0])
Sergey Alexandrovich Kryukov 21-May-14 12:44pm    
No! Don't do what Ziee-M advises; it makes no sense at all. Instead, understand what do you want to achieve. The error is self-explanatory.
—SA
CHill60 21-May-14 12:45pm    
singleCellRecords[0] is of type IZteBbh ... did you mean to pick out a specific property of that object?

if you need to remove last record
C#
singleCellRecords.RemoveAt(singleCellRecords.Count-1);
 
Share this answer
 
Comments
R Harshal 22-May-14 3:48am    
Thanks Friend.
Thanks A lot.
singleCellRecords.Count - singleCellRecords[0]
What you probably wanted to do was use singleCellRecords.Count.
 
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