WS.SaveConfig 1.0.1

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

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

概述

WS.SaveConfig

这是一个自动保存配置文件功能封装。只适用Windows。

例子

public partial class Form1 : Form
	{
		public class MyConfig
		{
			public string Name { get; set; }
		}
		SaveConfig<MyConfig> saveConfig;
		MyConfig Config = new MyConfig();
		public Form1()
		{
			InitializeComponent();
			saveConfig = new SaveConfig<MyConfig>(Config);
			saveConfig.ReadConfig = c =>  // 读取配置文件到Config
			{
				Config = c;
				label1.Text = Config.Name;
			};
			saveConfig.ReadUI = () => // 读取UI值到到Config
			{
				Config.Name = "save";
				return Config;
			};
			// 读取C盘临时目录
			saveConfig.ReadDefaultConfig();
		}

		private void Form1_FormClosed(object sender, FormClosedEventArgs e)
		{
            //关闭窗口时,自动保存配置文件到C盘临时目录 C:\Users\Administrator\AppData\Roaming\{XXX}
			saveConfig.WriteDefaultConfig();
		}
	}
Product Compatible and additional computed target framework versions.
.NET Framework net40 is compatible.  net403 was computed.  net45 was computed.  net451 was computed.  net452 was computed.  net46 was computed.  net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • .NETFramework 4.0

    • No dependencies.

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 182 12/27/2022