System.Convert.ToBoolean(object)

Here are the examples of the csharp api class System.Convert.ToBoolean(object) taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

200 Examples 7

1. Example

Project: TraceLab
Source File: Converters.cs
public object Convert(object value, Type targetType, object parameter,
            System.Globalization.CultureInfo culture)
        {
            return System.Convert.ToBoolean(value) ? Visibility.Visible :
            (parameter != null && ((string)parameter) == "Hidden" ? Visibility.Hidden : Visibility.Collapsed);
        }

2. Example

Project: GameCloud.Orleans
Source File: _Custom.cs
static Boolean va_arg( object[] ap, Boolean sysType )
{
  return Convert.ToBoolean( ap[vaNEXT++] );
}

3. Example

Project: GameCloud.Orleans
Source File: _Custom.cs
static Boolean va_arg( object[] ap, Boolean sysType )
{
  return Convert.ToBoolean( ap[vaNEXT++] );
}

4. Example

Project: CsharpSQLite
Source File: SQLiteDataReader.cs
public override bool GetBoolean(int i)
		{
			return Convert.ToBoolean(((object[])rows[current_row])[i]);
		}

5. Example

Project: CsharpSQLite
Source File: _Custom.cs
static Boolean va_arg(object[] ap, Boolean sysType)
		{
			return Convert.ToBoolean(ap[vaNEXT++]);
		}

6. Example

Project: TidyTabs-VisualStudio
Source File: Extensions.cs
private static bool IsWindowPinned(this IVsWindowFrame frame)
        {
            object result;
            frame.GetProperty((int)__VSFPROPID5.VSFPROPID_IsPinned, out result);
            return Convert.ToBoolean(result);
        }

7. Example

Project: Extend
Source File: Object.ToBoolean.cs
[PublicAPI]
        [Pure]
        public static Boolean ToBoolean( [CanBeNull] this Object obj )
            => Convert.ToBoolean( obj );

8. Example

Project: Dopamine
Source File: LoveConverter.cs
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            bool isLoved = System.Convert.ToBoolean(value);
            return isLoved ? Visibility.Visible : Visibility.Collapsed;
        }

9. Example

Project: Dopamine
Source File: LoveConverter.cs
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            bool isLoved = System.Convert.ToBoolean(value);
            return isLoved ? Visibility.Collapsed : Visibility.Visible;
        }

10. Example

Project: Dnn.Platform
Source File: Null.cs
public static bool SetNullBoolean(object objValue)
        {
            return objValue != DBNull.Value ? Convert.ToBoolean(objValue) : NullBoolean;
        }

11. Example

Project: Dnn.Platform
Source File: jQuery.cs
private static bool GetSettingAsBoolean(string key, bool defaultValue)
        {
            bool retValue = defaultValue;
            try
            {
                object setting = HttpContext.Current.Items[key];
                if (setting != null)
                {
                    retValue = Convert.ToBoolean(setting);
                }
            }
            catch (Exception ex)
            {
                Exceptions.LogException(ex);
            }
            return retValue;
        }

12. Example

Project: Dnn.Platform
Source File: FileInfo.cs
public void Fill(IDataReader dr)
        {
            ContentType = Null.SetNullString(dr["ContentT/n ..... /n //View Source file for more details /n }

13. Example

Project: Dnn.Platform
Source File: SettingsEditorControl.cs
protected override bool GetRowVisibility(object obj)
        {
            var info = (SettingInfo) obj;
            bool _IsVisible = true;
            if ((Visibility != null) && (Visibility[info.Name] != null))
            {
                _IsVisible = Convert.ToBoolean(Visibility[info.Name]);
            }
            return _IsVisible;
		}

14. Example

Project: api
Source File: Decimal_BigInteger.cs
bool IConvertible.ToBoolean (IFormatProvider provider)
		{
			return Convert.ToBoolean (this);
		}

15. Example

Project: digitsquare
Source File: _Custom.cs
static Boolean va_arg( object[] ap, Boolean sysType )
{
  return Convert.ToBoolean( ap[vaNEXT++] );
}

16. Example

Project: BehaviorIsManaged
Source File: BoolToStatus.cs
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            return System.Convert.ToBoolean(value) ? "Running" : "Stopped";
        }

17. Example

Project: BehaviorIsManaged
Source File: IsEquipedBoolConverter.cs
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            if (!( value is bool ))
                return null;

            return System.Convert.ToBoolean(value) ? "Equipped" : "In inventory";
        }

18. Example

Project: InnovatorAdmin
Source File: ExprQuery.cs
internal override object GetValue(XPathReader reader)
        {
            object ret = this.opnd1.GetValue(reader);

            if (Convert.ToBoolean(ret) == false) {
                ret = this.opnd2.GetValue(reader);
            }
#if DEBUG1
            Console.WriteLine("OrExpr: {0}", ret);
#endif
            return ret;
        }

19. Example

Project: InnovatorAdmin
Source File: ExprQuery.cs
internal override object GetValue(XPathReader reader)
        {
            object ret = this.opnd1.GetValue(reader);

            if (Convert.ToBoolean(ret) == true) {
                ret = this.opnd2.GetValue(reader);
            }
            return ret;
        }

20. Example

Project: NCache
Source File: ConfigConverter.cs
private static PerfCounters GetPerfCounters(Hashtable settings)
            {
                PerfCounters perCounters = new PerfCounters();
                perCounters.Enabled = Convert.ToBoolean(settings["perf-counters"]);
                return perCounters;
            }

21. Example

Project: vsSolutionBuildEvent
Source File: VersionFrm.cs
private void save(StepFields s)
        {
            foreach(DataGridViewRow row in dgvFields.Rows) {
                s.items[row.Index].disabled = !Convert.ToBoolean(row.Cells[dgvFieldsEnabled.Name].Value);
                s.items[row.Index].newname  = (string)row.Cells[dgvFieldsNameNew.Name].Value;
            }
        }

22. Example

Project: nemiro.oauth.dll
Source File: UniValue.cs
[EditorBrowsable(EditorBrowsableState.Never)]
    public bool ToBoolean(IFormatProvider provider)
    {
      if (!this.HasValue) { return false; }
      return Convert.ToBoolean(this.Data);
    }

23. Example

Project: YAMP
Source File: EvaluationVisitor.cs
public override void Visit(TernaryExpression expression)
        {
            // Evaluates the left expression and saves the value
            expression.LeftExpression.Accept(this);
            bool left = Convert.ToBoolean(Result);

            if (left)
            {
                expression.MiddleExpression.Accept(this);
            }
            else
            {
                expression.RightExpression.Accept(this);
            }
        }

24. Example

Project: fluentcassandra
Source File: BigDecimal.cs
bool IConvertible.ToBoolean(IFormatProvider provider)
		{
			return Convert.ToBoolean(this);
		}

25. Example

Project: FinalesFunkeln
Source File: YamlFile.cs
public bool GetBoolean(string key)
        {
            return Convert.ToBoolean(this[key]);
        }

26. Example

Project: SyncUtil
Source File: GUIUtil.cs
static object FieldFuncBool(object v, ref string unparsedStr, params GUILayoutOption[] options) { return GUILayout.Toggle(Convert.ToBoolean(v), "", options); }

27. Example

Project: openPDC
Source File: ConfigurationTypeScreen.xaml.cs
private void UpdateDatabaseRadioButtonContent()
        {
            if (m_state != null && Convert.ToBoolean(m_state["existing"]))
                m_databaseRadioButton.Content = "Database";
            else
                m_databaseRadioButton.Content = "Database (suggested)";
        }

28. Example

Project: openPDC
Source File: OracleDatabaseSetupScreen.xaml.cs
private void AdminUserNameTextBox_TextChanged(object sender, TextChangedEventArgs e)
        {
            string adminUserName = m_adminUserNameTextBox.Text;
            bool existing = Convert.ToBoolean(m_state["existing"]);
            bool migrate = existing && Convert.ToBoolean(m_state["updateConfiguration"]);

            m_oracleSetup.AdminUserName = adminUserName;

            if (existing && !migrate)
                m_oracleSetup.SchemaUserName = adminUserName;
        }

29. Example

Project: openPDC
Source File: OracleDatabaseSetupScreen.xaml.cs
private void AdminPasswordTextBox_PasswordChanged(object sender, RoutedEventArgs e)
        {
            string adminPassword = m_adminPasswordTextBox.Password;
            bool existing = Convert.ToBoolean(m_state["existing"]);
            bool migrate = existing && Convert.ToBoolean(m_state["updateConfiguration"]);

            m_oracleSetup.AdminPassword = adminPassword;

            if (existing && !migrate)
                m_oracleSetup.SchemaPassword = adminPassword;
        }

30. Example

Project: openPDC
Source File: PostgresDatabaseSetupScreen.xaml.cs
private void AdminUserNameTextBox_TextChanged(object sender, TextChangedEventArgs e)
        {
            if ((object)m_state != null)
            {
                string adminUserName = m_adminUserNameTextBox.Text;
                bool existing = Convert.ToBoolean(m_state["existing"]);
                bool migrate = existing && Convert.ToBoolean(m_state["updateConfiguration"]);

                m_postgresSetup.AdminUserName = adminUserName;

                if (existing && !migrate)
                    m_postgresSetup.RoleName = adminUserName;
            }
        }

31. Example

Project: openPDC
Source File: PostgresDatabaseSetupScreen.xaml.cs
private void AdminPasswordTextBox_PasswordChanged(object sender, RoutedEventArgs e)
        {
            bool existing = Convert.ToBoolean(m_state["existing"]);
            bool migrate = existing && Convert.ToBoolean(m_state["updateConfiguration"]);

            m_postgresSetup.AdminPassword = m_adminPasswordTextBox.SecurePassword;

            if (existing && !migrate)
                m_postgresSetup.RolePassword = m_adminPasswordTextBox.SecurePassword;
        }

32. Example

Project: openHistorian
Source File: ConfigurationTypeScreen.xaml.cs
private void UpdateDatabaseRadioButtonContent()
        {
            if (m_state != null && Convert.ToBoolean(m_state["existing"]))
                m_databaseRadioButton.Content = "Database";
            else
                m_databaseRadioButton.Content = "Database (suggested)";
        }

33. Example

Project: openHistorian
Source File: OracleDatabaseSetupScreen.xaml.cs
private void AdminUserNameTextBox_TextChanged(object sender, TextChangedEventArgs e)
        {
            string adminUserName = m_adminUserNameTextBox.Text;
            bool existing = Convert.ToBoolean(m_state["existing"]);
            bool migrate = existing && Convert.ToBoolean(m_state["updateConfiguration"]);

            m_oracleSetup.AdminUserName = adminUserName;

            if (existing && !migrate)
                m_oracleSetup.SchemaUserName = adminUserName;
        }

34. Example

Project: openHistorian
Source File: OracleDatabaseSetupScreen.xaml.cs
private void AdminPasswordTextBox_PasswordChanged(object sender, RoutedEventArgs e)
        {
            string adminPassword = m_adminPasswordTextBox.Password;
            bool existing = Convert.ToBoolean(m_state["existing"]);
            bool migrate = existing && Convert.ToBoolean(m_state["updateConfiguration"]);

            m_oracleSetup.AdminPassword = adminPassword;

            if (existing && !migrate)
                m_oracleSetup.SchemaPassword = adminPassword;
        }

35. Example

Project: openHistorian
Source File: PostgresDatabaseSetupScreen.xaml.cs
private void AdminUserNameTextBox_TextChanged(object sender, TextChangedEventArgs e)
        {
            if ((object)m_state != null)
            {
                string adminUserName = m_adminUserNameTextBox.Text;
                bool existing = Convert.ToBoolean(m_state["existing"]);
                bool migrate = existing && Convert.ToBoolean(m_state["updateConfiguration"]);

                m_postgresSetup.AdminUserName = adminUserName;

                if (existing && !migrate)
                    m_postgresSetup.RoleName = adminUserName;
            }
        }

36. Example

Project: openHistorian
Source File: PostgresDatabaseSetupScreen.xaml.cs
private void AdminPasswordTextBox_PasswordChanged(object sender, RoutedEventArgs e)
        {
            bool existing = Convert.ToBoolean(m_state["existing"]);
            bool migrate = existing && Convert.ToBoolean(m_state["updateConfiguration"]);

            m_postgresSetup.AdminPassword = m_adminPasswordTextBox.SecurePassword;

            if (existing && !migrate)
                m_postgresSetup.RolePassword = m_adminPasswordTextBox.SecurePassword;
        }

37. Example

Project: byteflood
Source File: NullableToNonNullableConverter.cs
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            try
            {
                return System.Convert.ToBoolean(value);
            }
            catch
            {
                return false;
            }
        }

38. Example

Project: byteflood
Source File: PieceViewConverter.cs
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            if (System.Convert.ToBoolean(value))
            {
                return Brushes.Red;
            }
            else
            {
                return Brushes.Black;
            }
        }

39. Example

Project: BetterEntityFramework
Source File: QueryableDataReader.cs
public override bool GetBoolean(int ordinal)
        {
            return Convert.ToBoolean(this[ordinal]);
        }

40. Example

Project: RestDb
Source File: Common.cs
public static bool IsTrue(bool? val)
        {
            if (val == null) return false;
            return Convert.ToBoolean(val);
        }

41. Example

Project: KOS
Source File: Opcode.cs
public override void Execute(ICpu cpu)
        {
            // This may look like it's just pointlessly converting from a
            // ScalarBoolean to a primitive boolean and then back into a
            // ScalarBoolean, and in the case where the operand was already
            // a ScalarBoolean that would be true.  But the purpose of this opcode
            // is to also change integers and floats into booleans. Thus the call to
            // Convert.ToBoolean():
            object value = cpu.PopValueArgument();
            bool result = Convert.ToBoolean(value);
            cpu.PushArgumentStack(Structure.FromPrimitive(result));
        }

42. Example

Project: storage-server
Source File: Common.cs
public static bool IsTrue(bool? val)
        {
            if (val == null) return false;
            return Convert.ToBoolean(val);
        }

43. Example

Project: PureJSB
Source File: JSB_System_Convert.cs
static bool Convert_ToBoolean__Object(JSVCall vc, int argc)
{
    int len = argc;
    if (len == 1) 
    {
        System.Object arg0 = (System.Object)JSMgr.datax.getWhatever((int)JSApi.GetType.Arg);
                JSApi.setBooleanS((int)JSApi.SetType.Rval, (System.Boolean)(System.Convert.ToBoolean(arg0)));
    }

    return true;
}

44. Example

Project: FileHelpers
Source File: ConvertHelpers.cs
public override string FieldToString(object from)
            {
                bool b = Convert.ToBoolean(from);
                if (b) {
                    if (mTrueString == null)
                        return "True";
                    else
                        return mTrueString;
                }
                else if (mFalseString == null)
                    return "False";
                else
                    return mFalseString;
            }

45. Example

Project: MatterControl
Source File: _Custom.cs
private static Boolean va_arg(object[] ap, Boolean sysType)
		{
			return Convert.ToBoolean(ap[vaNEXT++]);
		}

46. Example

Project: candor-common
Source File: DataRecordExtensions.cs
public static bool GetBoolean(object fieldValue, bool defaultValue)
        {
            if (fieldValue == DBNull.Value || fieldValue == null)
                return defaultValue;
            else
                return Convert.ToBoolean(fieldValue);
        }

47. Example

Project: graphql-dotnetcore
Source File: GraphQLBoolean.cs
protected override GraphQLValue GetAst(object value, ISchemaRepository schemaRepository)
        {
            if (value is int)
                value = Convert.ToBoolean(value);

            if (!(value is bool))
                return null;

            var stringValue = (bool)value ? "true" : "false";

            return new GraphQLScalarValue(ASTNodeKind.BooleanValue)
            {
                Value = stringValue
            };
        }

48. Example

Project: UWPConversionMappings
Source File: BooleanToVisibilityConverter.cs
public object Convert(object value, Type targetType, object parameter, string language)
        {
            var boolValue = System.Convert.ToBoolean(value);
            if(parameter != null)
            {
                boolValue = !boolValue;
            }
            return boolValue ? Visibility.Visible : Visibility.Collapsed;
        }

49. Example

Project: MultiversePlatform
Source File: RepositoryInstaller.cs
bool IsTypeEnabled( string type )
        {
            return Convert.ToBoolean( FilterFlags & m_TypeToFilterFlagMap[ type ] );
        }

50. Example

Project: neolua
Source File: LuaGlobalPortable.cs
private static bool IsTrue(object value)
		{
			if (value == null)
				return false;
			else if (value is bool)
				return (bool)value;
			else
				try
				{
					return Convert.ToBoolean(value);
				}
				catch
				{
					return true;
				}
		}