GenClass1.cs
partial void DoSomethingExtension();
public void DoSomething()
{
//Do things in here that are generated
DoSomethingExtension();
}
CustomClass1.cs (partial class of GenClass1)
partial void DoSomethingExtension()
{
//Do custom adjustments here
}
Of course I don't think this is a great option for standard coding except for specific instances, but in the code generation world, this fits in nicely. One other nice feature is this: if you don't implement a CustomClass1, DoSomethingExtension is taken out at compile time.
No comments:
Post a Comment