feat: Adding CompareTo method wich helped with validation cheking on DeploymentTool.

This commit is contained in:
Laura Gomez
2019-10-28 18:40:15 -04:00
parent f39b3897fc
commit 7cf3d18127
2 changed files with 20 additions and 1 deletions

View File

@@ -1,4 +1,5 @@
using System;
using System.Collections.Generic;
namespace ICD.Common.Utils
{
@@ -6,7 +7,7 @@ namespace ICD.Common.Utils
/// Convenience wrapper for supporting null keys in hash tables.
/// </summary>
/// <typeparam name="T"></typeparam>
public struct NullObject<T> : IEquatable<NullObject<T>>
public struct NullObject<T> : IEquatable<NullObject<T>>, IComparable<NullObject<T>>
{
#region Properties
@@ -101,5 +102,20 @@ namespace ICD.Common.Utils
}
#endregion
#region Comparable
public int CompareTo(NullObject<T> other)
{
if (IsNull && other.IsNull)
return 0;
if (IsNull)
return -1;
return Comparer<T>.Default.Compare(Item, other.Item);
}
#endregion
}
}