static void Main(string[] args) { StringBuilder sb = new StringBuilder(255); MyPath.GetCurrentDirectory(255, sb); Console.WriteLine(sb.ToString()); Console.ReadLine(); }
static void Main(string[] args) { Console.WriteLine("=================方法的重载================"); OverLoadExample Over = new OverLoadExample(); int i = 10; double d = 11.1; Over.SamleMothod(i); Over.SamleMothod(d); Over.SamleMothod(ref i); Console.WriteLine("=================外部方法================"); //引入了study9_17_dll类库 StringBuilder sb = new StringBuilder(255); MyPath.GetCurrentDirectory(255, sb); Console.WriteLine(sb.ToString()); Console.WriteLine("=================递归================"); for (int j = 5; j <= 10; j++) { Console.Write("{0}!={1}\n", j, RecursionTest.factorial(j)); } Console.WriteLine("=================迭代器方法================"); foreach (int item in Fibs()) { if (item < 1000) { Console.Write("{0}\t", item); } else { break; } } Console.WriteLine("=================属性================"); TimePeriod t = new TimePeriod(); t.Hours = -6; t.Hours = 6; //调用Get访问器 Console.WriteLine("以小时为单位计算时间:" + t.Hours); Console.WriteLine("=================静态构造函数================"); Bus.Drive(); Bus.Drive(); Console.ReadKey(); }