Exemplo n.º 1
0
        /// <summary>
        /// Determines whether the specified object instance is considered equal to the current instance.
        /// </summary>
        /// <param name="obj">The object to compare with.</param>
        /// <returns>true if the objects are considered equal; otherwise, false.</returns>
        public override bool Equals(object obj)
        {
            // an indexable option cannot store null
            if (obj == null)
            {
                return(false);
            }

            if (obj is IndexableOption <T> option)
            {
                return(Equals(option));
            }
            else
            {
                if (IsIndexed)
                {
                    return(IndexedValues.Equals(obj));
                }
                else
                {
                    return(SingleValue.Equals(obj));
                }
            }
        }