My StatusCategory object is a editable child list contained in a root object. When I compile I get the following warning.
Warning 1 'MyCompany.Library.StatusCategoryList.this[int]' hides inherited member 'System.Collections.ObjectModel.Collection<MyCompany.Library.StatusCategory>.this[int]'. Use the new keyword if hiding was intended.
This is because the property "this[int index]" is already implemneted in the base class of your class. Since in base class its not marked a svirtula therefore you must use new i.e. "new this[int index]" before the property if you are intentionally overriding this property. Usually you need to override this but I dont know your requirements so you need to decide on this..
- Ramesh
Thanks for the quick reply :) Just so I understand correctly.
The issue is BusinessListBase doesn't declare a virtual (this) property and the generic list has a default this property which expects an indexer of type int. So in order for me to use this[int index] I need to add a virtual (this) property to business list base?
Is that why in project tracker. The class ResourceAssignments can use this[guid projectid] with out a warning because it expects a guid and ProjectResources has GetItem method because it needed an integer for an index?
Ok so I just found a link that explains the "new" keyword it basically just tells the compiler that you intentially want to call this method instead of the one implemented in the base class.
What I don't understand is why using the "new" keyword on a method is breaking OOP principles.
Copyright (c) Marimer LLC