Home
Manage Your Code
Snippet: Attributes that needs to be applied when implementing ISerializable (C#)
Title: Attributes that needs to be applied when implementing ISerializable Language: C#
Description: Use this as a template when implementing the ISerializable interface. Views: 57
Author: Schalk van Wyk Date Added: 8/26/2008
Copy Code  
1[SecurityPermissionAttribute(SecurityAction.Demand, SerializationFormatter = true)]
2public void GetObjectData(SerializationInfo info, StreamingContext context)
3{
4}
5
Notes
Adding this attribute will prevent outside code to gain acess to sensitive data when serialization happens. Alternatively use the new event driven serialization model of .NET 2.0 and Version Tolerant Serialization