VCCodeFunction.AddInitializer Method
Adds a C++ initializer to a constructor's member initializer list.
Namespace: Microsoft.VisualStudio.VCCodeModel
Assembly: Microsoft.VisualStudio.VCCodeModel (in Microsoft.VisualStudio.VCCodeModel.dll)
Syntax
'Declaration
Sub AddInitializer ( _
bstrText As String _
)
void AddInitializer(
string bstrText
)
void AddInitializer(
[InAttribute] String^ bstrText
)
abstract AddInitializer :
bstrText:string -> unit
function AddInitializer(
bstrText : String
)
Parameters
- bstrText
Type: System.String
Required. The full text of the initializer.
Examples
This example adds an initialization string to the first function, assuming that the first function has a variable m_func.
Sub AddInitializer()
Dim vcCM As VCCodeModel
Dim vcClass As VCCodeClass
Dim vcVariable As VCCodeVariable
Dim vcFunction As VCCodeFunction
vcCM = DTE.Solution.Item(1).CodeModel
vcClass = vcCM.AddClass("MyClass", "MyClass.h")
vcVariable = vcClass.AddVariable("m_var", "int")
vcFunction = vcClass.AddFunction("MyClass", vsCMFunction.vsCMFunctionConstructor, "")
vcFunction.AddInitializer("m_var(0)")
End Sub
.NET Framework Security
- Full trust for the immediate caller. This member cannot be used by partially trusted code. For more information, see Using Libraries from Partially Trusted Code.