Partager via


IVsExpansionFunction.GetDefaultValue Method

Returns the default string to be inserted before any template is edited.

Namespace:  Microsoft.VisualStudio.TextManager.Interop
Assembly:  Microsoft.VisualStudio.TextManager.Interop.8.0 (in Microsoft.VisualStudio.TextManager.Interop.8.0.dll)

Syntax

'Déclaration
Function GetDefaultValue ( _
    <OutAttribute> ByRef bstrValue As String, _
    <OutAttribute> ByRef fHasDefaultValue As Integer _
) As Integer
int GetDefaultValue(
    out string bstrValue,
    out int fHasDefaultValue
)
int GetDefaultValue(
    [OutAttribute] String^% bstrValue, 
    [OutAttribute] int% fHasDefaultValue
)
abstract GetDefaultValue : 
        bstrValue:string byref * 
        fHasDefaultValue:int byref -> int 
function GetDefaultValue(
    bstrValue : String, 
    fHasDefaultValue : int
) : int

Parameters

  • bstrValue
    Type: System.String%
    [out] Returns a string that contains the default value.
  • fHasDefaultValue
    Type: System.Int32%
    [out] Returns non-zero (true) if the expansion function has a default value; otherwise, returns zero (false). See Remarks.

Return Value

Type: System.Int32
If the method succeeds, it returns S_OK. If it fails, it returns an error code.

Remarks

COM Signature

From textmgr2.idl:

bool IVsExpansionFunction::GetDefaultValue(
   [out] BSTR *bstrValue,
   [out] bool *fHasDefaultValue
);

All fields in a code snippet can have a default value specified in the snippet file itself. The GetDefaultValue method can supply a dynamically generated default value through an expansion function. If an expansion function does not have a default value, it should always return zero (false) in the fHasDefaultValue parameter. The fHasDefaultValue parameter is often used by the caller of this method to determine whether to update the field in the code snippet.

.NET Framework Security

See Also

Reference

IVsExpansionFunction Interface

Microsoft.VisualStudio.TextManager.Interop Namespace