-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Closed
Labels
2 - ReadyArea-Language DesignFeature RequestLanguage-C#Language-VBhelp wantedThe issue is "up for grabs" - add a comment if you are interested in working on itThe issue is "up for grabs" - add a comment if you are interested in working on it
Description
Problem
For some attributes (e.g. TypeConverterAttribute) that are used to reference types, the current usage looks like this:
[TypeConverter(typeof(X))]This has two disadvantages:
- You can't guarantee that the type matches the requirements of the attribute -- e.g. has an empty constructor or inherits
TypeConverter. - The syntax is a bit verbose.
Suggestion
I suggest that the generic attributes should be supported, including any generic constraints.
Usage example:
[TypeConverter<X>]Pros
- Support for type constraints in type-referencing attributes
- Shorter syntax
- As far as I know, generic attributes are already supported in IL
Cons
The set of attributes that benefit from this might not be that large.
Updates
Removed pro 4 as it wasn't a pro.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
2 - ReadyArea-Language DesignFeature RequestLanguage-C#Language-VBhelp wantedThe issue is "up for grabs" - add a comment if you are interested in working on itThe issue is "up for grabs" - add a comment if you are interested in working on it