If tomorrow never comes

The meaning of life is creation,which is independent an boundless.

导航

随笔分类 -  .NET

摘要:请看下面的代码:[代码]输出结果是:Before unsafe code, i = 0After unsafe code seg 1, i = 24832Inside unsafe code seg 2, *ptr = aQUESTION: There is no code to modify variable i directly, why the value of i ischanged to... 阅读全文

posted @ 2009-07-16 23:23 Brucegao 阅读(515) 评论(0) 推荐(0)

摘要:二分查找1、二分查找(Binary Search)二分查找又称折半查找,它是一种效率较高的查找方法。二分查找要求:线性表是有序表,即表中结点按关键字有序,并且要用向量作为表的存储结构。不妨设有序表是递增有序的。2、二分查找的基本思想二分查找的基本思想是:(设R[low..high]是当前的查找区间)(1)首先确定该区间的中点位置:(2)然后将待查的K值与R[mid].key比较:若相等,则查找成功... 阅读全文

posted @ 2009-05-18 16:55 Brucegao 阅读(340) 评论(0) 推荐(0)

摘要:1、单链表的倒置的C#实现。 思路:从头节点开始以此将节点的指向倒转,最后返回原链表的尾节点也就是倒转后链表的头节点。 Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/-->using System; using System.Collections... 阅读全文

posted @ 2009-04-30 16:21 Brucegao 阅读(1061) 评论(1) 推荐(0)

摘要:“斐波那契数列”的发明者,是意大利数学家列昂纳多·斐波那契(Leonardo Fibonacci,生于公元1170年,卒于1240年。籍贯大概是比萨)。他被人称作“比萨的列昂纳多”。1202年,他撰写了《珠算原理》(Liber Abaci)一书。他是第一个研究了印度和阿拉伯数学理论的欧洲人。他的父亲被比萨的一家商业团体聘任为外交领事,派驻地点相当于今日的阿尔及利亚地区,列昂纳多因此得以在一个阿拉... 阅读全文

posted @ 2009-04-24 13:45 Brucegao 阅读(252) 评论(0) 推荐(0)

摘要:The readonly keyword is a modifier that you can use on fields. When a field declaration includes a readonly modifier, assignments to the fields introduced by the declaration can only occur as part o... 阅读全文

posted @ 2009-04-17 21:10 Brucegao 阅读(270) 评论(0) 推荐(0)

摘要:The const keyword is used to modify a declaration of a field or local variable. It specifies that the value of the field or the local variable is constant, which means it cannot be modified. For exa... 阅读全文

posted @ 2009-04-17 21:03 Brucegao 阅读(342) 评论(0) 推荐(0)

摘要:1、ref和out是.NET里面的两个关键字。2、ref: The ref keyword causes arguments to be passed by reference. The effect is that any changes to the parameter in the method will be reflected in that variable when contro... 阅读全文

posted @ 2009-04-17 20:49 Brucegao 阅读(484) 评论(0) 推荐(0)

摘要:1、求两个正整数的最大公约数与最小公倍数 【提示】: (1)求两个非负正数m和n(要求m>n)的最大公约数可以使用辗转相除法。其算法描述为: 1)m除以n得到的余数为r(0using System;using System.Collections.Generic;using System.Text;namespace DivisorMutiple{ class Program { ... 阅读全文

posted @ 2009-04-08 19:35 Brucegao 阅读(1046) 评论(0) 推荐(1)

摘要:两个正正数的最大公约数用程序算法来求解是算法里面比较入门的东西,这是我昨天试着写的,还望指正。Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/-->/*Author:Bruce * Time:2009-4-7pm * Function:obtain the ... 阅读全文

posted @ 2009-04-08 17:08 Brucegao 阅读(316) 评论(0) 推荐(0)

摘要:C#.NET offers a variety of ways of testing for equality. For the most part, things just work as the programmer would expect. But, because the == operator and Equals() method can be overriden, some gui... 阅读全文

posted @ 2009-03-27 21:29 Brucegao 阅读(378) 评论(0) 推荐(0)

摘要:刚刚结束在上海美罗大厦的微软面试,一起两轮估计没什么希望,因为人都说微软一般最少是四轮面试的,不管怎么我把我他们问的问题记录下来了,希望对浏览此网页的网友有益,谢谢! Time:2009/3/27 Address:Metro Tower floor23 Interviewee: Bruce First round:Interviewer is a Chinese who was born in A... 阅读全文

posted @ 2009-03-27 13:27 Brucegao 阅读(641) 评论(8) 推荐(1)

摘要:快速排序 Code highlighting produced by Actipro CodeHighlighter (freeware) http://www.CodeHighlighter.com/ -->using System; using System.Collections.Generic; using System.Linq; using System.Text;... 阅读全文

posted @ 2009-03-25 12:49 Brucegao 阅读(332) 评论(0) 推荐(0)

摘要:目录: 什么是段(segments)和堆(heaps),为GC分配了多少? 什么是代(generations),我们为什么使用带有代的GC? 什么时间发生收集,如何发生的? 什么是根(root),是什么保证一个对象存活? 什么是大对象堆(large object heap),为什么存在? 哪种加了味(模式)的GC适合我的应用程序? 垃圾收集(garbage collection ,GC)的代价是什... 阅读全文

posted @ 2009-03-23 16:22 Brucegao 阅读(3465) 评论(1) 推荐(0)

摘要:今天下午接到微软中软上海的电话面试,整个过程49分钟,现在我把刚才问到的问题整理了一下,希望对后来者有益,这也是我写这篇博客的初衷。 1、 假如在.NET里面要用其他程序的.dll文件该怎么做? 2、 模态和非模态窗体的区别? 3、 .NET Winform程序里面的Show()和ShowDialog()的区别? 4、 解释一下.NET里面的GC的工作机制? 5、 什么时候进行垃圾回收? 6、... 阅读全文

posted @ 2009-03-19 20:02 Brucegao 阅读(2482) 评论(5) 推荐(0)

摘要:这是我在面试中软国际时候的一道笔试题。 编程题: 写一个Singleton出来。 Singleton模式 Singleton可以说是《Design Pattern》中最简单也最实用的一个设计模式。那么,什么是Singleton? 顾名思义,Singleton就是确保一个类只有唯一的一个实例。Singleton主要用于对象的创建,这意味着,如果某个类采用了 Singleton 模式,则... 阅读全文

posted @ 2009-03-18 20:50 Brucegao 阅读(544) 评论(0) 推荐(0)

摘要:递归: 递归是一种重要的编程技术。该方法用于让一个函数从其内部调用其自身。一个示例就是计算阶乘。0 的阶乘被特别地定义为 1。 更大数的阶乘是通过计算 1 * 2 * ...来求得的,每次增加 1,直至达到要计算其阶乘的那个数。 C#实现N! Code highlighting produced by Actipro CodeHighlighter (freeware) http://ww... 阅读全文

posted @ 2009-03-13 15:27 Brucegao 阅读(184) 评论(0) 推荐(0)

摘要:面试题目:判定一个字符串是不是回文,例如:“ABA”,"ABBA"代码:[代码]以上是昨天参加中软国际面试时候的一道题目,我是按上面的思路和代码写的,但是面试官说有问题,注:面试官是一个QA有哪位牛人知道问题出在哪里,欢迎指正。 阅读全文

posted @ 2009-03-13 15:18 Brucegao 阅读(954) 评论(5) 推荐(0)

摘要:1.值类型与引用类型 结构是值类型:值类型在栈上分配地址,所有的基类型都是结构类型,例如:int 对应System.int32 结构,string 对应 system.string 结构 ,通 过使用结构可以创建更多的值类型 类是引用类型:引用类型在堆上分配地址 栈的执行效率要比堆的... 阅读全文

posted @ 2009-03-04 17:06 Brucegao 阅读(2444) 评论(0) 推荐(1)

摘要:System.Collections 常用类,结构和结构: 类:ArrayList,Hashtable,SortedList 接口:ICollection,IEnumerator,IList 结构:DictionaryEntry 类: ArrayList: 数组列表,是Array类的优化版本。。 Hashtable: 一种数据结构,将数据作为一组键(Key)值(Val... 阅读全文

posted @ 2009-03-03 20:47 Brucegao 阅读(561) 评论(0) 推荐(0)

摘要:·csc.exe的环境变量设置 csc.exe是.net用来编译.cs文件的,但必须要在安装目录下使用。 所以我们要设置一下环境变量。 C#环境变量设置: 1、在桌面右击[我的电脑]以此打开/高级系统设置->高级->环境变量(Windows server 2008) 2、在下面的系统变量栏点击“新建” 3、变量名输入“csc” 4、变量值输入:“C:\Windows\Micr... 阅读全文

posted @ 2009-03-02 17:24 Brucegao 阅读(404) 评论(0) 推荐(0)