Associate List<T>.Remove to an event in C#?
Posted
by Uri
on Stack Overflow
See other posts from Stack Overflow
or by Uri
Published on 2010-03-16T05:07:50Z
Indexed on
2010/03/16
5:16 UTC
Read the original article
Hit count: 234
c#
Hi guys, I have a Products:List<Product>
class.
I'd like to make it so that every time that I remove an item from that list, my program decreases a counter.
Is there a way to do it without overriding the Remove method or decreasing it manually? And if there is none, anybody knows where I can find the code for the Remove method?
Thanks!
I thought about associating the Remove method to an event, but I don't know how to do it without overriding it or creating another method with the Remove method inside it. Excuse me for my ignorance, but I'm just getting into OOP programming.
© Stack Overflow or respective owner