I want to add an event to the List generic class in C# in order to handle changing items of list in case that a new item is added or removed. I create class and inherit it from List class. Since the Add, Insert, and Remove methods of this class can't be overrode, I define new Add, Insert, and Remove methods by new keyword and call the parent methods and then raise my event. I used this class as a property in an User Control. In design mode when I change the collection with provided GUI in .net development studio, the event does not work. How can I solve this problem?
Here is an example of defining such a class
public class SelectorItemCollection : List
{
public new void Add(SelectorItem Item)
{
//Call parent method
base.Add(Item);
//Raise changing event
this.OnCollectionChanged();
}
}
I defined a property in my user control class like this:
[DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
public SelectorItemCollection Items { get; }
My desired state that when I change the items in this dialog, I want to raise a changing event from collection class.
JavaScript questions and answers, JavaScript questions pdf, JavaScript question bank, JavaScript questions and answers pdf, mcq on JavaScript pdf, JavaScript questions and solutions, JavaScript mcq Test , Interview JavaScript questions, JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)