Search Results for

    Show / Hide Table of Contents
    View Source

    Class CustomBooleanTypeConverter

    Allows for converting string representations of 0 and 1 to boolean

    Inheritance
    object
    TypeConverter
    BooleanConverter
    Namespace: Umbraco.Cms.Core
    Assembly: Umbraco.Core.dll
    Syntax
    public class CustomBooleanTypeConverter : BooleanConverter

    Methods

    View Source

    CanConvertFrom(ITypeDescriptorContext?, Type)

    Gets a value indicating whether this converter can convert an object in the given source type to a Boolean object using the specified context.

    Declaration
    public override bool CanConvertFrom(ITypeDescriptorContext? context, Type sourceType)
    Parameters
    Type Name Description
    ITypeDescriptorContext context

    An System.ComponentModel.ITypeDescriptorContext that provides a format context.

    Type sourceType

    A System.Type that represents the type you wish to convert from.

    Returns
    Type Description
    bool

    true if this object can perform the conversion; otherwise, false.

    View Source

    ConvertFrom(ITypeDescriptorContext?, CultureInfo?, object)

    Converts the given value object to a Boolean object.

    Declaration
    public override object? ConvertFrom(ITypeDescriptorContext? context, CultureInfo? culture, object value)
    Parameters
    Type Name Description
    ITypeDescriptorContext context

    An System.ComponentModel.ITypeDescriptorContext that provides a format context.

    CultureInfo culture

    A System.Globalization.CultureInfo that specifies the culture to which to convert.

    object value

    The object to convert.

    Returns
    Type Description
    object

    An object that represents the converted value.

    Exceptions
    Type Condition
    FormatException

    value is not a valid value for the target type.

    NotSupportedException

    The conversion cannot be performed.

    • Edit this page
    • View Source
    In this article
    Back to top Copyright © 2016-present Umbraco
    Generated by DocFX