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

set() public method

public set ( object key, object val ) : Map
key object
val object
return Map
        public Map set(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;
              m_map[key] = val;
              return this;
        }

Usage Example

Example #1
0
        private static Map initVars()
        {
            Map vars = new Map(Sys.StrType, Sys.StrType);

            try
            {
                vars.caseInsensitive(true);

                // predefined
                vars.set("os.name", Environment.OSVersion.Platform.ToString());
                vars.set("os.version", Environment.OSVersion.Version.ToString());

                // environment variables
                IDictionary getenv = Environment.GetEnvironmentVariables();
                foreach (DictionaryEntry de in getenv)
                {
                    string key = (string)de.Key;
                    string val = (string)de.Value;
                    vars.set(key, val);
                }
            }
            catch (Exception e)
            {
                Err.dumpStack(e);
            }
            return((Map)vars.toImmutable());
        }
All Usage Examples Of Fan.Sys.Map::set