lundi 26 septembre 2016

Check via Reflection if Property is computed

Please imagine having following two properties inside a class:

public string Category { get; set; }
public string DisplayCategory => "SomeCategory"

Now I just want to collect all PropertyInfo objects where the property itself is not computed

var properties = type.GetProperties();
var serializables = properties.Where(p => p.CanRead, true));

How do I find out via Reflection if a property is a computed one so I can ignore it?





Aucun commentaire:

Enregistrer un commentaire