jeudi 7 avril 2016

Reflection not returning the any Properties

For a given class, e.g.

[DataContract]
    public class HomeInsuranceQuotationResponse
    {
        [DataMember]
        public QuotationPremimum Quotation;
    }

where

[DataContract]
    public class QuotationDetails
    {
        [DataMember]
        public string CustomerName;
        [DataMember]
        public string CustomerAddress;

    }

when I use

 var dictionary = response.Quotation.GetType().GetProperties(BindingFlags.Public | BindingFlags.Instance).ToDictionary(p => p.Name, p => p.GetGetMethod().Invoke(response.Quotation, null));

it doesnt return me any results. What am i doing wrong here please?





Aucun commentaire:

Enregistrer un commentaire