我想验证ArrayList中是否已经存在对象属性。
首先,我为对象创建了一个类,因此它具有多个属性(例如:title,author等)。 然后,我为这些对象创建了一个ArrayList。听说List(T)是ArrayList列出对象的最佳方法吗?
现在,在创建另一个对象之前,我想检查其中一个属性是否已经存在,例如标题。
所以我写了这段代码:
Public Class object
Private _title as String
Private _author as String
Public Sub New(ByVal title as string, ByVal author as string)
_title = title
_author = author
End Sub
End Class
Public Class Form1
Dim myobject As object
Dim objectlist As New ArrayList
myobject = new object(title, author)
For i as Interger = 0 To objectlist.Count - 1
If objectlist(i).title = "Title" Then
MsgBox("Already exist")
Else
objectlist.Add(object)
End If
Next
End Class
```
答案 0 :(得分:0)
print (df.mask(df.eq(df.shift(axis=1))).interpolate(axis=1))
d1 d2 d3 d4
p1 1.0 2.000000 3.000000 4.0
p2 2.0 4.666667 7.333333 10.0