Some ideas about attribute #4832
Replies: 2 comments
-
What is the motivation behind these ideas? What is the real world use case where current solutions are insufficient, and these suggestions will help? |
Beta Was this translation helpful? Give feedback.
-
Usable, but doesn't solve a lot comparing to current syntax.
This is something we intentionally avoided. The team said it should be possible to use non-record code to define a class same to record.
This is really only meaningful for
This are better for a custom code generator recognizing the attribute. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Add a new keyword "attribute" to create an attribute
For example:
It will translate into:
Add more attribute targets
Such as "Record" "Attribute" and so on
Now the AttributeUsage attribute can become like this:
Add some attribute event methods
For example:
This is an example of "BeforeInvokeMethod" event method
Others (for example, fields and properties have OnGet, OnSet and other event methods)
Beta Was this translation helpful? Give feedback.
All reactions