Base primitive extensions default data
 /// <summary>
 /// Convert nullable long value to decimal value
 /// </summary>
 /// <param name="longValue">nullable long value</param>
 /// <returns>decimal value</returns>
 public static decimal TryParseDecimal(this long?longValue)
 {
     return(longValue.TryParseDecimal(BasePrimitivesExtensions.GetDefaultDecimalConversionValue()));
 }
Exemplo n.º 2
0
 /// <summary>
 /// <para>Convert string byte value to byte value</para>
 /// <para>Set default value on invalid convertion</para>
 /// </summary>
 /// <param name="strValue">string value</param>
 /// <param name="defaultValue">default value</param>
 /// <returns>byte value</returns>
 public static byte TryParseByte(this string strValue, byte defaultValue)
 {
     return(strValue.TryParseByte(defaultValue, BasePrimitivesExtensions.GetDefaultByteAllowDefaultConversion(),
                                  BasePrimitivesExtensions.GetDefaultByteNumberStyle(), BasePrimitivesExtensions.GetCurrentCulture()));
 }
Exemplo n.º 3
0
 /// <summary>
 /// Test if string value is a valid byte value
 /// </summary>
 /// <param name="strValue">string value</param>
 /// <returns>true/false</returns>
 public static bool IsValidByte(this string strValue)
 {
     return(strValue.IsValidByte(
                BasePrimitivesExtensions.GetDefaultByteNumberStyle(),
                BasePrimitivesExtensions.GetCurrentCulture()));
 }
Exemplo n.º 4
0
 /// <summary>
 /// Parse string array in byte array
 /// </summary>
 /// <param name="strValue">string to parse</param>
 /// <param name="numberStyle">number style to convert</param>
 /// <param name="culture">culture origin</param>
 /// <returns>byte array</returns>
 public static byte[] TryParseByteArray(this string strValue, NumberStyles numberStyle, CultureInfo culture)
 {
     return(strValue.TryParseByteArray(null,
                                       BasePrimitivesExtensions.GetDefaultByteArrayAllowDefaultConversion(),
                                       numberStyle, culture));
 }
Exemplo n.º 5
0
 /// <summary>
 /// Parse string array in byte array
 /// </summary>
 /// <param name="strValue">string to parse</param>
 /// <param name="defaultValue">default value when default tryparse</param>
 /// <param name="allowDefaultConversion">Allow default tryparse values</param>
 /// <returns>byte array</returns>
 public static byte[] TryParseByteArray(this string strValue, byte[] defaultValue, bool allowDefaultConversion)
 {
     return(strValue.TryParseByteArray(defaultValue, allowDefaultConversion,
                                       BasePrimitivesExtensions.GetDefaultByteNumberStyle(),
                                       BasePrimitivesExtensions.GetCurrentCulture()));
 }
Exemplo n.º 6
0
 /// <summary>
 /// <para>Try parse byte to byte value</para>
 /// <para>Default value is BasePrimitivesExtensions.GetDefaultByteConversionValue() value</para>
 /// </summary>
 /// <param name="objValue">object to convert</param>
 /// <returns>byte result</returns>
 public static byte TryParseByte(this object objValue)
 {
     return(objValue.TryParseByte(BasePrimitivesExtensions.GetDefaultByteConversionValue()));
 }
Exemplo n.º 7
0
 /// <summary>
 /// <para>Convert string byte value to byte value</para>
 /// <para>Set default value on invalid convertion</para>
 /// <para>Allow 0 as converted value flag</para>
 /// </summary>
 /// <param name="strValue">string value</param>
 /// <param name="defaultValue">default value</param>
 /// <param name="allowZero">Allow 0</param>
 /// <returns>byte value</returns>
 public static byte TryParseByte(this string strValue, byte defaultValue, bool allowZero)
 {
     return(strValue.TryParseByte(defaultValue, allowZero, BasePrimitivesExtensions.GetDefaultByteNumberStyle(), BasePrimitivesExtensions.GetCurrentCulture()));
 }
Exemplo n.º 8
0
 /// <summary>
 /// Convert nullable decimal value to byte value
 /// </summary>
 /// <param name="decimalValue">nullable decimal value</param>
 /// <returns>byte value</returns>
 public static byte TryParseByte(this decimal?decimalValue)
 {
     return(decimalValue.TryParseByte(BasePrimitivesExtensions.GetDefaultByteConversionValue()));
 }
Exemplo n.º 9
0
 /// <summary>
 /// <para>Convert string to short</para>
 /// <para>Set default value on error</para>
 /// </summary>
 /// <param name="strValue">string value</param>
 /// <param name="defaultValue">default value</param>
 /// <param name="allowZero">allow 0 on convert.</param>
 /// <returns>converted value or default value</returns>
 public static short TryParseShort(this string strValue, short defaultValue, bool allowZero)
 {
     return(strValue.TryParseShort(defaultValue, allowZero,
                                   BasePrimitivesExtensions.GetDefaultShortNumberStyle(),
                                   BasePrimitivesExtensions.GetCurrentCulture()));
 }
Exemplo n.º 10
0
 /// <summary>
 /// Parse string array in short array
 /// </summary>
 /// <param name="strValue">string to parse</param>
 /// <param name="defaultValue">default value when default tryparse</param>
 /// <param name="numberStyle">number style to convert</param>
 /// <param name="culture">culture origin</param>
 /// <returns>short array</returns>
 public static short[] TryParseShortArray(this string strValue, short[] defaultValue, NumberStyles numberStyle, CultureInfo culture)
 {
     return(strValue.TryParseShortArray(defaultValue,
                                        BasePrimitivesExtensions.GetDefaultShortArrayAllowDefaultConversion(),
                                        numberStyle, culture));
 }
Exemplo n.º 11
0
 /// <summary>
 /// <para>Try parse short to short value</para>
 /// <para>Default value is BasePrimitivesExtensions.GetDefaultShortConversionValue() value</para>
 /// </summary>
 /// <param name="objValue">object to convert</param>
 /// <returns>short result</returns>
 public static short TryParseShort(this object objValue)
 {
     return(objValue.TryParseShort(BasePrimitivesExtensions.GetDefaultShortConversionValue()));
 }
Exemplo n.º 12
0
 /// <summary>
 /// Convert nullable decimal value to short value
 /// </summary>
 /// <param name="decimalValue">nullable decimal value</param>
 /// <returns>short value</returns>
 public static short TryParseShort(this decimal?decimalValue)
 {
     return(decimalValue.TryParseShort(BasePrimitivesExtensions.GetDefaultShortConversionValue()));
 }