ActivitySurrogateSelector.GetSurrogate 方法

定义

从指定序列化上下文的指定代理项选择器开始,查找表示指定类型的代理项。

public:
 override System::Runtime::Serialization::ISerializationSurrogate ^ GetSurrogate(Type ^ type, System::Runtime::Serialization::StreamingContext context, [Runtime::InteropServices::Out] System::Runtime::Serialization::ISurrogateSelector ^ % selector);
public override System.Runtime.Serialization.ISerializationSurrogate GetSurrogate (Type type, System.Runtime.Serialization.StreamingContext context, out System.Runtime.Serialization.ISurrogateSelector selector);
override this.GetSurrogate : Type * System.Runtime.Serialization.StreamingContext * ISurrogateSelector -> System.Runtime.Serialization.ISerializationSurrogate
Public Overrides Function GetSurrogate (type As Type, context As StreamingContext, ByRef selector As ISurrogateSelector) As ISerializationSurrogate

参数

type
Type

要从中获取代理项的 Type

context
StreamingContext

一个 StreamingContext,用作当前序列化的源上下文或目标上下文。

selector
ISurrogateSelector

当此方法返回时,将包含一个 ISurrogateSelector,它持有一个指向从中找到合适代理项的代理项选择器的引用。 此参数未经初始化即被传递。

返回

ISerializationSurrogate

指定类型和上下文的适当代理项。

例外

type 包含空引用(在 Visual Basic 中为 Nothing)。

注解

返回的代理项类型依赖于可以从 type 赋值的类型。

适用于