C#结构体

/*  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;                     
                    }                 
                 }             
            }         
         }     
    } 
}
原文地址:https://www.cnblogs.com/djcsch2001/p/2035688.html