public void Test() { XYZ2 xyz_1 = new XYZ2(0, 0, 0); XYZ2 xyz_2 = new XYZ2(0, 0, 1); XYZ2 xyz_3 = new XYZ2(0, 1, 0); XYZ a = new XYZ(0, 1.0, 0); TaskDialog.Show("xyz", (a.IsAlmostEqualTo(xyz_3)).ToString()); List <XYZ2> myListXYZ = new List <XYZ2>() { xyz_1, xyz_2, xyz_3 }; XYZ2 xyz_test = new XYZ2(0, 0, 0); if (xyz_1 == xyz_test) { TaskDialog.Show("abc", "Yes"); } if (myListXYZ.Contains(xyz_test)) { TaskDialog.Show("abc", "Yes"); } else { TaskDialog.Show("abc", "No"); } }
public override bool Equals(object obj) { XYZ2 other = obj as XYZ2; if (other == null) { return(false); } else { if (this.X == other.X && this.Y == other.Y && this.Z == other.Z) { return(true); } return(false); } }