请使用 vs2015 c# interactive 修改运行以下代码:
要求得到顺序为: 001*002*003*+001*+002*+005
1 using System.Text.RegularExpressions; 2 class obj { 3 public string cwdm; 4 public override string ToString() 5 { 6 return cwdm; 7 } 8 } 9 10 var regex = new Regex("[0-9]+"); 11 var beds = new List<obj> { new obj { cwdm = "+002" }, new obj { cwdm = "+001" }, new obj { cwdm = "003" }, new obj { cwdm = "001" }, new obj { cwdm = "002" }, new obj { cwdm = "+005" }, }; 12 Console.WriteLine(string.Join("*", beds)); 13 beds.Sort((x, y) => { 14 int bx = 0, by = 0; 15 bool rx = int.TryParse(x.cwdm, out bx), ry = int.TryParse(y.cwdm, out by); 16 Match mx = regex.Match(x.cwdm),my = regex.Match(y.cwdm); 17 18 if (rx && ry) return bx - by; 19 if (!rx && !ry && mx != null && mx.Success && my != null && my.Success) return int.Parse(mx.Value) - int.Parse(my.Value); 20 else if (ry) return 1; 21 else if (rx) return 0; 22 23 24 return x.cwdm.CompareTo(y.cwdm); 25 }); 26 27 Console.WriteLine(string.Join("*", beds));