.net - How to use arr.Contains with Object ArrayList -
i have visual basic .net arraylist
dim first new arraylist() first.add({100, 200}) first.add({500, 250}) first.add({700, 200}) my question is, how can true code...
first.contains({500, 250}) always return me false... correct syntax?
contains proves if object pass in in arraylist. not compare values.
sample:
imports system public class sample sub method() dim obj1 new object() dim obj2 new object() console.writeline(obj1.equals(obj2)) '===> false obj2 = obj1 console.writeline(obj1.equals(obj2)) '===> true end sub 'method end class 'sample here obj1 und obj2 both of type object not equal if internal object state might same.
you might write own custom class implementing icomparable achieve want want.
Comments
Post a Comment