This documentation is archived and is not being maintained.

LogicalMethodInfo::Create Method (array<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
)

Parameters

methodInfos
Type: array<System.Reflection::MethodInfo>

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

Return Value

Type: array<System.Web.Services.Protocols::LogicalMethodInfo>
An array of LogicalMethodInfo, representing the methods within methodInfos.

ExceptionCondition
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 );
}
#using <mscorlib.dll>
#using <System.Web.Services.dll>
using namespace System;
using namespace System::Runtime::InteropServices;
using namespace System::Reflection;
using namespace System::Web::Services::Protocols;

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

int main() {
   Type*  myType = __typeof(MyService);

   MethodInfo* myMethodInfo = myType->GetMethod(S"MyMethod");
   MethodInfo * temparray[] = { myMethodInfo};
   LogicalMethodInfo* myLogicalMethodInfo = 
      ( LogicalMethodInfo::Create(temparray))[0];

   Console::WriteLine(S"\nPrinting parameters for the method : {0}",
      myLogicalMethodInfo->Name);

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

   Console::WriteLine(S"\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(S"\t ", myParameters[i]->Name,
         S" : ", myParameters[i]->ParameterType));
   }

   Console::WriteLine(S"\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(S"\t ", myParameters[i]->Name,
         S" : ", myParameters[i]->ParameterType));
   }

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

Windows 7, Windows Vista, Windows XP SP2, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP Starter Edition, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003, Windows Server 2000 SP4, Windows Millennium Edition, Windows 98

The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

.NET Framework

Supported in: 3.5, 3.0, 2.0, 1.1, 1.0
Show: