Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Does Marking Objects As Serializable Incur Overhead?

Tags:

c#

.net

If I add the [Serializable] attribute to a class, does this introduce any overhead? How about if the class is never used in any serialization operations?

like image 275
Bullines Avatar asked Sep 16 '10 22:09

Bullines


1 Answers

This doesn't add any overhead to the normal runtime use of the object.

Marking a class as Serializable doesn't even result in a size difference in metadata. It just sets a bit in the typedef flag. (Thanks to thecoop for pointing that out)

like image 66
JaredPar Avatar answered Sep 27 '22 22:09

JaredPar