Checking if Viewbag property is empty, and using default value in a view

asp.net-mvc, asp.net-mvc-3, razor

Solution

@(ViewBag.Name ?? Html.Raw(" "))

Problem

I have this piece of code in a MVC view that works, but it seams like a lot of code to achieve this simple thing. Any way to make it more efficient? ``` @if (string.IsNullOrEmpty(ViewBag.Name)) { @:  } else { @:ViewBag.Name } ```

Original source