摘要: Enum 扩展 阅读全文
posted @ 2019-12-31 18:07 wesson2019 阅读(173) 评论(0) 推荐(0)
摘要: System.Threading.ReaderWriterLockSlim,该类用于管理资源访问的锁定状态,可实现多线程读取或进行独占式写入访问。可以避免在同一时间段内多线程同时写入一个文件而导致的并发写入问题。 /// <summary> /// 读写锁,当资源处于写入模式时,其他线程写入需要等待 阅读全文
posted @ 2019-12-31 18:06 wesson2019 阅读(265) 评论(0) 推荐(0)
摘要: Windows编程中不建议创建进程(进程创建的开销不容忽视),若需要大量创建进程,最好切换到Linux系统; Windows偏向多线程,大量面对资源争抢与同步的问题。 在面向多核的服务器端编程中,需要习惯多进程而非多线程。(在CPU多核情况下,多线程在性能上不如多进程);Linux偏向进程间通信的方 阅读全文
posted @ 2019-12-31 18:05 wesson2019 阅读(417) 评论(0) 推荐(0)
摘要: 这些信息有助于跟踪、调试和创建诊断工具。 if the call site doesn't provide the argument, the compiler will use the current file, line number, or member name to fill in the 阅读全文
posted @ 2019-12-02 18:06 wesson2019 阅读(148) 评论(0) 推荐(0)
摘要: 实时、刷新、更新 阅读全文
posted @ 2019-12-02 17:15 wesson2019 阅读(217) 评论(0) 推荐(0)
摘要: RandomElement 阅读全文
posted @ 2019-12-02 16:42 wesson2019 阅读(606) 评论(0) 推荐(0)
摘要: foreach (var item in ReadLines("E:\\bigFile.txt")) { Console.Write(item); } /// <summary> /// 异步读取每行内容 /// </summary> /// <param name="fileName">指定文件的 阅读全文
posted @ 2019-11-26 20:44 wesson2019 阅读(281) 评论(0) 推荐(0)
摘要: 节省内存消耗。 /// <summary> /// 字节流,包装流以实现高效的异步字节访问 /// </summary> public sealed class ByteStream : IDisposable { private readonly Stream _stream; private r 阅读全文
posted @ 2019-11-26 20:25 wesson2019 阅读(237) 评论(0) 推荐(0)
摘要: IncompletionOrder 阅读全文
posted @ 2019-11-25 13:44 wesson2019 阅读(331) 评论(0) 推荐(0)
摘要: C# 多线程高并发的情况下,怎么让数据先到先执行? using System.Collections.Concurrent; using System.Threading; using System.Threading.Tasks; ConcurrentQueue<string> _queue = 阅读全文
posted @ 2019-11-20 10:13 wesson2019 阅读(593) 评论(0) 推荐(0)