上一页 1 ··· 4 5 6 7 8 9 10 11 12 ··· 85 下一页
  2017年12月15日
摘要: ConcurrentDictionary> mailBoxes = new ConcurrentDictionary>(); int maxBoxes = 5; CancellationTokenSource cancelationTokenSource = new CancellationTokenSource(); CancellationT... 阅读全文
posted @ 2017-12-15 15:39 武胜-阿伟 阅读(333) 评论(0) 推荐(0) 编辑
摘要: public static void AddRange(this ConcurrentBag @this, IEnumerable toAdd) { foreach (var element in toAdd) { @this.Add(element); } } 阅读全文
posted @ 2017-12-15 15:34 武胜-阿伟 阅读(856) 评论(1) 推荐(1) 编辑
摘要: public static TValue GetOrAdd( this Dictionary dictionary, TKey key, Func valueFactory) { TValue value; if (!dictionary.TryGetValue(key, out value)) { value = valueFactory(ke... 阅读全文
posted @ 2017-12-15 15:31 武胜-阿伟 阅读(855) 评论(0) 推荐(0) 编辑
摘要: var sessionId = a.Session.SessionID.ToString(); userDic.AddOrUpdate( authUser.UserId, sessionId, (key, oldValue) => sessionId); static class Extension 阅读全文
posted @ 2017-12-15 15:26 武胜-阿伟 阅读(6719) 评论(0) 推荐(0) 编辑
摘要: /// /// 对象池 /// /// public class ObjectPool { private readonly ConcurrentBag _buffer; private readonly Func _createFunc; private readonly Action _reset... 阅读全文
posted @ 2017-12-15 11:29 武胜-阿伟 阅读(204) 评论(0) 推荐(0) 编辑
  2017年11月13日
摘要: 客户端采用C++开发,服务端采用C#开发,所以双方必须保证各自定义结构体成员类型和长度一致才能保证报文解析的正确性. 一、首先是 [StructLayoutAttribute(LayoutKind.Sequential, CharSet = CharSet.Ansi, Pack = 1)],这是C# 阅读全文
posted @ 2017-11-13 19:22 武胜-阿伟 阅读(1046) 评论(0) 推荐(0) 编辑
  2017年11月5日
摘要: namespace DevExpress.Utils { using DevExpress.LookAndFeel; using DevExpress.Skins; using DevExpress.Utils.Drawing; using DevExpress.XtraEditors; using 阅读全文
posted @ 2017-11-05 19:17 武胜-阿伟 阅读(425) 评论(0) 推荐(0) 编辑
  2017年11月4日
摘要: 如题,市面上常见的方法是: 此法的问题是,如果图像是透明背景,那么得到的Icon的边缘就是毛糙的,像是先垫了一层背景色然后再去色的效果,很不如人意,用过的朋友都知道。尚未研究是bmp.GetHicon出的问题,还是Icon.FromHandle有问题,日后有闲心再捣鼓下。 下面给出完美转换方法: 如 阅读全文
posted @ 2017-11-04 22:32 武胜-阿伟 阅读(843) 评论(0) 推荐(0) 编辑
摘要: 直接下载NLua编译好的版本在c#项目中使用,运行的时候会提示无法加载lua52.dll,但lua52.dll这个文件又是在运行目录下的。 其实NLua不是无法加载lua52.dll本身,而是找不到lua52.dll需要的另一个文件,msvcr100.dll。这个文件可以在C:windowssyst 阅读全文
posted @ 2017-11-04 20:18 武胜-阿伟 阅读(2230) 评论(0) 推荐(1) 编辑
  2017年10月25日
摘要: /// /// An IEnumerable extension method that picks a random item from the given /// collection. /// /// Generic type parameter. /// The collection to act on. /// A T picked at random from the col... 阅读全文
posted @ 2017-10-25 14:53 武胜-阿伟 阅读(204) 评论(0) 推荐(0) 编辑
上一页 1 ··· 4 5 6 7 8 9 10 11 12 ··· 85 下一页