NGWS SDK Documentation  

This is preliminary documentation and subject to change.
To comment on this topic, please send us email at ngwssdk@microsoft.com. Thanks!

ParameterAttributes Enumeration

Obtains the flags that define the attributes of a method parameter. The attributes can be used to determine if the parameter is an in parameter, an out parameter, etc.

[Visual Basic]
Public Enum ParameterAttributes
[C#]
public enum ParameterAttributes
[C++]
public enum ParameterAttributes

[JScript] In JScript, you can use the enumerations in the NGWS frameworks, but you cannot define your own.

Remarks

ParameterAttributes is an enum defining the attributes that may be associated with a Parameter. This enumerated value can be used to determine the In/ Out attributes of the parameter.

To get the ParameterAttributes value, first get the Type. From the Type, get the ParameterInfo array. The ParameterAttributes 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 attributes are logically bitwise Or'd in the following groups.

Flags

None = 0x0000

In = 0x0001

Out = 0x0002

Lcid = 0x0004

Retval = 0x0008

Optional = 0x0010

Reserved flags for Runtime use only.

ReservedMask = 0xf000,

HasDefault = 0x1000

HasFieldMarshal = 0x2000

Reserved3 = 0x4000

Reserved4 = 0x8000

Members

Member Name Description
HasDefault [To be supplied.]
HasFieldMarshal [To be supplied.]
In [To be supplied.]
Lcid [To be supplied.]
None [To be supplied.]
Optional [To be supplied.]
Out [To be supplied.]
Reserved3 [To be supplied.]
Reserved4 [To be supplied.]
ReservedMask [To be supplied.]
Retval [To be supplied.]

Requirements

Namespace: System.Reflection

Assembly: mscorlib.dll

Example [C#]

[C#]

class paramatt
{
   public static void mymethod ([in] string str1, [out] string str2, 
      ref string str3)
   {
   }
   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 a "
         + EnumInfo.ToString(Type.GetType( "System.Reflection.ParameterAttributes"),
         Myparamattributes));
 
      return 0;
   }
}
Produces the following output

Reflection.ParameterAttributes

Mymethodbase = Void mymethod (System.String, System.String,
System.String ByRef)

For the second parameter:
Myparamattributes = 2, which is a Out

See Also

System.Reflection Namespace