다음을 통해 공유


ParameterAttributes 열거형

매개 변수와 관련될 수 있는 특성을 정의합니다. 이러한 특성은 CorHdr.h에 정의됩니다.

이 열거형에는 멤버 값를 비트로 조합할 수 있는 FlagsAttribute 특성이 있습니다.

네임스페이스: System.Reflection
어셈블리: mscorlib(mscorlib.dll)

구문

‘선언
<SerializableAttribute> _
<ComVisibleAttribute(True)> _
<FlagsAttribute> _
Public Enumeration ParameterAttributes
‘사용 방법
Dim instance As ParameterAttributes
[SerializableAttribute] 
[ComVisibleAttribute(true)] 
[FlagsAttribute] 
public enum ParameterAttributes
[SerializableAttribute] 
[ComVisibleAttribute(true)] 
[FlagsAttribute] 
public enum class ParameterAttributes
/** @attribute SerializableAttribute() */ 
/** @attribute ComVisibleAttribute(true) */ 
/** @attribute FlagsAttribute() */ 
public enum ParameterAttributes
SerializableAttribute 
ComVisibleAttribute(true) 
FlagsAttribute 
public enum ParameterAttributes

멤버

  멤버 이름 설명
Supported by the .NET Compact Framework HasDefault 매개 변수가 기본값을 갖도록 지정합니다. 
Supported by the .NET Compact Framework HasFieldMarshal 매개 변수에 필드 마샬링 정보가 포함되도록 지정합니다. 
Supported by the .NET Compact Framework In 매개 변수가 입력 매개 변수가 되도록 지정합니다. 
Supported by the .NET Compact Framework Lcid 매개 변수가 lcid(로캘 식별자)가 되도록 지정합니다. 
Supported by the .NET Compact Framework None 매개 변수 특성이 없도록 지정합니다. 
Supported by the .NET Compact Framework Optional 매개 변수를 선택적 요소로 지정합니다. 
Supported by the .NET Compact Framework Out 매개 변수가 출력 매개 변수가 되도록 지정합니다. 
Supported by the .NET Compact Framework Reserved3 예약되었습니다.  
Supported by the .NET Compact Framework Reserved4 예약되었습니다.  
Supported by the .NET Compact Framework ReservedMask 매개 변수가 예약되도록 지정합니다. 
Supported by the .NET Compact Framework Retval 매개 변수가 반환 값이 되도록 지정합니다. 

설명

ParameterAttributes 값을 가져오려면 먼저 Type을 가져옵니다. Type에서 ParameterInfo 배열을 가져옵니다. ParameterAttributes 값은 배열 안에 있습니다.

이러한 열거자 값은 선택적 메타데이터에 따라 달라집니다. 일부 컴파일러에 사용할 수 없는 특성도 있습니다. 사용할 수 있는 열거형 값을 확인하려면 해당 컴파일러 지침을 참조하십시오.

예제

다음 예제에서는 지정된 매개 변수의 특성을 표시합니다.

Imports System
Imports System.Reflection
Imports Microsoft.VisualBasic

Class paramatt

    Public Shared Sub mymethod(ByVal str1 As String, ByRef str2 As String, _
    ByRef str3 As String)
        str2 = "string"
    End Sub

    Public Shared Function Main() As Integer
        Console.WriteLine(ControlChars.CrLf + "Reflection.ParameterAttributes")

        ' Get the Type and the method.
        Dim Mytype As Type = Type.GetType("paramatt")
        Dim Mymethodbase As MethodBase = Mytype.GetMethod("mymethod")

        ' Display the method.
        Console.WriteLine("Mymethodbase = " + Mymethodbase.ToString())

        ' Get the ParameterInfo array.
        Dim Myarray As ParameterInfo() = Mymethodbase.GetParameters()

        ' Get and display the attributes for the second parameter.
        Dim Myparamattributes As ParameterAttributes = Myarray(1).Attributes

        Console.WriteLine("For the second parameter:" + ControlChars.CrLf _
           + "Myparamattributes = " + CInt(Myparamattributes).ToString() _
           + ", which is a " + Myparamattributes.ToString())

        Return 0
    End Function
End Class
using System;
using System.Reflection;
 
class paramatt
{
    public static void mymethod (string str1, out string str2, ref string str3)
    {
        str2 = "string";
    }
    
    public static int Main(string[] args)
    {
        Console.WriteLine("\nReflection.ParameterAttributes");
  
        // Get the Type and the method.
  
        Type Mytype = Type.GetType("paramatt");
        MethodBase Mymethodbase = Mytype.GetMethod("mymethod");
  
        // Display the method.
        Console.Write("\nMymethodbase = " + Mymethodbase);
  
        // Get the ParameterInfo array.
        ParameterInfo[] Myarray = Mymethodbase.GetParameters();
  
        // Get and display the attributes for the second parameter.
        ParameterAttributes Myparamattributes = Myarray[1].Attributes;
  
        Console.Write("\nFor the second parameter:\nMyparamattributes = " 
            + (int) Myparamattributes
            + ", which is an "
            + Myparamattributes.ToString());
  
        return 0;
    }
}
using namespace System;
using namespace System::Reflection;
using namespace System::Runtime::InteropServices;
public ref class paramatt
{
public:
   static void mymethod( String^ str1, [Out]interior_ptr<String^> str2, interior_ptr<String^> str3 )
   {
       *str2 = "string";
   }

};

int main()
{
   Console::WriteLine( "\nReflection.ParameterAttributes" );
   
   // Get the Type and the method.
   Type^ Mytype = Type::GetType( "paramatt" );
   MethodBase^ Mymethodbase = Mytype->GetMethod( "mymethod" );
   
   // Display the method.
   Console::Write( "\nMymethodbase = {0}", Mymethodbase );
   
   // Get the ParameterInfo array.
   array<ParameterInfo^>^Myarray = Mymethodbase->GetParameters();
   
   // Get and display the attributes for the second parameter.
   ParameterAttributes Myparamattributes = Myarray[ 1 ]->Attributes;
   Console::Write( "\nFor the second parameter:\nMyparamattributes = {0}, which is an {1}", (int)Myparamattributes, Myparamattributes );
   return 0;
}
import System.*;
import System.Reflection.*;

class Paramatt
{   
    public static void Mymethod(String str1,
        /** @ref
         */ String str2,
        /** @ref
         */ String str3)
    {
        str2 = "string";
    } //Mymethod

    public static void main(String[] args)
    {
        Console.WriteLine("\nReflection.ParameterAttributes");

        // Get the Type and the method.
        Type myType = Type.GetType("Paramatt");
        MethodBase myMethodBase = myType.GetMethod("Mymethod");

        // Display the method.
        Console.Write(("\nMymethodbase = " + myMethodBase));

        // Get the ParameterInfo array.
        ParameterInfo myArray[] = myMethodBase.GetParameters();

        // Get and display the attributes for the second parameter.
        ParameterAttributes myParamAttributes = myArray[1].get_Attributes();

        Console.Write(("\nFor the second parameter:\nMyparamattributes = " 
            + (int)(myParamAttributes) + ", which is an " 
            + myParamAttributes.ToString()));
    } //main
} //Paramatt

플랫폼

Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

.NET Framework에서 모든 플래폼의 모든 버전을 지원하지는 않습니다. 지원되는 버전의 목록은 시스템 요구 사항을 참조하십시오.

버전 정보

.NET Framework

2.0, 1.1, 1.0에서 지원

.NET Compact Framework

2.0, 1.0에서 지원

참고 항목

참조

System.Reflection 네임스페이스