/// <summary> /// This add can be used in initialzier /// </summary> /// <param name="elem"></param> internal void Add(JMbr elem) { int len = elements.Length; if (count >= len) { JMbr[] alloc = new JMbr[len * 4]; Array.Copy(elements, 0, alloc, 0, len); elements = alloc; } elements[count++] = elem; }
public void Write <C>(C cnt) where C : IContent, ISink { for (int i = 0; i < count; i++) { JMbr e = elements[i]; JType t = e.type; if (t == JType.Array) { cnt.Put(null, (JArr)e); } else if (t == JType.Object) { cnt.Put(null, (JObj)e); } else if (t == JType.String) { cnt.Put(null, (string)e); } else if (t == JType.Number) { cnt.Put(null, (JNumber)e); } else if (t == JType.True) { cnt.Put(null, true); } else if (t == JType.False) { cnt.Put(null, false); } else if (t == JType.Null) { cnt.PutNull(null); } } }