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
数组参数中从零开始的索引,将从该索引处开始复制。
示例
在此示例中,实例化 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 类