public string Name { get; set;}
public int RandomValue { get; set; }
public override bool Equals(object obj)
TestClass otherTestClass = (TestClass)obj;
return otherTestClass.Name == Name;
public static bool operator ==(TestClass t1, TestClass t2)
public static bool operator !=(TestClass t1, TestClass t2)
public TestClass(string name)
public static void Main()
TestClass t1 = new TestClass("Peter");
TestClass t2 = new TestClass("Franz");
TestClass t3 = new TestClass("Klaus");
Console.WriteLine(t1 == t2);
Console.WriteLine(t2 == t3);
Console.WriteLine(t1 == t3);