SecurityException.GetObjectData(SerializationInfo, StreamingContext) Método

Definição

Define SerializationInfo com informações sobre SecurityException.Sets the SerializationInfo with information about the SecurityException.

public:
 override void GetObjectData(System::Runtime::Serialization::SerializationInfo ^ info, System::Runtime::Serialization::StreamingContext context);
public override void GetObjectData (System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context);
[System.Security.SecurityCritical]
public override void GetObjectData (System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context);
override this.GetObjectData : System.Runtime.Serialization.SerializationInfo * System.Runtime.Serialization.StreamingContext -> unit
[<System.Security.SecurityCritical>]
override this.GetObjectData : System.Runtime.Serialization.SerializationInfo * System.Runtime.Serialization.StreamingContext -> unit
Public Overrides Sub GetObjectData (info As SerializationInfo, context As StreamingContext)

Parâmetros

info
SerializationInfo

O SerializationInfo que mantém os dados de objeto serializados sobre a exceção que está sendo lançada.The SerializationInfo that holds the serialized object data about the exception being thrown.

context
StreamingContext

O StreamingContext que contém informações contextuais sobre a fonte ou o destino.The StreamingContext that contains contextual information about the source or destination.

Atributos

Exceções

O parâmetro info é null.The info parameter is null.

Exemplos

O código a seguir mostra o uso do GetObjectData método para exibir o estado de permissão contido no SerializationInfo objeto.The following code shows the use of the GetObjectData method to display the permission state contained in the SerializationInfo object.

Display("Demonstrating the use of the GetObjectData "
    "method.");
SerializationInfo^ entryPointSerializatonInfo =
    gcnew SerializationInfo(TestSecurityException::typeid,
    gcnew FormatterConverter);
exception->GetObjectData(entryPointSerializatonInfo,
    *gcnew StreamingContext(StreamingContextStates::All));
Display("The FirstPermissionThatFailed from the call"
    " to GetObjectData is: ");
Display(entryPointSerializatonInfo->GetString(
    "FirstPermissionThatFailed"));
Display("Demonstrating the use of the GetObjectData method.");
SerializationInfo si = new SerializationInfo(
    typeof(EntryPoint), new FormatterConverter());
sE.GetObjectData(si, 
    new StreamingContext(StreamingContextStates.All));
Display("The FirstPermissionThatFailed from the " +
    "call to GetObjectData is: ");
Display(si.GetString("FirstPermissionThatFailed"));
    Display("Demonstrating the use of the GetObjectData method.")
    Dim si As New SerializationInfo( _
        GetType(EntryPoint), New FormatterConverter())
    sE.GetObjectData(si, _
        New StreamingContext(StreamingContextStates.All))
    Display("The FirstPermissionThatFailed from the " & _
        "call to GetObjectData is: ")
    Display(si.GetString("FirstPermissionThatFailed"))
End Try

Comentários

O GetObjectData define um SerializationInfo com todos os dados do objeto de exceção destinados para a serialização.GetObjectData sets a SerializationInfo with all the exception object data targeted for serialization. Durante a desserialização, a exceção é reconstituída do SerializationInfo transmitido no fluxo.During deserialization, the exception is reconstituted from the SerializationInfo transmitted over the stream.

Aplica-se a

Confira também