public static bool UnregisterDynamicProperty(String name, ContextBoundObject obj, Context ctx)
        {
            bool fUnregister = false;

            // name, obj, ctx arguments should be exactly the same as a previous
            // RegisterDynamicProperty call
            if (name == null)
            {
                throw new ArgumentNullException("name");
            }
            if (obj != null && ctx != null)
            {
                throw new ArgumentException(Environment.GetResourceString("Argument_NonNullObjAndCtx"));
            }
            if (obj != null)
            {
                // ctx is ignored and must be null.
                fUnregister = IdentityHolder.RemoveDynamicProperty(obj, name);
            }
            else
            {
                // ctx may or may not be null
                fUnregister = Context.RemoveDynamicProperty(ctx, name);
            }

            return(fUnregister);
        }
Example #2
0
 public static bool UnregisterDynamicProperty(string name, ContextBoundObject obj, Context ctx)
 {
     if (name == null)
     {
         throw new ArgumentNullException("name");
     }
     if (obj != null && ctx != null)
     {
         throw new ArgumentException(Environment.GetResourceString("Argument_NonNullObjAndCtx"));
     }
     return(obj == null?Context.RemoveDynamicProperty(ctx, name) : IdentityHolder.RemoveDynamicProperty((MarshalByRefObject)obj, name));
 }
        public static bool UnregisterDynamicProperty(string name, ContextBoundObject obj, Context ctx)
        {
            if (name == null)
            {
                throw new ArgumentNullException("name");
            }
            if (obj != null && ctx != null)
            {
                throw new ArgumentException(Environment.GetResourceString("Argument_NonNullObjAndCtx"));
            }
            bool result;

            if (obj != null)
            {
                result = IdentityHolder.RemoveDynamicProperty(obj, name);
            }
            else
            {
                result = Context.RemoveDynamicProperty(ctx, name);
            }
            return(result);
        }