摘要: using System;using System.Collections.Generic;using System.Linq;using System.Text;namespace ConsoleApplication1{ //静态类和普通类的区别 //静态类不能被实例化 //正常的类 class A { internal void M() { Console.WriteLine("M() of class A"); } } //静态类 class S { internal static void StaticMethod() { Console.WriteLine(&q 阅读全文
posted @ 2012-05-07 18:01 |▍花舞花落泪 ╮ 阅读(92) 评论(0) 推荐(0) 编辑
摘要: using System;using System.IO;using System.Collections.Generic;using System.Linq;using System.Text;namespace ConsoleApplication1{ /// <summary> /// Log 的类别 /// </summary> public enum LogType { Debug, Trace, Info, Warn, Error } //定义委托 public delegate void Log(string content, LogType type); 阅读全文
posted @ 2012-05-07 18:01 |▍花舞花落泪 ╮ 阅读(187) 评论(0) 推荐(0) 编辑
摘要: using System;using System.Collections.Generic;using System.Linq;using System.Text;//一列数的规则如下: 1、1、2、3、5、8、13、21、34...... 求第30位数是多少,用递归算法实现namespace ConsoleApplication1{ /// <summary> /// 斐波那契数列 /// 该类不能被实例化 /// </summary>//1.斐波那契:任何一个给定元素等于前面两个元素之和(其中,第一和第二个元素为1) static class Phabe { //静 阅读全文
posted @ 2012-05-07 18:00 |▍花舞花落泪 ╮ 阅读(137) 评论(0) 推荐(0) 编辑
摘要: using System;using System.Collections.Generic;using System.Linq;using System.Text;//一列数的规则如下: 1、1、2、3、5、8、13、21、34...... 求第30位数是多少,用递归算法实现namespace ConsoleApplication1{ class PhabeRecur_递归 { /// <summary> /// 返回斐波那契数列中得索引为 index d的 数值 /// </summary> /// <param name="index"&g 阅读全文
posted @ 2012-05-07 17:59 |▍花舞花落泪 ╮ 阅读(149) 评论(0) 推荐(0) 编辑
摘要: using System;using System.Collections.Generic;using System.Linq;using System.Text;namespace ConsoleApplication1{ /// <summary> /// 委托的应用场合///任务的执行者把任务在分配,执行者确切的知道什么工作要被执行,但是却把执行细节委托给其他的组///件、方法或者程序集。 /// 链式委托是指一个由委托串成的链表,当链表上得一个委托被回调时,所有链表上该委托的后莲委托将会被顺序执行 /// /// 所有的自定义的委托都可以成为链式委托中的一个。 /// // 阅读全文
posted @ 2012-05-07 17:58 |▍花舞花落泪 ╮ 阅读(167) 评论(0) 推荐(0) 编辑
摘要: using System;using System.Collections.Generic;using System.Linq;using System.Text;namespace ConsoleApplication1{ class DelegateReturn_返回值 { public delegate string GetStringDelegate(); internal static string GetTimeString() { return DateTime.Now.ToString(); } internal static string GetTypeName() { re 阅读全文
posted @ 2012-05-07 17:55 |▍花舞花落泪 ╮ 阅读(191) 评论(0) 推荐(0) 编辑
摘要: using System;using System.Collections.Generic;using System.Linq;using System.Text;namespace ConsoleApplication1{ /// <summary> /// 委托是一类继承自 System.Delegate 的类型,每个委托对象至少包含一个指向某个方法的指针,该方法可以是实例方法,也可以是静态方法,委托实现了回调放方式的机制,能够帮助程序员设计简洁优美的面向对象程序。 /// System.Object /// system.Delegate - ISerilizable /// 阅读全文
posted @ 2012-05-07 17:54 |▍花舞花落泪 ╮ 阅读(132) 评论(0) 推荐(0) 编辑