Solved

How can I get the value of a parameter of a method in vb.net?

Posted on 2013-01-21
4
432 Views
Last Modified: 2013-11-13
Sir/Ma'am,

I want to get the value of a parameter of the method being used. How is it possible? Can i use reflection to do this task?

Thanks in advance
0
Comment
Question by:hc_gupta
  • 3
4 Comments
 
LVL 53

Expert Comment

by:Dhaest
ID: 38800678
Can you give an example of what you are achieving ?

Using Reflection to analyze Parameters and their values
http://stackoverflow.com/questions/2147368/using-reflection-to-analyze-parameters-and-their-values
0
 

Accepted Solution

by:
hc_gupta earned 0 total points
ID: 38800711
Basically I'm trying to get the values of the parameters of the current method using  " System.Reflection.MethodBase.GetCurrentMethod.GetParameters ".
Here I'm getting the array of the parameters but I'm interested in getting their values.


For Example

Public Function method1(ByVal name As String, ByVal marks As Integer) As String
Dim detail As String = name & " got " & marks & " marks."
Dim val As Object = System.Reflection.MethodBase.GetCurrentMethod.GetParameters
Dim val2 As Type = val(0).GetType()

Dim val3 As ParameterInfo =...??   '(wat to use here)

Return detail
End Function

how can i get the values of "name" and "marks"??
0
 

Author Comment

by:hc_gupta
ID: 39469440
Sorry, but i didn't find the exact solution required .
0
 

Author Closing Comment

by:hc_gupta
ID: 39475832
Sorry, but i didn't find the exact solution required .
0

Featured Post

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Does the idea of dealing with bits scare or confuse you? Does it seem like a waste of time in an age where we all have terabytes of storage? If so, you're missing out on one of the core tools in every professional programmer's toolbox. Learn how to …
A short article about a problem I had getting the GPS LocationListener working.
The goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.

910 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now