Private Class Object1
Public Property int() As Integer
Get
Return _int
End Get
Set(ByVal value As Integer)
_int = value
End Set
End Property
Public Property str() As String
Get
Return _str
End Get
Set(ByVal value As String)
_str = value
End Set
End Property
Public Property bmp() As Bitmap
Get
Return _bmp
End Get
Set(ByVal value As Bitmap)
_bmp = value
End Set
End Property
Friend _int As Integer
Friend _str As String
Friend _bmp As Bitmap
Public Sub New(ByVal int As Integer, ByVal str As String, ByVal bmp as Bitmap)
_int = int
_str = str
_bmp = bmp
End Sub
End Class
然後你可以初始化它是這樣的...
Dim obj1 as List (Of Object1)
obj1.Add(New Object1(myInt, myStr, myBmp))
您已將所有公開屬性聲明爲日期 – AUSteve
良好的捕獲...不幸的是複製/粘貼並不總是你的朋友。 –