Question Convert argument function in hastable

gremlinsy

New member
Joined
Jul 23, 2010
Messages
1
Programming Experience
Beginner
Hi all,
I try to convert names and values parameters of function into a hashtable.
For name of parameter, it's ok, but not for value.

Function test(ByVal param1 As String, ByVal param2 As String) As Hashtable
Dim hash As Hashtable = New Hashtable
Dim stFrame As New StackFrame
Dim currentMethod As System.Reflection.MethodBase = stFrame.GetMethod()
Dim currentParameters() As System.Reflection.ParameterInfo = currentMethod.GetParameters()
For Each param As System.Reflection.ParameterInfo In currentParameters
hash.Add(param.Name, "value of param ?") 'How to get value of param ?)
Next
Return hash
End Function

Sub Main()
Dim myhash As Hashtable = New Hashtable
myhash = test("value1", "value2")
End sub

In myhash, I would have:
key / value

param1 / value1
param2 / value2

There is a property to get default value of parameter (if optional) with param.DefaultValue but how to get current value ?
 

Latest posts

Back
Top