示例#1
0
 public override int GetHashCode()
 {
     unchecked {
         var hashCode = Amperage.GetHashCode();
         hashCode = (hashCode * 397) ^ Current.GetHashCode();
         hashCode = (hashCode * 397) ^ Resistance.GetHashCode();
         return(hashCode);
     }
 }
示例#2
0
        /// <summary>
        /// Return a text-representation of this object.
        /// </summary>
        public override String ToString()

        => new String[]
        {
            PowerType.HasValue?PowerType.ToString()         : "",
                    Voltage.HasValue ? Voltage.ToString() + " V"  : "",
                    Amperage.HasValue ? Amperage.ToString() + " A"  : "",
                    Power.HasValue ? Power.ToString() + " KW" : ""
        }

        .AggregateWith(",");
示例#3
0
        /// <summary>
        /// Return the HashCode of this object.
        /// </summary>
        /// <returns>The HashCode of this object.</returns>
        public override Int32 GetHashCode()
        {
            unchecked
            {
                return((PowerType.HasValue
                            ? PowerType.GetHashCode() * 7
                            : 0) ^

                       (Voltage.HasValue
                            ? Voltage.GetHashCode() * 5
                            : 0) ^

                       (Amperage.HasValue
                            ? Amperage.GetHashCode() * 3
                            : 0) ^

                       (Power.HasValue
                            ? Power.GetHashCode()
                            : 0));
            }
        }
示例#4
0
 protected bool Equals(ElectricProperties other)
 {
     return(Amperage.Equals(other.Amperage) && Current.Equals(other.Current) && Resistance.Equals(other.Resistance));
 }