YTUtils 2.0.1
dotnet add package YTUtils --version 2.0.1
NuGet\Install-Package YTUtils -Version 2.0.1
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="YTUtils" Version="2.0.1" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="YTUtils" Version="2.0.1" />
<PackageReference Include="YTUtils" />
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 YTUtils --version 2.0.1
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: YTUtils, 2.0.1"
#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 YTUtils@2.0.1
#: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=YTUtils&version=2.0.1
#tool nuget:?package=YTUtils&version=2.0.1
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
YTUtils 库实用工具 Readme
作者
彭木德
开发起始时间
2024年3月27日
简介
YTUtils 是一个为.NET应用程序提供便捷辅助功能的库。本Readme文件主要介绍库中两个核心组件:
JsonConfigHelper.cs
描述
JsonConfigHelper 类位于 YTUtils.JsonConfigure 命名空间内,是一个专用于读取、写入和管理JSON配置文件的助手类。它借助强大的Json.NET库,实现了简单易用的JSON配置数据加载、编辑和保存功能。
主要特性与功能
- 加载JSON配置文件:能够加载指定文件名的JSON配置文件,如果文件不存在,则创建一个新的空JSON对象并将其写入新文件;
- 键值操作:向JSON配置对象中插入或更新键值对,并能实时同步到文件中;
- 深度读取:支持根据嵌套键路径从JSON配置对象中读取特定键值;
- 数据一致性保证:确保在整个读写过程中数据的一致性和正确性。
使用示例可在各个方法内部的注释说明中查阅。
LogHelper.cs
描述
LogHelper 类同样是YTUtils库的一部分,它是为项目提供统一日志管理的助手类,底层基于log4net库实现。
核心功能
- 多级别日志记录:包含Info、Debug、Error和Fatal四个级别的日志记录方法;
- 自动元数据填充:利用Caller Information特性自动填充日志输出的源文件路径、成员名称及行号,便于追踪问题源头;
- 配置文件处理:在类初始化时,默认读取当前程序的“Config\log4net.config”作为日志配置文件;
- 清理机制:提供了
ReleaseLogerConfigure方法,用于在适当时候删除临时生成的配置文件(如果有)。
开发者可参考类内提供的方法注释来了解具体的使用场景和示例。
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET Framework | net48 is compatible. net481 was computed. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
.NETFramework 4.8
- log4net (>= 2.0.15)
- Newtonsoft.Json (>= 13.0.3)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.