internal static bool RemoveDynamicProperty(MarshalByRefObject obj, String name)
{
if (RemotingServices.IsObjectOutOfContext(obj))
{
// We have to add a proxy side property, get the identity
RealProxy rp = RemotingServices.GetRealProxy(obj);
return(rp.IdentityObject.RemoveProxySideDynamicProperty(name));
}
else
{
MarshalByRefObject realObj =
(MarshalByRefObject)
RemotingServices.AlwaysUnwrap((ContextBoundObject)obj);
// This is a real object. See if we have an identity for it
ServerIdentity srvID = (ServerIdentity)MarshalByRefObject.GetIdentity(realObj);
if (srvID != null)
{
return(srvID.RemoveServerSideDynamicProperty(name));
}
else
{
// identity not found, we can't set a sink for this object.
throw new RemotingException(
Environment.GetResourceString("Remoting_NoIdentityEntry"));
}
}
}