Serializable partial classes
https://stackoverflow.com/questions/928219
Question
I have the following VB.NET class definition:
<Serializable()> Partial Public Class Customers
End Class
Inside another file I have the same thing (with different methods and variables of course). When I compile, I get the following error:
Attribute 'SerializableAttribute' cannot be applied multiple times.
The error is pretty self explanatory. My question is though, if I just mark the one class as Serializable(), can I assume the entire class with be marked as serializable()? In other words, Do I only need the serializable() tag in 1 spot in the class?
OTHER TIPS
Yes, you only need to put it in one of the Partial Classes:
http://msdn.microsoft.com/en-us/library/wa80x488.aspx
At compile time, attributes of partial-type definitions are merged.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow