ParameterAttributes 列挙体とは? わかりやすく解説

ParameterAttributes 列挙体

パラメータに関連付けることができる属性を定義します。これらの属性は CorHdr.h で定義されています。

この列挙体には、メンバ値のビットごとの組み合わせを可能にする FlagsAttribute 属性が含まれています。

名前空間: System.Reflection
アセンブリ: mscorlib (mscorlib.dll 内)
構文構文

<SerializableAttribute> _
<ComVisibleAttribute(True)> _
<FlagsAttribute> _
Public Enumeration ParameterAttributes
Dim instance As ParameterAttributes
[SerializableAttribute] 
[ComVisibleAttribute(true)] 
[FlagsAttribute] 
public enum ParameterAttributes
[SerializableAttribute] 
[ComVisibleAttribute(true)] 
[FlagsAttribute] 
public enum class ParameterAttributes
/** @attribute SerializableAttribute() */ 
/** @attribute ComVisibleAttribute(true) */ 
/** @attribute FlagsAttribute() */ 
public enum ParameterAttributes
SerializableAttribute 
ComVisibleAttribute(true) 
FlagsAttribute 
public enum ParameterAttributes
メンバメンバ
 メンバ名説明
.NET Compact Framework によるサポートHasDefaultパラメータが既定値を持つことを指定します。 
.NET Compact Framework によるサポートHasFieldMarshalパラメータがフィールド マーシャリング情報を持つことを指定します。 
.NET Compact Framework によるサポートInパラメータが入力パラメータであることを指定します。 
.NET Compact Framework によるサポートLcidパラメータがロケール識別子 (LCID: LoCale Identifier) であることを指定します。 
.NET Compact Framework によるサポートNoneパラメータ属性がないことを指定します。 
.NET Compact Framework によるサポートOptionalパラメータが省略可能であることを指定します。 
.NET Compact Framework によるサポートOutパラメータが出力パラメータであることを指定します。 
.NET Compact Framework によるサポートReserved3予約済み。 
.NET Compact Framework によるサポートReserved4予約済み。 
.NET Compact Framework によるサポートReservedMaskパラメータが予約済みであることを指定します。 
.NET Compact Framework によるサポートRetvalパラメータが戻り値を持つことを指定します。 
解説解説
使用例使用例

指定したパラメータの属性を表示する例を次に示します。

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
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照



英和和英テキスト翻訳

英語⇒日本語日本語⇒英語

辞書ショートカット

すべての辞書の索引

「ParameterAttributes 列挙体」の関連用語

ParameterAttributes 列挙体のお隣キーワード

   

英語⇒日本語
日本語⇒英語
   



ParameterAttributes 列挙体のページの著作権

   
日本マイクロソフト株式会社日本マイクロソフト株式会社
© 2026 Microsoft.All rights reserved.

©2026 GRAS Group, Inc.RSS