Is it a better way or consider a best practice to call ToTileCase in Asp.Net MVC Core 6

mehmood tekfirst 771 Reputation points
2022-07-22T06:40:55.227+00:00

Hi,

Is it a better way or consider a best practice to call ToTileCase in Asp.Net MVC Core 6 ?

System.Threading.Thread.CurrentThread.CurrentCulture.TextInfo.ToTitleCase((payment.DTitle ?? "").ToLower())  
ASP.NET Core
ASP.NET Core
A set of technologies in the .NET Framework for building web applications and XML web services.
4,187 questions
0 comments No comments
{count} votes

Accepted answer
  1. Bruce (SqlWork.com) 56,686 Reputation points
    2022-07-22T16:41:23.42+00:00

    if you need the feature, then call it. In you sample code, there is no reason to call it because you convert to lowercase anyway and be better written:

     payment.DTitle?.ToLower() ?? ""  
    
    1 person found this answer helpful.
    0 comments No comments

0 additional answers

Sort by: Most helpful