请教,如何实现list(of class) 的搜索功能?
- VB.NET code
public class a public id as integerend classpublic b as new list(of a)dim a1 as new aa1.id=1dim a2 as new aa2.id=2
怎么才能实例 List 的搜索功能?
或者如何将对象存储在DataTable的列中?
[解决办法]
Public Class a
Implements IEquatable(Of a)
Public id As Integer
Public Function Equals1(other As a) As Boolean Implements System.IEquatable(Of a).Equals
Return id = other.id
End Function
End Class
dim x as new a
x.id=2
dim index=b.indexof(x)
这样就能找到a了
[解决办法]