DLDLibrary 1.0.6
See the version list below for details.
dotnet add package DLDLibrary --version 1.0.6
NuGet\Install-Package DLDLibrary -Version 1.0.6
<PackageReference Include="DLDLibrary" Version="1.0.6" />
<PackageVersion Include="DLDLibrary" Version="1.0.6" />
<PackageReference Include="DLDLibrary" />
paket add DLDLibrary --version 1.0.6
#r "nuget: DLDLibrary, 1.0.6"
#:package DLDLibrary@1.0.6
#addin nuget:?package=DLDLibrary&version=1.0.6
#tool nuget:?package=DLDLibrary&version=1.0.6
说明
封装常用的第三方库的基础使用方法。
Result
public class Result<T>
{
public bool Success { get; set; }
public int Code { get; set; }
public string? Message { get; set; }
public T? Data { get; set; }
public Result(bool Success, int Code, string? Message, T? Data)
{
this.Success = Success;
this.Code = Code;
this.Message = Message;
this.Data = Data;
}
}
JSONLib
序列化和反序列化JSON,参考js。
序列化:JSONLib.Stringify(Object data) 返回string。
反序列化:JSONLib.Parse<T>(string data) 返回T?。
RedisLib
初始化Redis。
在启动文件中使用RedisLib.Init(string connect) 返回CSRedisClient。
connect是Redis连接字符串
DLDFile
使用IFormFile进行文件上传。
DLDFile.UploadFIle(IFormFile file, string directory, string name) 返回Result<string>。
file是接收到的文件directory是要保存的目录,最后需要带上/name是文件名称,<b>不需要携带后缀</b>
DLDExcel
使用MiniExcel库操作Excel。
读取Excel:
DLDExcel.Get<T>(string path/IFormFile file, string sheetName = null, string startCol = "A1") 返回Result<IEnumerable<T>>
DLDExcel.Get(string path, string sheetName = null, string startCol = "A1") 返回Result<IEnumerable<dynamic>>
path是Excel路径file是Excel文件sheetName是Excel的Sheet名称startCol是开始查询的列
获取所有Sheet名称:DLDExcel.GetSheetNames(string path/IFormFile file) 返回Result<List<string>>
path是Excel路径file是Excel文件
获取所有的列名:DLDExcel.GetCols(string path/IFormFile file, bool showHeader = false) 返回Result<ICollection<string>>
path是Excel路径file是Excel文件- showHeader是否显示自定义的表头,就是表格的第一行
获取带有合并单元格的Excel表数据:
DLDExcel.GetMarge<T>(string path/IFormFile file, string sheetName = null) 返回Result<IEnumerable<T>>
DLDExcel.GetMarge(string path/IFormFile file, string sheetName = null) 返回Result<IEnumerable<dynamic>>
path是Excel路径file是Excel文件sheetName是Excel的Sheet名称
保存数据:DLDExcel.Set(string directory, string name, Dictionary<string, object> sheets) 返回Result<string>
directory是导出Excel表的目录name是导出Excel表的文件名称,<b>需要携带后缀</b>sheets是表数据,例如
var users = new[] { ... };
var department = new[] { ... };
var sheets = new Dictionary<string, object> sheets)
{
["users"] = users,
["department"] department
}
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net6.0 is compatible. 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. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net6.0
- CSRedisCore (>= 3.8.670)
- Microsoft.AspNetCore.Http.Features (>= 5.0.17)
- MiniExcel (>= 1.30.2)
- Newtonsoft.Json (>= 13.0.2)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.