Marker interface in C #

I am currently trying to implement a marker interface in C #. But I have not done this until now, so I would like to ask you to seek advice.

Short problem:
I have a Factory interface and the factory contains multiple subinterfaces that should be a marker interface because they don't have a property or method or whatever. Therefore, the marker interface must implement the factory interface. And my marker interface, for example for cars, trucks, etc. And the marker interface is implemented for cars for MyBMW, MyAUDI, etc. How can I implement such a pattern? Thank!

interface Factory
{
    string[] process (string [] entry);
}

      

+3


source to share


2 answers


You should consider using attributes instead of an interface for labeling classes.



then you can decide in your code how to handle specific instances when the attribute is set.

+1


source


I believe you want to implement a factory pattern. I suggest you look at an example: http://en.wikipedia.org/wiki/Factory_method_pattern



0


source







All Articles