Show / Hide Table of Contents

Class ConvertUtility

Provides conversion utilities.

Inheritance
System.Object
ConvertUtility
Inherited Members
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ToString()
System.Object.ReferenceEquals(System.Object, System.Object)
Namespace: Celerik.NetCore.Util
Assembly: cs.temp.dll.dll
Syntax
public static class ConvertUtility

Methods

ToBool(String, Boolean)

Converts this string to a bool.

Declaration
public static bool ToBool(this string str, bool defaultVal = false)
Parameters
Type Name Description
System.String str

The string to be converted.

System.Boolean defaultVal

Value to return by default in case the string is an invalid bool.

Returns
Type Description
System.Boolean

String converted to bool.

ToDateTime(String, DateTime)

Convert this string to an DateTime by using invariant culture.

Declaration
public static DateTime ToDateTime(this string str, DateTime defaultVal = default(DateTime))
Parameters
Type Name Description
System.String str

The string to be converted.

System.DateTime defaultVal

Value to return by default in case the convertion cann't be performed.

Returns
Type Description
System.DateTime

String converted to DateTime

ToDecimalInvariant(String, Decimal)

Converts this string to a decimal by using invariant culture.

Declaration
public static decimal ToDecimalInvariant(this string str, decimal defaultVal = 0M)
Parameters
Type Name Description
System.String str

The string to be converted.

System.Decimal defaultVal

Value to return by default in case the string is an invalid decimal.

Returns
Type Description
System.Decimal

String converted to decimal.

ToDouble(String, Double)

Converts this string to a Double by using invariant culture.

Declaration
public static double ToDouble(this string str, double defaultVal = 0)
Parameters
Type Name Description
System.String str

The string to be converted.

System.Double defaultVal

Value to return by default in case the convertion cann't be performed.

Returns
Type Description
System.Double

String converted to Double.

ToFloat(String, Single)

Converts this string to a float by using invariant culture.

Declaration
public static float ToFloat(this string str, float defaultVal = 0F)
Parameters
Type Name Description
System.String str

The string to be converted.

System.Single defaultVal

Value to return by default in case the string is an invalid float.

Returns
Type Description
System.Single

String converted to Float.

ToIntInvariant(String, Int32)

Converts this string to an int by using invariant culture.

Declaration
public static int ToIntInvariant(this string str, int defaultVal = 0)
Parameters
Type Name Description
System.String str

The string to be converted.

System.Int32 defaultVal

Value to return by default in case the string is an invalid int.

Returns
Type Description
System.Int32

String converted to int.

In This Article
Back to top Generated by DocFX