I've been fiddling with different approaches for implementing INotifyPropertyChanged. I blogged one approach awhile back, declaring my unhappiness with the pattern. Neil Mosafi also talked about how INotifyPropertyChanged might be an anti-pattern. I keep searching for a better way.
At last night's Nerd Dinner, Brian Henderson was talking to Glenn Block and me about this problem. He suggested a language feature of some sort, with perhaps the feeling of generics. He mentioned that there really isn't anything to make properties easier, other than the automatic properties of C#, but those aren't very flexible.
I crafted a syntax that I think is what Brian was driving at. Here's what I came up with for declaring an automatic property that implements INotifyPropertyChanged.
The key for a feature like this is that you need to be able to define the "template" for these properties as a class. I created a PropertyTemplate base class that could be used for defining these templates.
Then, implementing a property template that implements INotifyPropertyChanged could be something along these lines:
This doesn't quite feel right, because it's not the property template that implements INotifyPropertyChanged, but rather it's the class that has the property. I could certainly see how some sort of language feature like this would be cool though.