C# 判断文件是否被占用的三种方法 using System.IO; using System.Runtime.InteropServices; [DllImport("kernel32.dll")] public static extern IntPtr _lopen(string lpPathName, int iReadWrite); [DllImport("kernel32.dll")] public static extern bool CloseHand
最近重构一套代码,运用以下几种方法,供参考. 1 公共方法尽可能的使用缓存 public static List<string> GetRegisteredCompany() { String sql = "SELECT CompanyCode FROM dbo.Company WHERE Suspended='N' ORDER BY CompanyCode"; DataTable table = SqlHelper.ExecuteDataset(BaseCommon.G