using System.Collections.Generic;
public static void Main()
string json = @"{'destinationAddress':'msmq://jjagarlamudilt/mt_pdiworkforcesynchqp_request_001?tx=false&recoverable=true','headers':{'messagehash':'-1977742549'},'message':{'globalId':'001','tableNames':['Users','Countries','States','FIPS_Codes','User_Groups','User_Group_Members'],'sourceScope':2,'sourceType':2,'destinationScope':3,'destinationType':4,'companyGuids':['ca4e9deb-3ebb-4d91-908f-1bd81aa2edf7']},'messageType':['urn:message:profdata.WF.QueueProcessor.Contracts.Messages:SynchTablesMsg'],'sourceAddress':'msmq://jjagarlamudilt/mt_pdiworkforcesynchqp_response_001?tx=false&recoverable=true'}";
MsmqMessage msmqMessage = JsonConvert.DeserializeObject<MsmqMessage>(json);
string json1 = @"{'destinationAddress':'msmq://jjagarlamudilt/mt_pdiworkforcesynchqp_request_001?tx=false&recoverable=true','headers':{'messagehash':'-1977742549'},'message':{'globalId':'001','tableNames':['Users','Countries','States','FIPS_Codes','User_Groups','User_Group_Members'],'sourceScope':2,'sourceType':2,'destinationScope':3,'destinationType':4,'companyGuids':['ca4e9deb-3ebb-4d91-908f-1bd81aa2edf7']},'messageType':['urn:message:profdata.WF.QueueProcessor.Contracts.Messages:SynchTablesMsg'],'sourceAddress':'msmq://jjagarlamudilt/mt_pdiworkforcesynchqp_response_001?tx=false&recoverable=true'}";
MsmqMessage msmqMessage1 = JsonConvert.DeserializeObject<MsmqMessage>(json1);
Console.WriteLine(msmqMessage1.SynchTablesMsg.Equals(msmqMessage.SynchTablesMsg) ? "Equal Objects" : "Unequal Objects");
Console.WriteLine(msmqMessage1.SynchTablesMsg.GetHashCode().Equals(msmqMessage.SynchTablesMsg.GetHashCode()) ? "Equal Objects By Hash Code" : "Unequal Objects By Hash Code");
public class SynchTablesMsg
[JsonProperty(PropertyName = "globalId")]
public string GlobalId { get; set; }
[JsonProperty(PropertyName = "tableNames")]
public List<string> TableNames { get; set; }
[JsonProperty(PropertyName = "sourceScope")]
public int SourceScope { get; set; }
[JsonProperty(PropertyName = "sourceType")]
public int SourceType { get; set; }
[JsonProperty(PropertyName = "destinationScope")]
public int DestinationScope { get; set; }
[JsonProperty(PropertyName = "destinationType")]
public int DestinationType { get; set; }
[JsonProperty(PropertyName = "companyGuids")]
public List<string> CompanyGuids { get; set; }
public override int GetHashCode()
tableNamesHash = TableNames.Aggregate(tableNamesHash, (current, p) => current ^ p.GetHashCode());
companiesHash = CompanyGuids.Aggregate(companiesHash, (current, p) => current ^ p.GetHashCode());
return GlobalId.GetHashCode() + tableNamesHash + SourceScope.GetHashCode() + SourceType.GetHashCode() + DestinationScope.GetHashCode() + DestinationType.GetHashCode() + companiesHash;
[JsonProperty(PropertyName = "destinationAddress")]
public string DestinationAddress { get; set; }
[JsonProperty(PropertyName = "message")]
public SynchTablesMsg SynchTablesMsg { get; set; }
[JsonProperty(PropertyName = "messageType")]
public List<string> MessageType { get; set; }
[JsonProperty(PropertyName = "sourceAddress")]
public string SourceAddress { get; set; }