using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace MyDelegate { class Program { static void Main(string[] args) { List<User> users = GetUsers(); //1.传统方式实例化委托实例 users = users.OrderBy(new Func<User, int
Winform 单实例运行 前言 前两天在博客园看到<如何防止程序多次运行>,文章写的很好,最后还留下一个问题给我们思考.关于Winform的防止多次运行,曾经也想研究过,但是后来工作上没有需要,于是就放弃了研究,这两天找资料,将其封装了一下,最后实现的效果为:Winform程序运行后,再次点击exe,会将Winform显示出去,若该窗体被其他窗体遮挡,则将其前置,若该窗体被最小化至托盘,将其显示并前置. 原理 使用命名事件,进程在此启动时,前一个进程会收到通知,并做出回应. using Sy
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace ConsoleApplication17 { public delegate string testDelegate(string a, int b); class Program { static void Main(string[] args)
子程序定义: public delegate void CurrentControlListenEvent(string uniqueID, string way = null); public event CurrentControlListenEvent CurrentControlEvent; protected void InvokeCurrentControlEvent(string uniqueID, string way = null) { if (this.CurrentCont
using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace weituo { class Program { static void Main(string[] args) { // 声明委托变量 ProcessDelegate process; Console.WriteLine("请输入用逗号分隔的两个数字:"); string input = C
这几天对突然对委托事件,异步编程产生了兴趣,大量阅读前辈们的代码后自己总结了一下. 主要是实现 DataTable的导入导出,当然可以模拟从数据库读取大量数据,这可能需要一定的时间,然后 再把数据导入到xml excel等.做了个小实例模拟了一下.特此帖出来以便日后查阅 先上效果图 然后贴上代码 using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using