Beispiel #1
0
        public override void Add(string aKey, JSONNode aItem)
        {
            if (aItem == null)
            {
                aItem = new JSONNull();
            }

            if (!string.IsNullOrEmpty(aKey))
            {
                if (m_Dict.ContainsKey(aKey))
                {
                    m_Dict[aKey] = aItem;
                }
                else
                {
                    m_Dict.Add(aKey, aItem);
                }
            }
            else
            {
                m_Dict.Add(Guid.NewGuid().ToString(), aItem);
            }
        }
Beispiel #2
0
 public override JSONNode this[int aIndex]
 {
     get
     {
         if (aIndex < 0 || aIndex >= m_Dict.Count)
         {
             return(null);
         }
         return(m_Dict.ElementAt(aIndex).Value);
     }
     set
     {
         if (value == null)
         {
             value = new JSONNull();
         }
         if (aIndex < 0 || aIndex >= m_Dict.Count)
         {
             return;
         }
         string key = m_Dict.ElementAt(aIndex).Key;
         m_Dict[key] = value;
     }
 }