text: public static Boolean? CoerceValueToBoolean(ValueEval ve, bool stringsAreBlanks){if (ve == null || ve == BlankEval.instance){return null;}if (ve is BoolEval){return ((BoolEval)ve).BooleanValue;}if (ve is StringEval){if (stringsAreBlanks){return null;}String str = ((StringEval)ve).StringValue;if (str.Equals("true", StringComparison.OrdinalIgnoreCase)){return true;}if (str.Equals("false", StringComparison.OrdinalIgnoreCase)){return false;}throw new EvaluationException(ErrorEval.VALUE_INVALID);}if (ve is NumericValueEval){NumericValueEval ne = (NumericValueEval)ve;double d = ne.NumberValue;if (Double.IsNaN(d)){throw new EvaluationException(ErrorEval.VALUE_INVALID);}return d != 0;}if (ve is ErrorEval){throw new EvaluationException((ErrorEval)ve);}throw new InvalidOperationException("Unexpected eval (" + ve.GetType().Name + ")");}