コード例 #1
0
ファイル: NamedTuple.cs プロジェクト: pswaters/T4Include
        public void ToString(StringBuilder sb, int indent)
        {
            sb.Append(' ', indent);
            var innerIndent = indent + 4;

            sb.AppendLine("{");

            sb.Append(' ', innerIndent);
            sb.Append("!Type           = ");
            sb.AppendLine(GetType().Name);

            sb.Append(' ', innerIndent);
            sb.Append("Id              = ");
            NamedTupleCommon.AppendValueLine(sb, Id, innerIndent);
            sb.Append(' ', innerIndent);
            sb.Append("FirstName       = ");
            NamedTupleCommon.AppendStringLine(sb, FirstName, innerIndent);
            sb.Append(' ', innerIndent);
            sb.Append("LastName        = ");
            NamedTupleCommon.AppendStringLine(sb, LastName, innerIndent);
            sb.Append(' ', innerIndent);
            sb.Append("Aliases         = ");
            NamedTupleCommon.AppendReferenceLine(sb, Aliases, innerIndent);
            sb.Append(' ', innerIndent);
            sb.Append("InvoiceAddress  = ");
            NamedTupleCommon.AppendReferenceLine(sb, InvoiceAddress, innerIndent);
            sb.Append(' ', innerIndent);
            sb.Append("DeliveryAddress = ");
            NamedTupleCommon.AppendReferenceLine(sb, DeliveryAddress, innerIndent);
            sb.Append(' ', indent);
            sb.AppendLine("}");
        }
コード例 #2
0
ファイル: NamedTuple.cs プロジェクト: pswaters/T4Include
 public override int GetHashCode()
 {
     unchecked
     {
         var result = NamedTupleCommon.DefaultHashCode;
         result = (result << 5) + result ^ (Id.GetHashCode());
         result = (result << 5) + result ^ (FirstName != null ? FirstName.GetHashCode() : NamedTupleCommon.DefaultHashCode);
         result = (result << 5) + result ^ (LastName != null ? LastName.GetHashCode() : NamedTupleCommon.DefaultHashCode);
         result = (result << 5) + result ^ (NamedTupleCommon.StructuralGetHashCode(Aliases));
         result = (result << 5) + result ^ (InvoiceAddress != null ? InvoiceAddress.GetHashCode() : NamedTupleCommon.DefaultHashCode);
         result = (result << 5) + result ^ (DeliveryAddress != null ? DeliveryAddress.GetHashCode() : NamedTupleCommon.DefaultHashCode);
         return(result);
     }
 }
コード例 #3
0
ファイル: NamedTuple.cs プロジェクト: pswaters/T4Include
        public bool Equals(Customer other)
        {
            if (other == null)
            {
                return(false);
            }

            var result =
                (Id.Equals(other.Id)) &&
                ((FirstName ?? "").Equals(other.FirstName ?? "", NamedTupleCommon.DefaultStringComparison)) &&
                ((LastName ?? "").Equals(other.LastName ?? "", NamedTupleCommon.DefaultStringComparison)) &&
                (NamedTupleCommon.StructuralEqual(Aliases, other.Aliases)) &&
                (InvoiceAddress == null && other.InvoiceAddress == null || InvoiceAddress != null && other.InvoiceAddress != null && InvoiceAddress.Equals(other.InvoiceAddress)) &&
                (DeliveryAddress == null && other.DeliveryAddress == null || DeliveryAddress != null && other.DeliveryAddress != null && DeliveryAddress.Equals(other.DeliveryAddress))
            ;

            return(result);
        }
コード例 #4
0
ファイル: NamedTuple.cs プロジェクト: pswaters/T4Include
        public void ToString(StringBuilder sb, int indent)
        {
            sb.Append(' ', indent);
            var innerIndent = indent + 4;

            sb.AppendLine("{");

            sb.Append(' ', innerIndent);
            sb.Append("!Type    = ");
            sb.AppendLine(GetType().Name);

            sb.Append(' ', innerIndent);
            sb.Append("Id       = ");
            NamedTupleCommon.AppendValueLine(sb, Id, innerIndent);
            sb.Append(' ', innerIndent);
            sb.Append("CareOf   = ");
            NamedTupleCommon.AppendStringLine(sb, CareOf, innerIndent);
            sb.Append(' ', innerIndent);
            sb.Append("Address1 = ");
            NamedTupleCommon.AppendStringLine(sb, Address1, innerIndent);
            sb.Append(' ', innerIndent);
            sb.Append("Address2 = ");
            NamedTupleCommon.AppendStringLine(sb, Address2, innerIndent);
            sb.Append(' ', innerIndent);
            sb.Append("Address3 = ");
            NamedTupleCommon.AppendStringLine(sb, Address3, innerIndent);
            sb.Append(' ', innerIndent);
            sb.Append("Address4 = ");
            NamedTupleCommon.AppendStringLine(sb, Address4, innerIndent);
            sb.Append(' ', innerIndent);
            sb.Append("City     = ");
            NamedTupleCommon.AppendStringLine(sb, City, innerIndent);
            sb.Append(' ', innerIndent);
            sb.Append("Zip      = ");
            NamedTupleCommon.AppendStringLine(sb, Zip, innerIndent);
            sb.Append(' ', innerIndent);
            sb.Append("County   = ");
            NamedTupleCommon.AppendStringLine(sb, County, innerIndent);
            sb.Append(' ', innerIndent);
            sb.Append("Country  = ");
            NamedTupleCommon.AppendStringLine(sb, Country, innerIndent);
            sb.Append(' ', indent);
            sb.AppendLine("}");
        }