コード例 #1
0
 /// <summary>
 /// Gets the hash code
 /// </summary>
 /// <returns>Hash code</returns>
 public override int GetHashCode()
 {
     unchecked // Overflow is fine, just wrap
     {
         var hashCode = 41;
         // Suitable nullity checks etc, of course :)
         if (TicketId != null)
         {
             hashCode = hashCode * 59 + TicketId.GetHashCode();
         }
         if (OperationDate != null)
         {
             hashCode = hashCode * 59 + OperationDate.GetHashCode();
         }
         if (TicketTypeId != null)
         {
             hashCode = hashCode * 59 + TicketTypeId.GetHashCode();
         }
         if (OperationTypeId != null)
         {
             hashCode = hashCode * 59 + OperationTypeId.GetHashCode();
         }
         if (StatusId != null)
         {
             hashCode = hashCode * 59 + StatusId.GetHashCode();
         }
         return(hashCode);
     }
 }
コード例 #2
0
        /// <summary>
        /// Returns true if TicketFilterResult instances are equal
        /// </summary>
        /// <param name="other">Instance of TicketFilterResult to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(TicketFilterResult other)
        {
            if (ReferenceEquals(null, other))
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return
                ((
                     TicketId == other.TicketId ||
                     TicketId != null &&
                     TicketId.Equals(other.TicketId)
                     ) &&
                 (
                     OperationDate == other.OperationDate ||
                     OperationDate != null &&
                     OperationDate.Equals(other.OperationDate)
                 ) &&
                 (
                     TicketTypeId == other.TicketTypeId ||
                     TicketTypeId != null &&
                     TicketTypeId.Equals(other.TicketTypeId)
                 ) &&
                 (
                     OperationTypeId == other.OperationTypeId ||
                     OperationTypeId != null &&
                     OperationTypeId.Equals(other.OperationTypeId)
                 ) &&
                 (
                     StatusId == other.StatusId ||
                     StatusId != null &&
                     StatusId.Equals(other.StatusId)
                 ));
        }
コード例 #3
0
ファイル: Observer.cs プロジェクト: HuaGeWuDi/CSharp
 public override void SendMsg()
 {
     Console.WriteLine(string.Format("{0}:您的账户发生了变化,变化时间{1},当前余额为{2}", Name, OperationDate.ToString("yyyy.MM.dd HHmmss"), Balance));
 }