Z
Zanna
Hi all!
Problem: let's say I have a structure
Public Structure MyObject
Public Id As String
Public Description As String
Public Overrides Function Equals(ByVal obj As Object) As Boolean
If TypeOf obj Is String Then
Return DirectCast(obj, String).Equals(Me.Id)
Else
Return DirectCast(obj, Deposito).Id.Equals(Me.Id)
End If
End Function
End Structure
Now, have an array of MyObject:
Dim myObj(3) As MyObject
I fill the array and then I do
Dim idx As Int32 = Array.IndexOf(myObj, "MyId", 0, myObj.Length)
This last line give to me always -1, but I'm sure that the Equals() works.
MSDN says that the Array.IndexOf works on the override of Object.Equals(),
so I really don't know why this does not works for me
Some help?
Problem: let's say I have a structure
Public Structure MyObject
Public Id As String
Public Description As String
Public Overrides Function Equals(ByVal obj As Object) As Boolean
If TypeOf obj Is String Then
Return DirectCast(obj, String).Equals(Me.Id)
Else
Return DirectCast(obj, Deposito).Id.Equals(Me.Id)
End If
End Function
End Structure
Now, have an array of MyObject:
Dim myObj(3) As MyObject
I fill the array and then I do
Dim idx As Int32 = Array.IndexOf(myObj, "MyId", 0, myObj.Length)
This last line give to me always -1, but I'm sure that the Equals() works.
MSDN says that the Array.IndexOf works on the override of Object.Equals(),
so I really don't know why this does not works for me
Some help?