上一页 1 ··· 99 100 101 102 103 104 105 106 107 ··· 133 下一页
摘要: async/await是C#5.0中推出的,先上用法: static void Main(string[] args) { Console.WriteLine(" 主线程启动 "); Task<int> task = GetStrLengthAsync(); Console.WriteLine("主 阅读全文
posted @ 2021-01-06 09:19 MaxBruce 阅读(795) 评论(0) 推荐(0)
摘要: WPF线程获取UI线程 WPF中只能是UI线程才可以改变UI控件相关,当采用多线程工作时,可用以下代码获取 UI线程进行操作: App.Current.Dispatcher.Invoke((Action)delegate() { //codes } 阅读全文
posted @ 2021-01-04 18:52 MaxBruce 阅读(735) 评论(0) 推荐(0)
摘要: 为了实现Undo和Redo,必须要在程序中保存起程序的运行状态,从而能够在Undo时跳转到前一个状态和在Redo时跳转到下一个状态。为了实现状态的维护,我采用了两个栈来分别保存Undo操作的状态和Redo操作的状态。 public static Stack<MyCommand> undoStack 阅读全文
posted @ 2021-01-04 07:13 MaxBruce 阅读(324) 评论(0) 推荐(0)
摘要: 原文地址:http://kb.cnblogs.com/page/116095/ 随着拥有多个硬线程CPU(超线程、双核)的普及,多线程和异步操作等并发程序设计方法也受到了更多的关注和讨论。本文主要是想与园中各位高手一同探讨一下如何使用并发来最大化程序的性能。 多线程和异步操作的异同 多线程和异步操作 阅读全文
posted @ 2021-01-04 06:51 MaxBruce 阅读(652) 评论(0) 推荐(0)
摘要: private void initalAlarmHanle() { string cancelAlarm = "CancelAlarmEvent"; ConnectionManager.AddHandler(cancelAlarm, async (v) => { string clockId = " 阅读全文
posted @ 2021-01-03 16:36 MaxBruce 阅读(103) 评论(0) 推荐(0)
摘要: Dictionary<string, object> dic = new Dictionary<string, object>(); long lg = 12345; dic["123"] = lg; long ?l = dic["123"]as long?; if(l!=null) { Conso 阅读全文
posted @ 2021-01-03 16:02 MaxBruce 阅读(165) 评论(0) 推荐(0)
摘要: xml code <UserControl x:Class="WinTest.HPControl.ReminderTimer" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://sche 阅读全文
posted @ 2021-01-03 15:58 MaxBruce 阅读(141) 评论(0) 推荐(0)
摘要: xml code <Page x:Class="MyApp.MainPage" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/ 阅读全文
posted @ 2021-01-02 23:36 MaxBruce 阅读(107) 评论(0) 推荐(0)
摘要: Xml code <Page x:Class="MyApp.MainPage" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/ 阅读全文
posted @ 2021-01-02 21:50 MaxBruce 阅读(171) 评论(0) 推荐(0)
摘要: 泛型(Generic) 允许您延迟编写类或方法中的编程元素的数据类型的规范,直到实际在程序中使用它的时候。换句话说,泛型允许您编写一个可以与任何数据类型一起工作的类或方法。 您可以通过数据类型的替代参数编写类或方法的规范。当编译器遇到类的构造函数或方法的函数调用时,它会生成代码来处理指定的数据类型。 阅读全文
posted @ 2021-01-02 20:16 MaxBruce 阅读(119) 评论(0) 推荐(0)
上一页 1 ··· 99 100 101 102 103 104 105 106 107 ··· 133 下一页