Lets say we got a code generating tool that creates thousands of C# classes, and we sometimes need to add those attributes to them.
We are considering whether it is better to put [DataContract]
and [DataMember]
on all appropriate classes or we need to create a special strategy that will determine whether to do so in order to save up some possible? performance lost in AtribbuteAll approach.
In the end the question is whether adding attributes can somehow affect performance?
I am thinking that adding an attribute on a class will simply stay with its type information and should not affect any performance but would like to be 100% certain here
Adding attributes would impact in performance if these are inspected in some part of the code, if not, classes would have more metadata, but this doesn't impact performance.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With