Class SafeConvertExtensions
Safely convert strings to specified types.
Inheritance
Namespace: System
Assembly: PnP.Framework.dll
Syntax
public static class SafeConvertExtensions : object
Methods
ToBoolean(String)
Converts the input string to a boolean and if null, it returns the default value.
Declaration
public static bool ToBoolean(this string input)
Parameters
System.String
input
Input string. |
Returns
System.Boolean
|
ToBoolean(String, Boolean)
Converts the input string to a boolean and if null, it returns the default value.
Declaration
public static bool ToBoolean(this string input, bool defaultValue)
Parameters
System.String
input
Input string. |
System.Boolean
defaultValue
A default value to return for a null input value. |
Returns
System.Boolean
|
ToDouble(String)
Converts the input string to a double and if null, it returns the default value.
Declaration
public static double ToDouble(this string input)
Parameters
System.String
input
Input string. |
Returns
System.Double
|
ToDouble(String, Double)
Converts the input string to a double and if null, it returns the default value.
Declaration
public static double ToDouble(this string input, double defaultValue)
Parameters
System.String
input
Input string. |
System.Double
defaultValue
A default value to return for a null input value. |
Returns
System.Double
|
ToEnum<T>(Byte)
Converts byte input to Enum
Declaration
public static T ToEnum<T>(this byte enumValue)
Parameters
System.Byte
enumValue
byte input |
Returns
T
Return Generic Type of Enum |
Type Parameters
T
Generic Type |
ToEnum<T>(Int32)
Converts integer input to Enum
Declaration
public static T ToEnum<T>(this int enumValue)
Parameters
System.Int32
enumValue
integer input |
Returns
T
Return Generic Type of Enum |
Type Parameters
T
Generic Type |
ToEnum<T>(String)
Converts input string to Enum
Declaration
public static T ToEnum<T>(this string name)
Parameters
System.String
name
string input |
Returns
T
Return Generic Type of Enum |
Type Parameters
T
Generic Type |
ToGuid(String)
Converts the input string to a Guid and if null, it returns the default value.
Declaration
public static Guid ToGuid(this string input)
Parameters
System.String
input
Input string. |
Returns
Guid
|
ToGuid(String, Guid)
Converts the input string to a Guid and if null, it returns the default value.
Declaration
public static Guid ToGuid(this string input, Guid defaultValue)
Parameters
System.String
input
Input string. |
Guid
defaultValue
A default value to return for a null input value. |
Returns
Guid
|
ToInt32(String)
Converts the input string to a Int64 and if null, it returns the default value.
Declaration
public static int ToInt32(this string input)
Parameters
System.String
input
Input string. |
Returns
System.Int32
|
ToInt32(String, Int32)
Converts the input string to a Int32 and if null, it returns the default value.
Declaration
public static int ToInt32(this string input, int defaultValue)
Parameters
System.String
input
Input string. |
System.Int32
defaultValue
A default value to return for a null input value. |
Returns
System.Int32
|
ToInt64(String)
Converts the input string to a Int32 and if null, it returns the default value.
Declaration
public static long ToInt64(this string input)
Parameters
System.String
input
Input string. |
Returns
System.Int64
|
ToInt64(String, Int32)
Converts the input string to a Int32 and if null, it returns the default value.
Declaration
public static long ToInt64(this string input, int defaultValue)
Parameters
System.String
input
Input string. |
System.Int32
defaultValue
A default value to return for a null input value. |
Returns
System.Int64
|