soundvision/UnityProject/Assets/ThridParty/KinectScript/CollectionMap.cs

27 lines
598 B
C#
Raw Normal View History

2019-06-30 12:46:10 +00:00
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;
}
}
}
}
}