C#常用命名空间和类
-
using System.Collections; 有ArrayList;Hashtable;Stack;Queue;DictionaryEntry;等集合
-
using System.Reflection; 获取Assembly 的属性值
-
using System.Data; 访问和操作数据库等类
-
using System.Drawing; 图像,画笔,和gdi
-
using System.IO; 对文件、文件夹的操作
-
using System.Media; 播放wav和系统wav文件
-
using System.Net; 操作网络
-
using System.Runtime; 运行时的各种信息
-
using System.Security; 用于安全和加密
10.using System.Text; 各种编码方式和正则表达式
11.using System.Threading; 多线程
12.using System.Web; asp.net的web编程
13.using System.Windows.Forms; 各种控件
14.using System.Xml; 操作xml文件
常用类
-
Microsoft.Win32.Registry 操作注册表
-
System.Runtime.InteropServices.Marshal 操作内存
-
System.Enum; 操作枚举
-
System.DateTime; 操作时间
-
System.Math; 操作数字类
-
System.Runtime.Serialization 用于序列化和反序列化
-
System.Windows.Forms.Clipboard; 操作剪贴板
-
DateTime.IsLeapYear("1990"); 判断是否为闰年
-
System.Text.RegularExpressions.Regex.IsMatch("字符串","正则表达式"); 判断正则,返回bool型
-
Console.CapsLock; 获取caps_lock键,是否按下
-
System.Environment; System.Windows.Forms.SystemInformation;
获取系统信息 -
System.Array; 操作数组,排序,倒序等
-
System.Windows.Forms.Screen s = Screen.PrimaryScreen; 获取显示器信息
-
System.Guid.NewGuid(); 获取新的guid
-
System.Random r = new Random(); r.Next(); 产生随机数
-
System.Drawing.Point p = new Point(100,200); System.Drawing.Size s = new Size(500,600); 位置和大小
-
System.Threading.Thread.Sleep(3000); 延迟三秒
-
System.Drawing.Point p = MousePosition; 获取当前鼠标坐标