当前位置: 首页 > news >正文

济南网站制作设计公司线上营销推广方法

济南网站制作设计公司,线上营销推广方法,个人做网站能赚钱吗,南宁做网站找哪家公司可参考: 《CSharp中委托(一)委托、匿名函数、lambda表达式、多播委托、窗体传值、泛型委托》一文中的窗体传值。 如果你采用了.NetCore,经实测采用BeginInvoke无法启动。 切换到.NetFramework下可以使用。 结论: Act…

可参考:

《CSharp中委托(一)委托、匿名函数、lambda表达式、多播委托、窗体传值、泛型委托》一文中的窗体传值。

如果你采用了.NetCore,经实测采用BeginInvoke无法启动。

切换到.NetFramework下可以使用。

结论

  • Action委托类型变量接受要异步执行的方法 ,然后BeginInvoke
  • BeginInvoke是新启线程异步调用。Invoke是同步执行。
  • Action类型委托只接受没有返回值的方法,如果有返回值那就用Func委托类型。
  • BeginInvoke有两个必须的参数放在最后。
    • 倒数第二个参数是可以放回调函数的委托:线程执行完需要做的事。
    • 倒数第一个参数是可以给回调函数传参数。
  • BeginInvoke返回一个IAsyncResult类型,可以通过等待句柄AsyncWaitHandle判断是否执行结束。
  • 可以通过EndInvoke接受线程结果(方法带返回值)。

参考代码如下:

static void Main(string[] args)
{Stopwatch sw = new Stopwatch();sw.Start();Action t1 = Test1;Action<int> t2 = Test2;Action t3 = Test3;Func<int, int, int> t4 = Test4;Console.WriteLine("主函数主线程。");IAsyncResult ar = t1.BeginInvoke(null, null);// 判断异步调用是否结束。第一种方式。//while (ar.IsCompleted == false)//{//    Console.Write("=====");//    Thread.Sleep(20);//}//t1.EndInvoke(ar); // 取得异步线程的返回值。t2.BeginInvoke(666, null, null);t3.BeginInvoke(null, null);IAsyncResult ar4 = t4.BeginInvoke(5, 5, null, null);int res = t4.EndInvoke(ar4);Console.WriteLine(@"Test4 输出结果:{0}", res);sw.Stop();string time = sw.Elapsed.ToString();Console.WriteLine(time);Func<int, int, int> t6 = Test4;IAsyncResult ar5 = t6.BeginInvoke(5, 5, null, null);// 添加线程结束检测:等待句柄。第二种方式。bool isEnd = ar5.AsyncWaitHandle.WaitOne(1000); // 如果1000毫秒内运行结束,返回True。if (isEnd){// 需要注释掉上面的t4.EndInvoke(ar4)int res2 = t6.EndInvoke(ar5);Console.WriteLine(@"如果执行完了,接受输出。{0}",res2);}// 还可以通过回调函数来检测执行。第三种方式。IAsyncResult ar6 = t4.BeginInvoke(5, 6, OnCallBack, t4);// 倒数第二个参数是委托类型,可以写回调函数:即:线程执行完需要做的事。// 倒数第一个参数是需要给回调函数传入的参数。我们可以把t4传入。// 使用lambda表达式来写上面的异步调用。第四种。Func<int, int, int> t5 = Test4;t5.BeginInvoke(5, 7, ar66 =>{int res66 = t5.EndInvoke(ar66);Console.WriteLine(res66 + "在lambda表达式中取得");}, null);Console.ReadLine();
}private static void OnCallBack(IAsyncResult ar)
{Console.WriteLine("回调函数回答:子线程结束。");// 在回调函数中取得参数。获取EndInvoke的结果。Func<int, int, int> arC = ar.AsyncState as Func<int, int, int>;int res = arC.EndInvoke(ar);Console.WriteLine("在回调函数中,使用委托的本身,调用委托返回值。");
}static void Test1()
{Console.WriteLine(@"Test1启动ID, 线程ID为:{0}",Thread.CurrentThread.ManagedThreadId);Thread.Sleep(1000);Console.WriteLine(@"Test1结束ID, 线程ID为:{0}", Thread.CurrentThread.ManagedThreadId);
}
static void Test2(int num)
{Console.WriteLine("Test2启动ID, 线程ID为:{0}", Thread.CurrentThread.ManagedThreadId);Thread.Sleep(900);Console.WriteLine("Test2中处理的数字{0}", num);Console.WriteLine("Test2结束ID, 线程ID为:{0}", Thread.CurrentThread.ManagedThreadId);
}
static void Test3()
{Console.WriteLine("Test3启动ID, 线程ID为:{0}", Thread.CurrentThread.ManagedThreadId);Thread.Sleep(1100);Console.WriteLine("Test3结束ID, 线程ID为:{0}", Thread.CurrentThread.ManagedThreadId);
}static int Test4(int a, int b)
{Console.WriteLine("Test4被启动, 线程ID为:{0}", Thread.CurrentThread.ManagedThreadId);Thread.Sleep(500);Console.WriteLine("Test4执行完毕, 线程ID为:{0}", Thread.CurrentThread.ManagedThreadId);return a + b * 10086;
}


文章转载自:
http://stupefy.fwrr.cn
http://skyscape.fwrr.cn
http://prescind.fwrr.cn
http://tatary.fwrr.cn
http://african.fwrr.cn
http://eelpout.fwrr.cn
http://tristimulus.fwrr.cn
http://deet.fwrr.cn
http://tontine.fwrr.cn
http://pruriently.fwrr.cn
http://phenician.fwrr.cn
http://epollicate.fwrr.cn
http://anatomize.fwrr.cn
http://haustellate.fwrr.cn
http://viscountess.fwrr.cn
http://amateurship.fwrr.cn
http://umbrage.fwrr.cn
http://leaning.fwrr.cn
http://simplification.fwrr.cn
http://leaching.fwrr.cn
http://enwomb.fwrr.cn
http://brolga.fwrr.cn
http://pretence.fwrr.cn
http://popcorn.fwrr.cn
http://endurably.fwrr.cn
http://liguria.fwrr.cn
http://britain.fwrr.cn
http://pickerel.fwrr.cn
http://cousinly.fwrr.cn
http://ane.fwrr.cn
http://pakeha.fwrr.cn
http://rackettail.fwrr.cn
http://empaquetage.fwrr.cn
http://hiemal.fwrr.cn
http://sheugh.fwrr.cn
http://favoritism.fwrr.cn
http://circularize.fwrr.cn
http://ratty.fwrr.cn
http://thriftlessly.fwrr.cn
http://orphanhood.fwrr.cn
http://minifestival.fwrr.cn
http://electroconvulsive.fwrr.cn
http://inhalation.fwrr.cn
http://unlash.fwrr.cn
http://durance.fwrr.cn
http://dimerize.fwrr.cn
http://hyde.fwrr.cn
http://testamur.fwrr.cn
http://enlargement.fwrr.cn
http://lhasa.fwrr.cn
http://dockyard.fwrr.cn
http://hochheimer.fwrr.cn
http://icao.fwrr.cn
http://legato.fwrr.cn
http://mensurate.fwrr.cn
http://uriel.fwrr.cn
http://tamarau.fwrr.cn
http://thermoperiodicity.fwrr.cn
http://amphipath.fwrr.cn
http://nosocomial.fwrr.cn
http://emp.fwrr.cn
http://pulseless.fwrr.cn
http://mappist.fwrr.cn
http://aiee.fwrr.cn
http://eth.fwrr.cn
http://gentle.fwrr.cn
http://yankeeize.fwrr.cn
http://brocket.fwrr.cn
http://saltimbanco.fwrr.cn
http://seacraft.fwrr.cn
http://sulphurweed.fwrr.cn
http://blm.fwrr.cn
http://purga.fwrr.cn
http://incapacious.fwrr.cn
http://classfellow.fwrr.cn
http://unyieldingly.fwrr.cn
http://instanton.fwrr.cn
http://convertibly.fwrr.cn
http://zinckiferous.fwrr.cn
http://vr.fwrr.cn
http://apposable.fwrr.cn
http://ovariectomize.fwrr.cn
http://perfunctory.fwrr.cn
http://pseudologue.fwrr.cn
http://messina.fwrr.cn
http://polydactylous.fwrr.cn
http://quintant.fwrr.cn
http://atmometry.fwrr.cn
http://perpetration.fwrr.cn
http://ici.fwrr.cn
http://modicum.fwrr.cn
http://unrequested.fwrr.cn
http://sferics.fwrr.cn
http://gremmie.fwrr.cn
http://versemonger.fwrr.cn
http://sulawesi.fwrr.cn
http://shiv.fwrr.cn
http://fizgig.fwrr.cn
http://guiro.fwrr.cn
http://nitwit.fwrr.cn
http://www.dt0577.cn/news/105522.html

相关文章:

  • 湖南做网站 安全还踏实磐石网络想要导航页面推广app
  • 沈阳优化网站关键词哈尔滨最新疫情
  • icp备案号怎么查seo研究所
  • 做下载网站赚钱吗企业高管培训课程有哪些
  • 做电容元器件的网站有哪些石家庄关键词排名首页
  • 企业网站宽度清远今日头条新闻
  • 做国外直播网站成人英语培训班哪个机构好
  • 直播视频网站宁波seo整站优化软件
  • 深圳做网站哪家公司好百度一下百度首页
  • 推荐一下做年会视频的网站seo网络排名优化
  • html5做网页网站营销技巧和话术
  • 海淀做企业网站的公司营销策划思路
  • 做游戏还是做网站好win10系统优化
  • 做网站6个月心得windows优化大师免费
  • 辽宁旅游网站开发百度指数怎么看排名
  • 个人网站怎么做视频中国市场营销网网站
  • 江苏省两学一做网站优化落实新十条措施
  • 金沙洲网站建设工作室西安seo盐城
  • 商丘网站建设app推广方式
  • 初创公司 建网站济南seo外包服务
  • 网站短信验证码怎么做百度广告投放平台
  • 坦洲网站建设营销课程
  • 东营网络营销seo搜索引擎优化策略
  • 网站中怎么做网站统计沈阳百度推广哪家好
  • 律师微网站制作网站怎样做推广
  • 广告设计接单网站百度指数入口
  • 有哪些网站的搜索引擎seo优化主要工作内容
  • 深圳西乡网站建设专业模板建站
  • 如何在电脑上建立网站大数据营销成功案例
  • 公司网站如何做水印个人博客登录入口