This documentation is archived and is not being maintained.
LogicalMethodInfo.ToString Method
.NET Framework 1.1
Returns a string that represents the current LogicalMethodInfo.
[Visual Basic] Overrides Public Function ToString() As String [C#] public override string ToString(); [C++] public: String* ToString(); [JScript] public override function ToString() : String;
Return Value
A String that represents the current LogicalMethodInfo.
Example
[Visual Basic] Imports System Imports System.Reflection 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 Public Class LogicalMethodInfo_Constructor Public Shared Sub Main() 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 'Main End Class 'LogicalMethodInfo_Constructor [C#] using System; using System.Reflection; using System.Web.Services.Protocols; public class MyService { public int Add(int xValue, int yValue) { return (xValue + yValue); } } public class LogicalMethodInfo_Constructor { public static void Main() { 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})); } } [C++] #using <mscorlib.dll> #using <System.Web.Services.dll> using namespace System; using namespace System::Reflection; using namespace System::Web::Services::Protocols; public __gc class MyService { public: int Add(int xValue, int yValue) { return (xValue + yValue); } }; int main() { Type* myType = __typeof(MyService); MethodInfo* myMethodInfo = myType->GetMethod(S"Add"); LogicalMethodInfo* myLogicalMethodInfo = new LogicalMethodInfo(myMethodInfo); Console::WriteLine(S"\nPrinting properties of method : {0}\n", myLogicalMethodInfo); Console::WriteLine(S"\nThe declaring type of the method {0} is :\n", myLogicalMethodInfo->Name); Console::WriteLine(S"\t {0}", myLogicalMethodInfo->DeclaringType); 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(S"\t {0}",String::Concat(myParameters[i]->Name, S" : ", myParameters[i]->ParameterType)); } Console::WriteLine(S"\nThe return type of the method {0} is :\n", myLogicalMethodInfo->Name); Console::WriteLine(S"\t {0}", myLogicalMethodInfo->ReturnType); MyService* service = new MyService(); Console::WriteLine(S"\nInvoking the method {0}\n", myLogicalMethodInfo->Name); Object * values __gc[] = new Object * [2]; values[0] = __box(10); values[1] = __box(10); Console::WriteLine(S"\tThe sum of 10 and 10 is : {0}", myLogicalMethodInfo->Invoke(service,values)); }
[JScript] No example is available for JScript. To view a Visual Basic, C#, or C++ example, click the Language Filter button
in the upper-left corner of the page.
Requirements
Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family, .NET Compact Framework
See Also
LogicalMethodInfo Class | LogicalMethodInfo Members | System.Web.Services.Protocols Namespace
Show: