This commit is contained in:
NaBian committed 2020-07-14 23:09:13 +08:00
1 parent 25a6117ee1
commit d4e32272a2
19 files changed
+349 -148

No files matched your search

@@ -0,0 +1,35 @@
using System;
using System.Collections.Generic;
using HandyControl.Collections;
using HandyControl.Data;
namespace HandyControl.Tools
{
public class ComparerGenerator
{
private static readonly Dictionary<Type, ComparerTypeCode> TypeCodeDic = new Dictionary<Type, ComparerTypeCode>
{
[typeof(DateTimeRange)] = ComparerTypeCode.DateTimeRange,
};
public static IComparer<T> GetComparer<T>()
{
if (TypeCodeDic.TryGetValue(typeof(T), out var comparerType))
{
if (comparerType == ComparerTypeCode.DateTimeRange)
{
return (IComparer<T>)new DateTimeRangeComparer();
}
return null;
}
return null;
}
private enum ComparerTypeCode
{
DateTimeRange
}
}
}