C#C
C#2y ago
ægteemil

✅ Apply multiple attributes from custom attribute

Hey. I want to encapsulate some duplicated logic from a custom attribute. Right now I'm decorating endpoints with multiple attributes, and I'd like to be apply to just apply my own custom attribute, and have that attribute apply multiple other attributes.
So my custom attribute would look like this(?):
public class TestAttribute : Attribute
{
    [MyFirstAttribute(name)]
    [MySecondAttribute(name)]
    public TestAttribute(string name)
    {
        Name = name;
    }

    public string Name { get; }
}
Was this page helpful?