soundvision/CylVision/Assets/ThridParty/KinectScript/CollectionMap.cs
2019-06-30 14:46:11 +02:00

26 lines
598 B
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Helper
{
class CollectionMap<TKey, TValue> : Helper.ThreadSafeDictionary<TKey, TValue> where TValue : new()
{
public bool TryAddDefault(TKey key)
{
lock (_impl)
{
if (!_impl.ContainsKey(key))
{
_impl.Add(key, new TValue());
return true;
}
else
{
return false;
}
}
}
}
}