Edit

Bagikan melalui


SurrogateSelector.GetSurrogate Method

Definition

Returns the surrogate for a particular type.

public:
 virtual System::Runtime::Serialization::ISerializationSurrogate ^ GetSurrogate(Type ^ type, System::Runtime::Serialization::StreamingContext context, [Runtime::InteropServices::Out] System::Runtime::Serialization::ISurrogateSelector ^ % selector);
public virtual System.Runtime.Serialization.ISerializationSurrogate? GetSurrogate (Type type, System.Runtime.Serialization.StreamingContext context, out System.Runtime.Serialization.ISurrogateSelector selector);
public virtual System.Runtime.Serialization.ISerializationSurrogate GetSurrogate (Type type, System.Runtime.Serialization.StreamingContext context, out System.Runtime.Serialization.ISurrogateSelector selector);
[System.Security.SecurityCritical]
public virtual System.Runtime.Serialization.ISerializationSurrogate GetSurrogate (Type type, System.Runtime.Serialization.StreamingContext context, out System.Runtime.Serialization.ISurrogateSelector selector);
abstract member GetSurrogate : Type * System.Runtime.Serialization.StreamingContext * ISurrogateSelector -> System.Runtime.Serialization.ISerializationSurrogate
override this.GetSurrogate : Type * System.Runtime.Serialization.StreamingContext * ISurrogateSelector -> System.Runtime.Serialization.ISerializationSurrogate
[<System.Security.SecurityCritical>]
abstract member GetSurrogate : Type * System.Runtime.Serialization.StreamingContext * ISurrogateSelector -> System.Runtime.Serialization.ISerializationSurrogate
override this.GetSurrogate : Type * System.Runtime.Serialization.StreamingContext * ISurrogateSelector -> System.Runtime.Serialization.ISerializationSurrogate
Public Overridable Function GetSurrogate (type As Type, context As StreamingContext, ByRef selector As ISurrogateSelector) As ISerializationSurrogate

Parameters

type
Type

The Type for which the surrogate is requested.

context
StreamingContext

The streaming context.

selector
ISurrogateSelector

The surrogate to use.

Returns

The surrogate for a particular type.

Implements

Attributes

Exceptions

The type parameter is null.

The caller does not have the required permission.

Remarks

If the current selector cannot provide a surrogate, it checks all its child objects before returning null.

Applies to