孤独的猫

  博客园 :: 首页 :: 博问 :: 闪存 :: 新随笔 :: 联系 :: 订阅 订阅 :: 管理 ::
/*  Example7_6.cs illustrates some of the System.Object  class methods*/
using System;
class Example7_6{
    class Program    
    {         
       static void Main(string[] args)      
       {             
           MyStruct st = new MyStruct();             
           st.X = 50;             
           Console.WriteLine(st.X);             
           Console.ReadLine();         
        }           
        
        struct MyStruct         
        {             
           int intexmp;             
           public int X            
           {                 
              get 
                 { 
                    return intexmp; 
                 }                 
              set                 
                 { 
                    if (value < 100)                    
                    {                         
                        intexmp = value;                     
                    }                 
                 }             
            }         
         }     
    } 
}
posted on 2011-05-03 20:42  孤独的猫  阅读(296)  评论(0编辑  收藏  举报