TextFileSettings.Set

I am able to read successfully from the following file called UserSettings.txt:

RegionName AUS

using the following code:

var settings = new MultiAppSettingsBuilder()
                   .AddAppSettings()
                   .AddTextFile("~/UserSettings.txt".MapProjectPath())
                   .Build();
var regionName = settings.GetString("RegionName");

//regionName is "AUS"

However, when I want to write an updated value to the text file in question it is not changed:

var settings = new TextFileSettings("~/UserSettings.txt".MapProjectPath());
settings.Set("RegionName", "UK"); 

//The RegionName value in the UserSettings file is still "AUS"

There are no errors being thrown.

Please note in the documentation that the values are shadowed in TextFileSettings, i.e. they’re overwritten in memory only.

Hi Demis,

I’m not entirely sure what you mean here. So, is it not possible to set a value using TextFileSettings?

The values aren’t written to the underlying file source in TextFileSettings, no.