Follow @RoyOsherove on Twitter

Do not serialize delegates and events blindly

usually, you should not serialize your class's delegates or events. This is because serialization takes he full object graph into play, and delegates by nature will serialize your subscriber list into the mix (invocation list). you can never make sure all your subscribers are serializable, can you?

so, you should put [NonSerialized] on delegates.

on events (with the event keyword) you can use the

[Field:NonSerialized] attribute  ("Field" is in System.Reflection)


[via Juval Lowy's .Net Master class]

Truly, a ".Net Master Class"

Denying your public classes from your end customers