|
dev
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Using reflection to get parameters and values at runtimeI 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") Steve,
>I can get a function's parameters at runtime using reflection, but is it No it isn't.>possible to get their values dynamically too? Mattias -- Mattias Sjögren [C# MVP] mattias @ mvps.org http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com Please reply only to the newsgroup. 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. > |
|||||||||||||||||||||||