• 博客园logo
  • 会员
  • 众包
  • 新闻
  • 博问
  • 闪存
  • 赞助商
  • HarmonyOS
  • Chat2DB
    • 搜索
      所有博客
    • 搜索
      当前博客
  • 写随笔 我的博客 短消息 简洁模式
    用户头像
    我的博客 我的园子 账号设置 会员中心 简洁模式 ... 退出登录
    注册 登录
 






heyu52

 
 

Powered by 博客园
博客园 | 首页 | 新随笔 | 联系 | 订阅 订阅 | 管理
上一页 1 2

2009年11月26日

适时释放一下内存
摘要: [DllImport("kernel32.dll")] public static extern bool SetProcessWorkingSetSize(IntPtr process, int minSize, int maxSize); public static void GarbageCollect() { GC.Collect(); GC.WaitForPendingFinalizer... 阅读全文
posted @ 2009-11-26 20:12 heyu52 阅读(204) 评论(0) 推荐(0)
 
DeepClone 或许对你很有用
摘要: public static object Clone(object obj) { return Clone(obj, true); } public static object Clone(object obj, bool serialize) { MemoryStream ms = new MemoryStream(); if (serialize) { BinaryFormatter bf =... 阅读全文
posted @ 2009-11-26 20:10 heyu52 阅读(204) 评论(0) 推荐(0)
 

2009年11月24日

很实用的节能方法Singleton
摘要: public static class Singleton<T> where T : class { private static T instance = default(T); public static T Instance { get { if (instance == null) { instance = typeof(T).InvokeMember(typeof(T).Na... 阅读全文
posted @ 2009-11-24 20:16 heyu52 阅读(146) 评论(0) 推荐(0)
 
定义一个我们自己的异常Exception
摘要: [global::System.Serializable]//这个很重要,否则有时会造成参数丢失,比如 Net Remoting public class AppException : Exception { private object[] _args; private ArrayList _invalidData; public object[] Args { get { return _ar... 阅读全文
posted @ 2009-11-24 20:14 heyu52 阅读(341) 评论(0) 推荐(0)
 
根据域名转为IP
摘要: // URL 的格式 Islsz.vicp.netpublic static string GetIPByDomain(string url) { if (url.Trim() == string.Empty) return ""; try { System.Net.IPHostEntry host = System.Net.Dns.GetHostEntry(url); return host.A... 阅读全文
posted @ 2009-11-24 13:07 heyu52 阅读(168) 评论(0) 推荐(0)
 
检测NET框是否安装
摘要: public static bool CheckIfDotNetFrameworkInstalled(string version) { return CheckIfDotNetFrameworkInstalled(version, 0); } public static bool CheckIfDotNetFrameworkInstalled(string version, int servic... 阅读全文
posted @ 2009-11-24 12:57 heyu52 阅读(174) 评论(0) 推荐(0)
 
窗体中回车键代替Tab键
摘要: private void Form1_Load(object sender, EventArgs e) { this.KeyPreview = true;//让窗体接收键盘按键 } protected override void OnKeyPress(KeyPressEventArgs e) { base.OnKeyPress(e); if (DesignMode) return; if (e.K... 阅读全文
posted @ 2009-11-24 12:53 heyu52 阅读(154) 评论(0) 推荐(0)
 
设置程序开机自动运行
摘要: public static void SetRegistryIsStart(bool IsStart) { if (IsStart) { try { string strAssName = Application.StartupPath + @"\" + Application.ProductName + @".exe"; string ShortFileName = Application.Pr... 阅读全文
posted @ 2009-11-24 12:50 heyu52 阅读(378) 评论(0) 推荐(0)
 
上一页 1 2