ParameterAttributes 列挙体
この列挙体には、メンバ値のビットごとの組み合わせを可能にする FlagsAttribute 属性が含まれています。
名前空間: System.Reflectionアセンブリ: mscorlib (mscorlib.dll 内)

<SerializableAttribute> _ <ComVisibleAttribute(True)> _ <FlagsAttribute> _ Public Enumeration ParameterAttributes
[SerializableAttribute] [ComVisibleAttribute(true)] [FlagsAttribute] public enum ParameterAttributes
[SerializableAttribute] [ComVisibleAttribute(true)] [FlagsAttribute] public enum class ParameterAttributes

メンバ名 | 説明 | |
---|---|---|
![]() | HasDefault | パラメータが既定値を持つことを指定します。 |
![]() | HasFieldMarshal | パラメータがフィールド マーシャリング情報を持つことを指定します。 |
![]() | In | パラメータが入力パラメータであることを指定します。 |
![]() | Lcid | パラメータがロケール識別子 (LCID: LoCale Identifier) であることを指定します。 |
![]() | None | パラメータ属性がないことを指定します。 |
![]() | Optional | パラメータが省略可能であることを指定します。 |
![]() | Out | パラメータが出力パラメータであることを指定します。 |
![]() | Reserved3 | 予約済み。 |
![]() | Reserved4 | 予約済み。 |
![]() | ReservedMask | パラメータが予約済みであることを指定します。 |
![]() | Retval | パラメータが戻り値を持つことを指定します。 |

ParameterAttributes 値を取得するには、最初に type を取得します。Type から ParameterInfo 配列を取得します。ParameterAttributes 値は、この配列に格納されています。
これらの列挙値は、省略可能なメタデータに依存します。すべての属性をすべてのコンパイラで使用できるわけではありません。該当するコンパイラのドキュメントを参照し、使用できる列挙値を確認してください。

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
using System; using System.Reflection; class paramatt { public static void mymethod (string str1, out string str2, ref string str3) { str2 = "string"; } 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 an " + Myparamattributes.ToString()); return 0; } }
using namespace System; using namespace System::Reflection; using namespace System::Runtime::InteropServices; public ref class paramatt { public: static void mymethod( String^ str1, [Out]interior_ptr<String^> str2, interior_ptr<String^> str3 ) { *str2 = "string"; } }; int main() { 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 = {0}", Mymethodbase ); // Get the ParameterInfo array. 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 = {0}, which is an {1}", (int)Myparamattributes, Myparamattributes ); return 0; }
import System.*; import System.Reflection.*; class Paramatt { public static void Mymethod(String str1, /** @ref */ String str2, /** @ref */ String str3) { str2 = "string"; } //Mymethod public static void 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].get_Attributes(); Console.Write(("\nFor the second parameter:\nMyparamattributes = " + (int)(myParamAttributes) + ", which is an " + myParamAttributes.ToString())); } //main } //Paramatt

Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


- ParameterAttributes 列挙体のページへのリンク