SecurityException.GetObjectData(SerializationInfo, StreamingContext) Metoda

Definice

Upozornění

This API supports obsolete formatter-based serialization. It should not be called or extended by application code.

Nastaví s SerializationInfo informacemi o .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.Obsolete("This API supports obsolete formatter-based serialization. It should not be called or extended by application code.", DiagnosticId="SYSLIB0051", UrlFormat="https://aka.ms/dotnet-warnings/{0}")]
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.Obsolete("This API supports obsolete formatter-based serialization. It should not be called or extended by application code.", DiagnosticId="SYSLIB0051", UrlFormat="https://aka.ms/dotnet-warnings/{0}")>]
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)

Parametry

info
SerializationInfo

Objekt SerializationInfo, ve kterém jsou uložena serializovaná data objektu týkající se výjimky

context
StreamingContext

Objekt StreamingContext obsahující kontextové informace o zdroji nebo cíli

Atributy

Výjimky

Parametr info je null.

Příklady

Následující kód ukazuje použití GetObjectData metody k zobrazení stavu oprávnění obsaženého v objektu SerializationInfo .

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

Poznámky

GetObjectData nastaví objekt se SerializationInfo všemi objektovými daty výjimek, na které cílí serializace. Během deserializace je výjimka rekonstituována z SerializationInfo přenášeného přes datový proud.

Platí pro

Viz také