2
0
mirror of https://github.com/esiur/esiur-dotnet.git synced 2025-06-27 05:23:13 +00:00
This commit is contained in:
2024-06-21 16:37:48 +03:00
parent c04fc29810
commit 3a89a108db
49 changed files with 2095 additions and 1373 deletions

View File

@ -63,15 +63,22 @@ public interface IMap
public class Map<KT, VT> : IEnumerable<KeyValuePair<KT, VT>>, IMap
{
//public struct StructureMetadata
//{
// public KT[] Keys;
// public VT[] Types;
//}
private Dictionary<KT, VT> dic = new Dictionary<KT, VT>();// StringComparer.OrdinalIgnoreCase);
private Dictionary<KT, VT> dic = new Dictionary<KT, VT>();
private object syncRoot = new object();
// Change map types
public Map<NewKeyType, NewValueType> Select<NewKeyType, NewValueType>
(Func<KeyValuePair<KT, VT>, KeyValuePair<NewKeyType, NewValueType>> selector)
{
var rt = new Map<NewKeyType, NewValueType>();
foreach(var kv in dic)
{
var nt = selector(kv);
rt.dic.Add(nt.Key, nt.Value);
}
return rt;
}
public bool ContainsKey(KT key)
{