using System;using System.Collections.Generic;using System.Linq;using System.Text;namespace 实现字符串的返转{ class Program { static void Main(string[] args) { //把字符串先转换为一个字符数组 string s = "abcdehhhd"; char[] ct = s.ToCharArray(); for (int i = 0; i < ct.Length/2; i++) { //这里定义一个临时变量 其实就是通过引入第三个变量来交换两个值的意思 char temp = ct[i]; ct[i] = ct[ct.Length - i - 1]; ct[ct.Length - i - 1] = temp; } foreach (var VARIABLE in ct) { Console.WriteLine(VARIABLE); } Console.ReadKey(); } }}