共用方式為


IVsSettingsWriter.WriteSettingString(String, String) Method

Definition

Stores a string value in the Visual Studio settings file.

public:
 int WriteSettingString(System::String ^ pszSettingName, System::String ^ pszSettingValue);
public:
 int WriteSettingString(Platform::String ^ pszSettingName, Platform::String ^ pszSettingValue);
int WriteSettingString(std::wstring const & pszSettingName, std::wstring const & pszSettingValue);
public int WriteSettingString (string pszSettingName, string pszSettingValue);
abstract member WriteSettingString : string * string -> int
Public Function WriteSettingString (pszSettingName As String, pszSettingValue As String) As Integer

Parameters

pszSettingName
String

[in] String uniquely identifying the data element to be stored

pszSettingValue
String

[in] String to be stored as the specified data element of the Visual Studio settings file.

Returns

If the method succeeds, it returns S_OK. If it fails, it returns an error code.

Remarks

COM Signature

From vsshell80.idl:

HRESULT WriteSettingString(  
   LPCOLESTR pszSettingName,   
   LPCOLESTR pszSettingValue  
);  

The names specified by pfSettingValue need to be unique within a Custom Settings Point (settings category), as the IDE uses the Custom Settings Point identifying GUID and the value of pfSettingValue to identify each saved setting.

If more than one IVsSettingsWriter method is called with the same value of pszSettingName, the original value is overwritten in the Visual Studio settings file.

Because the value of pfSettingValue must be unique, the order of calling WriteSettingString with respect to other methods of the IVsSettingsReader interface is not relevant.

Applies to