本文整理汇总了C#中PropertyCollection.RemoveProperty方法的典型用法代码示例。如果您正苦于以下问题:C# PropertyCollection.RemoveProperty方法的具体用法?C# PropertyCollection.RemoveProperty怎么用?C# PropertyCollection.RemoveProperty使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PropertyCollection
的用法示例。
在下文中一共展示了PropertyCollection.RemoveProperty方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TestRemove
static void TestRemove(ref PropertyCollection collection, int count)
{
for (int i = 0; i < count; i++)
{
collection.RemoveProperty(i);
Assert.AreEqual(collection.GetProperty(i), null);
}
}
示例2: PropertyCollectionTest
public void PropertyCollectionTest()
{
var collection = new PropertyCollection();
for (int pass = 1; pass < 100; pass++)
{
collection.ClearProperties();
Assert.AreEqual(collection.Count, 0);
int count = pass * 2;
TestAdd(ref collection, count);
Assert.AreEqual(collection.Count, count);
TestRemove(ref collection, count);
Assert.AreEqual(collection.Count, 0);
TestAdd(ref collection, count);
Assert.AreEqual(collection.Count, count);
// delete every second property
for (int i = 0; i < count; i+=2)
{
collection.RemoveProperty(i);
Assert.AreEqual(collection.GetProperty(i), null);
}
Assert.AreEqual(collection.Count, count / 2);
// test property replacement
for (int i = 1; i < count; i += 2)
{
collection.SetProperty(i, i * 2);
Assert.AreEqual(collection.GetProperty(i), i * 2);
}
Assert.AreEqual(collection.Count, count / 2);
}
}