Apq.Cfg.Properties 1.2.1

dotnet add package Apq.Cfg.Properties --version 1.2.1
                    
NuGet\Install-Package Apq.Cfg.Properties -Version 1.2.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="Apq.Cfg.Properties" Version="1.2.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Apq.Cfg.Properties" Version="1.2.1" />
                    
Directory.Packages.props
<PackageReference Include="Apq.Cfg.Properties" />
                    
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 Apq.Cfg.Properties --version 1.2.1
                    
#r "nuget: Apq.Cfg.Properties, 1.2.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 Apq.Cfg.Properties@1.2.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=Apq.Cfg.Properties&version=1.2.1
                    
Install as a Cake Addin
#tool nuget:?package=Apq.Cfg.Properties&version=1.2.1
                    
Install as a Cake Tool

Apq.Cfg.Properties

Gitee Documentation

Java Properties 文件配置源扩展包。

仓库地址:https://gitee.com/apq/Apq.Cfg

📖 在线文档:https://apq-cfg.vercel.app/

依赖

  • Apq.Cfg

默认层级

该配置源的默认层级为 CfgSourceLevels.Properties (0)。

用法

using Apq.Cfg;
using Apq.Cfg.Properties;

var cfg = new CfgBuilder()
    .AddPropertiesFile("config.properties", level: 0, writeable: true)
    .Build();

var appName = cfg["AppName"];
var host = cfg["Database:Host"];
var port = cfg.GetValue<int>("Database:Port");

键路径映射

Properties 区段使用冒号分隔的键路径:

Properties 键 配置键
AppName AppName
[Database] Host Database:Host
[Database] Connection.Timeout Database:Connection:Timeout

Properties 格式示例

# 根级别配置
AppName=MyApp

[Database]
Host=localhost
Port=5432
ConnectionString=Server=localhost;Database=mydb

[Logging]
Level=Information

许可证

MIT License

作者

  • 邮箱:amwpfiqvy@163.com

仓库

  • Gitee:https://gitee.com/apq/Apq.Cfg
Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  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 is compatible.  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.2.1 161 1/17/2026