Get the App
SLTechnology News&Howtos  ›  Development  › 

What are the String.Empty fields?

Shulou Source: shulou.com Published: 2022-06-03 11:02:25 10月27日 Update

This article mainly introduces what are the String.Empty fields, which are introduced in great detail and have certain reference value. Friends who are interested must finish reading them.

String.Empty, is an empty string.

String.Empty field

.net Framework class library

Represents an empty string. This field is read-only. Namespace: System

Assemblies: mscorlib (in mscorlib.dll)

ProtectedstringloginId=String.Empty

ProtectedstringloginId= ""

"" allocate a storage space with an empty length

So we usually use string.Empty.

In order to cross-platform in the future, use string.empty.

In C #, "" and string.Empty can be used interchangeably in most cases. For example:

Strings= ""

Strings2=string.Empty

If (s==string.Empty) {

/ /

}

If statement established

Several writing methods for determining an empty string, in order of performance from high to low, are:

S.Length==0 is better than s==string.Empty.

Your question about String.Empty and Null is that both represent empty strings, and one of the key points is the difference between stringstr1=String.Empty and stringstr2=null. After this definition, str1 is an empty string, and the empty string is a special string, but the value of this string is empty and there is an accurate point in memory, stringstr2=null. After this definition, you only define a reference to the string class. Str2 does not point anywhere and will report an error if it is not instantiated before use. The value of textBox1.Text is a zero-length string''.

String.Empty support platform

Windows98, Windows2000SP4, WindowsCE, WindowsMillenniumEdition, WindowsMobileforPocketPC, WindowsMobileforSmartphone, WindowsServer2003, WindowsXPMediaCenterEdition, WindowsXPProfessionalx64Edition, WindowsXPSP2, WindowsXPStarterEdition, WindowsVista, Windows7, Windows8 and 8.1.

The .NET Framework does not support all versions of every platform. For a list of supported versions, see system requirements.

Version information

.NETFramework

Supported by the following versions: 4.5, 4.0, 3.5, 2.0, 1.1, 1.0

.NETCompactFramework

Supported by the following versions: 2.0, 1.0

Related entries DBNull, Null, and String.Empty

The above is all the content of this article "what are the String.Empty fields?" Thank you for reading! Hope to share the content to help you, more related knowledge, welcome to follow the industry information channel!

Tags: Null character version support field character string content platform point space article length special two value information interest memory writing just Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Apple OPPO Reno macOS Xiaomi NVidia