Пример #1
0
        /// <summary>
        /// Creates a deep copy of this <see cref="Command"/> instance.
        /// </summary>
        /// <returns>The new copy of the <see cref="Command"/>.</returns>
        public Command Clone()
        {
            var newCommand = new Command {
                UnknownAttributes = UnknownAttributes, UnknownElements = UnknownElements, IfZeroInstallVersion = IfZeroInstallVersion, Name = Name, Path = Path
            };

            newCommand.Arguments.AddRange(Arguments.CloneElements());
            newCommand.Bindings.AddRange(Bindings.CloneElements());
            if (WorkingDir != null)
            {
                newCommand.WorkingDir = WorkingDir.Clone();
            }
            if (Runner != null)
            {
                newCommand.Runner = Runner.CloneRunner();
            }
            newCommand.Dependencies.AddRange(Dependencies.CloneElements());
            newCommand.Restrictions.AddRange(Restrictions.CloneElements());

            return(newCommand);
        }