ParameterInfo.IsOut プロパティとは? わかりやすく解説

Weblio 辞書 > コンピュータ > .NET Framework クラス ライブラリ リファレンス > ParameterInfo.IsOut プロパティの意味・解説 

ParameterInfo.IsOut プロパティ

このパラメータ出力パラメータかどうかを示す値を取得します

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

解説解説

このメソッドは、オプションメタデータ フラグ依存します。このフラグは、コンパイラ挿入できますが、必ず挿入されるとは限りません。

このメソッドは、ParameterAttributes 列挙子の Out フラグ利用します

ParameterInfo 配列取得するには、最初にメソッドまたはコンストラクタ取得してから MethodBase.GetParameters を呼び出します。

使用例使用例
Imports System
Imports System.Reflection
Imports Microsoft.VisualBasic

Class parminfo
    
    Public Shared Sub mymethod(int1m
 As Integer, ByRef str2m
 As String, _
    ByRef str3m As String)
    
        str2m = "in mymethod"
    End Sub
    
    Public Shared Function
 Main() As Integer
        Console.WriteLine(ControlChars.CrLf + "Reflection.Parameterinfo")
        
        'Get the ParameterInfo parameter of a function.
        'Get the type.
        Dim Mytype As Type = Type.GetType("parminfo")
        
        'Get and display the method.
        Dim Mymethodbase As MethodBase = Mytype.GetMethod("mymethod")
        Console.Write(ControlChars.CrLf + "Mymethodbase = "
 _
           + Mymethodbase.ToString())
        
        'Get the ParameterInfo array.
        Dim Myarray As ParameterInfo() = Mymethodbase.GetParameters()
        
        'Get and display the IsOut of each parameter.
        Dim Myparam As ParameterInfo
        For Each Myparam In
  Myarray
            Console.Write(ControlChars.CrLf _
               + "For parameter # " + Myparam.Position.ToString()
 _
               + ", the IsOut is - " + Myparam.IsOut.ToString())
        Next Myparam
        Return 0
    End Function
End Class

' This code produces the following output:
'
' Reflection.ParameterInfo
'  
' 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 
using System;
using System.Reflection;
 
 class parminfo
 {
    public static void mymethod
 (
       int int1m, out string str2m, ref string
 str3m)
    {
       str2m = "in mymethod";
    }
  
    public static int Main(string[]
 args)
    {
       Console.WriteLine("\nReflection.Parameterinfo");
       
       //Get the ParameterInfo parameter of a function.
  
       //Get the type.
       Type Mytype = Type.GetType("parminfo");
  
       //Get and display the method.
       MethodBase Mymethodbase = Mytype.GetMethod("mymethod");
       Console.Write("\nMymethodbase = " + Mymethodbase);
  
       //Get the ParameterInfo array.
       ParameterInfo[] Myarray = Mymethodbase.GetParameters();
       
       //Get and display the IsOut of each parameter.
       foreach (ParameterInfo Myparam in Myarray)
       {
          Console.Write ("\nFor parameter # "   + Myparam.Position 
             + ", the IsOut is - " +  Myparam.IsOut );
       }
       return 0;
    }
 }
 /*
 This code produces the following output:

 Reflection.ParameterInfo
  
 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
 */
using namespace System;
using namespace System::Reflection;
using namespace System::Runtime::InteropServices;
public ref class parminfo
{
public:
   static void mymethod( int
 int1m, [Out]interior_ptr<String^> str2m, interior_ptr<String^> str3m
 )
   {
       *str2m = "in mymethod";
   }

};

int main()
{
   Console::WriteLine( "\nReflection.Parameterinfo" );
   
   //Get the ParameterInfo parameter of a function.
   //Get the type.
   Type^ Mytype = Type::GetType( "parminfo" );
   
   //Get and display the method.
   MethodBase^ Mymethodbase = Mytype->GetMethod( "mymethod" );
   Console::Write( "\nMymethodbase = {0}", Mymethodbase );
   
   //Get the ParameterInfo array.
   array<ParameterInfo^>^Myarray = Mymethodbase->GetParameters();
   
   //Get and display the IsOut of each parameter.
   System::Collections::IEnumerator^ enum0 = Myarray->GetEnumerator();
   while ( enum0->MoveNext() )
   {
      ParameterInfo^ Myparam = safe_cast<ParameterInfo^>(enum0->Current);
      Console::Write( "\nFor parameter # {0}, the IsOut is - {1}", Myparam->Position,
 Myparam->IsOut );
   }

   return 0;
}

/*
This code produces the following output:

Reflection.ParameterInfo

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
*/
import System.*;
import System.Reflection.*;

class Parminfo
{   
    public static void Mymethod(int
 int1m, 
        /**    @ref
         */ String str2m,
        /**    @ref
         */ String str3m)
    {
        str2m = "in mymethod";
    } //Mymethod

    public static void main(String[]
 args)
    {
        Console.WriteLine("\nReflection.Parameterinfo");

        //Get the ParameterInfo parameter of a function.
        //Get the type.
        Type myType = Type.GetType("Parminfo");

        //Get and display the method.
        MethodBase myMethodBase = myType.GetMethod("Mymethod");
        Console.Write(("\nMymethodbase = " + myMethodBase));

        //Get the ParameterInfo array.
        ParameterInfo myArray[] = myMethodBase.GetParameters();
        //Get and display the IsOut of each parameter.
        for(int iCtr=0; iCtr < myArray.length;
 iCtr++) {
            ParameterInfo myParam = myArray[iCtr];
            Console.Write(("\nFor parameter # " + myParam.get_Position()
 
                + ", the IsOut is - " 
                + ((System.Boolean) myParam.get_IsOut())));
        }
    } //main
} //Parminfo
/*
 This code produces the following output:

 Reflection.ParameterInfo
  
 Mymethodbase = Void mymethod (Int32, System.String ByRef, System.String ByRef)
 For parameter # 0, the IsOut is - False
 For parameter # 1, the IsOut is - False
 For parameter # 2, the IsOut is - False
 */
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照



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

辞書ショートカット

すべての辞書の索引

ParameterInfo.IsOut プロパティのお隣キーワード
検索ランキング

   

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



ParameterInfo.IsOut プロパティのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

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

©2024 GRAS Group, Inc.RSS