如何搜索我的列表? 我想在添加條形碼時驗證條形碼。List of(T)search vb.net
Public Class item2
Private m_name As String
Private m_barcode As Integer
Private m_Price As Double
Private m_Quinety As Integer
Public Property Name() As String
Get
Return m_name
End Get
Set(value As String)
m_name = value
End Set
End Property
Public Property Barcode() As Integer
Get
Return m_barcode
End Get
Set(value As Integer)
m_barcode = value
End Set
End Property
Public Property Price() As Double
Get
Return m_Price
End Get
Set(value As Double)
m_Price = value
End Set
End Property
Public Property Quinety() As Integer
Get
Return m_Quinety
End Get
Set(value As Integer)
m_Quinety = value
End Set
End Property
Dim ItemsList As New List(Of item2)()
End class
我一直在搜索互聯網發現是這樣的:
dim zz as item2 = ItemsList.Find(Function(p) p.Barcode = 12345689)
但它不工作。任何建議,將不勝感激。
歡迎SO!嘗試比「它不工作」更具體一點。 – J0e3gan
'Function(p)p.Barcode = 12345689'應該是幹什麼的? –
你不能訪問他們需要成爲「朋友」或「公共」的私人成員。另外它被稱爲'm_barcode'。 – OneFineDay