ISafeSerializationData Interface

.NET Framework (current version)
 
System_CAPS_noteNote

The .NET API Reference documentation has a new home. Visit the .NET API Browser on docs.microsoft.com to see the new experience.

Enables serialization of custom exception data in security-transparent code.

Namespace:   System.Runtime.Serialization
Assembly:  mscorlib (in mscorlib.dll)

public interface class ISafeSerializationData

NameDescription
System_CAPS_pubmethodCompleteDeserialization(Object^)

This method is called when the instance is deserialized.

In versions previous to.NET Framework 4.0, serialization of custom user data in a security transparent code was accomplished using the GetObjectData method. Starting with .NET Framework 4.0, that method is marked with the SecurityCriticalAttribute attribute which prevents execution in security-transparent code. To work around this condition, implement the ISafeSerializationData interface and add custom data as shown in the example below.

The CompleteDeserialization method is called after serialization, and uses the SafeSerializationEventArgs to restore the custom data.

The following example contains an implementation of the ISafeSerializationData interface that is used to store custom data that is serialized.

No code example is currently available or this language may not be supported.

.NET Framework
Available since 4.0
Return to top
Show: