C# 第三方库

基本上选用的都是 https://www.nuget.org 分类中最流行的那个库 

1. 日志工具库

NLOG 和 serilog

Stackify.com 简单入门文章  https://stackify.com/nlog-vs-log4net-vs-serilog/

NLog 支持结构化log输出,  下面是两种写法: 

# json format log
logger.Info("{@actionDetails}", new {person="harry", action="buy a book", book="Master C# in 21 days"});

#key=value format log 
logger.Info("{actionDetails}", new {person="harry", action="buy a book", book="Master C# in 21 days"});

 Nlog 可以直接将日志输出到richtextbox 文本框中, 非常实用.

 

2. REST 客户端

RestSharp 和  FlUrl,    HttpClient 客户端  https://flurl.dev/

 

3. JSON 处理

Newtonsoft.Json

 

3.  App.config 文件自定义ConfigSection 的 auto 配置

https://github.com/edpollitt/Nerdle.AutoConfig

 

4. ORM 工具

Dapper   https://dapper-tutorial.net/

 

5. 嵌入数据库

System.Data.SQLite

 

6. 条码/二维码

QRCoder 和 ZXing.Net 

 

7.  通讯类组件

7.0  串口通讯 https://www.nuget.org/packages/GodSharp.SerialPort/

7.1 Modbus 通讯组件

    NModbus 包  https://github.com/NModbus/NModbus

7.2 西门子通讯组件 Snap7  或者 S7.net   https://www.bilibili.com/read/cv27227756/  https://zhuanlan.zhihu.com/p/364106300

7.3 Fins协议通讯组件, 

   .net Framework 类库  https://github.com/ping9719/OmronFinsTCP.Net
   .net core 类库 https://github.com/ricado-group/dotnet-omron

 

8. 报表

FastReport 开源版限制很多, 不能用于Winform项目不能导出PDF, 所以还是推荐使用 FastReport .net 商业版 

QuestPDF 是另一个选择, 开源无功能限制,  https://www.questpdf.com/

 

9. 组件包(winform)

  澳洲 ComponentFactory 出品的 Krypton , 2006~2014年是商业组件包, 由于销售不佳, 现在已经转为开源,  可见开发工具厂商即使是在澳洲,  也不太好生存. 

  https://github.com/ComponentFactory/Krypton

 这个仓库有nuget 的下载链接,  https://github.com/Wagnerp/Krypton-NET-Version-Dashboard

nuget 下载 Wagnerp 发布的, 注意版本 naming rule ,比如 Wagnerp Krypton 版本 5.472 对应的是.Net 4.7.2

 

10. Docking 控制组件  (WinForm)

  Krypton 包也包含dock panel, 这个 dockpanelsuite 组件包, 这个是 WeifenLuo.WinFormsUI.Docking 后续版本

  https://github.com/dockpanelsuite/dockpanelsuite

  简单入门: 开源组件 DockPanelSuite使用

 

11. Grid 组件(WinForm)

 曾经用过 AdvancedDataGridView, 问题很多,  现在使用 objectListView 非常好用.

 

12. Winform 下工控组件包

SeeSharpTools 和  HZH_Controls

有一些很实用的通用组件, 更有一些工控类控件,

 

 

12. winform 下的 AGauge

https://www.nuget.org/packages/AGauge_V2/2.0.2

https://github.com/Code-Artist/AGauge

 

16.  Chart 组件 , winforms 下使用 scottChart , Blazor 下使用 livechart2 (基于 svg, 美观度要求不高的场景)

 

17. Redis 客户端 StackExchange.Redis

    StackExchange.Redis 是 Stackoverflow 公司开源的, 质量有保证.

 

18.  轻量级的Web 框架 Nancy 和 Nancy.Hosting.Self

     引入 Nancy 不是开发 Web 应用,  是开发 RPC 服务器,  Nancy 是一个轻量级的Web 框架, Nacy.Hosting.Self 是一个轻量级的Web 服务器.

 

19. Winform 下的 RichTextBox 增强

    https://www.nuget.org/packages/RichTextBoxEx

 

20. Template engine

  如需要功能强大的, 可选 scriban, 语法和 Jinja2/Liquid 类似,

    https://github.com/lunet-io/scriban

   如仅需要基本功能, 可以选用 https://github.com/thomaslevesque/NString   , 下面是示例: 

//NString模板示例:使用 Dictionary<string, object> 为模板传参,dictionary类型必须是<string,object>
Dictionary<string, object> dict = new Dictionary<string, object>();
dict.Add("Name", "a");
dict.Add("DateOfBirth", "b");
string text = StringTemplate.Format("{Name} was born on {DateOfBirth}", dict, false);
Console.WriteLine(text);

//NString模板示例:使用对象为模板传参
var joe = new { Name = "Joe", DateOfBirth = new DateTime(1980, 6, 22) };
string text2 = StringTemplate.Format("{Name} was born on {DateOfBirth:D}", joe);
Text = text2;
Console.WriteLine(text2); 

 

 

21. syntax highlight text editor

https://github.com/StefH/ICSharpCode.TextEditorEx

 

22.  diagram 

https://github.com/dalssoft/diagramnet

 

23. litedb, 嵌入型的mongodb

https://www.litedb.org/

 

24.  ObjectListView 免费的ListView, 支持treelist, 分组和Master-Detail 呈现

 

25.  ReoGrid , 免费的 spreedsheet 组件, 强大到令人发指, 甚至可以比拟 Excel

 

26. morelinq 和 ZZZ project 提供的 System.Linq.Dynamic

 

27.Masuit.Tools 工具类包 , 类似于Java 的 Hutool

 

28. String处理类库  NString  https://github.com/thomaslevesque/NString

 

29. ZZZ project 提供的 工具类包

    https://github.com/zzzprojects/Z.ExtensionMethods

 

30. autoMapper, Model类和DTO/ViewModel类转换工具

 

31.  最重要的参考项目,  git extensions  , 可以学到很多东西

 

32. MiniExcel 和 NPOI 包, 用于 导出Excel  

  MiniExcel 速度更快,

  NPOI 可支持更老的Framework 版本, 参考代码:  https://www.thecodebuzz.com/read-and-write-excel-file-in-net-core-using-npoi/

 

33 Spire.XLS 和 Spire.Pdf  Excel和PDF 商业组件(国产)

 

 34. 表达式组件.net framework版 表达式计算 Ncalc,  https://github.com/ncalc/ncalc

   .net core 版表达式组件 https://github.com/mparlak/Flee

    zzz project 的 z.expression.eval 收费

35. Fody 的 ToString

36. Fody 的 NullGaurd

 37. Glob  库, 按照文件名通配符搜索文件  https://www.nuget.org/packages/Glob/

38. 混淆器,   ConfuserEx 稳定性好

39. ID 生成算法包 NewId,   https://www.nuget.org/packages/NewId

40. 依赖注入框架 .net framework 下使用  NInject , .net core 使用微软官方即可

41. 分布式MQ : RabbitMQ+EasyNetQ,  使用RabbitMQ作为偏事务型的分布式MQ, 可靠性还是最好的.  EasyNetQ 客户端提供了reconnect 等开箱即用的特性

posted @ 2019-07-15 22:12  harrychinese  阅读(5168)  评论(0编辑  收藏  举报