---
title: "ReadOnlyTest"
author: "kanglecjr"
date: "2009-07-06T14:00:56Z"
tags: ["C", "C#", "C++", "Linq"]
slug: "readonlytest"
draft: false
lastmod: "2009-07-06T14:00:56Z"
id: 420774
url: "https://kanglecjr.iteye.com/blog/420774"
---

```c#

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();

        }
    }
}

```


[诚品服饰 英伦男装 无条件退换](http://s.click.alimama.com/a/qvYjdTCFlgg=-13358728)