In .NET, what is the difference between String.Empty and "", and are they interchangeable, or is there some underlying reference or Localization issues around equality that String.Empty will ensure are not a problem?
In .NET, what is the difference between String.Empty and "" , and are they
Share
In .NET prior to version 2.0,
''creates an object whilestring.Emptycreates no objectref, which makesstring.Emptymore efficient.In version 2.0 and later of .NET, all occurrences of
''refer to the same string literal, which means''is equivalent to.Empty, but still not as fast as.Length == 0..Length == 0is the fastest option, but.Emptymakes for slightly cleaner code.See the .NET specification for more information.