mirror of
https://gitee.com/ant-design-blazor/ant-design-blazor.git
synced 2024-12-14 17:01:18 +08:00
b1bbe30323
* 为组件增加GetParametersHashCode()扩展方法,以支持控制组件的渲染方式; 为Table组件增加RenderMode的渲染模式参数; * fix: translate the comments Co-authored-by: ElderJames <shunjiey@hotmail.com>
28 lines
907 B
C#
28 lines
907 B
C#
using Microsoft.AspNetCore.Components;
|
|
|
|
namespace AntDesign.Core.HashCodes
|
|
{
|
|
/// <summary>
|
|
/// Provide HashCode calculation of component parameters and other functions
|
|
/// </summary>
|
|
static class HashCodeExtensions
|
|
{
|
|
/// <summary>
|
|
/// Compute the HashCode for all parameters
|
|
/// </summary>
|
|
/// <typeparam name="TComponent"></typeparam>
|
|
/// <param name="component">Component</param>
|
|
/// <returns></returns>
|
|
public static int GetParametersHashCode<TComponent>(this TComponent component) where TComponent : ComponentBase
|
|
{
|
|
var hashCode = 0;
|
|
var descriptors = ParameterDescriptor<TComponent>.Descriptors;
|
|
foreach (var descriptor in descriptors)
|
|
{
|
|
hashCode ^= descriptor.GetValueHashCode(component);
|
|
}
|
|
return hashCode;
|
|
}
|
|
}
|
|
}
|