CodeArgumentReferenceExpression クラスとは? わかりやすく解説

Weblio 辞書 > コンピュータ > .NET Framework クラス ライブラリ リファレンス > CodeArgumentReferenceExpression クラスの意味・解説 

CodeArgumentReferenceExpression クラス

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

名前空間: System.CodeDom
アセンブリ: System (system.dll 内)
構文構文

<SerializableAttribute> _
<ClassInterfaceAttribute(ClassInterfaceType.AutoDispatch)> _
<ComVisibleAttribute(True)> _
Public Class CodeArgumentReferenceExpression
    Inherits CodeExpression
Dim instance As CodeArgumentReferenceExpression
[SerializableAttribute] 
[ClassInterfaceAttribute(ClassInterfaceType.AutoDispatch)] 
[ComVisibleAttribute(true)] 
public class CodeArgumentReferenceExpression
 : CodeExpression
[SerializableAttribute] 
[ClassInterfaceAttribute(ClassInterfaceType::AutoDispatch)] 
[ComVisibleAttribute(true)] 
public ref class CodeArgumentReferenceExpression
 : public CodeExpression
/** @attribute SerializableAttribute() */ 
/** @attribute ClassInterfaceAttribute(ClassInterfaceType.AutoDispatch) */ 
/** @attribute ComVisibleAttribute(true) */ 
public class CodeArgumentReferenceExpression
 extends CodeExpression
SerializableAttribute 
ClassInterfaceAttribute(ClassInterfaceType.AutoDispatch) 
ComVisibleAttribute(true) 
public class CodeArgumentReferenceExpression
 extends CodeExpression
解説解説

メソッド内で CodeArgumentReferenceExpression使用して、そのメソッド渡されパラメータの値を参照できます

ParameterName プロパティ使用して参照するパラメータの名前を指定します

使用例使用例

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

' 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
// 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.
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.get_Parameters().Add(new CodeParameterDeclarationExpression("String"
,
    "text"));
cmm.set_Name("WriteString");
cmm.set_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 CodeExpression[] { new CodeArgumentReferenceExpression("text")});
// Add the method invoke expression to the method's statements collection.
cmm.get_Statements().Add(cmie);
// A VJ# code generator produces the following source code for
// the preceeding example code:        
//        private void WriteString(String text) 
//        {
//            Console.WriteLine(text);
//        } //WriteString                      
継承階層継承階層
System.Object
   System.CodeDom.CodeObject
     System.CodeDom.CodeExpression
      System.CodeDom.CodeArgumentReferenceExpression
スレッド セーフスレッド セーフ
この型の public static (Visual Basic では Shared) メンバはすべて、スレッド セーフです。インスタンス メンバ場合は、スレッド セーフであるとは限りません。
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
CodeArgumentReferenceExpression メンバ
System.CodeDom 名前空間



英和和英テキスト翻訳>> Weblio翻訳
英語⇒日本語日本語⇒英語
  

辞書ショートカット

すべての辞書の索引

「CodeArgumentReferenceExpression クラス」の関連用語

CodeArgumentReferenceExpression クラスのお隣キーワード
検索ランキング

   

英語⇒日本語
日本語⇒英語
   



CodeArgumentReferenceExpression クラスのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

   
日本マイクロソフト株式会社日本マイクロソフト株式会社
© 2025 Microsoft.All rights reserved.

©2025 GRAS Group, Inc.RSS