Ejemplo n.º 1
0
        // Necessary so this class works as expected in collections.
        public override nuint GetNativeHash()
        {
            nuint hashValue = (ItemNameKey is null) ? 0 : (nuint)ItemNameKey.GetHashCode();

            hashValue = hashValue ^ (nuint)Price.GetNativeHash();
            hashValue = hashValue ^ (IconImageName is null ? 0 : (nuint)IconImageName.GetHashCode());
            hashValue = hashValue ^ (nuint)IsAvailable.GetHashCode();
            hashValue = hashValue ^ (nuint)IsDailySpecial.GetHashCode();
            return(hashValue);
        }
Ejemplo n.º 2
0
        override public bool IsEqual(NSObject anObject)
        {
            var other = anObject as MenuItem;

            if (other is null)
            {
                return(false);
            }

            if (ReferenceEquals(other, this))
            {
                return(true);
            }

            bool result =
                (ItemNameKey.Equals(other.ItemNameKey) &&
                 Price.IsEqual(other.Price) &&
                 IconImageName.Equals(other.IconImageName) &&
                 IsAvailable == other.IsAvailable &&
                 IsDailySpecial == other.IsDailySpecial);

            return(result);
        }