Public Sub Main(Byval Test as string)
Try
...
Catch Ex as Exception
WriteError(System.Reflection.MethodBase.GetCurrentMethod())
End Try
End Sub
Public Sub WriteError(Byval oCurrentMethod as System.Reflection.MethodBase)
Dim lcError As String = ""
lcError &= IIf(oCurrentMethod.IsPrivate, "Private ", "Public ")
lcError &= "Sub/Function "
lcError &= oCurrentMethod.Name & "("
For liParameters As Integer = 1 To oCurrentMethod.GetParameters().Length
If liParameters > 1 Then
cError &= ", "
End If
lcError &= IIf(Right(oCurrentMethod.GetParameters(liParameters - 1).ParameterType().ToString(), 1) = "&", "ByRef ", "ByVal ")
lcError &= oCurrentMethod.GetParameters(liParameters - 1).Name & " As "
lcError &= oCurrentMethod.GetParameters(liParameters - 1).ParameterType.ToString()
lcError = IIf(Right(oCurrentMethod.GetParameters(liParameters - 1).ParameterType().ToString(), 1) = "&", lcError.Substring(0, lcError.Length - 1), lcError.Substring(0, lcError.Length))
Next
lcError &= ")"
End Sub
The result of lcError will be : Private Sub/Function Main(Byval Test as System.String)
So, I don't know how to determinate if it is a function or a method. Also, I think I miss other thing like, if it is a property or overridable ...
I don't know if there is a simple way of doing this ...
Thx!