The type of object can be anything you like from primitive types such as int, string, etc... to custom objects.
If you have assigned a value to ViewBag such as:
public class CustomType {
public int IntVal { get; set; }
public string StrVal { get; set; }
}
...
ViewBag.SomeObject = new CustomType { IntVal = 5, StrVal = "Hello" }
You can invoke it simply as:
@Html.Action("SomeAction", "SomeController", new { myParam = @ViewBag.SomeObject })
And in your controller:
public ActionResult SomeAction(CustomType myParam ) {
var intVal = myParam.IntVal;
var strVal = myParam.StrVal;
...
}
However, note that you can still access ViewBag from within your controllers without having to pass them in route values.
Does this answer your question?