本文整理汇总了C#中JObject.Contains方法的典型用法代码示例。如果您正苦于以下问题:C# JObject.Contains方法的具体用法?C# JObject.Contains怎么用?C# JObject.Contains使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JObject
的用法示例。
在下文中一共展示了JObject.Contains方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: IListRemove
public void IListRemove()
{
JProperty p1 = new JProperty("Test1", 1);
JProperty p2 = new JProperty("Test2", "Two");
IList l = new JObject(p1, p2);
JProperty p3 = new JProperty("Test3", "III");
// won't do anything
l.Remove(p3);
Assert.Equal(2, l.Count);
l.Remove(p1);
Assert.Equal(1, l.Count);
Assert.False(l.Contains(p1));
Assert.True(l.Contains(p2));
l.Remove(p2);
Assert.Equal(0, l.Count);
Assert.False(l.Contains(p2));
Assert.Equal(null, p2.Parent);
}
示例2: GenericListJTokenContains
public void GenericListJTokenContains()
{
JProperty p = new JProperty("Test", 1);
IList<JToken> l = new JObject(p);
Assert.True(l.Contains(p));
Assert.False(l.Contains(new JProperty("Test", 1)));
}
示例3: IListContains
public void IListContains()
{
JProperty p = new JProperty("Test", 1);
IList l = new JObject(p);
Assert.True(l.Contains(p));
Assert.False(l.Contains(new JProperty("Test", 1)));
}
示例4: GenericListJTokenRemove
public void GenericListJTokenRemove()
{
JProperty p1 = new JProperty("Test1", 1);
JProperty p2 = new JProperty("Test2", "Two");
IList<JToken> l = new JObject(p1, p2);
JProperty p3 = new JProperty("Test3", "III");
// won't do anything
Assert.IsFalse(l.Remove(p3));
Assert.AreEqual(2, l.Count);
Assert.IsTrue(l.Remove(p1));
Assert.AreEqual(1, l.Count);
Assert.IsFalse(l.Contains(p1));
Assert.IsTrue(l.Contains(p2));
Assert.IsTrue(l.Remove(p2));
Assert.AreEqual(0, l.Count);
Assert.IsFalse(l.Contains(p2));
Assert.AreEqual(null, p2.Parent);
}