摘要: using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Linq;using System.Text;using System.Windows.Forms;using System.IO;namespace _09资料管理器{ public partial class Form1 : Form { public Form1() { Init... 阅读全文
posted @ 2012-09-25 22:53 51秒懂 阅读(244) 评论(0) 推荐(0) 编辑
摘要: 1 using System; 2 using System.Collections.Generic; 3 using System.Linq; 4 using System.Text; 5 using System.Collections; 6 7 namespace _15Foreach原理 8 { 9 class Program10 {11 static void Main(string[] args)12 {13 Person p = new Person();14 p[0] = "奇瑞... 阅读全文
posted @ 2012-09-25 18:12 51秒懂 阅读(516) 评论(0) 推荐(0) 编辑
摘要: 昨天面试的时候问到了.NET垃圾回收机制CLR中进行垃圾回收,内存管理垃圾回收的目的:提高内存利用率•垃圾回收器,只回收托管堆中的内存资源,不回收其他资源(数据库连接、文件句柄、网络端口等)。•什么样的对象才会被回收?–没有变量引用的对象。没有变量引用的对象,表示可以被回收了(null)•什么时间回收?–不确定,当程序需要新内存的时候开始执行回收。–GC.Collect();//手动调用垃圾回收器。不建议使用,垃圾回收时会暂停一下(非常短暂)让程序自动去GC。•垃圾回收器中“代”的概念:–共3代:第0代、第1代、第2代。–各代的回收频率:第0代最高,其次第1代,再次第2代。也就是说越老的对象生 阅读全文
posted @ 2012-09-25 16:12 51秒懂 阅读(222) 评论(0) 推荐(0) 编辑
摘要: 1 private static void Validate(string uid, string pwd, out string msg) 2 { 3 if (uid == "admin" && pwd == "888") 4 { 5 msg = "登陆成功"; 6 } 7 else if (uid != "admin" && pwd == "888") 8 { 9 msg = "登录名错误... 阅读全文
posted @ 2012-09-25 16:08 51秒懂 阅读(131) 评论(0) 推荐(0) 编辑
摘要: 类和结构最大的区别就是 结构是:值类型;类是引用类型。 结构不能继承,但是可以实现接口。如果需要面向对象的特性,如果存储的数据量比较大 →使用类如果存储的数据量比较小,不需要面向对象特性则使用结构关于继承问题 所有的引用类型都继承自Object 所有的值类型都继承自System.ValueType 又继承自ObjectCovert可以把任意类型转换成任意类型string n="23";int result=;TryParse:bool b=int.TryParse(n,out result) 阅读全文
posted @ 2012-09-25 15:15 51秒懂 阅读(146) 评论(0) 推荐(0) 编辑
摘要: View Code 1 //========================================================= 2 UserState state = UserState.Busy; 3 //为标志枚举赋值 4 GoodPeople lyh = GoodPeople.白 | GoodPeople.富 | GoodPeople.高 | GoodPeople.帅; 5 6 //验证lyh的枚举中是否具有白,这一项。 7 ... 阅读全文
posted @ 2012-09-25 15:08 51秒懂 阅读(258) 评论(0) 推荐(0) 编辑
摘要: 显示实现接口的目的,是为了解决方法中方法重名的问题显示实现接口是私有的,因此只能通过接口来访问。View Code 1 class Program 2 { 3 static void Main(string[] args) 4 { 5 IFlyable fly = new Person(); 6 fly.Fly(); 7 ISuperable super = new Person(); 8 //只能通过接口调用 9 super.Fly... 阅读全文
posted @ 2012-09-25 14:00 51秒懂 阅读(170) 评论(0) 推荐(0) 编辑