Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

With advent of WPF and MVVM Microsoft introduced DependencyProperties and INotifyPropertyChange interface to provide a way to implement the "reactive" approach used with those technologies.

Sadly both of these constructs are very verbose, require much boilerplate, are clumsy to use, also are not really that safe since they require much use of "magic strings".

So here come the question: why didn't they put these functionalities directly into the language - why didn't they create new kind of properties created with a simple keyword, providing useful stuff of DependencyProperties (like events on change and so on...).

What were stopping them?

share|improve this question
up vote 2 down vote accepted

Dependecy properties are very WPF-specific. As far as I know, even WinRT (which is XAML-based, just like WPF) doesn't use them. So, you are proposing adding a feature that wouldn't be at all useful for people who develop ASP.NET applications, Windows services, web services, WinRT applications, etc. That's points against this feature.

Also, it's not clear to me how exactly would this work. How would you set the default value of the property? Or PropertyChangedCallback? What about attached properties? If the feature you're proposing couldn't handle all this, it would make it much less useful. If it did, I have no idea how would the syntax look like, but I doubt it would fit well with the rest of C#.

And this feature doesn't actually add much, it just makes some code slightly more convenient.

This all says to me that such a feature wouldn't be worth it, considering that it would be relatively complicated change that would be useful only in a relatively small subset of programs and even in those wouldn't be actually useful that much.

share|improve this answer
+1: I agree. I think many modern languages tend to incorporate too many ad-hoc features that could be provided by libraries or tools. A programming language should just provide a clear simple programming metaphor and some constructs for building libraries (to produce a rich ecosystem around that language). Adding all kinds of features to a language makes it just more time-consuming for programmers to master it. A language construct should be general-purpose, a library should serve a specific purpose. – Giorgio Apr 27 '13 at 8:39

I'd guess their reason might be: Having to support that language support even long after WPF is dead.

ViewModels aren't supposed to contain any logic, so any implementation code pretty much is "write-only". And with snippet support in Visual Studio writing dependency properties isn't any harder than writing regular properties: propdp tab tab. Replace the snippet with one using a lambda instead of the magic string (like this one google found for me) and you are good to go.

Language support wouldn't improve much upon that, would it?

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.