Inelegant / misuse of attributes?

I have a class that I use as a handle to an object. In this descriptor there are several references Typefor classes that must be created for different operations with this object. I was thinking of pulling out these links and replacing them with attributes of the descriptor class.

From this:

class MyDescriptor : BaseDescriptor {
    public Type Op1Type { get; }
    public Type Op2Type { get; }
}

For this:

[Op1(typeof(foo))]
[Op2(typeof(bar))]
class MyDescriptor : BaseDescriptor {
}

I use attributes very rarely. Would this be considered poor use?

+5
source share
5 answers

, , , , . , .

, .

0

Injection Dependency , .

, , .

Injection Dependency /mocks.

0

, , , . , , .

0

, , , , .

, , .

0

- , .

, , , Dictionary<Type, Type>.

0

All Articles