namespace ServiceCenter.Extensions
{
    /// <summary>
    /// Linq 扩展
    /// </summary>
    public static class LinqExtension
    {
        ///// <summary>
        ///// 根据指定的属性返回集合中的非重复元素
        ///// </summary>
        ///// <remarks>不明白本方法是如何实现去重的</remarks>
        ///// <typeparam name="TSource">数据源的类型</typeparam>
        ///// <typeparam name="TKey">数据源需要进行筛选的属性</typeparam>
        ///// <param name="source">数据源</param>
        ///// <param name="keySelector">指定属性的函数表达式</param>
        ///// <returns></returns>
        //public static IEnumerable<TSource> DistinctBy<TSource, TKey>(this IEnumerable<TSource> source, Func<TSource, TKey> keySelector)
        //{
        //    var seenKeys = new HashSet<TKey>();
        //    foreach (var source1 in source)
        //    {
        //        if (seenKeys.Add(keySelector(source1)))
        //            yield return source1;
        //    }
        //}
    }
}
