예제 #1
0
        /// <summary>Compares contents of two EquatableLists element by element and returns true only if all elements match.</summary><param name="other">List to compare to.</param>

        public bool Equals([AllowNull] EquatableList <T> other)
        {
            if (other != null)
            {
                if (Count == other.Count)
                {
                    for (int i = 0; i < Count; ++i)
                    {
                        if (!this[i].Equals(other[i]))
                        {
                            return(false);        // If one of the elements is different. Lists are not equal.
                        }
                    }
                    return(true);
                }                                    // Looped through all elements, all were equal. Lists are equal.
                else
                {
                    return(false);
                }
            }
            else
            {
                return(false);
            }
        }
예제 #2
0
 /// <summary>Create a copy of specified source list.</summary><param name="sourceList">Source list to copy from.</param>
 public EquatableList(EquatableList <T> sourceList) : base(sourceList.Count)
 {
     Array.Copy(sourceList._E, _E, sourceList.Count);
 }