资源介绍
都是些经典的C#方面的例子
using System;
using System.Collections.Generic;
using System.Text;
namespace MyEnum
{
public enum Genders
{
Male, Female
}
class Student
{
///
/// 姓名
///
private string name;
public string Name
{
get { return name; }
set { name = value; }
}
///
/// 性别
///
//private string gender;
//public string Gender
//{
// get { return gender; }
// set { gender = value; }
//}
private Genders gender;
public Genders Gender
{
get { return gender; }
set { gender = value; }
}
///
/// 年龄
///
private int age;
public int Age
{
get { return age; }
set
{
//属性是聪明的字段
if (value > 0 && value < 100)
{
age = value;
}
else
{
age = 18;
}
}
}
}
}