- //注意:需要引用!
- //程序集-->框架-->System.web
- string SourceStr = "This is a Test~'''测试??";
- string Str_En = HttpUtility.UrlEncode(SourceStr);
- string Str_De = HttpUtility.UrlDecode(Str_En);
- Console.WriteLine("SourceStr:" + SourceStr);
- Console.WriteLine("Str_En:" + Str_En);
- Console.WriteLine("Str_De:" + Str_De);
- //该片段来自于http://www.codesnippet.cn/detail/2601201614484.html
来源: http://www.codesnippet.cn/detail/2601201614484.html