Home All Groups Group Topic Archive Search About

Using reflection to get parameters and values at runtime

Author
5 Sep 2006 2:28 PM
Steve Bugden
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")

Author
5 Sep 2006 5:57 PM
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

--
Mattias Sjögren [C# MVP]  mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Please reply only to the newsgroup.
Author
6 Sep 2006 5:22 PM
Steve Bugden
Thankyou Mattias

Show quote
"Mattias Sjögren" wrote:

> 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
>
> --
> Mattias Sjögren [C# MVP]  mattias @ mvps.org
> http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
> Please reply only to the newsgroup.
>

AddThis Social Bookmark Button