05 2013 档案
摘要: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”总之两点,缺一不可哦。
阅读全文