示例#1
0
 public override JToken this[int index] {
     get {
         if (index < 0 || index >= _list.Count)
         {
             throw new JIndexOutOfRangeException(this, index);
         }
         else
         {
             return(_list[index]);
         }
     }
     set {
         if (index < 0 || index >= _list.Count)
         {
             throw new JIndexOutOfRangeException(this, index);
         }
         else
         {
             if (value == null)
             {
                 value = new JNull();
             }
             _list[index] = value;
         }
     }
 }
示例#2
0
        public override JToken this[string name]
        {
            get
            {
                JToken token;
                _dict.TryGetValue(name, out token);
                if (token == null)
                {
                    token = new JNone(name);
                }
                return(token);
            }
            set
            {
                if (value == null)
                {
                    value = new JNull();
                }

                if (_dict.ContainsKey(name))
                {
                    _dict[name] = value;
                }
                else
                {
                    _dict.Add(name, value);
                }
                value.Name = name;
            }
        }
示例#3
0
 public void Insert(int index, JToken item)
 {
     if (item == null)
     {
         item = new JNull();
     }
     _list.Insert(index, item);
 }
示例#4
0
 public void Add(JToken item)
 {
     if (item == null)
     {
         item = new JNull();
     }
     _list.Add(item);
 }
示例#5
0
        public override bool Equals(object obj)
        {
            JNull other = obj as JNull;

            if (other == null)
            {
                return(false);
            }

            return(true);
        }