示例#1
0
        public static IList <T> StringToList <T>(object source, char separator = ',')
        {
            IList <T> list = (IList <T>) new List <T>();
            string    str1 = TypesHelper.ObjectToString(source, "", false, (string)null);

            char[] chArray = new char[1]
            {
                separator
            };
            foreach (string str2 in str1.Split(chArray))
            {
                try
                {
                    list.Add((T)Convert.ChangeType((object)str2, typeof(T), (IFormatProvider)CultureInfo.InvariantCulture));
                }
                catch
                {
                }
            }
            return(list);
        }
示例#2
0
 public static bool e_IsNullValue(this object source)
 {
     return(TypesHelper.ObjectIsNullOrWhiteSpace(source));
 }
示例#3
0
 public static bool e_IsNull(this object source)
 {
     return(TypesHelper.ObjectIsNull(source));
 }
示例#4
0
 public static IList <T> e_StringToList <T>(this object source, T defValue, char separator = ',')
 {
     return(TypesHelper.StringToList <T>(source, defValue, separator));
 }
示例#5
0
 public static string eString(this object source, string defValue = "", bool IsRidNullstring = false, string IFvalueToDefault = null)
 {
     return(TypesHelper.ObjectToString(source, defValue, IsRidNullstring, IFvalueToDefault));
 }
示例#6
0
 public static DateTime eDateTime(this object source, DateTime defValue)
 {
     return(TypesHelper.ObjectToDateTime(source, defValue));
 }
示例#7
0
 public static bool eDateTime(this object source, ref DateTime Result)
 {
     return(TypesHelper.ObjectToDateTime(source, ref Result));
 }
示例#8
0
 public static float eFloat(this object source, float defValue = 0.0f)
 {
     return(TypesHelper.ObjectToFloat(source, defValue));
 }
示例#9
0
 public static int eInt(this object source, int defValue = 0)
 {
     return(TypesHelper.ObjectToInt(source, defValue));
 }
示例#10
0
 public static long eLong(this object source, long defValue = 0L)
 {
     return(TypesHelper.ObjectToInt64(source, defValue));
 }
示例#11
0
 public static Decimal eDecimal(this object source, Decimal defValue = 0M)
 {
     return(TypesHelper.ObjectTodecimal(source, defValue));
 }
示例#12
0
 public static bool eBool(this object source, bool defValue = false)
 {
     return(TypesHelper.ObjectToBool(source, defValue));
 }
示例#13
0
 public static bool ObjectIsNullOrWhiteSpace(object source)
 {
     return(TypesHelper.ObjectIsNull(source) || string.IsNullOrWhiteSpace(source.ToString()));
 }