本文整理汇总了C#中Db4objects.Db4o.Foundation.Hashtable4.Put方法的典型用法代码示例。如果您正苦于以下问题:C# Hashtable4.Put方法的具体用法?C# Hashtable4.Put怎么用?C# Hashtable4.Put使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Db4objects.Db4o.Foundation.Hashtable4
的用法示例。
在下文中一共展示了Hashtable4.Put方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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());
}
示例2: TestToString
public virtual void TestToString()
{
var table = new Hashtable4();
table.Put("foo", "bar");
table.Put("bar", "baz");
Assert.AreEqual(Iterators.Join(table.Iterator(), "{", "}", ", "), table.ToString(
));
}
示例3: TestContainsKey
public virtual void TestContainsKey()
{
var table = new Hashtable4();
Assert.IsFalse(table.ContainsKey(null));
Assert.IsFalse(table.ContainsKey("foo"));
table.Put("foo", null);
Assert.IsTrue(table.ContainsKey("foo"));
table.Put("bar", "baz");
Assert.IsTrue(table.ContainsKey("bar"));
Assert.IsFalse(table.ContainsKey("baz"));
Assert.IsTrue(table.ContainsKey("foo"));
table.Remove("foo");
Assert.IsTrue(table.ContainsKey("bar"));
Assert.IsFalse(table.ContainsKey("foo"));
}
示例4: ClientTransactionPool
public ClientTransactionPool(LocalObjectContainer mainContainer)
{
// Transaction -> ContainerCount
// String -> ContainerCount
ClientTransactionPool.ContainerCount mainEntry = new ClientTransactionPool.ContainerCount
(mainContainer, 1);
_transaction2Container = new Hashtable4();
_fileName2Container = new Hashtable4();
_fileName2Container.Put(mainContainer.FileName(), mainEntry);
_mainContainer = mainContainer;
}
示例5: TestClear
public virtual void TestClear()
{
var table = new Hashtable4();
for (var i = 0; i < 2; ++i)
{
table.Clear();
Assert.AreEqual(0, table.Size());
table.Put("foo", "bar");
Assert.AreEqual(1, table.Size());
AssertIterator(table, new object[] {"foo"});
}
}
示例6: Test
public virtual void Test()
{
Hashtable4 ht = new Hashtable4();
ObjectContainerBase container = Container();
container.ShowInternalClasses(true);
IQuery q = Db().Query();
q.Constrain(typeof(Db4oDatabase));
IObjectSet objectSet = q.Execute();
while (objectSet.HasNext())
{
Db4oDatabase identity = (Db4oDatabase)objectSet.Next();
Assert.IsFalse(ht.ContainsKey(identity.i_signature));
ht.Put(identity.i_signature, string.Empty);
}
container.ShowInternalClasses(false);
}
示例7: InitPrimitive2Wrapper
private static void InitPrimitive2Wrapper()
{
_primitive2Wrapper = new Hashtable4();
foreach (Type type in PRIMITIVE_TYPES)
{
_primitive2Wrapper.Put(type, ConcreteNullableTypeFor(type));
}
}
示例8: InitNullValues
private static void InitNullValues()
{
_nullValues = new Hashtable4();
_nullValues.Put(typeof(int), 0);
_nullValues.Put(typeof(uint), (uint)0);
_nullValues.Put(typeof(byte), (byte)0);
_nullValues.Put(typeof(short), (short)0);
_nullValues.Put(typeof(float), (float)0);
_nullValues.Put(typeof(double), (double)0);
_nullValues.Put(typeof(ulong), (ulong)0);
_nullValues.Put(typeof(long), (long)0);
_nullValues.Put(typeof(bool), false);
_nullValues.Put(typeof(char), (char)0);
_nullValues.Put(typeof(sbyte), (sbyte)0);
_nullValues.Put(typeof(decimal), (decimal)0);
_nullValues.Put(typeof(ushort), (ushort)0);
_nullValues.Put(typeof(DateTime), DateTime.MinValue);
}
示例9: IntegerConverterforClassName
private static Prototypes.IntegerConverter IntegerConverterforClassName(IReflector
reflector, string className)
{
if (_integerConverters == null)
{
_integerConverters = new Hashtable4();
Prototypes.IntegerConverter[] converters = new Prototypes.IntegerConverter[] { new
_IntegerConverter_211(), new _IntegerConverter_215(), new _IntegerConverter_219(
), new _IntegerConverter_223(), new _IntegerConverter_227(), new _IntegerConverter_231
(), new _IntegerConverter_235(), new _IntegerConverter_239() };
for (int converterIndex = 0; converterIndex < converters.Length; ++converterIndex)
{
Prototypes.IntegerConverter converter = converters[converterIndex];
_integerConverters.Put(converter.PrimitiveName(), converter);
if (!converter.PrimitiveName().Equals(converter.WrapperName(reflector)))
{
_integerConverters.Put(converter.WrapperName(reflector), converter);
}
}
}
return (Prototypes.IntegerConverter)_integerConverters.Get(className);
}
示例10: 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);
}
}
}
示例11: TableFromKeys
private Hashtable4 TableFromKeys(object[] keys)
{
var ht = new Hashtable4();
for (var i = 0; i < keys.Length; i++)
{
ht.Put(keys[i], keys[i]);
}
return ht;
}
示例12: 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));
}
示例13: 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));
}