共用方式為


UnicodeCharacterRangeCollection.CopyTo 方法

從指定的目的陣列索引開始,將目前 UnicodeCharacterRangeCollection 集合的所有元素都複製到指定的一維陣列。

命名空間:  Microsoft.Ink
組件:  Microsoft.Ink.Analysis (在 Microsoft.Ink.Analysis.dll 中)

語法

'宣告
Public Sub CopyTo ( _
    array As UnicodeCharacterRange(), _
    index As Integer _
)
'用途
Dim instance As UnicodeCharacterRangeCollection
Dim array As UnicodeCharacterRange()
Dim index As Integer

instance.CopyTo(array, index)
public void CopyTo(
    UnicodeCharacterRange[] array,
    int index
)
public:
void CopyTo(
    array<UnicodeCharacterRange^>^ array, 
    int index
)
public void CopyTo(
    UnicodeCharacterRange[] array,
    int index
)
public function CopyTo(
    array : UnicodeCharacterRange[], 
    index : int
)

參數

  • array
    型別:array<Microsoft.Ink.UnicodeCharacterRange[]
    一維陣列,這個陣列是從集合複製過來的元素之目的陣列。此陣列必須具有以零起始的索引。
  • index
    型別:System.Int32
    array 參數中以零起始的索引,位於複製開始的位置。

範例

在這個範例中,會具現化 UnicodeCharacterRangeCollection,並且對它執行數項作業。

Dim UCRC As UnicodeCharacterRangeCollection = New UnicodeCharacterRangeCollection()
' add three UnicodeCharacterRange objects
UCRC.Add("A", 26)
UCRC.Add("a", 26)
UCRC.Add("0", 10)
Dim countOfRanges As Integer = UCRC.Count ' 3
' this is true because collection contains the exact range
Dim thisIsTrue As Boolean = UCRC.Contains(New UnicodeCharacterRange("A", 26))
' this is false because collection does not contain exact range
Dim thisIsFalse As Boolean = UCRC.Contains(New UnicodeCharacterRange("a", 25))
' does not remove because the exact range: '0', 11 does not exist
UCRC.Remove(New UnicodeCharacterRange("0", 11))
' removes because the exact range '0', 10 does exist
UCRC.Remove(New UnicodeCharacterRange("0", 10))
Dim newCountOfRanges As Integer = UCRC.Count ' 2
' idxOfLowerCase = 1 (2nd range added)
Dim idxOfLowerCase As Integer = UCRC.IndexOf(New UnicodeCharacterRange("a", 26))
' idxOfDigits = -1 because that range does not exist (it was removed)
Dim idxOfDigits As Integer = UCRC.IndexOf(New UnicodeCharacterRange("0", 10))
' create an array of UnicodeCharacterRange
Dim UCRArray(UCRC.Count) As UnicodeCharacterRange
' copy from the collection to the array
UCRC.CopyTo(UCRArray, 0)
UnicodeCharacterRangeCollection UCRC = new UnicodeCharacterRangeCollection();
// add three UnicodeCharacterRange objects
UCRC.Add('A', 26);
UCRC.Add('a', 26);
UCRC.Add('0', 10);
int countOfRanges = UCRC.Count; // 3
// this true because collection contains the exact range
bool thisIsTrue = UCRC.Contains(new UnicodeCharacterRange('A', 26));
// this is false because collection does not contain exact range
bool thisIsFalse = UCRC.Contains(new UnicodeCharacterRange('a', 25));
// does not remove because the exact range: '0', 11 does not exist
UCRC.Remove(new UnicodeCharacterRange('0', 11));
// removes because the exact range '0', 10 does exist
UCRC.Remove(new UnicodeCharacterRange('0', 10));
int newCountOfRanges = UCRC.Count; // 2
// idxOfLowerCase = 1 (2nd range added)
int idxOfLowerCase = UCRC.IndexOf(new UnicodeCharacterRange('a', 26));
// idxOfDigits = -1 because that range does not exist (it was removed)
int idxOfDigits = UCRC.IndexOf(new UnicodeCharacterRange('0', 10));
// create an array of UnicodeCharacterRange
UnicodeCharacterRange[] UCRArray = new UnicodeCharacterRange[UCRC.Count];
// copy from the collection to the array
UCRC.CopyTo(UCRArray, 0);

平台

Windows Vista

.NET Framework 和 .NET Compact Framework 並不支援各種平台的所有版本。如需支援平台版本的相關資訊,請參閱 .NET Framework 系統需求

版本資訊

.NET Framework

支援版本:3.0

請參閱

參考

UnicodeCharacterRangeCollection 類別

UnicodeCharacterRangeCollection 成員

Microsoft.Ink 命名空間