jeudi 20 juillet 2017

C# Generic types get properties returns 0 propertys

I have the following code which i would expect to return the properties within the generic type.

   var newType = new T();
            Type t = newType.GetType();
            var prop = t.GetProperties();

prop has 0 properties and i cant understand why, when inspecting the type object at debug it is showing the correct object. The object im using as the generic.

public class SOPOH
{

    public String OHDELF { get; set; }

    public Decimal OHORDR { get; set; }

    public String OHSTAT { get; set; }

    public String OHSUSP { get; set; }

    public Decimal OHODDT { get; set; }

    public String OHCUSN { get; set; }

    public String OHCSUB { get; set; }
}

prop returns {System.Reflection.PropertyInfo[0]}

t returns {Name = "SOPOH" FullName = "AS400_Library.Repositorys.CHGDGADV.SOPOH"}





Aucun commentaire:

Enregistrer un commentaire