ant-design-blazor/components/core/Helpers/ComponentBaseExtensions.cs

23 lines
613 B
C#
Raw Normal View History

2019-12-08 00:51:07 +08:00
using System.Collections.Generic;
using Microsoft.AspNetCore.Components;
namespace AntBlazor
{
public static class ComponentBaseExtensions
{
public static bool ParameterIsChanged<T>(this ComponentBase cmp, ParameterView parameters,
string parameterName, T value)
{
T newValue;
if (parameters.TryGetValue(parameterName, out newValue))
{
if (!EqualityComparer<T>.Default.Equals(value, newValue))
{
return true;
}
}
return false;
}
}
}