Exemplo n.º 1
0
    public void Method <T2>()
    {
        Console.Write("A1: ");
        T2 y = default(T2);

        Console.WriteLine(y.GetType().Name);
    }
        internal Tuple <IList <string>, IEnumerable <PropertyInfo> > LoadEntity <T2>()
        {
            IEnumerable <PropertyInfo> listaPropiedades;
            IList <string>             listaNombresColumnas;
            var c = typeof(T2).GetConstructors();
            T2  entidadResponse = (T2)c.First().Invoke(new Object[0]);

            listaPropiedades     = ensamblado.GetType(entidadResponse.GetType().FullName, true).GetProperties().ToList();
            listaNombresColumnas = new List <string>();
            listaPropiedades.ToList().ForEach(property =>
            {
                var attributes = property.GetCustomAttributes(false);
                PropertyNameAttribute columnMapping = (PropertyNameAttribute)attributes.FirstOrDefault(a => a.GetType() == typeof(PropertyNameAttribute));
                listaNombresColumnas.Add(columnMapping.MappingName);
            });
            return(new Tuple <IList <string>, IEnumerable <PropertyInfo> >(listaNombresColumnas, listaPropiedades));
        }