I am trying to have a List of classes that implement a generic class and be able to access some members of the GenericClass through the abstract base. This is where I am at the moment:
public abstract class AbstractParent: UserControl
{
public abstract AAction Action { get; set; }
}
public abstract class GenericBase<ActionType> : AbstractParent
{
protected ActionType _action;
new public ActionType Action
{
set { _action = value; }
get { return _action; }
}
}
In order to have a list of GenericBase<> instances, I use a List<AbstractParent>
The problem is that I want a public property of the genericType (passed by the derived class from GenericBase).
The error at the moment is Action hides inherited abstract member Action.get.
I know that I can either have an abstract proprty and an implementation, or implementation and new modifier in the derived property. Both don’t fit in this situation.
example of what I want:
GenericBase<BlueAction> blueClass;
blueClass.Action <- I want this member to be of BlueAction type
This does what you want, granted not using generics. Since I can’t figure out WHY you’d want a
List<ActionableWrapper>when instead of using generics you could just use an interfaces and make it simplelyList<IActionable>.I am trying to have a List of classes that implement a generic class and be able to access some members of the GenericClass through the abstract base.Using Linq you can do this easily anyway (using your example):