I would like to have an extension method for any class that has a specific attribute.
For clarification, I have to do my own serialization of objects. But I want to only serialize objects that have this custom attribute. I know I can do it by inheriting from another base class, but I already have the class attribute and I think it would be more elegant, so you could always see if an object is custom serializable.
Something like:
[CustomAttribut]public MyClass{}
MyClass o = new MyClass() ;
// should only exist if class has attribut CustomAttribut.
O.CustomSerialize();