CodeParameterDeclarationExpression 클래스

정의

메서드, 속성 또는 생성자에 대한 매개 변수 선언을 나타냅니다.

public ref class CodeParameterDeclarationExpression : System::CodeDom::CodeExpression
public class CodeParameterDeclarationExpression : System.CodeDom.CodeExpression
[System.Runtime.InteropServices.ClassInterface(System.Runtime.InteropServices.ClassInterfaceType.AutoDispatch)]
[System.Runtime.InteropServices.ComVisible(true)]
[System.Serializable]
public class CodeParameterDeclarationExpression : System.CodeDom.CodeExpression
type CodeParameterDeclarationExpression = class
    inherit CodeExpression
[<System.Runtime.InteropServices.ClassInterface(System.Runtime.InteropServices.ClassInterfaceType.AutoDispatch)>]
[<System.Runtime.InteropServices.ComVisible(true)>]
[<System.Serializable>]
type CodeParameterDeclarationExpression = class
    inherit CodeExpression
Public Class CodeParameterDeclarationExpression
Inherits CodeExpression
상속
CodeParameterDeclarationExpression
특성

예제

다음 예제에서는 를 사용하여 CodeParameterDeclarationExpression 다른 FieldDirection 필드 참조 형식 지정자를 사용하여 메서드의 매개 변수를 선언하는 방법을 보여 줍니다.

// Declares a method.
CodeMemberMethod^ method1 = gcnew CodeMemberMethod;
method1->Name = "TestMethod";

// Declares a string parameter passed by reference.
CodeParameterDeclarationExpression^ param1 = gcnew CodeParameterDeclarationExpression( "System.String","stringParam" );
param1->Direction = FieldDirection::Ref;
method1->Parameters->Add( param1 );

// Declares a Int32 parameter passed by incoming field.
CodeParameterDeclarationExpression^ param2 = gcnew CodeParameterDeclarationExpression( "System.Int32","intParam" );
param2->Direction = FieldDirection::Out;
method1->Parameters->Add( param2 );

// A C# code generator produces the following source code for the preceeding example code:
//        private void TestMethod(ref string stringParam, out int intParam) {
//        }
// Declares a method.
CodeMemberMethod method1 = new CodeMemberMethod();
method1.Name = "TestMethod";

// Declares a string parameter passed by reference.
CodeParameterDeclarationExpression param1 = new CodeParameterDeclarationExpression("System.String", "stringParam");
param1.Direction = FieldDirection.Ref;
method1.Parameters.Add(param1);

// Declares a Int32 parameter passed by incoming field.
CodeParameterDeclarationExpression param2 = new CodeParameterDeclarationExpression("System.Int32", "intParam");
param2.Direction = FieldDirection.Out;
method1.Parameters.Add(param2);

// A C# code generator produces the following source code for the preceeding example code:

//        private void TestMethod(ref string stringParam, out int intParam) {
//        }
           ' Declares a method.
           Dim method1 As New CodeMemberMethod()
           method1.Name = "TestMethod"

           ' Declares a string parameter passed by reference.
           Dim param1 As New CodeParameterDeclarationExpression("System.String", "stringParam")
           param1.Direction = FieldDirection.Ref
           method1.Parameters.Add(param1)

           ' Declares a Int32 parameter passed by incoming field.
           Dim param2 As New CodeParameterDeclarationExpression("System.Int32", "intParam")
           param2.Direction = FieldDirection.Out
           method1.Parameters.Add(param2)

           ' A Visual Basic code generator produces the following source code for the preceeding example code:

           '	 Private Sub TestMethod(ByRef stringParam As String, ByRef intParam As Integer)
           '    End Sub

설명

CodeParameterDeclarationExpression 메서드, 속성 또는 생성자에 대한 매개 변수를 선언하는 코드를 나타내는 데 사용할 수 있습니다.

속성은 Name 매개 변수의 이름을 지정합니다. 속성은 Type 매개 변수의 데이터 형식을 지정합니다. 속성은 Direction 매개 변수의 방향 한정자를 지정합니다. 속성은 CustomAttributes 매개 변수와 연결된 특성을 지정합니다.

생성자

CodeParameterDeclarationExpression()

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

CodeParameterDeclarationExpression(CodeTypeReference, String)

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

CodeParameterDeclarationExpression(String, String)

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

CodeParameterDeclarationExpression(Type, String)

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

속성

CustomAttributes

매개 변수 선언의 사용자 지정 특성을 가져오거나 설정합니다.

Direction

필드의 방향을 가져오거나 설정합니다.

Name

매개 변수의 이름을 가져오거나 설정합니다.

Type

매개 변수의 유형을 가져오거나 설정합니다.

UserData

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

(다음에서 상속됨 CodeObject)

메서드

Equals(Object)

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

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

기본 해시 함수로 작동합니다.

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

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

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

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

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

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

(다음에서 상속됨 Object)

적용 대상

추가 정보