using Microsoft.AspNetCore.Components;
namespace AntDesign.Core.HashCodes
{
///
/// Provide HashCode calculation of component parameters and other functions
///
static class HashCodeExtensions
{
///
/// Compute the HashCode for all parameters
///
///
/// Component
///
public static int GetParametersHashCode(this TComponent component) where TComponent : ComponentBase
{
var hashCode = 0;
var descriptors = ParameterDescriptor.Descriptors;
foreach (var descriptor in descriptors)
{
hashCode ^= descriptor.GetValueHashCode(component);
}
return hashCode;
}
}
}