DLDLibrary 1.0.6

There is a newer version of this package available.
See the version list below for details.
dotnet add package DLDLibrary --version 1.0.6
                    
NuGet\Install-Package DLDLibrary -Version 1.0.6
                    
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="DLDLibrary" Version="1.0.6" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="DLDLibrary" Version="1.0.6" />
                    
Directory.Packages.props
<PackageReference Include="DLDLibrary" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add DLDLibrary --version 1.0.6
                    
#r "nuget: DLDLibrary, 1.0.6"
                    
#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.
#:package DLDLibrary@1.0.6
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=DLDLibrary&version=1.0.6
                    
Install as a Cake Addin
#tool nuget:?package=DLDLibrary&version=1.0.6
                    
Install as a Cake Tool

说明

封装常用的第三方库的基础使用方法。

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 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.8 204 11/27/2025
1.0.7 399 3/23/2023
1.0.6 343 3/23/2023
1.0.5 351 3/22/2023
1.0.4 378 3/6/2023
1.0.3 366 3/6/2023
1.0.2 376 3/4/2023
1.0.1 368 3/4/2023
1.0.0 385 3/3/2023