I've just taken a look at the new features available in the MVC 3 preview: ScottGu's Blog. There are a lot of good improvements and it's well worth a read to see where MVC is going.
The thing that struck me was the addition of a dynamic type ViewModel. The point being that you would not need to reference view data using ViewModel["Message"]
but could use ViewModel.Message
.
What are people's thoughts on this? I'm struggling to see why dynamic types should be used in this way. It almost gives a false sense of security for developers to come across a member call as they would implicitly believe it to be strongly-typed. At least when you see an indexer with a "magic-string" you are aware of the possibility of a run-time error.
What are other people's thoughts on this? Is this a sensible use of the dynamic type?