private object Cast(FilterContext context, IFilterTarget target, ContentFilterElement element)
{
FilterOperand[] operands = GetOperands(element, 2);
// get the value to cast.
object value = GetValue(context, operands[0], target);
if (value == null)
{
return null;
}
// get the datatype to cast to.
NodeId datatype = GetValue(context, operands[1], target) as NodeId;
if (datatype == null)
{
return null;
}
BuiltInType targetType = GetBuiltInType(datatype);
// cast the value.
return Cast(value, targetType);
}