新的Blog

.NET

2006年9月5日 #

迭代器(yield return )

摘要: 4.1 迭代器块 一个迭代器块(iterator block)是一个能够产生有序的值序列的块。迭代器块和普通语句块的区别就是其中出现的一个或多个yield语句。 yield return语句产生迭代的下一个值。 yield break语句表示迭代完成。 只要相应的函数成员的返回值类型是一个枚举器接口(见4.1.1)或是一个可枚举接口(见4.1.2),一个迭代器块就可以用作方法体、运算符体或访问器体... 阅读全文

posted @ 2006-09-05 17:30 tity1110 阅读(4816) 评论(0) 推荐(0) 编辑

2006年9月1日 #

数列:1,1,2,3,5,8,13,21,34,..... 求第50个数值? 并用c#写出算法?(不难,但要注意int 溢出问题)

摘要: [STAThread]static void Main(string[] args){ int n =int.Pares(System.Console.ReadLine()); int i; Int64 j, k, temp; //如果用int则会得到: -298632863 j = 1; k = 1; temp = 0; if (n <= 2) { Console.WriteLine("N... 阅读全文

posted @ 2006-09-01 15:33 tity1110 阅读(2933) 评论(3) 推荐(0) 编辑

2006年8月31日 #

C# string问题

摘要: String.Empty != null; 如果一个TextBox没有值的话,if(TextBox.Text == String.Empty) ==> 结果为: FALSEif(TextBox.Text == String.Empty) ==> 结果为: TRUE; 在2.0中判断字符串是否为空String.IsNullOrEmpty(str) == True 则说明字符串为空(nul... 阅读全文

posted @ 2006-08-31 16:23 tity1110 阅读(550) 评论(0) 推荐(0) 编辑

2006年8月30日 #

C# 时间(几个常用时间,程序运行计时,页面运行计时)

摘要: 1.DateTimeDateTime now = System.DateTime.Now; now.ToString(); //显示: 2006/08/30 17:31:02now.ToString("yyyy-mm-dd hh:MM:ss");//显示: 2006-08-30 05:39:11now.ToString("yyyy-mm-dd HH:mm:ss");//显示: 2006-08-30... 阅读全文

posted @ 2006-08-30 17:53 tity1110 阅读(24771) 评论(0) 推荐(0) 编辑

导航