Beispiel #1
0
        /// <summary>
        /// What if we have two different <see cref="TypedString"/> types. Do they operator Equals (==) each other?
        /// They should *NOT* equal each other!
        /// </summary>
        static void DifferentTypesOperatorEquals()
        {
            var a = new TypedStringA("Value");
            var b = new TypedStringB("Value");

            var equal = a == b;

            Console.WriteLine($"{equal} = {nameof(a)} == {nameof(b)}");
        }
Beispiel #2
0
        static void DifferentTypesAsObjectEquals()
        {
            object a = new TypedStringA("Value");
            var    b = new TypedStringB("Value");

            var equal = b.Equals(a);

            Console.WriteLine($"{equal} = {nameof(a)} == {nameof(b)}");
        }