how to override the default Contains() method of the arraylist
hello..i've made a structure given below and the objects of that struct are stored in an arraylist
struct node
{
public int x;
public int y;
public int cost;
public object parent;
}
now when i'm adding a new object this type..i want to check if the arraylist already contains the object with the same values..the check should only focus on x,y and cost variables of the object leaving behind the parent variable..how do i achieve this??? which methods of the arraylist should i override?? any help would be appreciated
cool_zephyr
Junior Poster in Training
75 posts since Apr 2009
Reputation Points: 8
Solved Threads: 9
the compiler shows a warning about overriding Object.GetHashCode() method tooo..how do i do this??? could you please explain
cool_zephyr
Junior Poster in Training
75 posts since Apr 2009
Reputation Points: 8
Solved Threads: 9
i did this and it works
public override int GetHashCode()
{
return base.GetHashCode();
}
thanks a lot for help
cool_zephyr
Junior Poster in Training
75 posts since Apr 2009
Reputation Points: 8
Solved Threads: 9