Design-time Code Auto Generation
Hi,
Is there a way to auto-generate code after particular changes are made to the source code (without manually compiling)?
For example, I would like to automatically add container interface/class mappings when a new wpf form class with a predefined naming convention is added to the source code.
Not sure if Analyzers can be utilized to do this.
Suggestions are greatly appreciated.
Thanks!
Please sign in to leave a comment.
Hi Sam Najjar!
Thank you for the request.
It seems like a code generation request for a framework, not for IDE itself. The "automatic" code generation upon source code change would require some system for watching the source code changes, which is outside the capabilities of most IDEs.
I suggest using Live Templates to see if that boosts your productivity. You can find and customize an existing interface template in File | Settings | Editor | Live Templates | C#.
For your specific scenario (when a new WPF form class with a predefined naming convention is added):
While this mechanism requires a manual trigger, it can significantly speed up the code generation process.
I hope this helps!