LogicalMethodInfo::EndInvoke Method (Object^, IAsyncResult^)
.NET Framework (current version)
Ends an asynchronous invocation of the method represented by the current LogicalMethodInfo.
Assembly: System.Web.Services (in System.Web.Services.dll)
public: [PermissionSetAttribute(SecurityAction::LinkDemand, Name = "FullTrust")] array<Object^>^ EndInvoke( Object^ target, IAsyncResult^ asyncResult )
Parameters
- target
-
Type:
System::Object^
The instance of the Object on which to invoke the method.
- asyncResult
-
Type:
System::IAsyncResult^
The IAsyncResult returned from BeginInvoke.
Return Value
Type: array<System::Object^>^An array of objects containing the return value and any by-reference or out parameters of the derived class method.
| Exception | Condition |
|---|---|
| TargetException | The target parameter is null. |
| MemberAccessException | The caller does not have permission to invoke the method. |
| TargetInvocationException | The invoked method throws an exception. |
public: [PermissionSet(SecurityAction::Demand, Name="FullTrust")] static void main() { // Get the type information. // Note: The MyMath class is a proxy class generated by the Wsdl.exe // utility for the Math Web service. This class can also be found in // the SoapHttpClientProtocol class example. Type^ myType = MyMath::MyMath::typeid; // Get the method info. MethodInfo^ myBeginMethod = myType->GetMethod( "BeginAdd" ); MethodInfo^ myEndMethod = myType->GetMethod( "EndAdd" ); // Create an instance of the LogicalMethodInfo class. array<MethodInfo^>^ temp0 = { myBeginMethod, myEndMethod }; LogicalMethodInfo^ myLogicalMethodInfo = ( LogicalMethodInfo::Create( temp0, LogicalMethodTypes::Async ) )[ 0 ]; // Get an instance of the proxy class. MyMath::MyMath^ myMathService = gcnew MyMath::MyMath; // Call the MyEndIntimationMethod method to intimate the end of // the asynchronous call. AsyncCallback^ myAsyncCallback = gcnew AsyncCallback( MyEndIntimationMethod ); // Begin to invoke the Add method. array<Object^>^ temp1 = { 10, 10 }; IAsyncResult^ myAsyncResult = myLogicalMethodInfo->BeginInvoke( myMathService, temp1, myAsyncCallback, nullptr ); // Wait until invoke is complete. myAsyncResult->AsyncWaitHandle->WaitOne(); // Get the result. array<Object^>^ myReturnValue; myReturnValue = myLogicalMethodInfo->EndInvoke( myMathService, myAsyncResult ); Console::WriteLine( "Sum of 10 and 10 is {0}", myReturnValue[ 0 ] ); } // This method will be called at the end of the asynchronous call. static void MyEndIntimationMethod( IAsyncResult^ /*Result*/ ) { Console::WriteLine( "Asynchronous call on Add method finished." ); }
.NET Framework
Available since 1.1
Available since 1.1
Show: