liyonghui

导航

2011年4月18日 #

不定的多条件的过滤

摘要: 不定条件的,多条件的过滤删除,显然如果用if...else可以实现可是,现在的要求是实现条件的随意添加,这样的程序,我们怎么样实现灵活的扩展性呢?准备用装饰模式搞一下》代码如下:定义一个接口:using System;using System.Collections.Generic;using System.Linq;using System.Text;namespace ConsoleApplication1{ interface IFilterCondition { Ware Filter(); }}实现一个条件:using System;using System.Collections. 阅读全文

posted @ 2011-04-18 18:04 李永辉 阅读(316) 评论(1) 推荐(0) 编辑

Lambda 表达式(C# 编程指南)

摘要: 什么也不说,直接上代码!!using System;using System.Collections.Generic;using System.Linq;using System.Text;namespace ConsoleApplication1{ class Program { static void Main(string[] args) { Dictionary<string, int> dict = new Dictionary<string, int>(); List<string> ListResult = new List<string 阅读全文

posted @ 2011-04-18 14:34 李永辉 阅读(443) 评论(4) 推荐(1) 编辑

C#中定义数组

摘要: 一、一维: int[] numbers = new int[]{1,2,3,4,5,6}; //不定长 int[] numbers = new int[3]{1,2,3};//定长 二、多维 int[,] numbers = new int[,]{{1,2,3},{1,2,3}}; //不定长 int[,] numbers = new int[2,2]{{1,2},{1,2}}; //定长 三、例子 A:int[] mf1=new int[6]; //注意初始化数组的范围,或者指定初值; //包含6个元素的一维整数数组,初值1,2,3,4,5,6 int[] mf2=new int[6]{1, 阅读全文

posted @ 2011-04-18 14:23 李永辉 阅读(1013) 评论(0) 推荐(0) 编辑

C#中定义数组

摘要: 一、一维: int[] numbers = new int[]{1,2,3,4,5,6}; //不定长 int[] numbers = new int[3]{1,2,3};//定长 二、多维 int[,] numbers = new int[,]{{1,2,3},{1,2,3}}; //不定长 int[,] numbers = new int[2,2]{{1,2},{1,2}}; //定长 三、例子 A:int[] mf1=new int[6]; //注意初始化数组的范围,或者指定初值; //包含6个元素的一维整数数组,初值1,2,3,4,5,6 int[] mf2=new int[6]{1, 阅读全文

posted @ 2011-04-18 14:21 李永辉 阅读(46441) 评论(1) 推荐(0) 编辑