LogicalMethodInfo.Create Method (MethodInfo[])

Given an array of MethodInfo that can contain information about both asynchronous and synchronous methods, creates an array of LogicalMethodInfo.

Namespace: System.Web.Services.Protocols
Assembly: System.Web.Services (in system.web.services.dll)

public:
static array<LogicalMethodInfo^>^ Create (
	array<MethodInfo^>^ methodInfos
)
public static LogicalMethodInfo[] Create (
	MethodInfo[] methodInfos
)
public static function Create (
	methodInfos : MethodInfo[]
) : LogicalMethodInfo[]
Not applicable.

Parameters

methodInfos

An array of MethodInfo representing the asynchronous and synchronous methods for which to create LogicalMethodInfo objects.

Return Value

An array of LogicalMethodInfo, representing the methods within methodInfos.

Exception typeCondition

InvalidOperationException

A Begin asynchronous method is included in methodInfos without a corresponding End method.

#using <System.Web.Services.dll>

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

public ref class MyService
{
public:
   void MyMethod( int inParameter, [Out]interior_ptr<int> outParameter )
   {
       *outParameter = inParameter;
   }
};

int main()
{
   Type^ myType = MyService::typeid;
   MethodInfo^ myMethodInfo = myType->GetMethod( "MyMethod" );
   array<MethodInfo^>^temparray = {myMethodInfo};
   LogicalMethodInfo^ myLogicalMethodInfo = (LogicalMethodInfo::Create( temparray ))[ 0 ];
   Console::WriteLine( "\nPrinting parameters for the method : {0}", myLogicalMethodInfo->Name );
   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( String::Concat( "\t ", myParameters[ i ]->Name, " : ", myParameters[ i ]->ParameterType ) );

   }
   Console::WriteLine( "\nThe in parameters of the method {0} are :\n", myLogicalMethodInfo->Name );
   myParameters = myLogicalMethodInfo->InParameters;
   for ( int i = 0; i < myParameters->Length; i++ )
   {
      Console::WriteLine( String::Concat( "\t ", myParameters[ i ]->Name, " : ", myParameters[ i ]->ParameterType ) );

   }
   Console::WriteLine( "\nThe out parameters of the method {0} are :\n", myLogicalMethodInfo->Name );
   myParameters = myLogicalMethodInfo->OutParameters;
   for ( int i = 0; i < myParameters->Length; i++ )
   {
      Console::WriteLine( String::Concat( "\t ", myParameters[ i ]->Name, " : ", myParameters[ i ]->ParameterType ) );

   }
   if ( myLogicalMethodInfo->IsVoid )
      Console::WriteLine( "\nThe return type is void" );
   else
      Console::WriteLine( "\nThe return type is {0}", myLogicalMethodInfo->ReturnType );
}

import System.*;
import System.Reflection.*;
import System.Web.Services.Protocols.*;
public class MyService
{
    public void MyMethod(int inParameter, /** @ref */int outParameter)
    {
        outParameter = inParameter;
    } //MyMethod
} //MyService

public class LogicalMethodInfo_Create
{
    public static void main(String[] args)
    {
        Type myType = MyService.class.ToType();
        MethodInfo myMethodInfo = myType.GetMethod("MyMethod");
        LogicalMethodInfo myLogicalMethodInfo = (LogicalMethodInfo)
            LogicalMethodInfo.Create(new MethodInfo[] { myMethodInfo }).
            get_Item(0);

        Console.WriteLine("\nPrinting parameters for the method : {0}", 
            myLogicalMethodInfo.get_Name());
        Console.WriteLine("\nThe parameters of the method {0} are :\n", 
            myLogicalMethodInfo.get_Name());
        ParameterInfo myParameters[] = myLogicalMethodInfo.get_Parameters();
        for (int i = 0; i < myParameters.length; i++) {
            Console.WriteLine("\t"  
                + ((ParameterInfo)myParameters.get_Item(i)).get_Name() + " : "  
                + ((ParameterInfo)myParameters.get_Item(i)).get_ParameterType());
        }

        Console.WriteLine("\nThe in parameters of the method {0} are :\n", 
            myLogicalMethodInfo.get_Name());
        myParameters = myLogicalMethodInfo.get_InParameters();
        for (int i = 0; i < myParameters.length; i++) {
            Console.WriteLine("\t" 
                + ((ParameterInfo)myParameters.get_Item(i)).get_Name() + " : " 
                + ((ParameterInfo)myParameters.get_Item(i)).
                get_ParameterType());
        }

        Console.WriteLine("\nThe out parameters of the method {0} are :\n", 
            myLogicalMethodInfo.get_Name());
        myParameters = myLogicalMethodInfo.get_OutParameters();
        for (int i = 0; i < myParameters.length; i++) {
            Console.WriteLine("\t"  
                + ((ParameterInfo)myParameters.get_Item(i)).get_Name() + " : " 
                + ((ParameterInfo)myParameters.get_Item(i)).
                get_ParameterType());
        }

        if (myLogicalMethodInfo.get_IsVoid()) {
            Console.WriteLine("\nThe return type is void");
        }
        else {
            Console.WriteLine("\nThe return type is {0}", 
                myLogicalMethodInfo.get_ReturnType());
        }
    } //main 
} //LogicalMethodInfo_Create

Windows 98, Windows Server 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

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0, 2.0, 1.1, 1.0

Community Additions

ADD
Show: