Search Results for

    Show / Hide Table of Contents

    Class StringConverterUtil

    Summary description for StringConverterUtil.

    Inheritance
    System.Object
    StringConverterUtil
    Inherited Members
    System.Object.ToString()
    System.Object.Equals(System.Object)
    System.Object.Equals(System.Object, System.Object)
    System.Object.ReferenceEquals(System.Object, System.Object)
    System.Object.GetHashCode()
    System.Object.GetType()
    System.Object.MemberwiseClone()
    Namespace: ImageVault.Common.Lib
    Assembly: ImageVault.Common.dll
    Syntax
    public static class StringConverterUtil

    Methods

    ConvertBytesToString(Int64, IFormatProvider)

    Converts the supplied byte count to a suitable string representation with 3 significant numbers at the best suitable prefix

    Declaration
    public static string ConvertBytesToString(long bytes, IFormatProvider provider = null)
    Parameters
    Type Name Description
    System.Int64 bytes
    System.IFormatProvider provider
    Returns
    Type Description
    System.String
    Examples

    1310720 => 1,25 Mb 1649267441664 => 2 Tb

    ConvertBytesToString(Nullable<Int64>, IFormatProvider)

    Converts the supplied byte count to a suitable string representation with 3 significant numbers at the best suitable prefix

    Declaration
    public static string ConvertBytesToString(long? bytes, IFormatProvider provider = null)
    Parameters
    Type Name Description
    System.Nullable<System.Int64> bytes
    System.IFormatProvider provider
    Returns
    Type Description
    System.String
    Examples

    1310720 => 1,25 Mb 1649267441664 => 2 Tb

    ConvertBytesToString(UInt64, IFormatProvider)

    Converts the supplied byte count to a suitable string representation with 3 significant numbers at the best suitable prefix

    Declaration
    [CLSCompliant(false)]
    public static string ConvertBytesToString(ulong bytes, IFormatProvider provider = null)
    Parameters
    Type Name Description
    System.UInt64 bytes
    System.IFormatProvider provider
    Returns
    Type Description
    System.String
    Examples

    1310720 => 1,25 Mb 1649267441664 => 2 Tb

    ConvertToBool(String, Boolean)

    Declaration
    public static bool ConvertToBool(string value, bool defaultValue = false)
    Parameters
    Type Name Description
    System.String value
    System.Boolean defaultValue

    If no value is defined, the default value will be returned

    Returns
    Type Description
    System.Boolean

    ConvertToInt(String, Int32)

    Declaration
    public static int ConvertToInt(string value, int defaultValue = 0)
    Parameters
    Type Name Description
    System.String value
    System.Int32 defaultValue
    Returns
    Type Description
    System.Int32

    ConvertToLong(String, Int64)

    Convert the supplied string value to a long value

    Declaration
    public static long ConvertToLong(string value, long defaultValue = 0L)
    Parameters
    Type Name Description
    System.String value
    System.Int64 defaultValue
    Returns
    Type Description
    System.Int64

    ConvertToTimeSpan(String, Nullable<TimeSpan>)

    Declaration
    public static TimeSpan ConvertToTimeSpan(string value, TimeSpan? defaultValue = null)
    Parameters
    Type Name Description
    System.String value
    System.Nullable<System.TimeSpan> defaultValue
    Returns
    Type Description
    System.TimeSpan

    ParseByteString(String, IFormatProvider)

    Parses the supplied string for a byte expression including prefix and unit and returns the number of bytes represented

    Declaration
    public static long ParseByteString(string size, IFormatProvider provider = null)
    Parameters
    Type Name Description
    System.String size
    System.IFormatProvider provider
    Returns
    Type Description
    System.Int64
    In This Article
    Back to top (c) Meriworks 2002-2022