Find method in subclass based on dynamic parameter call in base class in C# -


I have a base class that accepts an interface. I want to find the method that best matches in the subclass. For example:

  abstract class support & lt; T & gt; {Receive public T (iPad parameters) {Provide return (parameters as dynamic); } Provide the public essence (IParam parameter); } Class implements & lt; String & gt; : Base & lt; String & gt; {Provide public string (IParam parameter) {return "default value"; } Provide public string (parameter 1 parameter) {return "value for implementation 1"; } Provide public string (ParamImplementation2 parameter) {return "value for implementation 2"; }}  

Unfortunately, the default value is returned every time it appears that dynamic keywords do not work when the actual implementation is in sub-classes. Is there any way to do this work?

why not provide parameter Override?

  Private authentic class support & lt; T & gt; {Receive public T (iPad parameters) {Return return (parameter); } Provide the public essence (IParam parameter); } Private class implements: base & lt; String & gt; {Provide the public override string (ipad parameter) {if (parameter parameter implantation 1) returns "value for implementation 1"; If (Parameter Parameter Implementation 2) returns "Price for implementation 2"; Return "Default value"; }}  

Comments