A new breed of magic strings in ASP.NET MVC(lostechies.com)
submitted by
johnsheehan(4785) 3 years, 4 months ago
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.
|category: MVC
|Views: 373
tags:
MVC another
Everyones tags:
Your Tags: