This documentation is archived and is not being maintained.

MethodBase.GetCurrentMethod Method

Returns a MethodBase object representing the currently executing method.

Namespace: System.Reflection
Assembly: mscorlib (in mscorlib.dll)

'Declaration
Public Shared Function GetCurrentMethod As MethodBase
'Usage
Dim returnValue As MethodBase

returnValue = MethodBase.GetCurrentMethod
public static MethodBase GetCurrentMethod ()
public static function GetCurrentMethod () : MethodBase

Return Value

A MethodBase object representing the currently executing method.

Imports System
Imports System.Reflection
Imports System.Runtime.Remoting
Imports System.Runtime.Remoting.Messaging
Imports System.Security.Permissions

Namespace RemotingSamples
   <SecurityPermission(SecurityAction.Demand, Flags:=SecurityPermissionFlag.Infrastructure)> _
   Public Class HelloServer
      Inherits MarshalByRefObject
      
      Public Sub New()
         Console.WriteLine("HelloServer activated")
      End Sub 'New
      
      <OneWay(), SecurityPermission(SecurityAction.Demand, Flags:=SecurityPermissionFlag.Infrastructure)>  _
      Public Sub HelloToServer(name As String)
         Console.WriteLine("Hello.HelloToServer : {0}", name)
      End Sub 'HelloToServer
      
      <SecurityPermission(SecurityAction.Demand, Flags:=SecurityPermissionFlag.Infrastructure)> _
      Public Function HelloToServerAndWait(name As String) As String
         Console.WriteLine("Client invoked HelloToServerAndWait : " + name)
         Console.WriteLine("Client waiting for return? {0}", _
                   IIf(RemotingServices.IsOneWay(MethodBase.GetCurrentMethod()),"No","Yes"))
         Return "Hi there, " + name
      End Function 'HelloToServerAndWait
   End Class 'HelloServer
End Namespace 'RemotingSamples

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

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

.NET Framework

Supported in: 2.0, 1.1, 1.0
Show: