SharpDevLib 1.1.0

dotnet add package SharpDevLib --version 1.1.0
NuGet\Install-Package SharpDevLib -Version 1.1.0
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="SharpDevLib" Version="1.1.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add SharpDevLib --version 1.1.0
#r "nuget: SharpDevLib, 1.1.0"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install SharpDevLib as a Cake Addin
#addin nuget:?package=SharpDevLib&version=1.1.0

// Install SharpDevLib as a Cake Tool
#tool nuget:?package=SharpDevLib&version=1.1.0

sharp-dev-lib

介绍

sharp-dev-lib是c#中经常用到的工具库,基本都采用扩展的方式,方便客户端调用。

依赖说明

sharp-dev-lib使用.netstandard2.0框架,依赖第三方库如下:

  • Newtonsoft.Json (>= 13.0.1) 用于对序列化及对json格式美化

  • SixLabors.Fonts (>= 1.0.0-beta17)

  • SixLabors.ImageSharp.Drawing (>= 1.0.0-beta14) 用于画验证码

  • DotNetZip (>= 1.16.0) 用于文件压缩

  • SharpCompress (>= 0.31.0) 用于文件解压

安装教程

  1. 从nuget包管理器中搜索安装SharpDevLib

  2. 在Package Manager中执行命令

Install-Package SharpDevLib -Version 1.1
  1. 在dotnet cli中执行命令
dotnet add package SharpDevLib --version 1.1

使用说明

如果我们想对一个字符串进行md5 hash,代码示例如下:

//using SharpDevLib;
 public void Md5Test()
 {
    var sampleString="HelloWorld";
    var md5Hash=sampleString.MD5Hash();
    Console.WriteLine(md5Hash);
 }

 //结果:68e109f0f40ca72a15e05cc22786f8e6

sharp-dev-lib包含如下表格的工具

名称 描述 使用
CloneUtil 提供对象的深克隆扩展方法 扩展方法
ConvertUtil 提供格式转换的扩展方法(string转Guid,Boolean) 扩展方法
EncodeUtil 提供Base64,Url,Base64Url的编码和解码扩展方法 扩展方法
EnumerableUtil 提供集合中对对象去重的扩展方法 扩展方法
EnumUtil 提供枚举的取值和转换的扩展方法 扩展方法
HashUtil 提供常用Hash以及文件的扩展方法 扩展方法
JsonUtil 提供Json序列化和反序列化及美化的扩展方法 扩展方法
NullCheckUtil 提供对象的空引用和空值断言的扩展方法 扩展方法
ReflectionUtil 提供对象的类型名称以及确保对象是否包含公有无参构造函数的扩展方法 扩展方法
TimeUtil 提供时间的UTC时间戳转换和输出格式的扩展方法 扩展方法
TreeUtil 提供树形结构构建的扩展方法 实现ITreeNode接口,且在对象集合上使用扩展方法
UrlUtil 提供路径合并的扩展方法 扩展方法
VerifyCodeUtil 提供验证码的生成和保存为图片的扩展方法 扩展方法
ZipUtil 文件的压缩和解压扩展方法 扩展方法
FileUtil 文件保存扩展方法 扩展方法
StringUtil Trim扩展方法 扩展方法

版本说明

时间 版本 描述
2024-04-29 v1.1 添加StringUtil,清理了代码
2022-07-09 v1.0.5 VerifyCodeUtil依赖库由"System.Drawing.Common"变更为"SixLabors.ImageSharp"
2022-05-19 v1.0.4 HashUtil中GetHexString方法重命名为ToHexString,增加FromHexString方法
2022-05-13 v1.0.3 增加1个工具(FileUtil)
2022-05-09 v1.0.2 ConvertUtil工具移除list和DataTable的转换,转换将在SharpDevLib.Extensions包中体现
2022-04-10 v1.0.1 增加1个工具(ZipUtil),添加nuget打包的注释
2022-04-08 v1.0.0 初始化13个工具(CloneUtil,ConvertUtil,EncodeUtil,EnumerableUtil,EnumUtil,HashUtil,JsonUtil,NullCheckUtil,ReflectionUtil,TimeUtil,TreeUtil,UrlUtil,VerifyCodeUtil)
Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
.NET Core netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.1 is compatible. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on SharpDevLib:

Package Downloads
SharpDevLib.Extensions

csharp development third party middlewares or commonly used service

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.1.0 44 4/29/2024
1.0.6 53 4/26/2024
1.0.5 6,565 7/9/2022
1.0.4 4,219 5/19/2022
1.0.3 379 5/13/2022
1.0.2 400 5/9/2022
1.0.1 410 4/10/2022
1.0.0 395 4/8/2022

add commonly used utils