摘要: c# 递归算法 c# 递归算法 1)1、1、2、3、5、8.......用递归算法求第30位数的值? 首先我们可以发现从第3位数起后一位数等于前两位数值之和,即:x=(x-1)+(x-2),x>2; 这里需要不断的相加,第一时刻就会想到循环处理,我们尝试用数组去装载这些数值,即: int[] a=n 阅读全文
posted @ 2017-08-23 10:20 忧叹ic 阅读(328) 评论(0) 推荐(0) 编辑
摘要: static void Main(string[] args) { Console.WriteLine(Process1(30)); Console.ReadLine(); } public static int Process1(int i) { //计算数组{1,1,2,3,5,8....... 阅读全文
posted @ 2017-08-23 10:12 忧叹ic 阅读(391) 评论(0) 推荐(0) 编辑
摘要: using System;using System.Windows.Forms;using System.Xml;namespace winformDemo{ public partial class Form2 : Form { public Form2() { InitializeCompone 阅读全文
posted @ 2017-08-21 19:23 忧叹ic 阅读(288) 评论(0) 推荐(0) 编辑
摘要: using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Linq;using System.Text;u 阅读全文
posted @ 2017-08-21 19:02 忧叹ic 阅读(930) 评论(0) 推荐(0) 编辑
摘要: 使用XmlReader读Xml XmlDocument和XElement在读取Xml时要将整个Xml文档放到内存中去操作,这样做操作简单,但是很费内存和IO(可能是磁盘IO或者网络IO);而在有些场景下我们必须考虑尽可能节省内存和IO的开销,这时候就该XmlReader和XmlWriter出场了。 阅读全文
posted @ 2017-08-21 18:56 忧叹ic 阅读(332) 评论(0) 推荐(0) 编辑
摘要: 使用XmlWriter写Xml 假定创建了XmlWriter的实例变量xmlWriter,下文中将使用此实例变量写Xml1.如何使用XmlWriter写Xml文档声明 // WriteStartDocument方法可以接受一个bool参数(表示standalone,是否为独立文档)或者不指定参数st 阅读全文
posted @ 2017-08-21 18:53 忧叹ic 阅读(493) 评论(0) 推荐(0) 编辑
摘要: 泛型集合lisit<>优点1.性能高 对值类型使用非泛型集合类,在把值类型转换为引用类型,和把引用类型转换为值类型时,需要进行装箱和拆箱的操作。装箱和拆箱的操作很容易实现,但是性能损失较大, 假如使用泛型,就可以避免装箱和拆箱操作。 此为集合。 ArrayList list=new ArrayLis 阅读全文
posted @ 2017-08-16 14:59 忧叹ic 阅读(3356) 评论(0) 推荐(2) 编辑