摘要: 重载构造函数:using System;public class Wine{ public decimal Price; public int Year; public Wine (decimal price) { Price = price; } public Wine (decimal price, int year) : this (price) { Year = year; }}对象初始化:public class Bunny{ public string Name; public bool LikesCarrots; public bool LikesHumans; ... 阅读全文
posted @ 2013-09-29 10:43 yangzhenping 阅读(546) 评论(0) 推荐(1) 编辑
摘要: 第一个C#程序:using System; // 导入命名空间class Test // 类声明 { static void Main () // 方法声明 { int x = 12 * 30; // 陈述1 Console.WriteLine (x); // 陈述2 } // 方法结束} ... 阅读全文
posted @ 2013-09-29 10:24 yangzhenping 阅读(333) 评论(0) 推荐(0) 编辑
摘要: App_StartIt has configuration classes to reduce clutter code in the Global.asax它包含了配置类来减少在Global.asax中的杂乱代码Application_Start 方法App_Start 文件夹里有如下文件:AuthConfig.cs: Related to security settings, including sites for OAuth login.关于安全设置,包含网站的授权登录。BundleConfig.cs: Related to register bundles for the bundli 阅读全文
posted @ 2013-09-29 08:42 yangzhenping 阅读(639) 评论(1) 推荐(0) 编辑
摘要: Lambda 表达式:Func doubleAppend= x => x + x;Console.WriteLine (doubleAppend(“test”)); // testtestLINQ 查询:string[] names = { "Tom", "Dick", "Harry" };IEnumerable filteredNames = Enumerable.Where (names, n => n.Length >= 4); // 字符长度大于等于4的名字扩展方法:string[] names = { &q 阅读全文
posted @ 2013-09-28 22:58 yangzhenping 阅读(194) 评论(0) 推荐(0) 编辑