chris carter's web log

Home |  Contact |  Admin
 

The Downside of Anonymous Types As Arguments

Posted on October 25, 2008

So far the only gotchya in upgrading to ASP.NET Beta was Html.TextBox.  It used to have this signature:

public string TextBox(string name, object htmlAttributes)
1

and now it has this signature

public string TextBox(string name, object value)
1

notice anything?

Yep, now that object means something different, so my calls that looked like this:

<%= Html.TextBox("whatever",new { @class="something", size=8 }) %>
1

started rendering this

<input type="text" id="whatever" value="new { @class="something", size=8 }" />
1

apparently I need better testing coverage, cuz you won't catch those at compile time.

Comments

Post a Comment

(required)
(required)
(no HTML!)