2007年07月
今天写代码的时候发现一个警告(下面是模拟的代码和警告): warning CS3005: Identifier 'ClassLibrary1' differing only in case is not CLS-compliant 而'ClassLibrary1' 是我的命名空间。当时我就头大了,命名空间也会报not CLS-compliant。 分析后,结果发现是我命名空间书写的时候,一个写成了大写,一个写成了小写,类似如下代码:一个写成了 ClassLibrary1,一个写成了 Classlibrary1 AssemblyInfo.cs 文件有以下定义 [assembly: CLSCompliant(true)] 代码文件: namespace ClassLibrary1{ public class Class1 { }} namespace Classlibrary1{ public class Class2 阅读全文>
发表于 @ 2007年07月19日 14:52:00|评论(loading...)|编辑
终于下定决心,把家里笔记本的操作系统装成了Win2008。(Windows Server 2008 June 2007 CTP)。在安装使用中,碰到了一系列的问题,特整理如下,避免后来者被这些问题所阻挡。 一、Win2008中的Internet Explorer 增强安全性设定 Win2003我们如果不是作为运维环境的服务器,而是开发机使用的时候,安装好Win2003后,第一件事情就是卸载Internet Explorer 增强安全性设定(Internet Explorer Enhanced Security Configuration)。 但是你在Win2008中可能会碰到问题,因为Win2008中这个组件不再可以卸载了,而是变成了针对用户组设置启用不启用了。参见下面两幅图。 Win2008中阅读全文>
发表于 @ 2007年07月15日 15:17:00|评论(loading...)|编辑
你访问以下地址就可以下载Orcas Team Suite 2007年6月份CTP: http://download.microsoft.com/download/f/2/a/f2ac411f-acf9-42a7-a84f-3efc409bcd6b/VSTS_VPCJuneCTP.mht 这个版本可是比 Orcas Beta 1 更新的版本。阅读全文>
发表于 @ 2007年07月12日 17:25:00|评论(loading...)|编辑
延迟执行的经典例子: 我们用 select ++i 就可以看到在foreach 时候,查询才被执行。 public static void Linq99(){ int[] numbers = new int[] { 5, 4, 1, 3, 9, 8, 6, 7, 2, 0 }; int i = 0; var q = from n in numbers select ++i; foreach (var v in q) Console.WriteLine("v = {0}, i = {1}", v, i);} 输出结果: v = 1, i = 1v = 2, i = 2v = 3, i = 3v = 4, i = 4v = 5, i = 5v = 6, i = 6v = 7, i = 7v = 8, i = 8v = 9, i = 9v = 10, i 阅读全文>
发表于 @ 2007年07月03日 16:22:00|评论(loading...)|编辑
Where 子句的用法 我们除了可以如下方式书写带Where子句的LINQ外: from p in products where p.UnitsInStock > 0 && p.UnitPrice > 3.00M select p; 还可以对数组(所有实现了IEnumerable接口的对象都可以)的实体使用 Where 扩展方法。 把一个查询语句写成多个扩展函数的方式,这其实是编译器处理查询语句的方法,比如下面的查询语句: int[] arr = new int[] { 8, 5, 89, 3, 56, 4, 1, 58 };var m = from n in arr where n < 5 orderby n select n; 编译器在编译后,替我们产生的代码等价于如下的代码: IOrderedSequence<int> m = arr.Where<int>(delegate (int n) { return (n < 5);}).Orde阅读全文>
发表于 @ 2007年07月03日 10:54:00|评论(loading...)|编辑