Using reflection to get parameters and values at runtime

G

Guest

Hi,

I would like to obtain a list of a function's parameter's and their values
dynamically at runtime from within the function itself.

Currently, I record these when starting a function by 'hardcoding' them into
a collection. Please see my code snippet below. I use the collection in my
error handler which prints the values to a log file.

This works fine except for the fact that it's not dynamic.

I can get a function's parameters at runtime using reflection, but is it
possible to get their values dynamically too?

Best Regards,

Steve

'******************************************************
Public Sub DoSomething(ByVal MyString As String, ByVal myint As Integer)

'Record the initial state of the input parameters
Dim objInputVariablesInitialStateCollection As New Collection()
objInputVariablesInitialStateCollection.Add(MyString , "MyString")
objInputVariablesInitialStateCollection.Add(myint, "myint")
 
M

Mattias Sjögren

Steve,
I can get a function's parameters at runtime using reflection, but is it
possible to get their values dynamically too?

No it isn't.


Mattias
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top