GetDefaultByteAllowDefaultConversion() публичный статический Метод

Get default byte allow default conversion
public static GetDefaultByteAllowDefaultConversion ( ) : bool
Результат bool
Пример #1
0
 /// <summary>
 /// Convert string byte value to byte value
 /// </summary>
 /// <param name="strValue">string value</param>
 /// <returns>byte value</returns>
 public static byte TryParseByte(this string strValue)
 {
     return(strValue.TryParseByte(BasePrimitivesExtensions.GetDefaultByteConversionValue(),
                                  BasePrimitivesExtensions.GetDefaultByteAllowDefaultConversion(),
                                  BasePrimitivesExtensions.GetDefaultByteNumberStyle(),
                                  BasePrimitivesExtensions.GetCurrentCulture()));
 }
Пример #2
0
        /// <summary>
        /// <para>Try parse object byte to byte value</para>
        /// </summary>
        /// <param name="objValue">object to convert</param>
        /// <param name="defaultValue">default return value</param>
        /// <returns>byte result</returns>
        public static byte TryParseByte(this object objValue, byte defaultValue)
        {
            if (objValue == null)
            {
                return(defaultValue);
            }

            try
            {
                return(objValue.ToString().TryParseByte(defaultValue,
                                                        BasePrimitivesExtensions.GetDefaultByteAllowDefaultConversion(),
                                                        BasePrimitivesExtensions.GetDefaultByteNumberStyle(),
                                                        BasePrimitivesExtensions.GetCurrentCulture()));
            }
            catch (Exception e)
            {
                Debug.WriteLine(e);
                return(defaultValue);
            }
        }
Пример #3
0
 /// <summary>
 /// Convert string byte value to byte value
 /// </summary>
 /// <param name="strValue">string value</param>
 /// <param name="numberStyle">number style to convert</param>
 /// <param name="culture">culture origin</param>
 /// <returns>byte value</returns>
 public static byte TryParseByte(this string strValue, NumberStyles numberStyle, CultureInfo culture)
 {
     return(strValue.TryParseByte(BasePrimitivesExtensions.GetDefaultByteConversionValue(),
                                  BasePrimitivesExtensions.GetDefaultByteAllowDefaultConversion(), numberStyle, culture));
 }