cast viewbag to list code example
Example 1: viewBag as a list
<td>@((ViewBag.data as ICollection<Person>).First().FirstName)</td>
Example 2: viewBag as a list
<ul>
@foreach (var person in ViewBag.data)
{
<li>@person.FirstName</li>
}
</ul>