예제 #1
0
        /// <summary>Unregisters a dynamic property implementing the <see cref="T:System.Runtime.Remoting.Contexts.IDynamicProperty" /> interface.</summary>
        /// <returns>true if the object was successfully unregistered; otherwise, false.</returns>
        /// <param name="name">The name of the dynamic property to unregister. </param>
        /// <param name="obj">The object/proxy for which the <paramref name="property" /> is registered. </param>
        /// <param name="ctx">The context for which the <paramref name="property" /> is registered. </param>
        /// <exception cref="T:System.ArgumentNullException">The <paramref name="name" /> parameter is null. </exception>
        /// <exception cref="T:System.ArgumentException">Both an object as well as a context are specified (both <paramref name="obj" /> and <paramref name="ctx" /> are not null). </exception>
        /// <PermissionSet>
        ///   <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="Infrastructure" />
        /// </PermissionSet>
        public static bool UnregisterDynamicProperty(string name, ContextBoundObject obj, Context ctx)
        {
            DynamicPropertyCollection dynamicPropertyCollection = Context.GetDynamicPropertyCollection(obj, ctx);

            return(dynamicPropertyCollection.UnregisterDynamicProperty(name));
        }
예제 #2
0
        /// <summary>Registers a dynamic property implementing the <see cref="T:System.Runtime.Remoting.Contexts.IDynamicProperty" /> interface with the remoting service.</summary>
        /// <returns>true if the property was successfully registered; otherwise, false.</returns>
        /// <param name="prop">The dynamic property to register. </param>
        /// <param name="obj">The object/proxy for which the <paramref name="property" /> is registered. </param>
        /// <param name="ctx">The context for which the <paramref name="property" /> is registered. </param>
        /// <exception cref="T:System.ArgumentNullException">Either <paramref name="prop" /> or its name is null, or it is not dynamic (it does not implement <see cref="T:System.Runtime.Remoting.Contexts.IDynamicProperty" />). </exception>
        /// <exception cref="T:System.ArgumentException">Both an object as well as a context are specified (both <paramref name="obj" /> and <paramref name="ctx" /> are not null). </exception>
        /// <PermissionSet>
        ///   <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="Infrastructure" />
        /// </PermissionSet>
        public static bool RegisterDynamicProperty(IDynamicProperty prop, ContextBoundObject obj, Context ctx)
        {
            DynamicPropertyCollection dynamicPropertyCollection = Context.GetDynamicPropertyCollection(obj, ctx);

            return(dynamicPropertyCollection.RegisterDynamicProperty(prop));
        }