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



英和和英テキスト翻訳>> Weblio翻訳
英語⇒日本語日本語⇒英語
  

辞書ショートカット

すべての辞書の索引

「ParameterAttributes 列挙体」の関連用語

ParameterAttributes 列挙体のお隣キーワード
検索ランキング

   

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



ParameterAttributes 列挙体のページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

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

©2025 GRAS Group, Inc.RSS