Skip to content

Instantly share code, notes, and snippets.

@ste-bel
Last active November 27, 2020 02:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ste-bel/cd07f0bc9810b11ead1aafa818606765 to your computer and use it in GitHub Desktop.
Save ste-bel/cd07f0bc9810b11ead1aafa818606765 to your computer and use it in GitHub Desktop.
ConversionKey - A POCO to store conversion criteria and data
using System;
using System.Collections.Generic;
namespace PB.Objects.B2B.Slot {
public class ConversionKey : IEquatable<ConversionKey> {
public ConversionKey(string organizationID, int? bAccountID, string messageType, string convertFrom) {
OrganizationID = organizationID;
BAccountID = bAccountID;
MessageType = messageType;
ConvertFrom = convertFrom;
}
public string OrganizationID { get; private set; }
public int? BAccountID { get; private set; }
public string MessageType { get; private set; }
public string ConvertFrom { get; private set; }
public bool Equals(ConversionKey other) {
return
this.OrganizationID == other.OrganizationID &&
this.BAccountID == other.BAccountID &&
this.MessageType == other.MessageType &&
this.ConvertFrom == other.ConvertFrom;
}
public override int GetHashCode() {
var hashCode = 219003723;
hashCode = hashCode * -1521134295 + EqualityComparer<string>.Default.GetHashCode(OrganizationID);
hashCode = hashCode * -1521134295 + EqualityComparer<int?>.Default.GetHashCode(BAccountID);
hashCode = hashCode * -1521134295 + EqualityComparer<string>.Default.GetHashCode(MessageType);
hashCode = hashCode * -1521134295 + EqualityComparer<string>.Default.GetHashCode(ConvertFrom);
return hashCode;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment