ParameterAttributes Sabit listesi

Tanım

Bir parametreyle ilişkilendirilebilen öznitelikleri tanımlar. Bunlar CorHdr.h içinde tanımlanır.

Bu sabit listesi, üyeleri için bit düzeyinde karşılaştırmayı destekler.

public enum class ParameterAttributes
[System.Flags]
public enum ParameterAttributes
[System.Flags]
[System.Serializable]
public enum ParameterAttributes
[System.Flags]
[System.Serializable]
[System.Runtime.InteropServices.ComVisible(true)]
public enum ParameterAttributes
[<System.Flags>]
type ParameterAttributes = 
[<System.Flags>]
[<System.Serializable>]
type ParameterAttributes = 
[<System.Flags>]
[<System.Serializable>]
[<System.Runtime.InteropServices.ComVisible(true)>]
type ParameterAttributes = 
Public Enum ParameterAttributes
Devralma
ParameterAttributes
Öznitelikler

Alanlar

Name Değer Description
None 0

Parametre özniteliği olmadığını belirtir.

In 1

parametresinin bir giriş parametresi olduğunu belirtir.

Out 2

parametresinin bir çıkış parametresi olduğunu belirtir.

Lcid 4

Parametresinin bir yerel ayar tanımlayıcısı (lcid) olduğunu belirtir.

Retval 8

parametresinin bir dönüş değeri olduğunu belirtir.

Optional 16

parametresinin isteğe bağlı olduğunu belirtir.

HasDefault 4096

parametresinin varsayılan bir değere sahip olduğunu belirtir.

HasFieldMarshal 8192

parametresinin alan hazırlama bilgilerine sahip olduğunu belirtir.

Reserved3 16384

Rezerve edilmiş.

Reserved4 32768

Rezerve edilmiş.

ReservedMask 61440

parametresinin ayrılmış olduğunu belirtir.

Örnekler

Aşağıdaki örnek, belirtilen parametrenin özniteliklerini görüntüler.

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;
    }
}
Imports System.Reflection

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

Açıklamalar

Değeri almak ParameterAttributes için önce değerini Typealın. dizininden Typedizisini ParameterInfo alın. ParameterAttributes Değer dizi içindedir.

Bu numaralandırıcı değerleri isteğe bağlı meta verilerine bağlıdır. Tüm öznitelikler tüm derleyicilerde kullanılamaz. Hangi numaralandırılmış değerlerin kullanılabilir olduğunu belirlemek için uygun derleyici yönergelerine bakın.

Şunlara uygulanır