Beispiel #1
0
        ///<summary>
        /// Returns true if the PropDefCol and all its PropDefs are equal.
        ///</summary>
        ///<param name="obj">the PropDefCol to compare to</param>
        ///<returns></returns>
        public bool Equals(PropDefCol obj)
        {
            if (ReferenceEquals(null, obj))
            {
                return(false);
            }
            if (ReferenceEquals(this, obj))
            {
                return(true);
            }
            if (obj.GetType() != typeof(PropDefCol))
            {
                return(false);
            }
            PropDefCol otherPropDefCol = (PropDefCol)obj;

            if (Count != otherPropDefCol.Count)
            {
                return(false);
            }
            foreach (PropDef def in this)
            {
                if (!otherPropDefCol.Contains(def.PropertyName))
                {
                    return(false);
                }
                bool equals = def.Equals(otherPropDefCol[def.PropertyName]);
                if (!equals)
                {
                    return(false);
                }
            }
            return(true);
        }
Beispiel #2
0
        ///<summary>
        /// Clones the propdefcol. NNB: The new propdefcol has the same propdefs in it (i.e. the propdefs are not copied).
        ///</summary>
        ///<returns></returns>
        public IPropDefCol Clone()
        {
            PropDefCol newPropDefCol = new PropDefCol();

            newPropDefCol.ClassDef = this.ClassDef;
            foreach (PropDef def in this)
            {
                newPropDefCol.Add(def);
            }
            return(newPropDefCol);
        }
Beispiel #3
0
        /// <summary>
        /// Clones the propdefcol. This method was created so that you could control the depth of the copy.
        /// The reason is so that you can limit the
        ///   extra memory used in cases where the propdef does not need to be copied.
        /// </summary>
        /// <param name="clonePropDefs">If true then makes a full copy of the propdefs else only
        /// makes a copy of the propdefcol.</param>
        /// <returns></returns>
        public IPropDefCol Clone(bool clonePropDefs)
        {
            PropDefCol newPropDefCol = new PropDefCol();

            newPropDefCol.ClassDef = this.ClassDef;
            foreach (PropDef def in this)
            {
                if (clonePropDefs)
                {
                    newPropDefCol.Add(def.Clone());
                }
                else
                {
                    newPropDefCol.Add(def);
                }
            }
            return(newPropDefCol);
        }