Reputation: 591
All,
I noticed in .Net 4.5 there is a CallerMemberName attribute, which Blend specifically uses to raise a PropertyChanged event from the calling method. My question is, since this attribute doesn't specifically exist in .Net 4.0, is it possible to somehow duplicate this behavior by creating a custom attribute? Code samples much appreciated.
Upvotes: 2
Views: 2421
Reputation: 887433
The behavior you're looking for is a feature of the C# 5.0 compiler.
As long as you're using a compiler that supports it, you can create your own System.ComponentModel.CallerMemberNameAttribute
and it will work fine.
Upvotes: 3