This is my expected anonymous type out of a list object;
var roleData = new[] {
new { roleName = "Office Director"},
new { roleName = "Manager Operations"},
new { roleName = "Training Manager" }
};
This is how we can create anonymous type out of a strongly typed C# list;
foreach (UserLocation location in request.RoleRequest.UserLocations)
{
....................
var rolesData = location.Roles
.Select(x => new { roleName = x.RoleName }).ToArray();
}
For more examples, continue on Stack Overflow

