ITeye博客

ReadOnlyTest

kanglecjr · 2009-07-06 14:00 · C# · C · Linq · C++ · C# · Markdown


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ReadOnlyTest
{
    // 定义 point 结构
    public struct point
    {
        public int x;
        public int y;
        // 定义 point 结构 的 构造函数
        public point(int x, int y)
        {
            this.x = x;
            this.y = y;
        }
    }


    class Program
    {
        // 定义 动态常量
        private static readonly double pi = 3.14159265;
        // 使用 构造函数 定义 动态常量
        public static readonly point  P=new point(12, 26);

        static void Main(string[] args)
        {
            // 输出 对比 结果
            Console.WriteLine("pi={0}", pi);
            Console.WriteLine("P.x={0}", P.x);
            Console.WriteLine("P.y={0}", P.y);
            Console.ReadKey();

        }
    }
}

诚品服饰 英伦男装 无条件退换

评论(0)

暂无评论。

评论功能维护中,当前仅展示历史评论。