mercredi 10 octobre 2018

typeof().GetFields doesnt show List

I am trying to go through my class, but I am unable to list everything.

I have class:

public class Order
    {
        public string PO_NO { get; set; }
        public string APPROVED_DATE { get; set; }
        public string SPPLR_CONTACT { get; set; } //SPPLR_Mailbox
        public string PO_REMARKS { get; set; }
        public string PO_CREATION_DATE { get; set; }
        public string SPPLR_CD { get; set; }
        public string OWN_CD { get; set; }
        public string LOCATION_CODE { get; set; }
        public string LOCATION_ID { get; set; }
        public string SHIPPING_TYPE { get; set; }
        public string FREIGHT_TERMS { get; set; }
        public string PO_STATUS { get; set; }
        public string CONTACT_PERSON { get; set; }
        public string CONTACT_PERSON_MAIL { get; set; }
        public string CONTACT_PERSON_PHONE { get; set; }

        public string ATTRIBUTE01 { get; set; }
        public string ATTRIBUTE02 { get; set; }
        public string ATTRIBUTE03 { get; set; }
        public string ATTRIBUTE04 { get; set; }
        public string ATTRIBUTE05 { get; set; }
        public List<OrderDetails> OrderDetails = new List<OrderDetails>();
    }

And I am trying to "enumerate" it like that

            foreach (var field in fields)
        {
            Debug.WriteLine(field.Name + "---" + field.FieldType);
        }

Getting this output:

    <PO_NO>k__BackingField---System.String
<APPROVED_DATE>k__BackingField---System.String
<SPPLR_CONTACT>k__BackingField---System.String
<PO_REMARKS>k__BackingField---System.String
<PO_CREATION_DATE>k__BackingField---System.String
<SPPLR_CD>k__BackingField---System.String
<OWN_CD>k__BackingField---System.String
<LOCATION_CODE>k__BackingField---System.String
<LOCATION_ID>k__BackingField---System.String
<SHIPPING_TYPE>k__BackingField---System.String
<FREIGHT_TERMS>k__BackingField---System.String
<PO_STATUS>k__BackingField---System.String
<CONTACT_PERSON>k__BackingField---System.String
<CONTACT_PERSON_MAIL>k__BackingField---System.String
<CONTACT_PERSON_PHONE>k__BackingField---System.String
<ATTRIBUTE01>k__BackingField---System.String
<ATTRIBUTE02>k__BackingField---System.String
<ATTRIBUTE03>k__BackingField---System.String
<ATTRIBUTE04>k__BackingField---System.String
<ATTRIBUTE05>k__BackingField---System.String

The List is missing, what is wrong, or what can I do, to get it there listed?

I am trying to make library for myslef, to which I could just hang class and whole xml would get generated, but I would not be able to do structure dynamicaly, since I am not getting that List (child node)





Aucun commentaire:

Enregistrer un commentaire