The title may be a bit ambiguous, but I couldn\'t think of a better way to word this.
I realize that I can not call a derived constructor prior to calling a base con
You can create a static method on derived class and put your logic there:
public enum InputType {
Number = 1,
String = 2,
Date = 3
}
public class BaseClass {
public BaseClass(InputType t) {
// Logic
}
}
public class DerivedClass : BaseClass {
public DerivedClass(int i)
: base(GetInputType(i)) {
// Is it possible to set "value" here?
// Logic
}
private static InputType GetInputType(Int32 parameter) {
// Do something with parameter
// and return an InputType
return (InputType)Enum.Parse(typeof(InputType), parameter);
}
}