LogicalMethodInfo.Create Method (MethodInfo(), LogicalMethodTypes)
.NET Framework (current version)
Given an array of MethodInfo, where the returned array of LogicalMethodInfo can be restricted to only asynchronous or synchronous methods, creates an array of LogicalMethodInfo.
Assembly: System.Web.Services (in System.Web.Services.dll)
Public Shared Function Create ( methodInfos As MethodInfo(), types As LogicalMethodTypes ) As LogicalMethodInfo()
Parameters
- methodInfos
-
Type:
System.Reflection.MethodInfo()
An array of MethodInfo representing the asynchronous and synchronous methods for which to create LogicalMethodInfo objects.
- types
-
Type:
System.Web.Services.Protocols.LogicalMethodTypes
A bitwise combination of the LogicalMethodTypes values. Determines whether just asynchronous or synchronous methods or both are included in the returned array of LogicalMethodInfo.
Return Value
Type: System.Web.Services.Protocols.LogicalMethodInfo()An array of LogicalMethodInfo, representing the methods within methodInfos, filtered by the value of types.
| Exception | Condition |
|---|---|
| InvalidOperationException | A Begin asynchronous method is included in methodInfos without a corresponding End method. |
Imports System Imports System.Reflection Imports System.Web.Services.Protocols Imports Microsoft.VisualBasic Public Class MyService Inherits SoapHttpClientProtocol Public Function BeginAdd _ (xValue As Integer, yValue As Integer, callback As AsyncCallback, asyncState As Object) _ As IAsyncResult Return Me.BeginInvoke("Add", New Object() {xValue, yValue}, callback, asyncState) End Function 'BeginAdd Public Function EndAdd(asyncResult As System.IAsyncResult) As Integer Dim results As Object() = Me.EndInvoke(asyncResult) Return CInt(results(0)) End Function 'EndAdd End Class 'MyService Public Class LogicalMethodInfo_Create Public Shared Sub Main() Dim myType As Type = GetType(MyService) Dim myBeginMethod As MethodInfo = myType.GetMethod("BeginAdd") Dim myEndMethod As MethodInfo = myType.GetMethod("EndAdd") Dim myLogicalMethodInfo As LogicalMethodInfo = _ LogicalMethodInfo.Create(New MethodInfo() _ {myBeginMethod, myEndMethod}, LogicalMethodTypes.Async)(0) Console.WriteLine _ (ControlChars.Newline + "The asynchronous callback parameter of method {0} is :" + _ ControlChars.Newline, myLogicalMethodInfo.Name) Console.WriteLine _ (ControlChars.Tab + myLogicalMethodInfo.AsyncCallbackParameter.Name + " : " + _ myLogicalMethodInfo.AsyncCallbackParameter.ParameterType.ToString()) Console.WriteLine _ (ControlChars.Newline + "The asynchronous state parameter of method {0} is :" + _ ControlChars.Newline, myLogicalMethodInfo.Name) Console.WriteLine _ (ControlChars.Tab + myLogicalMethodInfo.AsyncStateParameter.Name + " : " + _ myLogicalMethodInfo.AsyncStateParameter.ParameterType.ToString()) Console.WriteLine _ (ControlChars.Newline + "The asynchronous result parameter of method {0} is :" + _ ControlChars.Newline, myLogicalMethodInfo.Name) Console.WriteLine _ (ControlChars.Tab + myLogicalMethodInfo.AsyncResultParameter.Name + " : " + _ myLogicalMethodInfo.AsyncResultParameter.ParameterType.ToString()) Console.WriteLine _ (ControlChars.Newline + "The begin method of the asynchronous method {0} is :" + _ ControlChars.Newline, myLogicalMethodInfo.Name) Console.WriteLine(ControlChars.Tab + myLogicalMethodInfo.BeginMethodInfo.ToString()) Console.WriteLine _ (ControlChars.Newline + "The end method of the asynchronous method {0} is :" + _ ControlChars.Newline, myLogicalMethodInfo.Name) Console.WriteLine(ControlChars.Tab + myLogicalMethodInfo.EndMethodInfo.ToString()) If myLogicalMethodInfo.IsAsync Then Console.WriteLine(ControlChars.Newline + "{0} is asynchronous", myLogicalMethodInfo.Name) Else Console.WriteLine(ControlChars.Newline + "{0} is synchronous", myLogicalMethodInfo.Name) End If End Sub 'Main End Class 'LogicalMethodInfo_Create
.NET Framework
Available since 1.1
Available since 1.1
Show: