mercredi 16 août 2017

Why Attribute.IsDefined not checking my custom attribute list of Myproperty

The below line of code is not giving me any results, even though my custom attribute is there on some of the properties

var props = typeof(D).GetProperties().Where(prop => Attribute.IsDefined(prop, typeof(MYAttribute)));

sample property

  [Serializable]
  [Table()]
  public class MYClass : IMyInterface
  { 
      [Column()]
      [MyAttribute(HeaderFields.MyValue)]
      public string MyProp { get; set; }
  }

enter image description here





Aucun commentaire:

Enregistrer un commentaire