/// <summary> /// Transfers attributes from another <see cref="Element"/> object to this one. /// Existing values are not replaced. Provides an inheritance-like relation. /// </summary> /// <param name="parent">The object to take the attributes from.</param> internal void InheritFrom([NotNull] Element parent) { #region Sanity checks if (parent == null) { throw new ArgumentNullException(nameof(parent)); } #endregion // Check if values are unset and need inheritance) if (Version == null) { Version = parent.Version; } if (VersionModifier == null) { VersionModifier = parent.VersionModifier; } if (Released == default(DateTime)) { Released = parent.Released; } if (Main == null) { Main = parent.Main; } if (SelfTest == null) { SelfTest = parent.SelfTest; } if (DocDir == null) { DocDir = parent.DocDir; } if (License == null) { License = parent.License; } if (Stability == Stability.Unset) { Stability = parent.Stability; } if (Languages.Count == 0) { Languages = new LanguageSet(parent.Languages); } if (Architecture == default(Architecture)) { Architecture = parent.Architecture; } // Accumulate list entries Commands.AddRange(parent.Commands); Dependencies.AddRange(parent.Dependencies); Restrictions.AddRange(parent.Restrictions); Bindings.AddRange(parent.Bindings); }