摘要:
http://msdn.microsoft.com/zh-cn/library/system.threading.autoresetevent.aspxhttp://msdn.microsoft.com/en-us/library/system.threading.autoresetevent.aspx很久以前对这段翻译就很不爽了,为啥一直都要把non-signaled的翻译成“非终止状态”,为啥TMD就不可以翻译成“无信号量状态”,把signaled非得叫啥“终止状态”,直接翻成“有信号量的状态”不是更好吗。AutoResetEventallows threads to communicat 阅读全文
摘要:
阅读全文
摘要:
var person={name:'ninja'};person.prototype.sayName=function(){ return this.name;}分析上面这段代码,看看有没有问题?没错,这段代码是有问题的,我们可以通过Chrome看一下执行结果:错误提示说找不到sayName 属性,不是记得说Javascript可以随时新增属性的吗?没错,Javascript确实可以添加属性,但是不是针对对象实例本身的,而是针对其对实例对象所属的类型的对象的。是不是听起来有些别扭,没错,在Javascript的世界里,一切皆是对象,在其所属类型的对象里含有一个prototype 阅读全文
摘要:
NameDescriptionAcquireRequestStateOccurs when ASP.NET acquires the current state (for example, session state) that is associated with the current request.AuthenticateRequestOccurs when a security module has established the identity of the user.AuthorizeRequestOccurs when a security module has verifi 阅读全文
摘要:
关于具体的Http Request 在ASP.NET里处理流程,在博客园里张子阳的博客里已经讲的很清楚了,我这篇文章是基于他的文章的基础上的一个扩展。下图为我两种访问方式,左边为传统的asp.net form page的访问方式,有图为asp.net mvc的访问方式,最后处理的时候都是由Ihttphandler的handler处理的。在Asp.net page中,任何一个页面都已经实现了Ihttphandler,因为Page本身就继承了IhttpHandler,在Mvc里,我们以来与MvcRouteHanlder,来返回MvcHandler,最后在MvcHandler里的ProcessReq 阅读全文
摘要:
The only weird part here is getting a handle to the logger. I’m using an IoC container in my application, however I can’t tell IIS how to build up my RequestDurationLoggerModule, so I’m stuck using the Service Locator pattern. The container could be a singleton, but I don’t like singletons, so I imp 阅读全文
摘要:
class Program { static void Main() { List<MyClass> result = new List<MyClass>(); result.Add(new MyClass() { DisplayName = "新余", Key = 3, Owner = 1 }); result.Add(new MyClass() { DisplayName = "宜春", Key = 4, Owner = 1 }); result.Add(new M... 阅读全文
摘要:
protected void Application_Start() { AreaRegistration.RegisterAllAreas(); ValueProviderFactories.Factories.Insert(0, new CustomValueProviderFactory()); ModelBinders.Binders.Add(typeof(AddressSummary), new AddressSummaryBinder()); WebApiConfig.Regis... 阅读全文
摘要:
Custom Route HandlerRouteHandler是连接Route System和MVC的桥梁。RounteHandler:IRouteHandler;GetHttpHandler 阅读全文
摘要:
1.Generating Outgoing URLs in Views Rules: routes.MapRoute("MyRoute", "{controller}/{action}/{id}", new { controller = "Home", action = "Index", id = UrlParameter.Optional }); } View: <div> @Html.ActionLink("This is an outgoing URL", "Cust 阅读全文
摘要:
1.所有的Routing 规则都存在RoutTable.Routes这个全局的Collection当中 RouteConfig.RegisterRoutes(RouteTable.Routes);2.下面是具体的方法,将所有的Routing规则注册到全局变量里。 public static void RegisterRoutes(RouteCollection routes) { Route myRoute = new Route("{controller}/{action}", new MvcRouteHandler()); routes.... 阅读全文
摘要:
using System;using System.Collections.Generic;using System.Linq;namespace TreeNodes{public interface INodeInfomation{string DisplayName { get; set; }string Path { get; set; }}class HierarchyObject<T> where T : INodeInfomation{public HierarchyObject(){Id = Guid.NewGuid();Children = new List< 阅读全文
摘要:
From:http://karmian.org/net-tips-tricks-examples-articles/enum-description-typeconverterusing System;using System.ComponentModel;using System.Globalization;namespace Karmian.Core.TypeConverters{ public class EnumDescriptionTypeConverter : EnumConverter { public EnumDescriptionTypeConverter(Type... 阅读全文
摘要:
public class TreeNode<T> { public TreeNode() { Children = new List<TreeNode<T>>(); } public void AddChild(TreeNode<T> item) { item.Parent = this; Children.Add(item); } public List<TreeNode<T>> Children { get; set; } public TreeNode... 阅读全文
摘要:
码农们在debug代码的时候,经常会希望在断点进行时对代码立即进行修改,而且修改完之后希望能够马上看到效果,否则的话,就得推倒重来,在进行大项目开发的时候,编译一次的成本也是非常之高的。这里说一下两个步骤的设置,可以解决这个问题:1.在visual studio的Tools->options->Debugging->Edit and Continue下,在向导中勾选 “Enable Edit and Continue”2.在你要调试的项目中,选择“项目“,右键菜单属性->Web->“Enable Edit and Continue”总之两点,缺一不可哦。 阅读全文