在某些語言中，例如 C 和C++，null 字元表示字串的結尾。In some languages, such as C and C++, a null character indicates the end of a string.在 .NET 中，null 字元可以內嵌在字串中。In .NET, a null character can be embedded in a string.當字串包含一個或多個 null 字元時，它們會包含在總字串的長度中。When a string includes one or more null characters, they are included in the length of the total string.例如，在下列字串中，子字串 "abc" 和 "def" 會以 null 字元分隔。For example, in the following string, the substrings "abc" and "def" are separated by a null character.Length屬性會傳回7，這表示它包含六個字母字元以及 null 字元。The Length property returns 7, which indicates that it includes the six alphabetic characters as well as the null character.