예제 #1
0
 /// <summary> Removes the specified object from this set if it is present.
 ///
 /// If the specified object is of type <code>LdapAttribute</code>, the
 /// specified attribute will be removed.  If the specified object is of type
 /// <code>String</code>, the attribute with a name that matches the string will
 /// be removed.
 ///
 /// </summary>
 /// <param name="object">LdapAttribute to be removed or <code>String</code> naming
 /// the attribute to be removed.
 ///
 /// </param>
 /// <returns> true if the object was removed.
 ///
 /// @throws ClassCastException occurs the specified Object
 /// is not of type <code>LdapAttribute</code> or of type <code>String</code>.
 /// </returns>
 public override bool Remove(object object_Renamed)
 {
     System.String attributeName;             //the name is the key to object in the HashMap
     if (object_Renamed is System.String)
     {
         attributeName = ((System.String)object_Renamed);
     }
     else
     {
         attributeName = ((LdapAttribute)object_Renamed).Name;
     }
     if ((System.Object)attributeName == null)
     {
         return(false);
     }
     return(SupportClass.HashtableRemove(this.map, attributeName.ToUpper()) != null);
 }
예제 #2
0
        /// <summary>
        ///     Removes the specified object from this set if it is present.
        ///     If the specified object is of type. <code>LdapAttribute</code>, the
        ///     specified attribute will be removed.  If the specified object is of type.
        ///     <code>String</code>, the attribute with a name that matches the string will
        ///     be removed.
        /// </summary>
        /// <param name="object">
        ///     LdapAttribute to be removed or. <code>String</code> naming
        ///     the attribute to be removed.
        /// </param>
        /// <returns>
        ///     true if the object was removed.
        ///     @throws ClassCastException occurs the specified Object
        ///     is not of type. <code>LdapAttribute</code> or of type. <code>String</code>.
        /// </returns>
        public override bool Remove(object objectRenamed)
        {
            string attributeName; // the name is the key to object in the HashMap

            if (objectRenamed is string)
            {
                attributeName = (string)objectRenamed;
            }
            else
            {
                attributeName = ((LdapAttribute)objectRenamed).Name;
            }

            if (attributeName == null)
            {
                return(false);
            }

            return(SupportClass.HashtableRemove(_map, attributeName.ToUpper()) != null); // TODO: Make _map a Dictionary with a IgnoreCase comparer
        }