C#中delegate用法(带参数)
来源:互联网 发布:球球大作战代点源码 编辑:程序博客网 时间:2024/06/06 11:04
近期写了几个C#客户端软件,其中,上传数据时另开线程,同时要更新UI,跨线程操作,用到委托。用法如下:
//委托public delegate void delegate1(string str);//方法private void showUpdateProgress(string content){ //...rtbxUploadLog.Text += content;}//调用delegate1 change = new delegate1(showUpdateProgress); string resp = upload();if (resp.Equals("ok")){ this.BeginInvoke(change, "上传完成");}else{ this.BeginInvoke(change, "上传失败");}
委托的概念,刚接触有些难以理解,多加练习就能熟悉了。
阅读全文
0 0
- C#中delegate用法(带参数)
- C#中delegate的简单用法
- C# Delegate用法
- C# delegate 用法
- C#中yield关键字用法(以及delegate/Lambde/Linq之间的关系)
- C#中Delegate和Event的实现原理以及用法。
- 在C#中使用存储过程(带输入参数)
- .net 中delegate用法
- Rails中delegate用法
- 函数参数中带省略号的用法
- 函数参数中带省略号的用法
- 函数参数中带省略号的用法
- 函数参数中带省略号的用法
- 函数参数中带省略号的用法
- 函数参数中带省略号的用法
- 函数参数中带省略号的用法
- 函数参数中带省略号的用法
- 函数参数中带省略号的用法
- win10系统VS2015编译ifcplusplus
- 【nginx】读取缓存文件
- RecyclerView多布局加载
- cannot be cast to android.widget.HeaderViewListAdapter源码分析
- Android 的Canvas的drawArc方法参数介绍
- C#中delegate用法(带参数)
- 前端_全
- 目前主要有那些格式来作为虚拟机的
- 笔记五:linux下I2C子系统学习
- 【业务】短信
- Java基础总结
- shadowsocks的搭建
- 邻接表实现--图的拓扑排序
- pulltorefresh_demo2