NameTable.Add 方法

定義

將指定的字串原子化,並將其加入至 NameTableAtomizes the specified string and adds it to the NameTable.

多載

Add(String)

將指定的字串原子化,並將其加入至 NameTableAtomizes the specified string and adds it to the NameTable.

Add(Char[], Int32, Int32)

將指定的字串原子化,並將其加入至 NameTableAtomizes the specified string and adds it to the NameTable.

備註

如需已儘量縮減之字串的詳細資訊,請參閱 NameTableFor more information on atomized strings, see NameTable.

Add(String)

將指定的字串原子化,並將其加入至 NameTableAtomizes the specified string and adds it to the NameTable.

public:
 override System::String ^ Add(System::String ^ key);
public override string Add (string key);
override this.Add : string -> string
Public Overrides Function Add (key As String) As String

參數

key
String

要加入的字串。The string to add.

傳回

原子化後的字串,如果已經存在於 NameTable 中,則為現有的字串。The atomized string or the existing string if it already exists in the NameTable.

例外狀況

keynullkey is null.

備註

如需已儘量縮減之字串的詳細資訊,請參閱 NameTableFor more information on atomized strings, see NameTable.

Add(Char[], Int32, Int32)

將指定的字串原子化,並將其加入至 NameTableAtomizes the specified string and adds it to the NameTable.

public:
 override System::String ^ Add(cli::array <char> ^ key, int start, int len);
public override string Add (char[] key, int start, int len);
override this.Add : char[] * int * int -> string
Public Overrides Function Add (key As Char(), start As Integer, len As Integer) As String

參數

key
Char[]

包含要加入之字串的字元陣列。The character array containing the string to add.

start
Int32

陣列中以零起始的索引,指定字串的第一個字元。The zero-based index into the array specifying the first character of the string.

len
Int32

字串中的字元數。The number of characters in the string.

傳回

原子化後的字串,如果已經存在於 NameTable 中,則為現有的字串。The atomized string or the existing string if one already exists in the NameTable. 如果 len 為零,則會傳回 String.Empty。If len is zero, String.Empty is returned.

例外狀況

0 > start0 > start

-或--or- start >= key.Lengthstart >= key.Length -或--or- len >= key.Lengthlen >= key.Length 如果 len =0,上述條件就不會造成例外狀況擲回。The above conditions do not cause an exception to be thrown if len =0.

len < 0。len < 0.

備註

如需已儘量縮減之字串的詳細資訊,請參閱 NameTableFor more information on atomized strings, see NameTable.

適用於