VCCodeIDLCoClass.BodyText 屬性

取得或設定物件的主體文字。

命名空間:  Microsoft.VisualStudio.VCCodeModel
組件:  Microsoft.VisualStudio.VCCodeModel (在 Microsoft.VisualStudio.VCCodeModel.dll 中)

語法

'宣告
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)

屬性值

型別:System.String
物件的主體文字。

備註

本文定義為宣告的大括號之間的文字 (' {' 和 '}') 的物件所代表的程式碼項目。

如需這個範例的編譯與執行等詳細資訊,請參閱 HOW TO:編譯 Visual C++ 程式碼模型擴充性的範例程式碼

範例

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 安全性

請參閱

參考

VCCodeIDLCoClass 介面

Microsoft.VisualStudio.VCCodeModel 命名空間