Would you please add an option to introduce Constructors? #63
Replies: 3 comments
-
Hello @PeterHevesi, thank you for submitting this issue. We will try to get back to you as soon as possible. |
Beta Was this translation helpful? Give feedback.
-
This feature request is in our backlog, but not for our first public release. We will update you with the status. |
Beta Was this translation helpful? Give feedback.
-
This feature has been introduced in Metalama 2024.2.7-preview. This feature is yet to be documented, but its usage can be found in this example: https://github.com/postsharp/Metalama.Framework/blob/develop/2024.2/tests/Metalama.Framework.Tests.Integration/Tests/Aspects/Samples/Memento.cs |
Beta Was this translation helpful? Give feedback.
-
Hi,
I really love Metalama, and the way it can also introduce new members or methods. But I've learned, that it is not yet possible to introduce new constructors.
Buuut it would have very interesting use cases. For example, to create an attribute called [InheritConstructors], that would introduce all constructors in a simple way, when you don't need to add anything new to those constructors...
To illustrate this, I have a base abstract class called WebsiteElement, and it has 10 different constructors.
Then I have many classes, the actual website elements, that inherits from this WebsiteElement like button, link, textarea and so on....
Each WebsiteElement can introduce some new methods and stuff, but in terms of constructors, they are exactly the same, all of them...
And I had to just write all those constructors again and again in all those inherited classes just to delegate them into base class constructor... But that is just some boilerplate code, easy job for Metalama :)
Beta Was this translation helpful? Give feedback.
All reactions