LogicalMethodInfo コンストラクタとは? わかりやすく解説

Weblio 辞書 > コンピュータ > .NET Framework クラス ライブラリ リファレンス > LogicalMethodInfo コンストラクタの意味・解説 

LogicalMethodInfo コンストラクタ

渡されMethodInfo使用して LogicalMethodInfo クラス新しインスタンス初期化します。

名前空間: System.Web.Services.Protocols
アセンブリ: System.Web.Services (system.web.services.dll 内)
構文構文

Public Sub New ( _
    methodInfo As MethodInfo _
)
Dim methodInfo As MethodInfo

Dim instance As New LogicalMethodInfo(methodInfo)
public LogicalMethodInfo (
    MethodInfo methodInfo
)
public:
LogicalMethodInfo (
    MethodInfo^ methodInfo
)
public LogicalMethodInfo (
    MethodInfo methodInfo
)
public function LogicalMethodInfo (
    methodInfo : MethodInfo
)

パラメータ

methodInfo

MethodInfo に共通の LogicalMethodInfo のプロパティ初期化する MethodInfo

例外例外
例外種類条件

InvalidOperationException

methodInfo パラメータの MethodBase.IsStatic プロパティtrue です。

または

methodInfo パラメータの MethodBase.GetParameters メソッドに、LogicalMethodInfoインスタンスが表すメソッドで必要とされるすべてのパラメータ格納されていません。

使用例使用例
Imports System
Imports System.Reflection
Imports System.Security.Permissions
Imports System.Web.Services.Protocols
Imports Microsoft.VisualBasic

Public Class MyService
   
   Public Function Add(xValue As
 Integer, yValue As Integer)
 As Integer
      Return xValue + yValue
   End Function 'Add
End Class 'MyService

Class LogicalMethodInfo_Constructor

<PermissionSetAttribute(SecurityAction.Demand, Name := "FullTrust")>
  _
   Shared Sub Run()
      Dim myType As Type = GetType(MyService)
      Dim myMethodInfo As MethodInfo = myType.GetMethod("Add")
      Dim myLogicalMethodInfo As New
 LogicalMethodInfo(myMethodInfo)
      
      Console.WriteLine(ControlChars.NewLine + "Printing properties
 of method : {0}" + _
                              ControlChars.NewLine, myLogicalMethodInfo.ToString())
      
      Console.WriteLine(ControlChars.NewLine + "The declaring
 type of the method {0} is :" + _
                                    ControlChars.NewLine, myLogicalMethodInfo.Name)
      Console.WriteLine(ControlChars.Tab + myLogicalMethodInfo.DeclaringType.ToString())
      
      Console.WriteLine(ControlChars.NewLine + "The parameters
 of the method {0} are :" + _
                                    ControlChars.NewLine, myLogicalMethodInfo.Name)
      Dim myParameters As ParameterInfo() =
 myLogicalMethodInfo.Parameters
      Dim i As Integer
      For i = 0 To myParameters.Length - 1
         Console.WriteLine(ControlChars.Tab + myParameters(i).Name + "
 : " + _
                                                      myParameters(i).ParameterType.ToString())
      Next i
      
      Console.WriteLine(ControlChars.NewLine + "The return type
 of the method {0} is :" + _
                                             ControlChars.NewLine, myLogicalMethodInfo.Name)
      Console.WriteLine(ControlChars.Tab + myLogicalMethodInfo.ReturnType.ToString())
      
      Dim service As New
 MyService()
      Console.WriteLine(ControlChars.NewLine + "Invoking the method
 {0}" + _
                                                ControlChars.NewLine, myLogicalMethodInfo.Name)
      Console.WriteLine(ControlChars.Tab + "The sum of 10 and
 10 is : {0}", _
                                    myLogicalMethodInfo.Invoke(service, New
 Object() {10, 10}))

   End Sub 'Run
   
   Shared Sub Main()
      Run()
   End Sub 'Main
End Class 'LogicalMethodInfo_Constructor
using System;
using System.Reflection;
using System.Security.Permissions;
using System.Web.Services.Protocols;

public class MyService 
{
   public int Add(int xValue,
 int yValue)
   {
      return (xValue + yValue);
   }
}

class LogicalMethodInfo_Constructor
{
   [PermissionSetAttribute(SecurityAction.Demand, Name="FullTrust")]
   static void Run()
   {
      Type myType = typeof(MyService);
      MethodInfo myMethodInfo = myType.GetMethod("Add");
      LogicalMethodInfo myLogicalMethodInfo = 
                  new LogicalMethodInfo(myMethodInfo);

      Console.WriteLine("\nPrinting properties of method : {0}\n",
                              myLogicalMethodInfo.ToString());

      Console.WriteLine("\nThe declaring type of the method {0} is :\n"
,
                              myLogicalMethodInfo.Name);
      Console.WriteLine("\t" + myLogicalMethodInfo.DeclaringType);

      Console.WriteLine("\nThe parameters of the method {0} are :\n",
                              myLogicalMethodInfo.Name);
      ParameterInfo[] myParameters = myLogicalMethodInfo.Parameters;
      for(int i = 0; i < myParameters.Length;
 i++)
      {
         Console.WriteLine("\t" + myParameters[i].Name +
                                 " : " + myParameters[i].ParameterType);
      }

      Console.WriteLine("\nThe return type of the method
 {0} is :\n",
                              myLogicalMethodInfo.Name);
      Console.WriteLine("\t" + myLogicalMethodInfo.ReturnType);

      MyService service = new MyService();
      Console.WriteLine("\nInvoking the method {0}\n",
                              myLogicalMethodInfo.Name);
      Console.WriteLine("\tThe sum of 10 and 10 is : {0}",
                              myLogicalMethodInfo.Invoke(service, 
                                                   new object[]
 {10, 10}));

   }
   
   static void Main()
   {
      Run();
   }  
}
#using <System.Web.Services.dll>

using namespace System;
using namespace System::Reflection;
using namespace System::Web::Services::Protocols;

public ref class MyService
{
public:
   int Add( int xValue, int
 yValue )
   {
      return (xValue + yValue);
   }

};

int main()
{
   Type^ myType = MyService::typeid;
   MethodInfo^ myMethodInfo = myType->GetMethod( "Add" );
   LogicalMethodInfo^ myLogicalMethodInfo = gcnew LogicalMethodInfo( myMethodInfo
 );
   Console::WriteLine( "\nPrinting properties of method : {0}\n", myLogicalMethodInfo
 );
   Console::WriteLine( "\nThe declaring type of the method {0} is :\n",
 myLogicalMethodInfo->Name );
   Console::WriteLine( "\t {0}", myLogicalMethodInfo->DeclaringType
 );
   Console::WriteLine( "\nThe parameters of the method {0} are :\n", myLogicalMethodInfo->Name
 );
   array<ParameterInfo^>^myParameters = myLogicalMethodInfo->Parameters;
   for ( int i = 0; i < myParameters->Length;
 i++ )
   {
      Console::WriteLine( "\t {0}", String::Concat( myParameters[ i ]->Name,
 " : ", myParameters[ i ]->ParameterType ) );
   }
   Console::WriteLine( "\nThe return type of the method {0}
 is :\n", myLogicalMethodInfo->Name );
   Console::WriteLine( "\t {0}", myLogicalMethodInfo->ReturnType );
   MyService^ service = gcnew MyService;
   Console::WriteLine( "\nInvoking the method {0}\n", myLogicalMethodInfo->Name
 );
   array<Object^>^values = gcnew array<Object^>(2);
   values[ 0 ] = 10;
   values[ 1 ] = 10;
   Console::WriteLine( "\tThe sum of 10 and 10 is : {0}", myLogicalMethodInfo->Invoke(
 service, values ) );
}
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
LogicalMethodInfo クラス
LogicalMethodInfo メンバ
System.Web.Services.Protocols 名前空間



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

辞書ショートカット

すべての辞書の索引

「LogicalMethodInfo コンストラクタ」の関連用語

LogicalMethodInfo コンストラクタのお隣キーワード
検索ランキング

   

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



LogicalMethodInfo コンストラクタのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

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

©2024 GRAS Group, Inc.RSS