コード例 #1
0
        public static string getXmlByObjectList <T>(List <T> list)
        {
            InnerClass <T> ic = new InnerClass <T>();

            ic.list = list;
            if (ic.list.Count == 0)
            {
                return("");
            }
            return(ic.ToXml());
        }
コード例 #2
0
        public static List <T> getObjectListByXml <T>(string strXml)
        {
            InnerClass <T> innerObj = new InnerClass <T>();

            List <T> ret = new List <T>();

            if (strXml == null || strXml.Trim().Length == 0)
            {
                return(ret);
            }
            //(T)Convert.ChangeType(
            innerObj = (InnerClass <T>)GetObjectByXml(strXml, innerObj.GetType());
            if (ret == null)
            {
                return(null);
            }
            ret = innerObj.list;
            ////}
            ////catch(Exception e)
            ////{
            ////    return null;
            ////}
            return(ret);
        }