Most advisable way of checking empty strings in C#

后端 未结 7 873
抹茶落季
抹茶落季 2020-12-13 01:51

What is the best way for checking empty strings (I\'m not asking about initializing!) in C# when considering code performance?(see code bel

7条回答
  •  爱一瞬间的悲伤
    2020-12-13 02:42

    A late arrival:

    if a == ""
    

    will give rise to Code Analysis warning CA1820, so you definitely shouldn't do that. For a full analysis see CA1820: Test for empty strings using string length

提交回复
热议问题