Ejemplo n.º 1
0
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/plain";
            if (context.Request["ID"] == "a")
            {
                countryModel cm1 = new countryModel()
                {
                    ID = "0", NAME = "中国"
                };
                countryModel cm2 = new countryModel()
                {
                    ID = "1", NAME = "美国"
                };

                List <countryModel> cmlist = new List <countryModel>();
                cmlist.Add(cm1);
                cmlist.Add(cm2);

                List <IcountryModel> aa = null;

                aa = cmlist.ConvertAll(x => (IcountryModel)x);

                JavaScriptSerializer jss = new JavaScriptSerializer();
                string str = jss.Serialize(aa);
                context.Response.Write(str);
            }
        }
Ejemplo n.º 2
0
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/plain";
            if (context.Request["ID"] == "a")
            {
                countryModel cm1 = new countryModel() { ID = "0", NAME = "中国" };
                countryModel cm2 = new countryModel() { ID = "1", NAME = "美国" };

                List<countryModel> cmlist = new List<countryModel>();
                cmlist.Add(cm1);
                cmlist.Add(cm2);

                List<IcountryModel> aa = null;

                aa = cmlist.ConvertAll(x => (IcountryModel)x); 
               
                 JavaScriptSerializer jss = new JavaScriptSerializer();
                string str = jss.Serialize(aa);
                context.Response.Write(str);
            }
        }