Purpose of SecurityPermissionAttribute when implementing ISerializable

Experts,

I'm learning about custom serialization but one aspect isn't explained, and I can't seem to find it anywhere, so here goes.

The following code is the mandatory GetObjectData method call in a class, my text has it preceeded by a line that appears to be establishing security parameters:

[SecurityPermissionAttribute(SecurityAction.Demand, SerializationFormatter=true)]

public virtual void GetObjectData(SerializationInfo info, StreamingContext context)

{

info.AddValue("Product ID", productId);

info.AddValue("Price", price);

info.AddValue("Quantity", quantity);

}

Does anyone know where I can get some information on what the purpose of "SecurityPermissionAttribute", "SecurityAction.Demand," & "SerializationFormatter=true" are specifically what purpose is being served by the line as a whole in the whole scheme of custom serialization.

Any explanation or a point in the right direction would be greatly appreciated. Cheers! :)

~ Chris McQuade




Answer this question

Purpose of SecurityPermissionAttribute when implementing ISerializable