• IEnumerable是集合,IEnumerator是集合的迭代器

    我们常用IEnumerable,却忽视IEnumerator。简单来说,IEnumerable是可以被循环遍历的集合,IEnumerator实施循环遍历。 接口分别是: public interface IEnumerator { bool MoveNext(); object Current{get;} void Reset(); } public interface IEnumerable { IEnumerat...

    2018-06-22 06:44:11

  • 为什么说泛型是类型安全的

    通常说泛型,比如ListT是类型安全的,为什么这么说呢? 先来看一个类型不安全的例子。 class Program { static void Main(string[] args) { var tempArr = new ArrayList(); tempArr.Add(1); tempArr.Add("2"); foreach (var item in tempArr) { int tempInt = (int) i...

    2018-06-22 06:44:11

  • Cannot resolve the collation conflict between &

    ErrorMessage Cannot resolve the collation conflict between "SQL_Latin1_General_CP1_CI_AS" and "Latin1_General_100_CI_AS" in the equal to operation. 查看SQL Server的Collation SELECT SERVERPROPERTY ( ' Collation ' ) Solution 1. 在安装SQL Server的时候C...

    2018-06-22 06:44:10

  • ASP.NET 页面之间传递参数方法

    1、通过URL链接地址传递 (1) send.aspx代码 protected void Button1_Click(object sender, EventArgs e) { Request.Redirect("Default2.aspx?username=honge"); } (2) receive.aspx代码 string username = Request.QueryString["username"];//这样可以得到参数值。 2、...

    2018-06-22 06:44:10

  • 大话程序猿眼中的聚集索引和非聚集索引

    博客园将不进行维护,转站到我的个人博文: 地址 OS:这里对聚集所以和非聚集所以的概念说明就不叙述了。 身为程序猿,在平时的开发中,数据的操作是经常要做的事情,大多数公司是没有DBA的,程序开发人员的在操作数据的时候根本不会去看SQL语句执行的效率,所以就时常...

    2018-06-22 06:44:05

  • .NET 基于任务的异步模式(Task-based Asynchronous P

    本文内容 概述 编写异步方法 异步程序中的控制流 API 异步方法 线程 异步和等待 返回类型和参数 参考资料 下载 Demo 下载 Demo TPL 与 APM 和 EAP 结合(APM 和 EAP 这两个标准异步方式已经不能适应多核时代,但之前用这两种方式写的代码怎么办?——把它们改造一下,...

    2018-06-22 06:44:04

  • C#零基础入门08:代码规范

    一:前言 没有规矩,不成方圆。在代码的世界中,尤其这样。作为程序员,我们不想让我们的代码写出去之后被人耻笑:看,连个换行都换的这么不专业。作为开发主管,我们则不想我们的组员写出来的代码各类风格都有,五颜六色的,极其丑陋。写出规范的代码,首先需要训练,...

    2018-06-22 06:44:03

  • Cheatsheet: 2015 03.01 ~ 03.31

    Web The Architecture of Algolia’s Distributed Search Network No promises: asynchronous JavaScript with only generators Node performance: Hapi, Express.js, Restify Java Web App Architecture In Takes Framework Java Marco Behler’s 2014 Ultimate Java...

    2018-06-22 06:44:03

  • 正则表达式检测注册用户名是否规范

    Regex rex = new Regex( @" [\u4E00-\u9FFF] " ); var result = rex.Match(registReq.UserName); if (result.Success){ mResp.ErrorInfo = " 用户名不能是汉字! " ; return true ;}Regex rex2 = new Regex( @" ^\w$ " );result = rex2.Match(registReq.UserName); if (...

    2018-06-22 06:44:02

  • 如何选择使用IEnumerable, ICollection, IList

    IEnumerable, ICollection, IList,每种接口只适合某些特定场景,如何区别使用呢? IEnumerable接口,只提供了一个获取迭代器的方法,这也是为什么可以使用foreach遍历实现了IEnumerable接口集合的原因。 public interface IEnumerable { IEnumerator GetEnumerator();...

    2018-06-22 06:44:02

2