38 lines
992 B
C#
38 lines
992 B
C#
|
|
using DTS.Common.Interface.DASFactory;
|
|||
|
|
using System;
|
|||
|
|
using System.Collections.Generic;
|
|||
|
|
|
|||
|
|
namespace DTS.DASLib.Service.Interfaces
|
|||
|
|
{
|
|||
|
|
// Custom comparer for the IDASCommunication class.
|
|||
|
|
public class IDASCommunicationComparer : IComparer<IDASCommunication>
|
|||
|
|
{
|
|||
|
|
public int Compare(IDASCommunication x, IDASCommunication y)
|
|||
|
|
{
|
|||
|
|
if (x == null && y == null)
|
|||
|
|
{
|
|||
|
|
return 0;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
if (x != null && y == null)
|
|||
|
|
{
|
|||
|
|
return 1;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
if (x == null && y != null)
|
|||
|
|
{
|
|||
|
|
return -1;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// Check whether the compared objects reference the same data.
|
|||
|
|
if (Object.ReferenceEquals(x, y))
|
|||
|
|
{
|
|||
|
|
return 0;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// Check whether the GainInfos' properties are equal.
|
|||
|
|
return x.SerialNumber.CompareTo(y.SerialNumber);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|