mardi 16 août 2016

Is it possible to change structure of class via attributes?

Now I am reading "CLR via C#" book, and I am interested in following question - Is it possible to change structure of class via attributes like this:

[UseFooAttr(true)]
class A
{
  if (IsDefined(typeof(UseFooAttr)))
    public Foo FooProperty{get; set}
};

But I am not sure, that this approach has some real benefits.





Aucun commentaire:

Enregistrer un commentaire