摘要: 缘起: 假设有一个类myClass, myclass里有一个count属性. 在多线程的环境下 每个线程中 直接使用count++, 如果两个线程并行执行时, 两个线程中的一个的结果会被覆掉, 非线程安全. 这里可以用interlocked.compareExchanged 来确保它的原子性. 代码 阅读全文
posted @ 2019-02-26 10:07 马肯尼煤牙巴骨 阅读(1016) 评论(0) 推荐(0)
摘要: 这是一个比较偏的功能,看了其他的很多博客都没有介绍,最后看自己试出来了. 先上效果图 目前还不知道怎么把蚂蚁线中的 图形从 dashed(-) 改成arrow(箭头) 或其他图形. 如果谁有优雅的方法请麻烦分享一下 ^ ^ 阅读全文
posted @ 2019-02-25 14:41 马肯尼煤牙巴骨 阅读(1384) 评论(0) 推荐(2)
摘要: JS调用C#代码 HTML代码: WPF代码中的C#代码: WPF和JavaScript之间的通信需要完全信任,因此您需要添加以下代码: 也经常这么干 c#调用 JS方法 myscripts.js: 阅读全文
posted @ 2019-02-22 11:17 马肯尼煤牙巴骨 阅读(900) 评论(1) 推荐(0)
摘要: Event handlers leak This type of leak occurs when subscribing an object (let's call it listener) to an event of some other object (let's call it sourc 阅读全文
posted @ 2019-01-21 18:24 马肯尼煤牙巴骨 阅读(421) 评论(0) 推荐(0)
摘要: public class MyClass : IDisposable { #region 变量声明 // 指向外部非托管资源 private IntPtr handle; // 此类使用的其它托管资源. private Component Components; // 跟踪是否调用.D... 阅读全文
posted @ 2019-01-21 14:05 马肯尼煤牙巴骨 阅读(451) 评论(0) 推荐(0)
摘要: 1.GC只能回收堆里的托管资源 2.GC 回收,"代"的概念 .net 托管资源分三代,代数越大 资源的生命周期越长. 0 代 和1代的资源比较少可以比较频率的回收, 回收2代以上差不多等于对整个应用程序的堆进行遍历了,比较不适合频繁的回收. GC.Collection() 对所有代的资源进行遍历  阅读全文
posted @ 2019-01-17 14:51 马肯尼煤牙巴骨 阅读(374) 评论(0) 推荐(0)
摘要: public sealed class EventCommand : TriggerAction { public static readonly DependencyProperty CommandParameterProperty = DependencyProperty.Register("CommandParameter", typeof... 阅读全文
posted @ 2018-11-03 10:56 马肯尼煤牙巴骨 阅读(518) 评论(0) 推荐(0)
摘要: using System; using System.Collections.Generic; using System.ComponentModel; using System.Globalization; using System.Linq; using System.Reflection; u 阅读全文
posted @ 2018-10-24 16:27 马肯尼煤牙巴骨 阅读(371) 评论(0) 推荐(0)
摘要: <?xml version="1.0" encoding="utf-8" ?> <CodeSnippets xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet"> <CodeSnippet Format="1.0.0"> 阅读全文
posted @ 2018-09-28 15:08 马肯尼煤牙巴骨 阅读(326) 评论(0) 推荐(1)
摘要: 1引用程序集 2 xaml 命名空间 3 xaml 里用windowsFormsHost 来装报表控件 3.初始化控件参数 4 .加载视图,设置视图RDLC的方法 调用 阅读全文
posted @ 2018-07-14 09:37 马肯尼煤牙巴骨 阅读(725) 评论(1) 推荐(0)