Fan.Sys.Map.map C# (CSharp) Method

map() public method

public map ( Func f ) : Map
f Func
return Map
        public Map map(Func f)
        {
            Type r = f.returns();
              if (r == Sys.VoidType) r = Sys.ObjType.toNullable();
              Map acc = new Map(m_type.m_k, r);
              if (this.ordered()) acc.ordered(true);
              if (this.caseInsensitive()) acc.caseInsensitive(true);
              IDictionaryEnumerator en = m_map.GetEnumerator();
              while (en.MoveNext())
              {
            object key = en.Key;
            object val = en.Value;
            acc.set(key, f.call(val, key));
              }
              return acc;
        }