Return the name of a function in lowercase

后端 未结 1 1116
栀梦
栀梦 2021-01-29 15:58

In my project (ASP.net MVC) i have to return the name of a function (CSV File i read in) in lowercase. Becaus

相关标签:
1条回答
  • 2021-01-29 16:28

    you can use pre-defined function string.ToLower() like this,

    var descItemsStamp = db.ChartDatas
        .GroupBy(x => new { x.Function });
    
    var descItems = descItemsStamp
        .Select(x => new DescFunctionDataDTO
        {
            function = x.Select(b => b.Function.ToLower()).Distinct(),
            functionavg = Math.Round(x.Average(y => y.Duration), 2),
        })
        .OrderByDescending(x => x.functionavg)
        .ToList();
    return descItems;
    
    0 讨论(0)
提交回复
热议问题