Consider this code:
Public Class SomeViewModel
<Custom>
Public Property myData As String
End Class
I want the Custom attribute to have capability to change myData after it set to some data.
ie. trim myData or omit extra chars from it or … it doesn’t matter now.
I know I can use set and get statement, but those make my code look like not good, and also I want to repeat this CustomAttribute many times is same class or elsewhere.
UPDATE
Ok, if there is no way else, can I use some customAttribute and before my ‘insert to SQL logic’ call a function say: for all property that has this customAttribute do this thing? How can I implement that?
You should use setters and getters, that’s what they are for.
Attributes mark parts of your code, such that reflection can be used on this code – it is a rather heavy weight approach just because you don’t like the look of property setters and getters.