Error!
Success!

A new breed of magic strings in ASP.NET MVC

0
kicks

A new breed of magic strings in ASP.NET MVC  (Unpublished)

One of the common patterns in Ruby on Rails is the use of hashes in place of large parameter lists. Instead of hashes, which don’t exist in C#, ASP.NET MVC uses anonymous types for quite a few HTML generators on the view side. This is a trick used by the MVC team to simulate hashes. Since the dictionary initializer syntax is quite verbose, with lots of angly-bracket cruft, anonymous types provide a similar effect to hashes. However, don’t let the magic fool you. Anonymous types used to create dictionaries are still dictionaries.


Kicked By:
Drop Kicked By: