다음을 통해 공유


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 = 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 참조할 매개 변수의 이름을 지정합니다.

생성자

Name Description
CodeArgumentReferenceExpression()

CodeArgumentReferenceExpression 클래스의 새 인스턴스를 초기화합니다.

CodeArgumentReferenceExpression(String)

지정된 매개 변수 이름을 사용하여 클래스의 CodeArgumentReferenceExpression 새 인스턴스를 초기화합니다.

속성

Name Description
ParameterName

이 식이 참조하는 매개 변수의 이름을 가져오거나 설정합니다.

UserData

현재 개체에 대한 사용자 정의 데이터를 가져옵니다.

(다음에서 상속됨 CodeObject)

메서드

Name Description
Equals(Object)

지정된 개체가 현재 개체와 같은지 여부를 확인합니다.

(다음에서 상속됨 Object)
GetHashCode()

기본 해시 함수로 사용됩니다.

(다음에서 상속됨 Object)
GetType()

현재 인스턴스의 Type 가져옵니다.

(다음에서 상속됨 Object)
MemberwiseClone()

현재 Object단순 복사본을 만듭니다.

(다음에서 상속됨 Object)
ToString()

현재 개체를 나타내는 문자열을 반환합니다.

(다음에서 상속됨 Object)

적용 대상