I created two application in VS2012
- Application#1. MVC 3, NET 4.5
- Application#2. MVC 4, NET 4.5
Now I open any .cshtml file and add the following code:
<div>
@if (true)
{
@string.Format("{0}", "test")
}
</div>
It works just fine in Application#1 (mvc3) and I see "test" word displayed. But it doesn't work in Application#2 (mvc4).
Could anybody explain why it happens and what should be changed?
UPDATE: I've just found out one more very weird thing. If you replace @string.format("some text") with @String.format("some text") everything works fine (note uppercase String)

Modelis stillnullin your second test?