/// <summary> /// Determine if two <c>BaseColorCollections</c> are equivalent /// </summary> /// <param name="obj">The other <c>BaseColorCollection</c></param> /// <returns><see langword="true" /> if the two collections are equal, <see langword="false" /> /// otherwise</returns> public override bool Equals(object obj) { if ((obj == null) || !(obj is BaseColorCollection)) { return(false); } BaseColorCollection other = obj as BaseColorCollection; if (other == this) { return(true); } if (Count != other.Count) { return(false); } for (int i = 0; i < Count; i++) { if (colors[i] != other.colors[i]) { return(false); } } return(true); }
/// <summary> /// Copy construct a new <c>BaseColorCollection</c> /// </summary> /// <param name="other">The BaseColorCollection to copy</param> /// <exception cref="System.ArgumentNullException">other - Cannot copy construct a null reference</exception> public BaseColorCollection(BaseColorCollection other) { if (other == null) { throw new ArgumentNullException("other", "Cannot copy construct a null reference"); } this.colors = (Color[])other.colors.Clone(); }
/// <summary> /// Create an <c>AbstractColorPair</c> from another /// <c>BaseColorCollection</c> /// </summary> /// <param name="colors">The other <c>BaseColorCollection</c></param> /// <exception cref="System.ArgumentNullException">colors - BaseColorCollection cannot be null</exception> /// <remarks>Only the 1st and 2nd color are considered. If the <c>colors</c> /// collection only contains a single color, both color entries are /// equal to that value. If zero colors are specified in colors /// then both values are the default, <see cref="Color.Empty" /></remarks> public AbstractColorPair(BaseColorCollection colors) : base(2) { if (colors == null) { throw new ArgumentNullException("colors", "BaseColorCollection cannot be null"); } if (colors.Count > 0) { this[AbstractColorPairType.Color1] = colors[0]; } if (colors.Count > 1) { this[AbstractColorPairType.Color2] = colors[1]; } else { this[AbstractColorPairType.Color2] = Color1; } }
/// <summary> /// Create a <c>GradientColor</c> from a <see cref="BaseColorCollection" /> /// </summary> /// <param name="colors">The other <c>BaseColorCollection</c></param> /// <remarks>Only the 1st and 2nd color are considered. If the <c>colors</c> /// collection only contains a single color, both color entries are /// equal to that value. If zero colors are specified in colors /// then both values are the default, <see cref="Color.Empty" /></remarks> public GradientColor(BaseColorCollection colors) : base(colors) { }
/// <summary> /// Create a <c>ColorPair</c> form the specified <see cref="BaseColorCollection" /> /// </summary> /// <param name="colors">The <see cref="BaseColorCollection" /> to initialize /// from</param> /// <remarks>Only the 1st and 2nd color are considered. If the <c>colors</c> /// collection only contains a single color, both color entries are /// equal to that value. If zero colors are specified in colors /// then both values are the default, <see cref="Color.Empty" /></remarks> public XPanelColorPair(BaseColorCollection colors) : base(colors) { }