日期:2014-05-18 浏览次数:20737 次
static void Main(string[] args) { string Tem_str = ""; string str = "abcdefg"; //对str字符串逆序输出 foreach (object i in Transpose(str)) { Tem_str += i.ToString(); } Console.WriteLine(Tem_str); Console.ReadKey(); } public static IEnumerable<object> Transpose(string n) { for (int i = n.Length - 1; i >= 0; i++) { yield return (object)n[i]; } }