摘要:
//通过值传递参数
public int Cals(int len)
{
return len * len;
}
//通过引用参数传递
public void refCals(ref int width)
{
width *= width;
}
//输出参数
public void outCals(int a, out int b)
{
b = a * a;
} 阅读全文
摘要:
public enum TimeOfDay
{
Morning = 0,
Afternoon = 1,
Evening
}
public static int Main()
{
//调用方法
WriteGreeting(TimeOfDay.Morning);
//获取枚举字符串
TimeOfDay time = TimeOfDay.Afternoon;
Console.WriteLine(time.ToString());
//获取枚举字符串的值
TimeOfDay time2 = (TimeOfDay) Enum.Parse(typeof(TimeOfDay), "Evening", true);
Console.WriteLine((int)time2) 阅读全文