linq 截取字段数字排序C# codevar max (from s in db.Areawhere s.FareaId areaIdorderby Convert.ToI
linq 截取字段数字排序
C# code
var max= (from s in db.Area where s.FareaId == areaId orderby Convert.ToInt32(s.SubName.Substring(1)) descending select s.SubName).FirstOrDefault(); return max;
[解决办法] var max= (from s in db.Area where s.FareaId == areaId orderby Convert.ToInt32(Regex.Match(s.SubName,"\\d+").Value) descending select s.SubName).FirstOrDefault(); return max; [解决办法]