当前位置: 首页>>代码示例>>C#>>正文


C# Hashtable4.Get方法代码示例

本文整理汇总了C#中Db4objects.Db4o.Foundation.Hashtable4.Get方法的典型用法代码示例。如果您正苦于以下问题:C# Hashtable4.Get方法的具体用法?C# Hashtable4.Get怎么用?C# Hashtable4.Get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Db4objects.Db4o.Foundation.Hashtable4的用法示例。


在下文中一共展示了Hashtable4.Get方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: TestByteArrayKeys

 public virtual void TestByteArrayKeys()
 {
     byte[] key1 = {1, 2, 3};
     byte[] key2 = {3, 2, 1};
     byte[] key3 = {3, 2, 1};
     // same values as key2
     var table = new Hashtable4(2);
     table.Put(key1, "foo");
     table.Put(key2, "bar");
     Assert.AreEqual("foo", table.Get(key1));
     Assert.AreEqual("bar", table.Get(key2));
     Assert.AreEqual(2, CountKeys(table));
     Assert.AreEqual(2, table.Size());
     table.Put(key3, "baz");
     Assert.AreEqual("foo", table.Get(key1));
     Assert.AreEqual("baz", table.Get(key2));
     Assert.AreEqual(2, CountKeys(table));
     Assert.AreEqual(2, table.Size());
     Assert.AreEqual("baz", table.Remove(key2));
     Assert.AreEqual(1, CountKeys(table));
     Assert.AreEqual(1, table.Size());
     Assert.AreEqual("foo", table.Remove(key1));
     Assert.AreEqual(0, CountKeys(table));
     Assert.AreEqual(0, table.Size());
 }
开发者ID:masroore,项目名称:db4o,代码行数:25,代码来源:Hashtable4TestCase.cs

示例2: AssertItemsCanBeRetrievedByUUID

		protected virtual void AssertItemsCanBeRetrievedByUUID(Hashtable4 uuidCache)
		{
			IQuery q = NewItemQuery();
			IObjectSet objectSet = q.Execute();
			while (objectSet.HasNext())
			{
				UUIDTestCase.Item item = (UUIDTestCase.Item)objectSet.Next();
				Db4oUUID uuid = Uuid(item);
				Assert.IsNotNull(uuid);
				Assert.AreSame(item, Db().GetByUUID(uuid));
				Db4oUUID cached = (Db4oUUID)uuidCache.Get(item.name);
				if (cached != null)
				{
					Assert.AreEqual(cached, uuid);
				}
				else
				{
					uuidCache.Put(item.name, uuid);
				}
			}
		}
开发者ID:Galigator,项目名称:db4o,代码行数:21,代码来源:UUIDTestCase.cs

示例3: TestDifferentKeysSameHashCode

 public virtual void TestDifferentKeysSameHashCode()
 {
     var key1 = new Key(1);
     var key2 = new Key(1);
     var key3 = new Key(2);
     var table = new Hashtable4(2);
     table.Put(key1, "foo");
     table.Put(key2, "bar");
     Assert.AreEqual("foo", table.Get(key1));
     Assert.AreEqual("bar", table.Get(key2));
     Assert.AreEqual(2, CountKeys(table));
     table.Put(key2, "baz");
     Assert.AreEqual("foo", table.Get(key1));
     Assert.AreEqual("baz", table.Get(key2));
     Assert.AreEqual(2, CountKeys(table));
     table.Put(key1, "spam");
     Assert.AreEqual("spam", table.Get(key1));
     Assert.AreEqual("baz", table.Get(key2));
     Assert.AreEqual(2, CountKeys(table));
     table.Put(key3, "eggs");
     Assert.AreEqual("spam", table.Get(key1));
     Assert.AreEqual("baz", table.Get(key2));
     Assert.AreEqual("eggs", table.Get(key3));
     Assert.AreEqual(3, CountKeys(table));
     table.Put(key2, "mice");
     Assert.AreEqual("spam", table.Get(key1));
     Assert.AreEqual("mice", table.Get(key2));
     Assert.AreEqual("eggs", table.Get(key3));
     Assert.AreEqual(3, CountKeys(table));
 }
开发者ID:masroore,项目名称:db4o,代码行数:30,代码来源:Hashtable4TestCase.cs

示例4: TestSameKeyTwice

 public virtual void TestSameKeyTwice()
 {
     var key = 1;
     var table = new Hashtable4();
     table.Put(key, "foo");
     table.Put(key, "bar");
     Assert.AreEqual("bar", table.Get(key));
     Assert.AreEqual(1, CountKeys(table));
 }
开发者ID:masroore,项目名称:db4o,代码行数:9,代码来源:Hashtable4TestCase.cs


注:本文中的Db4objects.Db4o.Foundation.Hashtable4.Get方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。