本文整理汇总了C#中ConfigManager.SaveConfig方法的典型用法代码示例。如果您正苦于以下问题:C# ConfigManager.SaveConfig方法的具体用法?C# ConfigManager.SaveConfig怎么用?C# ConfigManager.SaveConfig使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ConfigManager
的用法示例。
在下文中一共展示了ConfigManager.SaveConfig方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Main
static void Main(string[] args)
{
//App name, this is what the folder will be called in Appdata\Local\<appNameSpace>
string appNamespace = "Json2Config.Net";
//Creates the config folder & config.json
ConfigManager burgerCfg = new ConfigManager(appNamespace, "burgerCfg");
ConfigManager securityCfg = new ConfigManager(appNamespace, "securityCfg");
//Get the objects ready
Store myStore = new Store();
myStore.Name = "Bobs Burgers";
Product product1 = new Product() { Name = "Cheese Burgers", Price = 7.99 };
Product product2 = new Product() { Name = "Pizza", Price = 12.49 };
myStore.Products.Add(product1);
myStore.Products.Add(product2);
//Save the objects!
burgerCfg.SaveConfig(myStore);
Company myCompany = new Company();
myCompany.CompanyId = 1;
myCompany.CompanyName = "Jacks Security Folk";
Client client1 = new Client() { ClientId = 1, Name = "Bobs Burgers", WebsiteUrl = "BobsBurgers.biz" };
myCompany.Clients.Add(client1);
securityCfg.SaveConfig(myCompany);
}