Show / Hide Table of Contents

    Class ObjectConverter

    This utility class is designed to make System.Object related conversions easier to work with.

    Inheritance
    System.Object
    ObjectConverter
    Namespace: Cuemon
    Assembly: Cuemon.Core.dll
    Syntax
    public static class ObjectConverter

    Methods

    | Improve this Doc

    ChangeType(Object, Type)

    Returns an object of the specified type and whose value is equivalent to the specified object.

    Declaration
    public static object ChangeType(object value, Type conversionType)
    Parameters
    Type Name Description
    System.Object value

    The object to convert the underlying type.

    System.Type conversionType

    The System.Type of object to return.

    Returns
    Type Description
    System.Object

    An object whose type is conversionType and whose value is equivalent to value.

    Remarks

    What differs from the System.Convert.ChangeType(Object, Type) is, that this converter supports generics and enums somewhat automated.

    | Improve this Doc

    ChangeType(Object, Type, IFormatProvider)

    Returns an object of the specified type and whose value is equivalent to the specified object.

    Declaration
    public static object ChangeType(object value, Type conversionType, IFormatProvider provider)
    Parameters
    Type Name Description
    System.Object value

    The object to convert the underlying type.

    System.Type conversionType

    The System.Type of object to return.

    System.IFormatProvider provider

    An object that supplies culture-specific formatting information.

    Returns
    Type Description
    System.Object

    An object whose type is conversionType and whose value is equivalent to value.

    Remarks

    What differs from the System.Convert.ChangeType(Object, Type) is, that this converter supports generics and enums. Failover uses System.ComponentModel.TypeDescriptor.

    | Improve this Doc

    FromString(String)

    Returns a primitive object whose value is equivalent to the specified value.

    Declaration
    public static object FromString(string value)
    Parameters
    Type Name Description
    System.String value

    The string to convert the underlying type.

    Returns
    Type Description
    System.Object

    An object whose type is primitive (either System.Boolean, System.Int64 or System.Double) and whose value is equivalent to value. If conversion is unsuccessful, the original value is returned.

    | Improve this Doc

    FromString(String, IFormatProvider)

    Returns a primitive object whose value is equivalent to the specified value.

    Declaration
    public static object FromString(string value, IFormatProvider provider)
    Parameters
    Type Name Description
    System.String value

    The string to convert the underlying type.

    System.IFormatProvider provider

    An object that supplies culture-specific formatting information.

    Returns
    Type Description
    System.Object

    An object whose type is primitive (either System.Boolean, System.Int64 or System.Double) and whose value is equivalent to value. If conversion is unsuccessful, the original value is returned.

    • Improve this Doc
    • View Source
    Back to top Copyright 2008-2018 Weubphoria. All rights reserved.
    Generated by DocFX