- public class Program
- {
- public static void Main()
- {
- string s = "CodeSnippet.Cn§$%&/()1234567890";
- Func<char, char> toggle = c => char.IsUpper(c) ? char.ToLower(c) : char.ToUpper(c);
- Console.WriteLine(s);
- Console.WriteLine(new string(s.Select(toggle).ToArray()));
- }
- }
- //该片段来自于http://www.codesnippet.cn/detail/1607201513116.html
来源: http://www.codesnippet.cn/detail/1607201513116.html