日期:2014-05-17 浏览次数:20426 次
using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace ConsoleApplication1 { class Program { static void Main(string[] args) { string s = "12345"; var query = from x in s from y in s where x != y select s.Replace(x, '*').Replace(y, '*'); foreach (var item in query) Console.WriteLine(item); } } }
------解决方案--------------------
using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace ConsoleApplication1 { class Program { static void Main(string[] args) { string s = "12345"; var query = (from x in s from y in s where x != y orderby x + y descending select s.Replace(x, '*').Replace(y, '*')).Distinct(); foreach (var item in query) Console.WriteLine(item); } } }
------解决方案--------------------