摘要: 简介: 前两篇文章讲了关于泛型的一些基础,下面笔者通过这篇文章来给刚刚接触泛型的朋友介绍一下 .原理性的东西----” 泛型的协变和逆变 “ .以及常用的接口----” IEnumerable 及其泛型版的IEnumerable “-------------------------------... 阅读全文
posted @ 2014-04-24 23:12 keiling 阅读(1880) 评论(5) 推荐(12) 编辑
摘要: 通过前面的文章我们知道“泛型”是个“形容词”,并且了解了 “泛型类” 和 “泛型数组” ,下面我们来看看泛型的其它的使用方式。上一篇:C# -- 泛型(1).泛型方法上一篇文章说到用一个泛型类SortHelper来做一个冒泡排序的处理,下面回顾一下之前的代码: public class Sor... 阅读全文
posted @ 2014-04-23 01:57 keiling 阅读(2710) 评论(6) 推荐(8) 编辑
摘要: 简介: 先看看泛型的概念--“通过参数化类型来实现在同一份代码上操作多种数据类型。利用“参数化类型”将类型抽象化,从而实现灵活的复用”。 很多初学者在刚开始接触泛型的时候会比较难理解 “泛型” 在这里先把 “泛型”当作一个形容词 这样比较方便理解 因为很多东西都可以是泛型的 比如--“泛型的类”... 阅读全文
posted @ 2014-04-18 01:13 keiling 阅读(3971) 评论(9) 推荐(35) 编辑
摘要: 简介:--NVI即(Non-VIrtual Interface)模式强化依赖倒置,介于 Virtual与No Virtual 之间 允许子类重新实现 也可以在父类中对子类 进行限制和其它操作。由来:在架构设计中,我们一般喜欢设计一个基类,然后把未来扩展的工作留给它的派生类做。调用者只能看到基类的方法... 阅读全文
posted @ 2014-04-15 15:42 keiling 阅读(1839) 评论(4) 推荐(2) 编辑
摘要: using System;using System.Collections.Generic;using System.Linq;using System.Text;namespace 接口{//Animal //Aquatic 水生动物 //Land 陆地动物 //Fly 会飞的 public interface IRunable { void Run(); } public interface ISwimable { void Siwm(); } public in... 阅读全文
posted @ 2014-04-08 10:05 keiling 阅读(704) 评论(0) 推荐(0) 编辑
摘要: using System;using System.Collections.Generic;using System.Linq;using System.Text;namespace 接口{ public interface IFlyable { void liftoff(); } public class Bird:IFlyable { public virtual void liftoff() { Console.WriteLine("Bird has lift off!!"); ... 阅读全文
posted @ 2014-04-08 10:04 keiling 阅读(288) 评论(0) 推荐(1) 编辑
摘要: using System;using System.Collections.Generic;using System.Linq;using System.Text;namespace 接口{ public interface IWindlows { void Close()... 阅读全文
posted @ 2014-04-08 10:01 keiling 阅读(232) 评论(0) 推荐(1) 编辑
摘要: 例子1--C#继承的常见问题:using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Threading.Tasks;namespace ConsoleApplication1{ class Program { static void Main(string[] args) { Animal animal = new Animal(); animal.Introduce(); ... 阅读全文
posted @ 2014-04-03 01:09 keiling 阅读(519) 评论(0) 推荐(1) 编辑
摘要: http://www.cnblogs.com/xiguain/p/3636022.html 阅读全文
posted @ 2014-04-02 16:28 keiling 阅读(201) 评论(0) 推荐(0) 编辑
摘要: 登陆 × Login UserName: Password: Login 阅读全文
posted @ 2014-04-02 16:22 keiling 阅读(249) 评论(0) 推荐(0) 编辑