예제 #1
0
 public static FSharpMap <TKey, TValue> WithGuaranteedEntry <TKey, TValue>(this FSharpMap <TKey, TValue> map, TKey key, Func <TValue> toAddIfNotPresent)
 {
     if (map.ContainsKey(key))
     {
         return(map);
     }
     else
     {
         return(map.Add(key, toAddIfNotPresent()));
     }
 }
예제 #2
0
 public bool ContainsKey(TKey key)
 {
     return(innerMap.ContainsKey(key));
 }
        public FSharpMap<string, ProductTypes.Meta> Merge(FSharpMap<string, ProductTypes.Meta> src, MetaData[] update)
        {
            if (src == null) return Convert(update);
            if (update == null) return src;

            foreach (MetaData m in update)
            {
                if(m == null) continue;
                if (src.ContainsKey(m.name))
                {
                    var converted = Merge(src[m.name], m);
                    src = src.Add(converted.key, converted);
                }
                else src = src.Add(m.name, Convert(m));
            }

            return src;
        }