mirror of
https://github.com/ICDSystems/ICD.Common.Utils.git
synced 2026-02-15 12:45:01 +00:00
feat: Adding CompareTo method wich helped with validation cheking on DeploymentTool.
This commit is contained in:
@@ -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
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user