Legend
| Method: void SaveInBackground()
Declarationpublic void SaveInBackground() SummarySaves settings on a background thread after a short delay. See Remarks.Remarks
This method can be called as often as necessary. It is cheap to call frequently, and will only save at most
once every SettingsFile<TSettings>.Background
This method may be safely interleaved with calls to SettingsFile<TSettings>.Save( Save errors are ignored; it is not possible to detect a failed background save. However, on file sharing violation a new background save is scheduled automatically.
If the process exits with a background save pending, the background save is lost. Make sure to call SettingsFile<TSettings>.Save( If TSettings implements ICloneable the object is cloned on every call and it is the clone that is scheduled for saving. Otherwise the SettingsFile<TSettings>.Settings object is saved as-is, meaning that any changes made after the call to SettingsFile<TSettings>.SaveInBackground() may end up getting saved.
You must consider thread safety when modifying the SettingsFile<TSettings>.Settings object if you use this method. The
background save thread expects to be able to read it consistently: in the ICloneable case it's
at the time of this call on the calling thread; otherwise it's at an unspecified time on a thread pool thread.
In particular, basic .NET collections such as Dictionary will break if read and modified simultaneously from
multiple threads. You should either implement ICloneable and synchronize the call to this method
with all changes to SettingsFile<TSettings>.Settings yourself, or you must wrap all changes to SettingsFile<TSettings>.Settings in
a lock of SettingsFile<TSettings>.Background |