I need to add the [Serializable] attribute to a class that is extremely performance sensitive.
Will this attribute have any performance implications on the operation of the class?
Instances of attribute classes are only created when they're first accessed. If you don't do any serialization on that particular class, the SerializableAttribute() constructor will never be called, hence it won't cause any performance issues.
SerializableAttribute()
Here's an interesting article about attribute constructors: http://www.codingonthetrain.com/2008/10/attribute-constructors.html
2.1m questions
2.1m answers
60 comments
57.0k users