Share via


IRemoteObjectContract.RemoteCast(String) 方法

定义

将当前 IRemoteObjectContract 标识的对象强制转换为指定类型。

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

要将对象强制转换成的类型的规范名称。

返回

一个 RemoteArgument,表示强制转换操作的结果。

注解

规范名称是全局唯一名称,例如 GUID。 建议使用格式为 <程序集名称>、 <完全限定类型名称> 的字符串。 推荐的规范名称格式的一个示例是“ShapeApp, Microsoft.VisualStudio.Tools.Applications.Samples.ShapeApp.Application”。

在组件中发布类型后,类型规范名称无法更改。 在组件的未来版本中更改类型的规范名称会破坏组件与已使用该类型的客户端之间的兼容性。

如果强制转换操作失败, RemoteCast 建议实现引发 InvalidCastException

适用于