OldBlueWater/BlueWater/Assets/Doozy/Runtime/Common/Extensions/EnumerableExtensions.cs
2023-08-02 15:08:03 +09:00

21 lines
929 B
C#

// Copyright (c) 2015 - 2023 Doozy Entertainment. All Rights Reserved.
// This code can only be used under the standard Unity Asset Store End User License Agreement
// A Copy of the EULA APPENDIX 1 is available at http://unity3d.com/company/legal/as_terms
using System.Collections.Generic;
// ReSharper disable UnusedType.Global
namespace Doozy.Runtime.Common.Extensions
{
/// <summary> Extension methods for the IEnumerable interface </summary>
public static class EnumerableExtensions
{
/// <summary> Convert IEnumerable to HashSet </summary>
/// <param name="source"> Source IEnumerable </param>
/// <param name="comparer"> Equality comparer for the set type </param>
/// <returns> A new HashSet </returns>
public static HashSet<T> ToHashSet<T>(this IEnumerable<T> source, IEqualityComparer<T> comparer = null) =>
new HashSet<T>(source, comparer);
}
}