public static bool ToBool(this IWoopsaValue value) { if (value.Type == WoopsaValueType.Logical) { return(WoopsaFormat.ToBool(value.AsText)); } else { throw new WoopsaException(WoopsaExceptionMessage.WoopsaCastTypeMessage("bool", value.Type.ToString())); } }
public static bool ToBool(this WoopsaJsonData data) { if (data.IsSimple) { return(WoopsaFormat.ToBool(WoopsaFormat.ToStringWoopsa(data.InternalObject))); } else { throw new WoopsaException(WoopsaExceptionMessage.WoopsaCastTypeMessage("bool", data.InternalObject.GetType().ToString())); } }