MConfiguration 1.0.1

dotnet add package MConfiguration --version 1.0.1                
NuGet\Install-Package MConfiguration -Version 1.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="MConfiguration" Version="1.0.1" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add MConfiguration --version 1.0.1                
#r "nuget: MConfiguration, 1.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.
// Install MConfiguration as a Cake Addin
#addin nuget:?package=MConfiguration&version=1.0.1

// Install MConfiguration as a Cake Tool
#tool nuget:?package=MConfiguration&version=1.0.1                

MConfiguration 🛠️

The MConfiguration library provides functionality for reading and updating configuration settings stored in a JSON file.

Usage 🚀

  1. Instantiate the MConfiguration.

    var configManager = new ConfigManager();
    
  2. Retrieve a configuration value by its key.

    string? value = configManager.Get("key");
    
  3. Set a configuration value.

    configManager.Set("key", "value");
    

Methods 🔧

Get

public string? Get(string key)

Retrieves the value associated with the specified key from the configuration.

  • Parameters

    • key: The key of the configuration value to retrieve.
  • Returns

    • A string representing the value associated with the specified key. Returns null if the key is not found or the value is empty.

Set

public void Set(string key, string value)

Sets the value for the specified key in the configuration.

  • Parameters
    • key: The key of the configuration value to set.
    • value: The value to set for the specified key.

GetConfigPath

public string GetConfigPath()

Retrieves the path of the configuration file.

  • Returns
    • A string representing the path of the configuration file.

Dependencies 📦

  • System.Text.Json: For JSON serialization and deserialization.
  • Microsoft.Extensions.Configuration: For configuration management.

Notes 📝

  • Configuration file path is resolved relative to the application's base directory.
  • The configuration file is expected to be in JSON format.
  • Configuration file is automatically reloaded when changes occur.
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. 
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.1 151 2/12/2024
1.0.0 120 2/12/2024