Delen via


VCCodeEnum.BodyText Property

Gets or sets the body text of the parent object.

Namespace:  Microsoft.VisualStudio.VCCodeModel
Assembly:  Microsoft.VisualStudio.VCCodeModel (in Microsoft.VisualStudio.VCCodeModel.dll)

Syntax

'Declaration
Property BodyText As String
string BodyText { get; set; }
property String^ BodyText {
    String^ get ();
    void set (String^ value);
}
abstract BodyText : string with get, set
function get BodyText () : String 
function set BodyText (value : String)

Property Value

Type: System.String
The body text of the parent object.

Remarks

Body text is defined as the text between the declaration braces ( '{' and '}' ) of the code element represented by the parent object.

See How to: Compile Example Code for Visual C++ Code Model Extensibility for information on how to compile and run this sample.

Examples

Imports EnvDTE
Imports System.Diagnostics
Imports VisualStudio.VCCodeModel

Public Module MyMacro

  ' Adds a function to MyClass.
    Sub AddFunctionCode()
        Dim cm As VCCodeModel
        cm = DTE.Solution.Item(1).CodeModel
        Dim cl As VCCodeClass
        cl = cm.Classes.Item("MyClass")
        Dim strBody As String
        strBody = "return 0;"
        Dim func1 As VCCodeFunction
        func1 = cl.AddFunction("MyFunction", vsCMFunction.vsCMFunctionFunction, "int")
        ' Sets the property BodyText to strBody.
        func1.BodyText = strBody
    End Sub

End Module

.NET Framework Security

See Also

Reference

VCCodeEnum Interface

Microsoft.VisualStudio.VCCodeModel Namespace