How to get the hard-coded parameter that the sub-class constructor is used to call the base-class constructor?
public class BaseMessage
{
public BaseMessage(string format, params string[] parameteres)
{
}
}
public class HelloMessage : BaseMessage
{
public HelloMessage(string name) : base("Hello {0}", name)
{
}
}
public class IntroductionMessage : BaseMessage
{
public IntroductionMessage(string name, string myName) : base("Hello {0}, I am {1}", name, myName)
{
}
}
I would like to get all the hard-coded formatting string for the sub-classes of BaseMessage, i.e. "Hello {0}" and "Hello {0}, I am {1}"
Aucun commentaire:
Enregistrer un commentaire