Question Passing MethodBase.GetCurrentMethod() to another Function

Swoop

Member
Joined
Dec 7, 2011
Messages
14
Programming Experience
Beginner
This maybe academic but I'd like to be able to pass the MethodBase.GetCurrentMethod() to another function. That way I could split apart the different parameters in one place.

What I'm currently doing is something like this...

Sub SomeSub()

Try

'Some code that does work for the app...

Catch ex As Exception
_err.IsError = True
_err.ErrorNamespace = MethodBase.GetCurrentMethod().ReflectedType.Namespace.ToString()
_err.ErrorClass = MethodBase.GetCurrentMethod().ReflectedType.Name.ToString()
_err.ErrorMethod = MethodBase.GetCurrentMethod().Name.ToString()
_err.ErrorMessage = ex.Message
_log.Write(_err.ErrorClassMethod, _err.ErrorMessage, True)
End Try

End Sub

What I'd like to do is something like this...


Sub SomeSub()

Try

'Some code that does work for the app...

Catch ex As Exception
_err.SplitApart(MethodBase.GetCurrentMethod())
_log.Write(_err.ErrorClassMethod, _err.ErrorMessage, True)
End Try

End Sub

Is this possible or am I only dreaming...Please advise and thanks!

Mark
 
Back
Top