Пример #1
0
        //</Snippet9>

        void AttributesEqual()
        {
            //<Snippet10>
            DrawingAttributes attributes1 = new DrawingAttributes();

            attributes1.Color     = Colors.Blue;
            attributes1.StylusTip = StylusTip.Rectangle;
            attributes1.Height    = 5;
            attributes1.Width     = 5;

            DrawingAttributes attributes2 = new DrawingAttributes();

            attributes2.Color     = Colors.Blue;
            attributes2.StylusTip = StylusTip.Rectangle;
            attributes2.Height    = 5;
            attributes2.Width     = 5;
            //</Snippet10>

            //<Snippet11>
            if (attributes1 == attributes2)
            {
                MessageBox.Show("The DrawingAttributes are equal");
            }
            else
            {
                MessageBox.Show("The DrawingAttributes are not equal");
            }
            //</Snippet11>


            //<Snippet12>
            if (attributes1.Equals(attributes2))
            {
                MessageBox.Show("The DrawingAttributes are equal");
            }
            else
            {
                MessageBox.Show("The DrawingAttributes are not equal");
            }
            //</Snippet12>

            //<Snippet13>
            if (attributes1 != attributes2)
            {
                MessageBox.Show("The DrawingAttributes are not equal");
            }
            else
            {
                MessageBox.Show("The DrawingAttributes are equal");
            }
            //</Snippet13>
        }