本文整理汇总了C#中Jayrock.Json.JsonObject.CopyTo方法的典型用法代码示例。如果您正苦于以下问题:C# JsonObject.CopyTo方法的具体用法?C# JsonObject.CopyTo怎么用?C# JsonObject.CopyTo使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Jayrock.Json.JsonObject
的用法示例。
在下文中一共展示了JsonObject.CopyTo方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CopyToViaGenericCollection
public void CopyToViaGenericCollection()
{
ICollection<KeyValuePair<string, object>> obj = new JsonObject();
KeyValuePair<string, object> first = new KeyValuePair<string, object>("first", 123);
obj.Add(first);
KeyValuePair<string, object> second = new KeyValuePair<string, object>("second", 456);
obj.Add(second);
KeyValuePair<string, object>[] pairs = new KeyValuePair<string, object>[2];
obj.CopyTo(pairs, 0);
Assert.AreEqual(first, pairs[0]);
Assert.AreEqual(second, pairs[1]);
}
示例2: CannotCopyToViaGenericCollectionWithNullArray
public void CannotCopyToViaGenericCollectionWithNullArray()
{
ICollection<KeyValuePair<string, object>> obj = new JsonObject();
obj.CopyTo(null, 0);
}
示例3: CannotCopyToViaGenericCollectionWithTooSmallArray
public void CannotCopyToViaGenericCollectionWithTooSmallArray()
{
ICollection<KeyValuePair<string, object>> obj = new JsonObject();
obj.Add(new KeyValuePair<string, object>("foo", "bar"));
obj.CopyTo(new KeyValuePair<string, object>[1], 1);
}
示例4: CannotCopyToViaGenericCollectionWithNegativeArrayIndex
public void CannotCopyToViaGenericCollectionWithNegativeArrayIndex()
{
ICollection<KeyValuePair<string, object>> obj = new JsonObject();
obj.CopyTo(new KeyValuePair<string, object>[0], -1);
}