ParameterInfo.IsOut Property

Gets a value indicating whether this is an output parameter.

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

public bool IsOut { get; }

Property Value

Type: System.Boolean
true if the parameter is an output parameter; otherwise, false.

This method depends on an optional metadata flag. This flag can be inserted by compilers, but compilers are not obligated to do so.

This method uses the Out member of the ParameterAttributes enumeration.

To get the ParameterInfo array, first get the method or the constructor, and then call MethodBase.GetParameters.

The following example shows how to test method parameters for the ParameterAttributes.Out attribute.

The example contains a method named mymethod that has three parameters. The first parameter has no attributes, the second is an out parameter (OutAttribute ByRef parameter in Visual Basic), and the third is a ref parameter (ByRef parameter in Visual Basic).

The example lists the parameters of mymethod, using the IsOut property to test each one for the ParameterAttributes.Out attribute.

using System;
using System.Reflection;

class Example
   public static void mymethod(
      int int1m, out string str2m, ref string str3m)
      str2m = "in mymethod";

   public static int Demo(System.Windows.Controls.TextBlock outputBlock)
      outputBlock.Text += "\nReflection.Parameterinfo" + "\n";

      //Get the ParameterInfo parameter of a function.

      //Get the type.
      Type Mytype = Type.GetType("Example");

      //Get and display the method.
      MethodBase Mymethodbase = Mytype.GetMethod("mymethod");
      outputBlock.Text += "\nMymethodbase = " + Mymethodbase;

      //Get the ParameterInfo array.
      ParameterInfo[] Myarray = Mymethodbase.GetParameters();

      //Get and display the IsOut of each parameter.
      foreach (ParameterInfo Myparam in Myarray)
         outputBlock.Text += "\nFor parameter # " + Myparam.Position
            + ", the IsOut is - " + Myparam.IsOut;
      return 0;
This code produces the following output:


Mymethodbase = Void mymethod (Int32, System.String ByRef, System.String ByRef)
For parameter # 0, the IsOut is - False
For parameter # 1, the IsOut is - True
For parameter # 2, the IsOut is - False


Supported in: 5, 4, 3

Silverlight for Windows Phone

Supported in: Windows Phone OS 7.1, Windows Phone OS 7.0

XNA Framework

Supported in: Xbox 360, Windows Phone OS 7.0

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.

Community Additions