As per the documentation from the following URL
https://learn.microsoft.com/en-us/dotnet/api/system.reflection.parameterinfo.attributes?view=net-5.0
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.
For you to check whether a parameter is In or Out, you can use the IsOut property and decide.
e.g.
internal class Program
{
static void Main(string[] args)
{
Console.WriteLine("Hello World!");
Type myType = typeof(MyClass1);
MethodBase myMethodBase = myType.GetMethod("MyMethod");
ParameterInfo[] myParameters = myMethodBase.GetParameters();
Console.WriteLine("\nThe method {0} has the {1} parameters :",
"ParameterInfo_Example.MyMethod", myParameters.Length);
for (int i = 0; i < myParameters.Length; i++)
{
Console.WriteLine("\tThe {0} parameter is {1}",
i + 1, myParameters[i].IsOut?"Out":"In");
}
}
}
public class MyClass1
{
public int MyMethod(int i, out short j, ref long k)
{
j = 2;
return 0;
}
}