C#结构体
时间:2011-05-03 来源:孤独的猫
/*
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;
}
}
}
}
}
}