Legend

Class
Struct
Enum
Interface
Delegate
Constructor
Method
Property
Event
Field

Method: bool Save(bool?)

  • Declared in: RT.Serialization.Settings.SettingsFile<TSettings>

Declaration

public bool Save(
    bool? throwOnError = null
)

Summary

Saves the settings object SettingsFile<TSettings>.Settings to the settings file.

Parameters

bool?throwOnError Specifies whether a failure to save settings should be propagated as an exception or silently suppressed (returning false from this method). If null (the default) then the same value is used as was passed into the SettingsFile<TSettings> constructor.

Returns

true if saved successfully. false if the save failed (for example, due to an I/O error). The latter is only possible if errors are suppressed via throwOnError.

Remarks

This method interacts with SettingsFile<TSettings>.SaveInBackground() by cancelling any pending background saves and making sure that the current Settings object is the one that gets persisted last, overwriting any previous changes. Thus it is safe to call this to reliably save settings on program exit regardless of any calls to SettingsFile<TSettings>.SaveInBackground() with older versions of the SettingsFile<TSettings>.Settings object.