Ability to generate constructor chaining
Closed this issue · 2 comments
Nitin5acc commented
Hello,
How can we have constructor chaining? something like -
public ValidLocationRule(PlateFact plateLocationFact) : base(plateLocationFact)
{
_plateLocationFact = plateLocationFact;
}
MilleBo commented
Hey! We don't support that right now but I can add it later today and upload a new version.
MilleBo commented
I have added this in the new version, you simply add a ConstructorInitializer
object when creating your constructor. Like this:
ConstructorGenerator.Create("MyClass", BodyGenerator.Create(), constructorInitializer: new ConstructorInitializer(ConstructorInitializerTypes.Base, new List<Argument> { new ValueArgument("myText")})))
Which will give you:
"MyClass():base("myText"){}"