CodeArgumentReferenceExpression クラス

定義

メソッドに渡される引数の値への参照を表します。

public ref class CodeArgumentReferenceExpression : System::CodeDom::CodeExpression
public class CodeArgumentReferenceExpression : System.CodeDom.CodeExpression
[System.Runtime.InteropServices.ClassInterface(System.Runtime.InteropServices.ClassInterfaceType.AutoDispatch)]
[System.Runtime.InteropServices.ComVisible(true)]
[System.Serializable]
public class CodeArgumentReferenceExpression : System.CodeDom.CodeExpression
type CodeArgumentReferenceExpression = class
    inherit CodeExpression
[<System.Runtime.InteropServices.ClassInterface(System.Runtime.InteropServices.ClassInterfaceType.AutoDispatch)>]
[<System.Runtime.InteropServices.ComVisible(true)>]
[<System.Serializable>]
type CodeArgumentReferenceExpression = class
    inherit CodeExpression
Public Class CodeArgumentReferenceExpression
Inherits CodeExpression
継承
CodeArgumentReferenceExpression
属性

次のコード例では、メソッドに渡される文字列パラメーターを出力するために呼び出 Console.WriteLine すメソッドを定義します。 メソッド CodeArgumentReferenceExpression パラメーター名によってメソッドに渡される引数を参照します。

// Declare a method that accepts a string parameter named text.
CodeMemberMethod^ cmm = gcnew CodeMemberMethod;
cmm->Parameters->Add( gcnew CodeParameterDeclarationExpression( "String","text" ) );
cmm->Name = "WriteString";
cmm->ReturnType = gcnew CodeTypeReference( "System::Void" );
array<CodeExpression^>^ce = {gcnew CodeArgumentReferenceExpression( "test1" )};

// Create a method invoke statement to output the string passed to the method.
CodeMethodInvokeExpression^ cmie = gcnew CodeMethodInvokeExpression( gcnew CodeTypeReferenceExpression( "Console" ),"WriteLine",ce );

// Add the method invoke expression to the method's statements collection.
cmm->Statements->Add( cmie );

// A C++ code generator produces the following source code for the preceeding example code:
// private:
//  void WriteString(String text) {
//       Console::WriteLine(text);
// }
// Declare a method that accepts a string parameter named text.
CodeMemberMethod cmm = new CodeMemberMethod();
cmm.Parameters.Add( new CodeParameterDeclarationExpression("String", "text") );
cmm.Name = "WriteString";
cmm.ReturnType = new CodeTypeReference("System.Void");

// Create a method invoke statement to output the string passed to the method.
CodeMethodInvokeExpression cmie = new CodeMethodInvokeExpression( new CodeTypeReferenceExpression("Console"), "WriteLine", new CodeArgumentReferenceExpression("text") );

// Add the method invoke expression to the method's statements collection.
cmm.Statements.Add( cmie );

// A C# code generator produces the following source code for the preceeding example code:
//        private void WriteString(String text)
//        {
//            Console.WriteLine(text);
//        }
 ' Declare a method that accepts a string parameter named text.
 Dim cmm As New CodeMemberMethod()
 cmm.Parameters.Add(New CodeParameterDeclarationExpression("String", "text"))
 cmm.Name = "WriteString"
 cmm.ReturnType = New CodeTypeReference("System.Void")
 
 ' Create a method invoke statement to output the string passed to the method.
 Dim cmie As New CodeMethodInvokeExpression(New CodeTypeReferenceExpression("Console"), "WriteLine", New CodeArgumentReferenceExpression("text"))
 
 ' Add the method invoke expression to the method's statements collection.
 cmm.Statements.Add(cmie)

 ' A Visual Basic code generator produces the following source code for the preceeding example code:
 '		Private Sub WriteString(ByVal [text] As [String])
 '			Console.WriteLine([text])
 '		End Sub

注釈

CodeArgumentReferenceExpression は、メソッドに渡されたパラメーターの値を参照するためにメソッドで使用できます。

このプロパティは ParameterName 、参照するパラメーターの名前を指定します。

コンストラクター

CodeArgumentReferenceExpression()

CodeArgumentReferenceExpression クラスの新しいインスタンスを初期化します。

CodeArgumentReferenceExpression(String)

パラメーター名を指定して、CodeArgumentReferenceExpression クラスの新しいインスタンスを初期化します。

プロパティ

ParameterName

この式が参照するパラメーターの名前を取得または設定します。

UserData

現在のオブジェクトのユーザー定義可能なデータを取得します。

(継承元 CodeObject)

メソッド

Equals(Object)

指定されたオブジェクトが現在のオブジェクトと等しいかどうかを判断します。

(継承元 Object)
GetHashCode()

既定のハッシュ関数として機能します。

(継承元 Object)
GetType()

現在のインスタンスの Type を取得します。

(継承元 Object)
MemberwiseClone()

現在の Object の簡易コピーを作成します。

(継承元 Object)
ToString()

現在のオブジェクトを表す文字列を返します。

(継承元 Object)

適用対象