我有以下内容:
ViewBag.SomeEnumerable = new List<string>() { "string1", "string2" };
现在如何在 JavaScript 端分配ViewBag.SomeEnumerable
给一个array
或某种形式的可枚举对象?例如:
function SomeFunction()
{
var array = @ViewBag.SomeEnumerable;
for(var eachItem in array)
{
alert(eachItem); // should display "string1" then string2"
}
}