mercredi 25 décembre 2019

Find Class Members which are Not Other Classes in C# Net Core with Reflection

I am trying to use reflection, and iterating through all Class members. How to tell if a member is not another class or regular system item(int, boolean, Datetime, string,etc)?

assembly.GetTypes().GetProperties.

PropertyType.BaseType

String is showing as Value Object, along with Manufacturer class. Trying to detect all non-classes regular system data types. How can this be done with reflection properties?

    public class Product
    {
        public int ProductId { get; set; }
        public string ProductDescription{ get; set; }
        public bool? Active { get; set; }
        public float SalesPrice { get;set;}
        public DateTime? EffectiveStartDate { get; set; }
        public Manufacturer Manufacturer { get; set; }
        pubic Department Department {get;set;}
    }

,





Aucun commentaire:

Enregistrer un commentaire