I would like to know if attributes can be used to "mix-in" functionality to a class / method / property.
Something like:
[TrackChanges]
public Foo
{
get;
set;
}
Does anyone how this would be implemented, if at all possible?
I would like to know if attributes can be used to "mix-in" functionality to a class / method / property.
Something like:
[TrackChanges]
public Foo
{
get;
set;
}
Does anyone how this would be implemented, if at all possible?
They certainly can but you will have to use reflection to do it. Also just because you can do it does not mean it is easy or elegant.
Reflection will give you access to every member in any type you wish. You would have to retrieve those members and work through the .NET reflection API to manipulate them. While this may work it would not be the easiest thing to maintain or read.