首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > .NET > C# >

.net字符串随机排列,该怎么处理

2012-11-08 
.net字符串随机排列比如“Hello,world”显示为“Hwoel,lord”。就是随机排列。这个怎么做?[解决办法]C# codestri

.net字符串随机排列
比如“Hello,world”显示为“Hwoel,lord”。
就是随机排列。
这个怎么做?

[解决办法]

C# code
string s = "Hello World!";string result = new string(s.Select(x => new { x, y = Guid.NewGuid().ToString() }).ToList().OrderBy(x => x.y).Select(x => x.x).ToArray());Console.WriteLine(result); 

热点排行