本文整理汇总了C#中Container.addUserData方法的典型用法代码示例。如果您正苦于以下问题:C# Container.addUserData方法的具体用法?C# Container.addUserData怎么用?C# Container.addUserData使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Container
的用法示例。
在下文中一共展示了Container.addUserData方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: testDerivedClasses2
public void testDerivedClasses2() {
var c = new Container();
var obj = new Object();
var str = "abc";
c.addUserData(str);
c.addUserData(obj);
Assert.assertEquals(str, c.getUserData(typeof(Object)));
Assert.assertEquals("abc", c.getUserData(typeof(String)));
}
示例2: testArrays2
public void testArrays2() {
var c = new Container();
var obj = new Object();
var str = "abc";
var arr = new Object[] { "a", "b", "c" };
c.addUserData(arr);
c.addUserData(obj);
c.addUserData(str);
Assert.assertEquals(arr, c.getUserData(typeof(Object)));
Assert.assertEquals("abc", c.getUserData(typeof(String)));
Assert.assertEquals((Object)arr, c.getUserData(typeof(Object[])));
}
示例3: testObject
public void testObject() {
var c = new Container();
var obj = new Object();
c.addUserData(obj);
Assert.assertEquals(obj, c.getUserData(typeof(Object)));
}
示例4: testGetAllUserData
public void testGetAllUserData() {
var c = new Container();
var strs = new String[] { "str1", "str2", "str3", "str4" };
foreach (var s in strs) {
c.addUserData(s);
}
Assert.assertTrue(c.getAllUserData(typeof(String)).sequenceEqual(Query.asIterable(strs)));
}