Exemplo n.º 1
0
        public static Object GetAs(DbDataReader reader, Type type)
        {
            Object o = Activator.CreateInstance(type);

            PropertyInfo[] props = type.GetProperties();
            for (int i = 0; i < props.Length; i++)
            {
                Util.SetPropertyFromText(o, props[i].Name, reader[props[i].Name].ToString().Trim());
            }
            return(o);
        }
Exemplo n.º 2
0
        public static Object GetAs(string line, Type type)
        {
            Object o = Activator.CreateInstance(type);

            PropertyInfo[] props = type.GetProperties();
            var            a     = line.Split('\t');

            for (int i = 0; i < props.Length; i++)
            {
                Util.SetPropertyFromText(o, props[i].Name, a[i].Trim());
            }
            return(o);
        }