This documentation is archived and is not being maintained.

ParameterAttributes Enumeration

Defines the attributes that can be associated with a parameter. These are defined in CorHdr.h.

This enumeration has a FlagsAttribute attribute that allows a bitwise combination of its member values.

Namespace:  System.Reflection
Assembly:  mscorlib (in mscorlib.dll)

'Declaration
<SerializableAttribute> _
<ComVisibleAttribute(True)> _
<FlagsAttribute> _
Public Enumeration ParameterAttributes
'Usage
Dim instance As ParameterAttributes

Member nameDescription
Supported by the .NET Compact FrameworkSupported by the XNA FrameworkNoneSpecifies that there is no parameter attribute.
Supported by the .NET Compact FrameworkSupported by the XNA FrameworkInSpecifies that the parameter is an input parameter.
Supported by the .NET Compact FrameworkSupported by the XNA FrameworkOutSpecifies that the parameter is an output parameter.
Supported by the .NET Compact FrameworkSupported by the XNA FrameworkLcidSpecifies that the parameter is a locale identifier (lcid).
Supported by the .NET Compact FrameworkSupported by the XNA FrameworkRetvalSpecifies that the parameter is a return value.
Supported by the .NET Compact FrameworkSupported by the XNA FrameworkOptionalSpecifies that the parameter is optional.
Supported by the .NET Compact FrameworkSupported by the XNA FrameworkReservedMaskSpecifies that the parameter is reserved.
Supported by the .NET Compact FrameworkSupported by the XNA FrameworkHasDefaultSpecifies that the parameter has a default value.
Supported by the .NET Compact FrameworkSupported by the XNA FrameworkHasFieldMarshalSpecifies that the parameter has field marshaling information.
Supported by the .NET Compact FrameworkSupported by the XNA FrameworkReserved3Reserved.
Supported by the .NET Compact FrameworkSupported by the XNA FrameworkReserved4Reserved.

To get the ParameterAttributes value, first get the Type. From the Type, get the ParameterInfo array. The ParameterAttributes value is within the array.

These enumerator values are dependent on optional metadata. Not all attributes are available from all compilers. See the appropriate compiler instructions to determine which enumerated values are available.

The following example displays the attributes of the specified parameter.

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

Windows 7, Windows Vista, Windows XP SP2, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP Starter Edition, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003, Windows Server 2000 SP4, Windows Millennium Edition, Windows 98, Windows CE, Windows Mobile for Smartphone, Windows Mobile for Pocket PC, Xbox 360, Zune

The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

.NET Framework

Supported in: 3.5, 3.0, 2.0, 1.1, 1.0

.NET Compact Framework

Supported in: 3.5, 2.0, 1.0

XNA Framework

Supported in: 3.0, 2.0, 1.0
Show: