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

26 lines
546 B
C#
Raw Normal View History

2019-12-08 00:51:07 +08:00
using System;
namespace AntDesign
2019-12-08 00:51:07 +08:00
{
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;
}
}
}