次の方法で共有


VCCodeInterface.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)

プロパティ値

型 : String
オブジェクトの本体テキスト。

解説

本体テキストとは、親オブジェクトが表すコード要素のうち、宣言を示す中かっこ ({ }) で囲まれたテキストです。

このサンプル コードをコンパイルして実行する方法については、「方法 : Visual C++ コード モデル機能拡張のプログラム例をコンパイルする」を参照してください。

[Visual Basic]

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 セキュリティ

  • 直前の呼び出し元に対する完全な信頼。このメンバーは、部分的に信頼されているコードから使用することはできません。詳細については、「部分信頼コードからのライブラリの使用」を参照してください。

参照

関連項目

VCCodeInterface インターフェイス

Microsoft.VisualStudio.VCCodeModel 名前空間