Beispiel #1
0
        /// <summary>Creates a new object that is a copy of the current instance.</summary>
        /// <remarks>
        /// <para>
        /// Clone can be implemented either as a deep copy or a shallow copy. In a deep copy, all objects are duplicated;
        /// in a shallow copy, only the top-level objects are duplicated and the lower levels contain references.
        /// </para>
        /// <para>
        /// The resulting clone must be of the same type as, or compatible with, the original instance.
        /// </para>
        /// <para>
        /// See <see cref="Object.MemberwiseClone"/> for more information on cloning, deep versus shallow copies, and examples.
        /// </para>
        /// </remarks>
        /// <returns>A new object that is a copy of this instance.</returns>
        public object Clone()
        {
            PortCollection clone = new PortCollection();

            foreach (ICloneable item in this.Items)
            {
                clone.Add((UnitPort)item.Clone());
            }
            return(clone);
        }
Beispiel #2
0
 public PortCollectionPropertyDescriptor(PortCollection coll, int idx) :
     base("#" + idx.ToString(), null)
 {
     this.collection = coll;
     this.index      = idx;
 }