I have a painfully simple view model
public class TellAFriendViewModel
{
public string Email1 { get; set; }
public string Email2 { get; set; }
pu
you could use reflection over the properties, or a simple for loop to generate the same HTML as is generated in your solution, but what's your goal?
For simplicity, what you have wins.
Reflection
foreach (var prop in typeof(whatever).GetProperties(BindingFlags.Instance | BindingFlags.Public))
{
@Html.TextBox(prop.Name, prop.GetValue(Model));
}
Loop
var numberProperties = 5; // you could also do typeof(whatever).GetProperties(BindingFlags.Instance | BindingFlags.Public).Count();
@for(var i = 0; i < numberProperties; i++){
<input type="text" name="Email@i" id="Email@i"/>
}