I have class like below.
public class Dropdown
{
[Required(ErrorMessage = "Please select state")]
public string StateId { get; set; }
public List<SelectListItem> States
{
get
{
return new List<SelectListItem>()
{
new SelectListItem
{
Text = "State1",
Value = "S1",
Selected = false
},
new SelectListItem
{
Selected = false,
Value = "S2",
Text = "State2"
}
};
}
}
}
In Action Method, I have below two options while instantiating this class.
Approach 1
var d = new Models.Dropdown();
Approach 2
Models.Dropdown d = new Models.Dropdown();
Both are show same number of Methods/Properties/Data Members etc. I also heard that it is recommended to use Approach 1
Question
Is my assumption correct to use Approach 1 ?