本文整理汇总了C#中Trie.CopyTo方法的典型用法代码示例。如果您正苦于以下问题:C# Trie.CopyTo方法的具体用法?C# Trie.CopyTo怎么用?C# Trie.CopyTo使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Trie
的用法示例。
在下文中一共展示了Trie.CopyTo方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CopyTo_IndexNonZero_ValuesCopied
public void CopyTo_IndexNonZero_ValuesCopied()
{
Trie<string, char, int> trie = new Trie<string, char, int>();
trie.Add("key1", 5);
trie.Add("key2", 6);
KeyValuePair<string, int>[] vals = new KeyValuePair<string, int>[4];
trie.CopyTo(vals, 2);
Assert.AreEqual(0, vals[0].Value);
Assert.AreEqual(0, vals[1].Value);
Assert.IsTrue(vals.Skip(2).Any(k => k.Key == "key1" && k.Value == 5));
Assert.IsTrue(vals.Skip(2).Any(k => k.Key == "key2" && k.Value == 6));
}
示例2: CopyTo_ArrayIndexLessThanZero_Thows
public void CopyTo_ArrayIndexLessThanZero_Thows()
{
Trie<string, char, int> trie = new Trie<string, char, int>();
trie.Add("key1", 5);
trie.Add("key2", 6);
KeyValuePair<string, int>[] vals = new KeyValuePair<string, int>[2];
trie.CopyTo(vals, -1);
}
示例3: CopyTo_NotEnoughSpace_IndexNonZero_Throws
public void CopyTo_NotEnoughSpace_IndexNonZero_Throws()
{
Trie<string, char, int> trie = new Trie<string, char, int>();
trie.Add("key1", 5);
KeyValuePair<string, int>[] vals = new KeyValuePair<string, int>[1];
trie.CopyTo(vals, 1);
}
示例4: CopyTo_ArrayIsNull_Throws
public void CopyTo_ArrayIsNull_Throws()
{
Trie<string, char, int> trie = new Trie<string, char, int>();
trie.Add("key1", 5);
trie.Add("key2", 6);
trie.CopyTo(null, 0);
}