Expression.IsTrue(...)
parent
fada8eea23
commit
0f04dabe2e
|
@ -31,7 +31,24 @@ namespace ln.templates
|
||||||
return TopEval.Evaluate(context);
|
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()
|
private void Compile()
|
||||||
|
|
Loading…
Reference in New Issue