コード例 #1
0
    static void Main()
    {
        CoOrds home;

        unsafe
        {
            CoOrds *p = &home;
            p->x = 25;
            p->y = 12;
            System.Console.WriteLine("The coordinates are: x={0}, y={1}", p->x, p->y);
        }
    }
コード例 #2
0
ファイル: AccessMembers.cs プロジェクト: akhuang/NetExercise
        public static void Run()
        {
            Console.WriteLine();
            Console.WriteLine("****AccessMembers****");

            CoOrds home;

            unsafe
            {
                CoOrds *p = &home;
                p->x = 25;
                p->y = 12;

                System.Console.WriteLine("The coordinates are: x={0}, y={1}", p->x, p->y);

                Console.WriteLine("&home.x:{0}", (int)(&home.x));
            }
        }