本文整理汇总了C#中KeyValuePair.Skip方法的典型用法代码示例。如果您正苦于以下问题:C# KeyValuePair.Skip方法的具体用法?C# KeyValuePair.Skip怎么用?C# KeyValuePair.Skip使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类KeyValuePair
的用法示例。
在下文中一共展示了KeyValuePair.Skip方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CopyToTest
public void CopyToTest()
{
for (int y = 1900; y < 2123; y++) {
var values = CreateZmanim(y);
var array = new KeyValuePair<DateTime, ZmanimInfo>[values.Length + 33];
new YearlyZmanimDictionary(y, values).CopyTo(array, 33);
Assert.IsTrue(array.Skip(33).Select(kvp => kvp.Value).SequenceEqual(values));
Assert.IsTrue(array.Skip(33).All(kvp => kvp.Key == kvp.Value.Date));
}
}
示例2: CopyToTest
public void CopyToTest()
{
var dict = new ShieldedDict<int, object>(
Enumerable.Range(1, 1000).Select(i =>
new KeyValuePair<int, object>(i, new object())).ToArray());
Assert.AreEqual(1000, dict.Count);
var array = new KeyValuePair<int, object>[1100];
// this works out of transaction (and consequently, so do ToArray and ToList), by opening
// a transaction itself. that could not be done when you do a foreach.
((ICollection<KeyValuePair<int, object>>)dict).CopyTo(array, 100);
var keys = new HashSet<int>();
foreach (var kvp in array.Skip(100))
{
Assert.IsTrue(dict.ContainsKey(kvp.Key));
Assert.IsTrue(keys.Add(kvp.Key));
Assert.AreEqual(dict[kvp.Key], kvp.Value);
}
}
示例3: CopyToTest
public void CopyToTest()
{
var tree = new ShieldedTree<int, object>();
ParallelEnumerable.Range(1, 1000).ForAll(
i => Shield.InTransaction(() => tree.Add(i, new object())));
Assert.AreEqual(1000, tree.Count);
var array = new KeyValuePair<int, object>[1100];
((ICollection<KeyValuePair<int, object>>)tree).CopyTo(array, 100);
var expected = 1;
foreach (var kvp in array.Skip(100))
{
Assert.IsTrue(tree.ContainsKey(kvp.Key));
Assert.AreEqual(expected, kvp.Key);
Assert.AreEqual(tree[kvp.Key], kvp.Value);
expected++;
}
}
示例4: 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));
}