Consider the following:
class Bind
{
public string x { get; set; }
public string y { get; set; }
}
public partial class MainWindow : Window
{
pub
The 'Contains' method uses the Equals on object, and this simply checks that the memory addresses are different.
Consider changing your class to this...
class Bind : IEquatable {
public string x { get; set; }
public string y { get; set; }
public bool Equals(Bind other)
{
return x == other.x && y == other.y;
}
}
Your loop will then visit the strongly typed Equals method in your class, and this will result in the behaviour you are after.
NOTE: the string class ALSO inherits from IEquatable of T and that is what allows the equality operator to operate on the content of the string rather than the address of the string.