ant-design-blazor/components/core/Helpers/ClassBuilderRuleIf.cs
2020-05-29 00:33:49 +08:00

26 lines
546 B
C#

using System;
namespace AntDesign
{
public class ClassBuilderRuleIf<T> : ClassBuilderRule<T>
{
public string ClassName { get; set; }
public Func<T, bool> Func { get; set; }
public ClassBuilderRuleIf(string className, Func<T, bool> func)
{
ClassName = className;
Func = func;
}
public override string GetClass(T data)
{
if (Func(data))
{
return ClassName;
}
return null;
}
}
}