IsOut Property

ParameterInfo.IsOut Property

[ This article is for Windows Phone 8 developers. If you’re developing for Windows 10, see the latest documentation. ]

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 (OutAttributeByRef 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

Windows Phone OS

Supported in: 8.1, 8.0, 7.1, 7.0

Windows Phone

© 2017 Microsoft