Why avoid string.ToLower() when doing case-insensitive string comparisons?
问题 I have read that when in your application you do a lot of string comparison and using ToLower method, this method is quite costly. I was wondering of anyone could explain to me how is it costly. Would appreciate any info or explanation. Thanks! 回答1: It's costly because a new string is "manufactured". Compare that to calling, say, Equals with an overload that asks for a case-insensitive comparison. This allows the comparison to terminate, without having to create a new string, as soon as a