Freigeben über


ISettingsManager.GetOrCreateList(String, Boolean) Method

Definition

Retrieves an existing list or creates a new one if one with the specified name doesn't exist.

public:
 Microsoft::VisualStudio::Settings::ISettingsList ^ GetOrCreateList(System::String ^ name, bool isMachineLocal);
public:
 Microsoft::VisualStudio::Settings::ISettingsList ^ GetOrCreateList(Platform::String ^ name, bool isMachineLocal);
Microsoft::VisualStudio::Settings::ISettingsList GetOrCreateList(std::wstring const & name, bool isMachineLocal);
public Microsoft.VisualStudio.Settings.ISettingsList GetOrCreateList (string name, bool isMachineLocal);
abstract member GetOrCreateList : string * bool -> Microsoft.VisualStudio.Settings.ISettingsList
Public Function GetOrCreateList (name As String, isMachineLocal As Boolean) As ISettingsList

Parameters

name
String

The name of the setting.

isMachineLocal
Boolean

True if the setting is machine-local, otherwise false.

Returns

Returns ISettingsList.

Exceptions

Thrown when name is null.

Thrown when name is empty.

Thrown when the empty list cannot be persisted to the private store (for example, because the disk is full).

Thrown when name exceeds the maximum allowed length.

Remarks

The reason for a special-case "get or create" method for lists (instead of letting the client pass, say, IEnumerable to SetValue to create a list) is to avoid a race condition between two clients in which both are composing lists "offline" at the same time. That would require the client to merge the two list contents (or discard one of the lists). By requiring clients to use this method instead, we ensure that lists are always "live", never "offline", so as soon as one client starts adding content to the list, that content will be visible to all other clients.

Applies to