〇Visual Basic 2010の新機能
・「_」が不要
・自動実装プロパティ
Public Property Name As String 裏で_nameという名の変数が宣言されるので、同じ名のフィールド変数が宣言されているとコンパイルエラーになる
・コレクションの初期化
Dim dic As New Dictionary(Of Integer, String) From
{
{1, "a"},
{2, "b"},
}
・プロパティを指定して初期化
Public Class Test
Public Property Age As Single
Public Property Name As String
End Class
Dim item as New Test With {.Name = "名前", .Age = 10}
Dim arr As New List(Of Test) From
{
New Test With {.Name = "a", .Age = 5},
New Test With {.Name = "b", .Age = 6},
}
・複数行のラムダ式
などなど