@{
ViewBag.Username = \"Charlie Brown\";
string title1 = string.Format(\"Welcome {0}\", ViewBag.Username);
var title2 = string.Format(\"Welcome {0}\", Vi
The error message is telling you exactly what's wrong here:
Extension methods cannot be dynamically dispatched. Consider casting the dynamic arguments or calling the extension method without the extension method syntax.
title2
is of type dynamic
. You need to cast it to string
, since you know that's what it is.