mirror of
https://github.com/ICDSystems/ICD.Common.Utils.git
synced 2026-02-17 21:54:58 +00:00
feat: Adding CompareTo method wich helped with validation cheking on DeploymentTool.
This commit is contained in:
@@ -6,6 +6,9 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
|
|||||||
|
|
||||||
## [Unreleased]
|
## [Unreleased]
|
||||||
|
|
||||||
|
### Changed
|
||||||
|
- NullObject implements IComparable, fixes issues with null keys in ordered dictionaries
|
||||||
|
|
||||||
## [10.0.0] - 2019-10-07
|
## [10.0.0] - 2019-10-07
|
||||||
### Added
|
### Added
|
||||||
- IcdEnvironment.GetUtcTime() to get UTC representaiton of current time.
|
- IcdEnvironment.GetUtcTime() to get UTC representaiton of current time.
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
using System;
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
namespace ICD.Common.Utils
|
namespace ICD.Common.Utils
|
||||||
{
|
{
|
||||||
@@ -6,7 +7,7 @@ namespace ICD.Common.Utils
|
|||||||
/// Convenience wrapper for supporting null keys in hash tables.
|
/// Convenience wrapper for supporting null keys in hash tables.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <typeparam name="T"></typeparam>
|
/// <typeparam name="T"></typeparam>
|
||||||
public struct NullObject<T> : IEquatable<NullObject<T>>
|
public struct NullObject<T> : IEquatable<NullObject<T>>, IComparable<NullObject<T>>
|
||||||
{
|
{
|
||||||
#region Properties
|
#region Properties
|
||||||
|
|
||||||
@@ -101,5 +102,20 @@ namespace ICD.Common.Utils
|
|||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#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