Skip to main content
Fix MSDN blog broken link, HTTPS
Source Link
Callum Watkins
  • 3k
  • 4
  • 33
  • 54

In .NET prior to version 2.0, "" creates an object while string.Empty creates no objectrefref, which makes string.Empty more 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 == 0 is the fastest option, but .Empty makes for slightly cleaner code.

See the .NET specification for more information.NET specification for more information.

In .NET prior to version 2.0, "" creates an object while string.Empty creates no objectref, which makes string.Empty more 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 == 0 is the fastest option, but .Empty makes for slightly cleaner code.

See the .NET specification for more information.

In .NET prior to version 2.0, "" creates an object while string.Empty creates no objectref, which makes string.Empty more 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 == 0 is the fastest option, but .Empty makes for slightly cleaner code.

See the .NET specification for more information.

deleted 34 characters in body
Source Link
Robert MacLean
  • 39.3k
  • 26
  • 102
  • 154

In .Net preNET prior to version 2.0, "" creates an object while Stringstring.Empty creates no object. So it is more efficient to use String.Empty.

Source of information

.Length == 0 is the fastest optionref, butwhich makes string.Empty makes for slightly cleaner codemore efficient.

As @chadmyers mentioned, inIn version 2.0 and abovelater of .NetNET, all occurrences of "" refer to the same string literal.

So, which means "" is pretty equivalent to .Empty, but still not as fast as .Length == 0.

.Length == 0 is the fastest option, but .Empty makes for slightly cleaner code.

See the .NetNET specification for more information.

In .Net pre 2.0, "" creates an object while String.Empty creates no object. So it is more efficient to use String.Empty.

Source of information

.Length == 0 is the fastest option, but .Empty makes for slightly cleaner code.

As @chadmyers mentioned, in version 2.0 and above of .Net, all occurrences of "" refer to the same string literal.

So "" is pretty equivalent to .Empty, but still not as fast as .Length == 0.

See the .Net specification for more information.

In .NET prior to version 2.0, "" creates an object while string.Empty creates no objectref, which makes string.Empty more 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 == 0 is the fastest option, but .Empty makes for slightly cleaner code.

See the .NET specification for more information.

deleted 1 characters in body
Source Link
Brian R. Bondy
  • 349.3k
  • 129
  • 607
  • 641

In .Net pre 2.0, "" creates an object while String.Empty creates no object. So it is more efficient to use String.Empty.

Source of information

.Length == 0 is the fastest option, but .Empty makes for slightly cleaner code.

As @chadmyers mentioned, in version 2.0 and above of .Net, all occurrences of "" refer to the same string literal.

So "" is pretty equivalent to .EqualsEmpty, but still not as fast as .Length == 0.

See the .Net specification for more information.

In .Net pre 2.0, "" creates an object while String.Empty creates no object. So it is more efficient to use String.Empty.

Source of information

.Length == 0 is the fastest option, but .Empty makes for slightly cleaner code.

As @chadmyers mentioned, in version 2.0 and above of .Net, all occurrences of "" refer to the same string literal.

So "" is pretty equivalent to .Equals, but still not as fast as .Length == 0.

See the .Net specification for more information.

In .Net pre 2.0, "" creates an object while String.Empty creates no object. So it is more efficient to use String.Empty.

Source of information

.Length == 0 is the fastest option, but .Empty makes for slightly cleaner code.

As @chadmyers mentioned, in version 2.0 and above of .Net, all occurrences of "" refer to the same string literal.

So "" is pretty equivalent to .Empty, but still not as fast as .Length == 0.

See the .Net specification for more information.

Typo fix and some formatting.
Source Link
strager
  • 90.3k
  • 27
  • 139
  • 181
Loading
added 156 characters in body
Source Link
Brian R. Bondy
  • 349.3k
  • 129
  • 607
  • 641
Loading
added 96 characters in body
Source Link
Brian R. Bondy
  • 349.3k
  • 129
  • 607
  • 641
Loading
added 87 characters in body
Source Link
Brian R. Bondy
  • 349.3k
  • 129
  • 607
  • 641
Loading
Source Link
Brian R. Bondy
  • 349.3k
  • 129
  • 607
  • 641
Loading