fix some routing problems

This commit is contained in:
2021-11-07 13:51:45 +01:00
parent a281b16a48
commit ca8cb0d856
8 changed files with 150 additions and 100 deletions
+15 -1
View File
@@ -1,4 +1,5 @@
using System.Collections.Generic;
using System;
using System.Collections.Generic;
namespace zero.Core.Extensions
{
@@ -22,5 +23,18 @@ namespace zero.Core.Extensions
object value = model.GetValueOrDefault(key);
return value == default || !(value is T) ? default : (T)value;
}
public static Dictionary<TKey, TElement> ToDistinctDictionary<TSource, TKey, TElement>(this IEnumerable<TSource> source, Func<TSource, TKey> keySelector, Func<TSource, TElement> elementSelector)
{
Dictionary<TKey, TElement> result = new();
foreach (TSource sourceElement in source)
{
result.TryAdd(keySelector(sourceElement), elementSelector(sourceElement));
}
return result;
}
}
}