public virtual bool CanCastTo(Type castType, Object o)
{
if (null != castType)
{
// check for System.Object and MBRO since those aren't included in the
// heirarchy
if ((castType == typeof(MarshalByRefObject)) ||
(castType == typeof(System.Object)))
{
return true;
}
else
if (castType.IsInterface)
{
if (interfacesImplemented != null)
return CanCastTo(castType, InterfacesImplemented);
else
return false;
}
else
if (castType.IsMarshalByRef)
{
if (CompareTypes(castType, serverType))
return true;
if ((serverHierarchy != null) && CanCastTo(castType, ServerHierarchy))
return true;
}
}
return false;
}