Home  /  Questions  /  Question

50   50
Oct 26, 2010

.NET 2.0. Decorate a property with attribute for a class that's in the same assembly

Hello folks,

I've a class with several properties, of which some are mandatory.
The consuming class will take action depending on whether properties are mandatory.

If property 'InvoiceNumber' is mandatory then
  'do stuff

It seems that doing this in .NET 2.0, this is fairly convoluted. See this article:

It involves loading an assembly and then use reflection.  This doesn't make sense, i.e. loading an assembly, if the class that I'm examining resides in the same assembly!

Any advice appreciated.