I need to define a method parameter that should ideally only accept object arguments that have been decorated with the Serializable attribute. The method task is to persist the object argument into a XML document.
I understand I can eventually check for SerializationException, but i’d rather be able to neatly define this as a part of the method contract. So, is there any way I can isolate types that have been decorated with this attribute?
One option is to use the
IsSerializableproperty of theTypeclass: