/// <summary>
        /// Checks if this Beacon is equal to another object, based on the identifier.
        /// </summary>
        /// <param name="obj">The other Beacon object.</param>
        /// <returns>true if identifiers match. false if <paramref name="obj"/> is not a Beacon or the identifiers don't match.</returns>
        public override bool Equals(object obj)
        {
            if (obj != null)
            {
                if (obj is Beacon)
                {
                    Beacon otherBeacon = (Beacon)obj;
                    for (int i = 0; i < this.Identifier.Length; i++)
                    {
                        if (this.Identifier[i] != otherBeacon.Identifier[i])
                        {
                            return(false);
                        }
                    }

                    return(true);
                }
            }

            return(false);
        }
Example #2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Rider"/> class with a name and a beacon to identify the rider.
 /// </summary>
 /// <param name="name">The name of the rider.</param>
 /// <param name="beacon">The <see cref="Beacon"/> belonging to the rider.</param>
 public Rider(string name, Beacon beacon)
 {
     Name   = name;
     Beacon = beacon;
 }