日期:2014-05-17 浏览次数:21085 次
public class EmployeeInfo
{
public int Emp_id { get; set; }
public string Name { get; set; }
public int InTime { get; set; }
public string Telephone { get; set; }
public string Post { get; set; }
public int SalaryLevel()
{
return 1 + (DateTime.Now.Year - InTime) / 2;
}
}
static void Main(string[] args)
{
EmployeeInfo employeeInfo = new EmployeeInfo() { Emp_id = 10001, Name = "zhang3", InTime = 2010, Telephone = "123456789", Post = "987654321" };
int salaryLevel = employeeInfo.SalaryLevel();
Console.WriteLine(salaryLevel);//2
}