I have an anonymous type of this form:
new List<MyList>()
{
new Column { Name = "blah", Width = 100, Hidden = true },
new Column { Name = "blah1", Width = 60, Hidden = false }
}
How can I go about creating the content within the list dynamically, like:
new List<MyList>()
{
foreach (var columns in col)
{
new Column { Name = columns.Name ... }
}
}
Even with col returning the right sort of data, the above example isn't acceptable and I can't see why.