alexa
menu

Blazor

  • Code Examples
  • Upgrade Guide
  • User Guide
  • Demos
  • Support
  • Forums
  • Download
Search Results for

    Show / Hide Table of Contents

    Class ValueConvert

    ValueConvert provides conversion routines for values to convert them to another type and routines for formatting values.

    Inheritance
    object
    ValueConvert
    Inherited Members
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    object.ToString()
    Namespace: Syncfusion.Blazor.Data
    Assembly: Syncfusion.Blazor.dll
    Syntax
    public static class ValueConvert

    Properties

    AllowFormatValueTrimEnd

    Indicates whether FormatValue(object, Type, string, CultureInfo, NumberFormatInfo) should trim whitespace characters from the end of the formatted text.

    Declaration
    public static bool AllowFormatValueTrimEnd { get; set; }
    Property Value
    Type
    bool

    Methods

    ChangeType(object, Type, IFormatProvider)

    Converts value from one type to another using an optional IFormatProvider.

    Declaration
    public static object ChangeType(object value, Type type, IFormatProvider provider)
    Parameters
    Type Name Description
    object value

    The original value.

    Type type

    The target type.

    IFormatProvider provider

    A IFormatProvider used to format or parse the value.

    Returns
    Type Description
    object

    The new value in the target type.

    ChangeType(object, Type, IFormatProvider, bool)

    Converts value from one type to another using an optional IFormatProvider.

    Declaration
    public static object ChangeType(object value, Type type, IFormatProvider provider, bool returnDbNUllIfNotValid)
    Parameters
    Type Name Description
    object value

    The original value.

    Type type

    The target type.

    IFormatProvider provider

    A IFormatProvider used to format or parse the value.

    bool returnDbNUllIfNotValid

    Indicates whether exceptions should be avoided or catched and return value should be DBNull if it cannot be converted to the target type.

    Returns
    Type Description
    object

    The new value in the target type.

    ChangeType(object, Type, IFormatProvider, string, bool)

    Converts value from one type to another using an optional IFormatProvider.

    Declaration
    public static object ChangeType(object value, Type type, IFormatProvider provider, string format, bool returnDbNUllIfNotValid)
    Parameters
    Type Name Description
    object value

    The original value.

    Type type

    The target type.

    IFormatProvider provider

    A IFormatProvider used to format or parse the value.

    string format

    Format string.

    bool returnDbNUllIfNotValid

    Indicates whether exceptions should be avoided or catched and return value should be DBNull if it cannot be converted to the target type.

    Returns
    Type Description
    object

    The new value in the target type.

    FormatValue(object, Type, string, CultureInfo, NumberFormatInfo)

    Generates display text using the specified format, culture info and number format.

    Declaration
    public static string FormatValue(object value, Type valueType, string format, CultureInfo ci, NumberFormatInfo nfi)
    Parameters
    Type Name Description
    object value

    The value to format.

    Type valueType

    The value type on which formatting is based. The original value will first be converted to this type.

    string format

    The format like in ToString(string format).

    CultureInfo ci

    The CultureInfo for formatting the value.

    NumberFormatInfo nfi

    The NumberFormatInfo for formatting the value.

    Returns
    Type Description
    string

    The string with the formatted text for the value.

    FormatValueWithTypeInformation(object, bool)

    Formats the given value as string including type information. String will be in format %lt;type> 'value'.

    Declaration
    public static string FormatValueWithTypeInformation(object value, bool allowConvertToBase64)
    Parameters
    Type Name Description
    object value
    bool allowConvertToBase64

    Indicates whether TypeConverter should be checked whether the type to be parsed supports conversion to/from byte array (e.g. an Image).

    Returns
    Type
    string

    GetDefaultValue(Type)

    Returns a representative value for any given type.

    Declaration
    public static object GetDefaultValue(Type type)
    Parameters
    Type Name Description
    Type type

    The Type.

    Returns
    Type Description
    object

    A value with the specified type.

    GetType(string)

    Returns the type from the specified name. If an assembly name is appended the list of currently loaded assemblies in the current AppDomain are checked.

    Declaration
    public static Type GetType(string typeName)
    Parameters
    Type Name Description
    string typeName
    Returns
    Type
    Type

    GetTypeName(Type)

    Returns the type name. If type is not in mscorlib, the assembly name is appended.

    Declaration
    public static string GetTypeName(Type type)
    Parameters
    Type Name Description
    Type type
    Returns
    Type
    string

    IsEmpty(string)

    Indicates whether string is null or empty.

    Declaration
    public static bool IsEmpty(string str)
    Parameters
    Type Name Description
    string str
    Returns
    Type
    bool

    Parse(string, Type, IFormatProvider, string)

    Parses the given text using the resultTypes "Parse" method or using a type converter.

    Declaration
    public static object Parse(string s, Type resultType, IFormatProvider provider, string format)
    Parameters
    Type Name Description
    string s

    The text to parse.

    Type resultType

    The requested result type.

    IFormatProvider provider

    A IFormatProvider used to format or parse the value. Can be NULL.

    string format

    A format string used in a ToString() call. Right now format is only interpreted to enable roundtripping for formatted dates.

    Returns
    Type Description
    object

    The new value in the target type.

    Parse(string, Type, IFormatProvider, string, bool)

    Parse the given text using the resultTypes "Parse" method or using a type converter.

    Declaration
    public static object Parse(string s, Type resultType, IFormatProvider provider, string format, bool returnDbNUllIfNotValid)
    Parameters
    Type Name Description
    string s

    The text to parse.

    Type resultType

    The requested result type.

    IFormatProvider provider

    A IFormatProvider used to format or parse the value. Can be NULL.

    string format

    A format string used in a ToString() call. Right now format is only interpreted to enable roundtripping for formatted dates.

    bool returnDbNUllIfNotValid

    Indicates whether DbNull should be returned if value cannot be parsed. Otherwise an exception is thrown.

    Returns
    Type Description
    object

    The new value in the target type.

    Parse(string, Type, IFormatProvider, string[], bool)

    Parse the given text using the resultTypes "Parse" method or using a type converter.

    Declaration
    public static object Parse(string s, Type resultType, IFormatProvider provider, string[] formats, bool returnDbNUllIfNotValid)
    Parameters
    Type Name Description
    string s

    The text to parse.

    Type resultType

    The requested result type.

    IFormatProvider provider

    A IFormatProvider used to format or parse the value. Can be NULL.

    string[] formats

    A string array holding permissible formats used in a ToString() call. Right now formats is only interpreted to enable roundtripping for formatted dates.

    bool returnDbNUllIfNotValid

    Indicates whether DbNull should be returned if value cannot be parsed. Otherwise an exception is thrown.

    Returns
    Type Description
    object

    The new value in the target type.

    ParseValueWithTypeInformation(string, object, bool)

    Parses the given string including type information. String can be in format %lt;type> 'value'.

    Declaration
    public static bool ParseValueWithTypeInformation(string valueAsString, object retVal, bool allowConvertFromBase64)
    Parameters
    Type Name Description
    string valueAsString
    object retVal
    bool allowConvertFromBase64

    Indicates whether TypeConverter should be checked whether the type to be parsed supports conversion to/from byte array (e.g. an Image).

    Returns
    Type
    bool

    TryConvertFromBase64String(Type, string, out object)

    Indicates whether the TypeConverter associated with the type supports conversion to/from a byte array (e.g. an Image). If that is the case the string is converted to a byte array from a base64 string.

    Declaration
    public static bool TryConvertFromBase64String(Type type, string valueAsString, out object retVal)
    Parameters
    Type Name Description
    Type type
    string valueAsString
    object retVal
    Returns
    Type
    bool
    In this article
    Back to top Generated by DocFX
    Copyright © 2001 - 2025 Syncfusion Inc. All Rights Reserved