最近没什么事情,复习了下以前几块不熟悉的东西。IEnumerator接口,yield,operator
namespace test { class Program { static void Main(string[] args) { Console.WriteLine("泛型方法数组遍历"); string[] strList = new string[] { "1", "2", "3", "4", "5" }; ListHelper<string> helper = new ListHelper<string>(strList); foreach (var item in helper) { Console.WriteLine(item); } Console.WriteLine("Yield学习"); var temp = ListYield.GetList<string>(strList.ToList()); temp.All(o => { Console.WriteLine(o); return true; }); Console.WriteLine("Operator学习"); ModelOperator model = new ModelOperator(1000, 100); ModelOperator model1 = new ModelOperator(2000, 200); var temp1 = model + model1; Console.WriteLine(temp1.GP + "," + temp1.Cost); } } }