Expression.IsTrue(...)

master
Harald Wolff 2019-02-14 18:41:21 +01:00
parent fada8eea23
commit 0f04dabe2e
1 changed files with 18 additions and 1 deletions

View File

@ -31,7 +31,24 @@ namespace ln.templates
return TopEval.Evaluate(context);
}
public bool IsTrue(Context context)
{
try
{
object v = Evaluate(context);
if ((v is bool) && ((bool)v))
return true;
if ((v is string) && (!String.Empty.Equals(v)))
return true;
if ((v is int) && ((int)v != 0))
return true;
return false;
}
catch (Exception e)
{
return false;
}
}
private void Compile()