IRemoteObjectContract.RemoteCast(String) 方法

定义

将当前 IRemoteObjectContract 标识的对象强制转换为指定类型。Casts the object identified by the current IRemoteObjectContract to a specified type.

public:
 System::AddIn::Contract::RemoteArgument RemoteCast(System::String ^ canonicalName);
public System.AddIn.Contract.RemoteArgument RemoteCast (string canonicalName);
abstract member RemoteCast : string -> System.AddIn.Contract.RemoteArgument
Public Function RemoteCast (canonicalName As String) As RemoteArgument

参数

canonicalName
String

要将对象强制转换成的类型的规范名称。The canonical name of the type to cast the object to.

返回

RemoteArgument

一个 RemoteArgument,表示强制转换操作的结果。A RemoteArgument that represents the result of the cast operation.

注解

规范名称是全局唯一名称,如 GUID。A canonical name is a globally unique name, such as a GUID. 建议使用格式的 <assembly name> 字符串 <fully qualified type name> 。Strings in the format <assembly name>, <fully qualified type name> are recommended. 建议的规范名称格式的一个示例是 "ShapeApp,VisualStudio,ShapeApp" 的示例。An example of the recommended format of a canonical name is "ShapeApp, Microsoft.VisualStudio.Tools.Applications.Samples.ShapeApp.Application".

在组件中发布类型后,类型的规范名称无法更改。The canonical name for a type cannot change after a type is published in a component. 更改组件的未来版本中类型的规范名称会断开组件与已使用该类型的客户端之间的兼容性。Changing the canonical name of a type in a future version of a component breaks compatibility between the component and clients that are already using the type.

建议 RemoteCast InvalidCastException 在转换操作失败时,实现引发。It is recommended that RemoteCast implementations throw an InvalidCastException if the cast operation fails.

适用于