mirror of
https://gitee.com/ant-design-blazor/ant-design-blazor.git
synced 2024-12-14 17:01:18 +08:00
33 lines
1.1 KiB
C#
33 lines
1.1 KiB
C#
|
namespace AntDesign.Core.HashCodes
|
|||
|
{
|
|||
|
/// <summary>
|
|||
|
/// Provides a hash comparison of two parameter values
|
|||
|
/// </summary>
|
|||
|
/// <typeparam name="TParameter"></typeparam>
|
|||
|
static class HashCode<TParameter>
|
|||
|
{
|
|||
|
private static readonly HashCodeProvider _provider = HashCodeProvider.Create(typeof(TParameter));
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// Calculate whether the hash of two parameter values is equal
|
|||
|
/// </summary>
|
|||
|
/// <param name="parameter1">Parameter 1</param>
|
|||
|
/// <param name="parameter2">Parameter 2</param>
|
|||
|
/// <returns></returns>
|
|||
|
public static bool HashCodeEquals(TParameter parameter1, TParameter parameter2)
|
|||
|
{
|
|||
|
return GetHashCode(parameter1) == GetHashCode(parameter2);
|
|||
|
}
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// Calculate the hash value of the parameter
|
|||
|
/// </summary>
|
|||
|
/// <param name="parameter">Parameter</param>
|
|||
|
/// <returns></returns>
|
|||
|
public static int GetHashCode(TParameter parameter)
|
|||
|
{
|
|||
|
return _provider.GetHashCode(parameter);
|
|||
|
}
|
|||
|
}
|
|||
|
}
|