IRemotingTypeInfo.CanCastTo(Type, Object) 方法
定义
检查是否可以将表示指定对象类型的代理强制转换为由 IRemotingTypeInfo 接口表示的类型。Checks whether the proxy that represents the specified object type can be cast to the type represented by the IRemotingTypeInfo interface.
public:
bool CanCastTo(Type ^ fromType, System::Object ^ o);
public bool CanCastTo (Type fromType, object o);
[System.Security.SecurityCritical]
public bool CanCastTo (Type fromType, object o);
abstract member CanCastTo : Type * obj -> bool
[<System.Security.SecurityCritical>]
abstract member CanCastTo : Type * obj -> bool
Public Function CanCastTo (fromType As Type, o As Object) As Boolean
参数
- fromType
- Type
要强制转换到的类型。The type to cast to.
- o
- Object
要为其检查强制转换的对象。The object for which to check casting.
返回
如果强制转换将成功,则为 true;否则为 false。true if cast will succeed; otherwise, false.
- 属性
例外
直接调用方通过引用接口进行调用,且没有基础结构权限。The immediate caller makes the call through a reference to the interface and does not have infrastructure permission.
注解
当尝试强制转换从生成的代理时,将调用当前方法 ObjRef 。The current method is called when an attempt is made to cast a proxy generated from a ObjRef. 此方法将考虑中携带的类型信息 ObjRef 。This method takes into account the type information carried in the ObjRef.