标签:style blog http color io os ar for div
简单例子:
public static System.Collections.Generic .IEnumerable<int> Power(int number, int exponent) { int result = 1; for (int i = 0; i < exponent; i++) { result = result * number; yield return result; } }
var abc = Power(2, 8); foreach (int i in Power(2, 8)) { Console.Write("{0} ", i); }
abc,输出结果是
2 4 8 16 32 64 128 256
http://msdn.microsoft.com/zh-cn/library/9k7k7cf0.aspx
http://www.cnblogs.com/ldp615/archive/2011/10/07/can-you-find-the-error-in-foreach-extension-method.html
标签:style blog http color io os ar for div
原文地址:http://www.cnblogs.com/hongdada/p/3991136.html