예제 #1
0
        public object DeepCopy()
        {
            var other = RedTypeManager.Create(GetType());

            foreach (var property in _properties)
            {
                if (property.Value is IRedCloneable cl)
                {
                    other._properties[property.Key] = (IRedType)cl.DeepCopy();
                }
                else
                {
                    other._properties[property.Key] = property.Value;
                }
            }

            return(other);
        }
예제 #2
0
        public object DeepCopy()
        {
            var other = (IList <T>)RedTypeManager.CreateRedType(GetType());

            foreach (var element in _internalList)
            {
                if (element is IRedCloneable cl)
                {
                    other.Add((T)cl.DeepCopy());
                }
                else
                {
                    other.Add(element);
                }
            }

            return(other);
        }