Esempio n. 1
0
        public static T ReadJson <T>(this string json, bool useConstructor)
        {
            TkDebug.AssertArgumentNullOrEmpty(json, "json", null);

            ToolkitXmlObject <T> obj = new ToolkitXmlObject <T>()
            {
                UseConstructor = useConstructor
            };
            string newJson = string.Format(ObjectUtil.SysCulture, "{{\"Toolkit\":{0}}}", json);

            ReadJson(obj, newJson);
            return(obj.Data);
        }
Esempio n. 2
0
        public static T ReadXml <T>(this string xml, bool useConstructor)
        {
            TkDebug.AssertArgumentNullOrEmpty(xml, "xml", null);

            ToolkitXmlObject <T> obj = new ToolkitXmlObject <T>()
            {
                UseConstructor = useConstructor
            };
            string newXml = string.Format(ObjectUtil.SysCulture,
                                          "<tk:Toolkit xmlns:tk='http://www.qdocuments.net'>{0}</tk:Toolkit>", xml);

            ReadXml(obj, newXml);
            return(obj.Data);
        }