我正在加载一个 ASP.NET 下拉列表。
这样做有什么好处吗::
Private Sub LoadSeasonsListbox(ByVal seasons As List(Of Season))
Dim li As ListItem
For Each s As Season In seasons
li = New ListItem(s.SeasonDescription, s.SeasonCodeID)
frm.SeasonsList.Items.Add(li)
Next
End Sub
对此:
Private Sub LoadSeasonsListbox(ByVal seasons As List(Of Season))
For Each s As Season In seasons
frm.SeasonsList.Items.Add(New ListItem(s.SeasonDescription, s.SeasonCodeID))
Next
End Sub