摘要: 由于最近较忙,上一篇的坑估计要慢慢填了。感觉写文章介绍要比写程序还累啊。先看看测试程序,能够了解api支持哪些功能:static void Main(string[] args){ //wrapper对象 dynamic data = DJson.Wrap(new { name = "Jane", male = false, age = 24, dob = DateTime.Now, friend = new { name = "Jesse", male = true, age = 32, dob = DateTime.Now }, mobile = n 阅读全文
posted @ 2011-02-27 18:39 dragonpig 阅读(496) 评论(0) 推荐(0) 编辑
摘要: 参考 http://www.yoda.arachsys.com/csharp/singleton.html双lock的singleton性能非常差,这里推荐inner class的方式,并且加上泛型。public class Singleton<T> where T : new(){ public static T Instance { get { return Nested.instance; } } private class Nested { //suppress optimization in .net v1.1 static Nested() { } internal s 阅读全文
posted @ 2011-02-27 18:25 dragonpig 阅读(484) 评论(0) 推荐(0) 编辑
摘要: 通过jQuery.get是不能异步访问跨域资源的。主要是因为安全考虑,否则其他域有可能获得当前页的cookie造成隐私泄漏。但js确可以跨域访问,因为所有浏览器都支持refer外部的js文件。访问外部域的js时会发送外部域的cookie,这样在返回的js中就能获取值了。创建两个website,分别叫local.domain1.com和local.domain2.comdomain1中负责set和get本域的cookie,分别为setcookie.aspx和getcookie.aspx//setcookie.aspxpublic partial class SetCookie : System. 阅读全文
posted @ 2011-02-27 18:04 dragonpig 阅读(2179) 评论(0) 推荐(0) 编辑
摘要: 在WCF Service Application中加入<enableWebScript><system.serviceModel> <behaviors> <endpointBehaviors> <behavior name="ajaxbehavior"> <enableWebScript /> </behavior> </endpointBehaviors> </behaviors> <services> <service name="J 阅读全文
posted @ 2011-02-27 00:06 dragonpig 阅读(478) 评论(0) 推荐(0) 编辑