摘要: 直接代码: public sealed class SafeTokenHandle : SafeHandleZeroOrMinusOneIsInvalid { private SafeTokenHandle() : base(true) { } [DllImport("kernel32.dll")] 阅读全文
posted @ 2020-04-02 18:05 自定义的星空 阅读(260) 评论(0) 推荐(0)
摘要: 假如我有一个list存储的数据为{ 100, 150, 30, 20, 50, 60, 100, 150, 30, 20, 50, 60,...... },它对应另一个列表中的{product1,product2,product3,product4,product5,product6,product 阅读全文
posted @ 2020-04-01 15:57 自定义的星空 阅读(513) 评论(0) 推荐(0)
摘要: Class: class Recipe { public int ID { get; set; } public string RecipeName { get; set; } public string Comment { get; set; } public string Quantity { 阅读全文
posted @ 2020-04-01 14:46 自定义的星空 阅读(416) 评论(0) 推荐(0)
摘要: 直接代码: static void Main(string[] args) { CancellationTokenSource cancellationTokenSource = new CancellationTokenSource(); CancellationToken cancellatio 阅读全文
posted @ 2020-03-31 15:42 自定义的星空 阅读(2342) 评论(0) 推荐(0)
摘要: 直接上代码了: 我的DLL(class library): namespace MyClassLibrary { public static class Test { [DllImport("user32.dll", CharSet = CharSet.Unicode, SetLastError = 阅读全文
posted @ 2020-03-31 14:58 自定义的星空 阅读(1727) 评论(0) 推荐(0)
摘要: SqlDependency允许你在数据库中的原始数据更改时接收通知,要接收通知,您需要订阅OnChange事件。 SqlDependency有如下限制: SELECT语句中的投影列必须明确声明,并且表名必须由两部分组成。请注意,这意味着该语句中引用的所有表必须位于同一数据库中。 该语句不能使用星号( 阅读全文
posted @ 2020-03-31 14:36 自定义的星空 阅读(1858) 评论(0) 推荐(0)
摘要: 如果是list中存储的是string,int等基本数据类型,直接使用Distinct方法 List<string> lst = new List<string>() {"A","B","C","A" }; var result = lst.Distinct().ToList(); 2.如果存储的是类 阅读全文
posted @ 2020-03-30 17:55 自定义的星空 阅读(3169) 评论(0) 推荐(0)
摘要: 基于Excel中的表创建Access数据库: string DBPath = ""; OleDbConnection conn; public static int ColumnNumber(string colAdress) { int[] digits = new int[colAdress.L 阅读全文
posted @ 2020-03-30 17:33 自定义的星空 阅读(442) 评论(0) 推荐(0)
摘要: 首先,你需要安装 Microsoft.Office.Interop.Excel 包。 将以下语句添加到开头以减少代码量: using Excel = Microsoft.Office.Interop.Excel; 初始化: Excel.Application xlapp = new Excel.Ap 阅读全文
posted @ 2020-03-27 11:21 自定义的星空 阅读(664) 评论(0) 推荐(0)