title: Custom Class in Razor View?
body: <p>Within my Controller I have a class called "ObjectData" that contains an ID and a string:</p>
  
  <pre><code>public class ObjectData
  {
      public int ObjectId { get; set; }
      public string Name { get; set; }
  }
  </code></pre>
  
  <p>I'm trying to pass a List of these to the view via ViewBag, but I don't know how to loop through the items in the array since the classtype isn't normal.  I'm doing it this way because I don't want to pass a bunch of Objects and their data to the view, when I only need the ID and Name (is this a valid concern?).  </p>
  
  <p>I'm thinking of looping through like this: </p>
  
  <pre><code>foreach (ObjectData i in ViewBag.ParentSetIds)
  {
      @Html.ActionLink(i.Name, "Detail", new { objectId = i.ObjectId }, null)
  }
  </code></pre>
  
  <p>But Razor doesn't recognize that class type.  How can this be accomplished? </p>