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

add() public method

public add ( object key, object val ) : Map
key object
val object
return Map
        public Map add(object key, object val)
        {
            modify();
              if (key == null)
            throw NullErr.make("key is null").val;
              if (!isImmutable(key))
            throw NotImmutableErr.make("key is not immutable: " + @typeof(key)).val;
              if (containsKey(key))
            throw ArgErr.make("Key already mapped: " + key).val;
              m_map[key] = val;
              return this;
        }

Usage Example

Example #1
0
 static void addProp(Map props, string n, string v, bool listVals)
 {
     if (listVals)
     {
         List list = (List)props.get(n);
         if (list == null)
         {
             props.add(n, list = new List(Sys.StrType));
         }
         list.add(v);
     }
     else
     {
         props.add(n, v);
     }
 }
All Usage Examples Of Fan.Sys.Map::add