public struct MyColor
{
public int red;
public int green;
public int blue;
}
class Program
{
static void Main(string[] args)
{
MyColor color;
color.red = 240; //只要green、blue为0,red为任意数,最后color都表示红色
color.green = 0;
color.blue = 0;
}
}
namespace @struct
{
public struct Person
{
public string name;
public int age;
public char gender;
public string telPh;
public double weight;
}
class Program
{
static void Main(string[] args)
{
Person XiaoMing;
XiaoMing.name = "小明";
XiaoMing.age = 18;
XiaoMing.gender ='男';
XiaoMing.telPh = "18255067XXX";
XiaoMing.weight = 70.5;
}
}
}