Yes, it would appear to be the case. The transformation inside MVC probably occurs when then processing the properties on the htmlAttributes object, rather than during rendering, since in a dictionary there would be no need to encode dashes as underscores.

Seems your change is not quite correct, as your second overload ignores a bunch of params (protocol/hostname/fragment). Could you fix that up in your SO answer and do some basic testing? Then I'll try to get that in T4MVC soon. Thanks!

Come to think of it, isn't the first overload superfluous? The signature is identical to the second overload if you ignore the optional parameters. I'd suggest to remove it entirely and only fix the second overload.

Crap, looks like AnonymousObjectToHtmlAttributes was added in Mvc3, so this would break anyone still using Mvc2. We could do some conditional logic based in 'if (MvcVersion >= 3)'. There is similar condition logic for RenderAction (a few lines down
from that code), except in that case it was between Mvc 1 and 2.

I'm not sure if you really want my local version. It's reformatted to use tab indents and includes a few helper methods that I like to have in my controllers (although they no longer work in MVC 4, so maybe I should get rid of them again).

I'm a bit pressed for time but can prepare you a cleanly modified file later this week, assuming you're not in a rush to get the changes.