String comparison performance in C#

后端 未结 10 1638
一向
一向 2020-12-20 11:42

There are a number of ways to compare strings. Are there performance gains by doing one way over another?

I\'ve always opted to compare strings like so:



        
10条回答
  •  情歌与酒
    2020-12-20 12:00

    There is a nice article Comparing Values for Equality in .NET: Identity and Equivalence which is a bit more general than only string comparison, but very interesting nevertheless.

提交回复
热议问题