Exemplo n.º 1
0
        /// <inheritdoc/>
        ICloneable ICloneable.Clone()
        {
            var clone = new InheritedTypeDictionary <V>();

            foreach (var pair in _dictionary)
            {
                // Only add direct elements
                if (pair.Value.IsDirect)
                {
                    var cloned = pair.Value.Value;
                    if (cloned is ICloneable cloneable)
                    {
                        cloned = (V)cloneable.Clone();
                    }
                    clone.Add(pair.Key, cloned);
                }
            }
            return(clone);
        }
Exemplo n.º 2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="InheritedTypeSet{V}"/> class.
 /// </summary>
 public InheritedTypeSet()
 {
     _dictionary = new InheritedTypeDictionary <V>();
 }
Exemplo n.º 3
0
 /// <summary>
 /// Initializes a new instance of the <see cref="InheritedTypeSet{V}"/> class.
 /// </summary>
 /// <param name="original">The original.</param>
 protected InheritedTypeSet(InheritedTypeSet <V> original)
 {
     _dictionary = (InheritedTypeDictionary <V>)((ICloneable)original._dictionary).Clone();
 }