C# 自动计算字符串公式的值(三种方式)

http://www.csframework.com/archive/2/arc-2-20110426-1394.htm

 提供数据的WebForm2.aspx

 

 

 

[csharp] view plain copy
 
  1. public partial class WebForm2 : System.Web.UI.Page  
  2.     {  
  3.         protected void Page_Load(object sender, EventArgs e)  
  4.         {  
  5.             string callback = Request.QueryString["jsoncallback"];  
  6.             string data = "{\"title\": \"Recent Uploads tagged cat\",\"link\": \"http://www.sina.com.cn\",\"items\": [{\"title\": \"Russell 003\",\"color\": \"red\"},{\"title\": \"Cat [07.04.11]\",\"color\": \"yellow\"}]}";  
  7.             string result = string.Format("{0}({1})", callback, data);  
  8.             Response.Expires = -1;  
  9.             Response.Clear();  
  10.             Response.ContentEncoding = Encoding.UTF8;  
  11.             Response.ContentType = "application/json";  
  12.             Response.Write(result);  
  13.             Response.Flush();  
  14.             Response.End();  
  15.         }  
  16.     }  
posted @ 2016-02-24 16:29  monica_guorong  阅读(466)  评论(0编辑  收藏  举报