摘要: Dictionary<int, int> dict = new Dictionary<int, int>(); dict.Add(200, 1); dict.Add(100, 2); dict.Add(50, 3); dict.Add(20, 4); foreach( KeyValuePair<int,int> entry in dict) { Console.... 阅读全文
posted @ 2009-05-14 11:56 何翔华 阅读(352) 评论(0) 推荐(0) 编辑
摘要: 如果 ?? 运算符的左操作数非 null,该运算符将返回左操作数,否则返回右操作数。 示例: // nullable_type_operator.cs using System; class MainClass { static int? GetNullableInt() { return null; } static string GetStringValue() { return null;... 阅读全文
posted @ 2009-05-03 01:27 何翔华 阅读(730) 评论(1) 推荐(0) 编辑
摘要: TreeView本身没办法Clone(),不过只是要内容一样的话,只要把顶层的TreeNode从源TreeView复制到目标TreeView就OK。 using System.Windows.Forms; namespace TestTreeView { public partial class Form2 : Form { public ... 阅读全文
posted @ 2009-04-18 21:24 何翔华 阅读(1608) 评论(0) 推荐(0) 编辑
摘要: 如题: this.label1.BackColor = System.Drawing.Color.Transparent; 阅读全文
posted @ 2009-04-18 00:32 何翔华 阅读(1641) 评论(2) 推荐(0) 编辑
摘要: group.DateTime= (DateTime)Enum.Parse(typeof(DateTime), reader["DateTime"].ToString()); 阅读全文
posted @ 2009-04-16 22:09 何翔华 阅读(298) 评论(0) 推荐(0) 编辑
摘要: 重构.封装字段 Ctrl + R,E 显示“封装字段”对话框,该对话框允许从现有字段创建属性,并更新所有引用以使用新属性。重构.提取接口 Ctrl + R,I 显示“提取接口”对话框,该对话框允许使用从现有类、结构或接口派生的成员创建新接口。重构... 阅读全文
posted @ 2009-04-03 23:36 何翔华 阅读(1055) 评论(0) 推荐(0) 编辑
摘要: 1、新建一个类库,例如库名为 ResourcesLibrary;2、添加引用 System.Drawing;3、添加资源文件(添加--新建项--资源文件),例如文件名为 Resource1.resx;4、添加图片(打开Resource1.resx,单击“添加资源”后的小三角,选择添加现有文件,选择需要作为资源的图片),例如添加了图片 Sunset.jpg5、添加类,例如名为 GetImage.... 阅读全文
posted @ 2009-03-31 17:21 何翔华 阅读(413) 评论(0) 推荐(0) 编辑