Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches

◆ ToBoolean()

static bool System.Data.DataExpression.ToBoolean ( object value)
inlinestaticpackage

Definition at line 225 of file DataExpression.cs.

226 {
227 if (IsUnknown(value))
228 {
229 return false;
230 }
231 if (value is bool)
232 {
233 return (bool)value;
234 }
236 {
237 return sqlBoolean.IsTrue;
238 }
239 if (value is string)
240 {
241 try
242 {
243 return bool.Parse((string)value);
244 }
245 catch (Exception ex) when (ADP.IsCatchableExceptionType(ex))
246 {
247 ExceptionBuilder.TraceExceptionForCapture(ex);
248 throw ExprException.DatavalueConvertion(value, typeof(bool), ex);
249 }
250 }
251 throw ExprException.DatavalueConvertion(value, typeof(bool), null);
252 }
static bool IsCatchableExceptionType(Exception e)
Definition ADP.cs:790
static bool IsUnknown(object value)

References System.Data.ExprException.DatavalueConvertion(), System.Data.Common.ADP.IsCatchableExceptionType(), System.Data.DataExpression.IsUnknown(), System.Data.ExceptionBuilder.TraceExceptionForCapture(), and System.value.

Referenced by System.Data.Select.AcceptRecord(), System.Data.BinaryNode.BinaryCompare(), System.Data.FunctionNode.EvalFunction(), System.Data.UnaryNode.EvalUnaryOp(), and System.Data.DataExpression.Invoke().