Exemple #1
0
        static void Main(string[] args)
        {
            names name1 = new names();
            names name2 = new names();

            name2.Name = "Shakhbekyan";
            name1.Name = "Tigran";

            point p1 = new point(8, 9, name2);
            point p2 = new point(5, 6, name1);


            p1.display();
            p2.display();
            Console.WriteLine();
            Console.WriteLine();
            p2 = p1;
            p1.display();
            p2.display();
            p1.x          = 20;
            p1.pname.name = "New name";
            Console.WriteLine();
            Console.WriteLine();
            p1.display();
            p2.display();


            Console.ReadKey();
        }
Exemple #2
0
        static void Main()
        {
            Console.WriteLine("Hello from struct");
            point myPoint;

            myPoint.X = 349;
            myPoint.Y = 76;
            myPoint.display();

            myPoint.increment();
            myPoint.display();

            point p1 = new point();

            p1.display();

            point p2 = new point(50, 60);

            p2.display();

            point p3          = new point(7, 5);
            var   PointValues = p3.Deconstruct();

            Console.WriteLine("x is {0}", PointValues.Xpos);
            Console.WriteLine("y is {0}", PointValues.Ypos);
        }