/// <summary> /// Check if nodes are equal /// </summary> public static bool IsSame(this OpcNodeModel model, OpcNodeModel that) { if (model == that) { return(true); } if (model == null || that == null) { return(false); } if (string.Compare(model.Id, that.Id, StringComparison.OrdinalIgnoreCase) != 0) { return(false); } if (string.Compare(model.DisplayName, that.DisplayName, StringComparison.OrdinalIgnoreCase) != 0) { return(false); } if (string.Compare(model.DataSetFieldId, that.DataSetFieldId, StringComparison.OrdinalIgnoreCase) != 0) { return(false); } if (string.Compare(model.ExpandedNodeId, that.ExpandedNodeId, StringComparison.OrdinalIgnoreCase) != 0) { return(false); } if (model.GetNormalizedPublishingInterval() != that.GetNormalizedPublishingInterval()) { return(false); } if (model.GetNormalizedSamplingInterval() != that.GetNormalizedSamplingInterval()) { return(false); } if (model.GetNormalizedHeartbeatInterval() != that.GetNormalizedHeartbeatInterval()) { return(false); } if (model.SkipFirst != that.SkipFirst) { return(false); } if (model.QueueSize != that.QueueSize) { return(false); } return(true); }
/// <summary> /// Returns the hashcode for a node /// </summary> public static int GetHashCode(this OpcNodeModel model) { var hash = new HashCode(); hash.Add(model.Id); hash.Add(model.DisplayName); hash.Add(model.DataSetFieldId); hash.Add(model.ExpandedNodeId); hash.Add(model.GetNormalizedPublishingInterval()); hash.Add(model.GetNormalizedSamplingInterval()); hash.Add(model.GetNormalizedHeartbeatInterval()); hash.Add(model.SkipFirst); hash.Add(model.QueueSize); return(hash.ToHashCode()); }