예제 #1
0
 public JToken Serialize()
 {
     JContainer obj = new JObject().Set("col1", Tag + ": " + Title);
     if (Id != 0)
     {
         obj.Set("id", (int)Id);
     }
     return obj;
 }
        public void Set()
        {
            JObject value = null;
            value.Set("silent", "fail");

            value = new JObject();
            
            value.Set("b", true);
            Assert.AreEqual(true, value.Get("b").AsBool());

            value.Set("c", 12);
            Assert.AreEqual(12, value.Get("c").AsInteger());

            value.Set("d", 12.2);
            Assert.AreEqual(12.2, value.Get("d").AsNumber());
            Assert.AreEqual(12, value.Get("d").AsInteger());

            value.Set("e", "abc");
            Assert.AreEqual("abc", value.Get("e").AsString());

            value.Set("f", new JObject());
            Assert.IsNotNull(value.Get("f"));
        }