- 博客(84)
- 资源 (37)
- 收藏
- 关注
翻译 创建自定义路由约束(C#)
这篇教程要演示如何创建自定义路由约束。自定义路由约束能够使路由只有达到某些自定义条件时才会匹配。在这篇教程里,我们创建一个 Localhost 路由约束。 它只匹配从本地计算机发出的请求。通过Internet发送的远程请求不被匹配。要实现自定义路由约束就要实现 IRouteConstraint 接口。这个接口极其简单,就描述了一个简单方法: bool Match( HttpContex
2010-02-07 12:59:00 2900
翻译 创建路由约束(C#)
使用路由约束来限制匹配特定路由的浏览器请求。可以使用正则表达式来指定约束。例如,假设你在代码1的Global.asax文件中已经定义了如下路由。代码1 – Global.asax.csroutes.MapRoute( "Product", "Product/{productId}", new {controller="Product", action="Details"} );
2010-02-07 12:34:00 2688
翻译 ASP.NET MVC Routing概览(C#)
在这篇教程里,将向你介绍每个ASP.NET MVC程序都有的重要特性,叫做 ASP.NET Routing。 ASP.NET Routing 模块负责将传入的浏览器请求映射到特定的MVC控制器actions。教程最后,你会理解标准路由表是如何将请求映射到控制器action的。使用默认路由表新建 ASP.NET MVC 程序,它已经配置好使用 ASP.NET Routing了。 ASP.NE
2010-02-06 14:57:00 2966
翻译 理解模型,视图和控制器(C#)
这篇教程向你提供ASP.NET MVC 模型,视图和控制的高度概览。换句话说,解释一下ASP.NET MVC中的 ‘M’, ‘V’, 和 ‘C’。看完这篇教程以后,你应该就能理解ASP.NET MVC的不同部分是如何共同工作的。而且你也应该能够理解ASP.NET MVC程序的架构与ASP.NET Web窗体程序或ASP程序有如何的不同。示例 ASP.NET MVC 应用程序用以创建AS
2010-02-05 18:53:00 2936
翻译 理解ASP.NET MVC执行过程
向基于ASP.NET MVC的Web程序发送请求首先传递一个 UrlRoutingModule 对象,这是一个HTTP模块。这个模块解析请求并执行路由选择。 UrlRoutingModule 对象选择第一个匹配当前请求的路由对象。(路由对象是实现 RouteBase 的类,而且通常是 Route 类的一个实例。) 如果没有任何路由匹配, UrlRoutingModule 对象就啥都不做,让请求回到
2010-02-05 18:04:00 5404 1
翻译 ASP.NET MVC概览(C#)
Model-View-Controller (MVC) 架构模式将一个应用程序分为三个组成部分:模型,视图与控制器。ASP.NET MVC框架为创建基于MVC的Web应用程序提供了一种替代方案。ASP.NET MVC框架是一个轻量级的,可高度测试的展示框架(基于Web窗体的应用程序),它继承了现有的ASP.NET特性,比如母版页和成员资格权限。 MVC框架定义在 System.Web.Mvc 命名
2010-02-04 18:08:00 3235 1
翻译 使用ASP.NET MVC(C#)15分钟内创建一个电影数据库程序
这篇教程的目的是让你体会一下创建一个 ASP.NET MVC 程序是一种什么样的感觉。在这篇教程里,我通过从头到尾地创建一整个ASP.NET MVC程序来进行说明。我会教你如何创建一个简单的数据库驱动程序,此程序会演示你如何以列表显示、新建和编辑数据库记录。 为了简化我们创建程序的过程,我们将利用Visual Studio 2008的“脚手架”特性。我们让Visual Studi
2010-02-02 18:23:00 10221 4
原创 C#基础谈(四)---- 解读"Hello World"
这半年来由于工作等的诸多原因,所以一直没有再继续此基础教程,现在难得有时间了,继续~~原文再续,书接上一回。上次我们已经创建了第一个C#应用程序,并已跑起来了,现在我们来详细解读这段代码。首先先来看看最左边的行号数字,你可能会奇怪,为什么自己的vs代码编辑区域没有显示行号呢?因为vs默认是不会显示行号的,要显示的话,需要自己设置一下,具体步骤如下:点击vs顶头
2009-11-21 00:04:00 1889 5
原创 C#基础谈(三)---- 从"Hello World"说起
接着上一讲,我们新建了一个名为"CSharpBasic"的控制台工程,首先看一下VS中的代码编辑区域,默认打开的是Program.cs这个文件,VS为我们自动添加的代码如下(由于我是用VS2008新建的,所以引入的命名空间与VS2005有所不同):using System;using System.Collections.Generic;using System.Linq;
2009-05-17 20:09:00 2688 1
原创 C#基础谈(二)---- 创建第一个C#程序
既然知道了C#是一个语言,那么我们就把这个语言慢慢学好吧,很多参考书,包括MSDN的第一个例子都是"Hello World",那我们也遵照国际惯例吧。 首先创建你的第一个应用程序,C#是语言,不是工具,所以,要用C#开发程序,我们要使用支持C#语言的开发工具,现在市面上有很多的C#语言开发工具,之前我说了,我是微软的忠实用户,而且C#就是微软开发的,那我们自然是用微软的Vi
2009-04-30 15:44:00 1704
原创 C#基础谈(一)---- 认识C#
一直想写一些关于C#的文章,尤其是在社区混得越久这种想法越强烈,今天终于下定决心“提笔”,全部的文字均基于本人对C#学习的心得体会,所有例子均直接取材于CSDN,希望转载时加以注明,目标:让大家都学好C# 好,言归正传,开始进入正题,什么是C#?先看一下MSDN的定义:Microsoft Visual C# 2005(读作 C sharp)是一种编程语言,它是为生
2009-04-29 20:50:00 1958
原创 C#实现启用或停用本地网络连接
今天在社区帮别人回答的一个问题,其实之前我也没弄过,今天自己在网上找了些别人的资料,自己改了一下,也是可以实现的。首先添加Microsoft Shell Control And Automation引用,如果你不知道怎么添加Microsoft Shell Control And Automation引用,请参考一下步骤: 在你的解决方案资源管理器的bin上右键->选择添加引用->选择->CO
2009-02-28 17:55:00 4073 7
原创 反射生成数组
两个月前写了一篇《对泛型进行反射》的文章,没什么人看,小伤心一下:(今天在论坛有人问怎样反射生成数组,突然又来了兴致,决定试试其实反射数组最难无非就是数组的初始化和数组的索引了,那么,如何初始化一个数组呢,数组是没有构造函数的,那么用InvokeMember(null, BindingFlags.DeclaredOnly |BindingFlags.Public | BindingFlags.No
2008-11-11 16:46:00 3360 6
原创 自制的一个输入验证控件
今天用正则表达式时突然来了兴致,想自己做一个验证用户输入的用户控件,经过几个小时的努力,终于完成了,内置了包括整数,正整数,负整数,数字,电话或手机,正数,负数,浮点数, 正浮点数,负浮点数,浮点数2,非负浮点数, 非正浮点数, 邮件,颜色,url,中文, ACSII字符,邮编,手机,IP地址,非空,图片,压缩文件, 日期, QQ号码,国内电话, 用户名,字母,大写字母,小写字母,身份证的32种常
2008-09-26 10:19:00 1901 5
原创 对泛型进行反射
今天在用反射的时候突然想到,之前从来没有对泛型对象进行反射,故决定尝试一下首先要获取某个泛型类的Type,键入如下代码: Type t = Type.GetType("System.Collections.Generic.List");但是调试发现,t为null,看来类名写的不对,再试试,System.Collections.Generic.List,还是错,再试试Syste
2008-09-17 19:06:00 14891 4
原创 一个比较好用的SQL分页查询
现在公司里用的分页存储过程,执行效率还行,不知道原作者是谁set ANSI_NULLS ONset QUOTED_IDENTIFIER ONgoALTER PROC [dbo].[P_viewPage_A]/*nzperfect [no_mIss] 高效通用分页存储过程(双向检索) 2007.5.7 QQ:34813284敬告:适用于单一主键或存在唯一值列的表或视图ps:Sql语句为8000字节
2008-09-16 16:11:00 6917 16
原创 常用的正则
intege:"^-?[1-9]//d*$", //整数 intege1:"^[1-9]//d*$", //正整数 intege2:"^-[1-9]//d*$", //负整数 num:"^([+-]?)//d*//.?//d+$", //数字 phone:"d*//-?//d+$", //电话或手机(新添) num1:"^[1-9]//d*|0$",
2008-09-11 14:01:00 2450 7
原创 使用反射令2个事件在不知道方法名的情况下使用同一个处理方法
今天在社区碰到了一个比较有意思的问题,将button1的Click事件与button2的Click事件在不知道方法名的情况下如何使用同一个处理方法,我之前已经解答了一个类似的问题,是要用到委托列表类实现的,上代码: private void Form1_Load(object sender, EventArgs e) { Button btn1 = new
2008-09-05 16:35:00 1239
原创 背包算法
今天在社区帮人解答某个算法问题,其中有位朋友提出了背包问题的算法,特把他的方法贴在这里收藏一下:namespace Program{ public class Package { public double[] goods = new double[] { 1, 1.1, 2, 3, 4 }; /// /// 用递归算出 //
2008-08-27 17:50:00 1585 1
原创 ASP.NET中获取CheckBoxList的当前选择项
CheckBoxList中有多个项,当选择/不选择某项时如果其AutoPostBack为True,则会触发SelectedIndexChanged,但是CheckBoxList及其Items属性都没有直接能获取当前选择的项的属性,想了一下,可以先将上一次的勾选状态存到ViewState中,在触发SelectedIndexChanged的时候进行比较,具体代码如下:%@ Page Language=
2008-08-27 17:45:00 6689
原创 Linq中查询二维数组
以下代码为在一个4*4的二维int数组中将大于5的元素查出: static void Main(string[] args) { int[,] array = new int[4, 4]; for (int i = 0; i for (int j = 0; j
2008-08-19 13:48:00 5108
原创 ASP.NET 页生命周期
ASP.NET页运行时,此页将经历一个生命周期,在生命周期中将执行一系列处理步骤。这些步骤包括初始化、实例化控件、还原和维护状态、运行事件处理程序代码以及进行呈现。了解页生命周期非常重要,因为这样做您就能在生命周期的合适阶段编写代码,以达到预期效果。此外,如果您要开发自定义控件,就必须熟悉页生命周期,以便正确进行控件初始化,使用视图状态数据填充控件属性以及运行任何控件行为代码。(控件
2008-07-22 15:56:00 7518
原创 IIS 7.0 的 ASP.NET 应用程序生命周期
IIS 7.0 集成管道是一种统一的请求处理管道,它同时支持本机代码和托管代码模块。实现 IHttpModule接口的托管代码模块可访问该请求管道中的所有事件。例如,托管代码模块可用于 ASP.NET 网页(.aspx 文件)和 HTML 页(.htm或 .html 文件)的 ASP.NET Forms 身份验证。即使 IIS 和 ASP.NET 将 HTML 页视为静态资源,情况也是如此
2008-07-22 15:42:00 1652
原创 IIS 5.0 和 6.0 的 ASP.NET 应用程序生命周期
在 ASP.NET 中,若要对 ASP.NET 应用程序进行初始化并使它处理请求,必须执行一些处理步骤。此外,ASP.NET只是对浏览器发出的请求进行处理的 Web服务器结构的一部分。了解应用程序生命周期非常重要,这样才能在适当的生命周期阶段编写代码,达到预期的效果。下表描述了 ASP.NET 应用程序生命周期的各个阶段。阶段说明用户从 Web 服务器请求应用程序资源。ASP.NET 应用
2008-07-22 15:13:00 1291
原创 Winform中同一窗口只能弹出一次的实现
1.首先新建一个Winform程序,拖一个Button到默认的Form1上,再新建一个Form2。2.将Form2的默认构造函数改为private,然后添加一个静态变量与实例化函数,代码如下: private static bool instanceFlag = false;private Form2(){ instanceFlag = true;
2008-07-09 11:30:00 2969 2
原创 在ASP.NET中实现ping
今天在社区帮别人回答问题,发现很多人不知道可以在ASP.NET中实现ping功能,其实这个很简单,只是要引入Microsoft.VisualBasic这个引用,可能大家用C#用多了,所以不太注意这个,其实这个命名空间里的类及函数相当有用,大家可以平时钻研一下。以下是在ASP.NET中实现ping功能的代码:[code=C#] Microsoft.VisualBasic.Devices.
2008-06-11 20:36:00 2359
翻译 Are the type system represented by XmlSchema and the CLS isomorphic?
这个问题比较模棱两可,首先要解释什么是XmlSchema类型系统,什么是CLS类型系统,和同构(isomorphic)都是什么意思。XmlSchema是一个特定的XML文档必须满足的一套标准。这些标准能够描述不同的数据类型。例如:一个XSD文件(XmlSchema的物理实例化)可能会有一个entry like。这意味着一个必须满足XSD文件架构的XML文件可能有一个entry like 21.33
2008-05-08 00:09:00 2365 1
原创 使用ASMX的XML Web服务与使用SOAP的.NET Remoting的区别
Web 服务基础结构通过将 SOAP 消息映射到方法调用,为 Web 服务提供了简单的 API。通过提供一种非常简单的编程模型(基于将 SOAP 消息交换映射到方法调用),它实现了此机制。ASP.NET Web 服务的客户端不需要了解用于创建它们的平台、对象模型或编程语言。而服务也不需要了解向它们发送消息的客户端。唯一的要求是:双方都要认可正在创建和使用的 SOAP 消息的格式,该格式是由使用 W
2008-05-07 23:18:00 2460 2
原创 什么是反射?
Reflection,中文翻译为反射。 这是.Net中获取运行时类型信息的方式,.Net的应用程序由几个部分:‘程序集(Assembly)’、‘模块(Module)’、‘类型(class)’组成,而反射提供一种编程的方式,让程序员可以在程序运行期获得这几个组成部分的相关信息,例如: Assembly类可以获得正在运行的装配件信息,也可以动态的加载装配件,以及在装配件
2008-05-07 23:07:00 1766 3
原创 什么是接口?它与类有什么区别?
1、接口类似于类,但接口的成员都没有执行方式,它只是方法、属性、事件和索引符的组合而已,并且也只能包含这四种成员;类除了这四种成员之外还可以别的成员(如字段)。2、不能实例化一个接口,接口只包括成员的签名;而类可以实例化(abstract类除外)。3、接口没有构造函数,类有构造函数。4、接口不能进行运算符的重载,类可以进行运算符重载。5、接口的成员没有任何修饰符,其成员总是公共的,而类的成员则可以
2008-05-07 23:05:00 11130 8
原创 什么是GAC?它解决了什么问题?
每一个CLR(Common Language Runtime)所在的计算机都有一个全局程序集缓存(Global Assembly Cache,GAC)。部署在GAC上的程序集必须有一个强名称。一种由.net framework sdk提供的名叫 "Global Assembly Cache tool" (Gacutil.exe)的开发工具,可以把程序集部署到GAC上。GAC存储专门指定的程序集以供
2008-05-07 22:29:00 7835 2
原创 PID是什么?在做系统的故障排除时如何使用它?
PID = Process Identifier, 是一个全局唯一的用来标识进程的整数。在多任务系统中,可用来诊断系统中发生错误的进程。
2008-05-07 22:07:00 3297 1
原创 什么是强类型,什么是弱类型?哪种更好些?为什么?
弱类型语言允许将一块内存看做多种类型。比如直接将整型变量与字符变量相加。C and C++ 是静态语言,也是弱类型语言;Perl and PHP 是动态语言,但也是弱类型语言。强类型语言在没有强制类型转化前,不允许两种不同类型的变量相互操作。Java、C# 和 Python 等都是强类型语言。使用哪种语言还是要按需而定。编写简单小应用,使用弱类型语言可节省很多代码量,有更高的开发效率。而对
2008-05-07 21:50:00 3320
原创 EXE和DLL之间的区别是什么?
现在的Windows中,exe 和 dll 都是基于PE格式,exe 是通常的可执行文件,包含数据和代码,而 dll 是动态链接文件,也有可能是纯资源文件,只包含数据,不含程序代码。ddl 的目的之一就是提供能被许多不同的应用程序所使用的函数和资源。dll 中的函数和资源为软件开发提供了复用。它们是在运行时由磁盘物理映像载入被调用者的内存空间或共享内存空间执行。
2008-05-07 21:37:00 3760
原创 Windows上的单个进程所能访问的最大内存量是多少?它与系统的最大虚拟内存一样吗?这对于系统设计有什么影响?
Windows使用一个系统:虚拟寻址系统。该系统把程序可用的内存地址映射到硬件内存中的实际地址上,这些任务完全有Windows后台管理,其实际结果是32位处理器上的每个进程都可以使用4GB的内存------无论计算机上有多少硬盘空间(在64位处理器上这个数值会更大)。这个4GB内存实际上包含了程序的所有部分------包括可执行代码,代码加载的所有dll,以及程序运行时使用的所有变量的内容。这个4
2008-05-07 21:33:00 6252 2
原创 什么是Windows服务,它的生命周期与标准的EXE程序有什么不同
Windows Service 是一种可随 Windows 操作系统启动而启动的,在后台运行的,通常不和用户产生交互的程序。它无法通过双击来运行,类似于 Unix 守护进程(daemon processes),当用户注销时它也不会停止。Windows 服务由三部分组成:1.一个服务可执行文件;2.一个服务控制程序(SCP);3.服务控制管理器(SCM),负责在 HKLM/SYSTEM/Curren
2008-05-07 21:04:00 4937 1
原创 进程与线程的区别
说法一:进程是具有一定独立功能的程序关于某个数据集合上的一次运行活动,进程是系统进行资源分配和调度的一个独立单位. 线程是进程的一个实体,是CPU调度和分派的基本单位,它是比进程更小的能独立运行的基本单位.线程自己基本上不拥有系统资源,只拥有一点在运行中必不可少的资源(如程序计数器,一组寄存器和栈),但是它可与同属一个进程的其他的线程共享进程所拥有的全部资源. 一个线程可以创建和撤销另一个线程;同
2008-05-07 20:33:00 1936
原创 C#指针未解决问题
考虑以下代码: C# code <!--Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/-->unsafe { byte b = 3;
2008-04-14 21:48:00 1068 1
转载 解密不同编码的的参数。
先看下面两个Url,他们传递的参数一样么??aaa.aspx?tag=.net%bc%bc%ca%f5aaa.aspx?tag=.net%e6%8a%80%e6%9c%af看起来好像是不一样,其实他们都是对".net技术"进行了UrlEncode,不过一个是GB2312的编码,一个是Utf-8的编码。如下代码就可以获得上面的编码后效果:string tmp1 = System.Web.
2007-10-18 20:25:00 890
淘宝mysql数据库高可用的设计实现
2012-12-13
在线网络考试系统(asp.net+sql2005)
2008-09-17
Addison Wesley - Inside the C++ Object Model
2007-09-22
Addison Wesley - Effcient C++ Programming Techniques
2007-09-22
Addison Wesley - Effective C++ & More Effective C++
2007-09-22
Addison Wesley - Design Patterns Explained: A New Perspective on Object-Oriented Design
2007-09-22
Addison Wesley - C++ Templates
2007-09-22
Addison Wesley - C++ Primer 3rd Edition
2007-09-22
Addison Wesley - C++ Network Programming Vol 2
2007-09-22
Addison Wesley - C++ Network Programming Vol 1
2007-09-22
Addison Wesley - C++ Gotchas
2007-09-22
Addison Wesley - Applied C++
2007-09-22
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人