Solved

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

Posted on 2013-01-21
4
424 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

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

The purpose of this article is to demonstrate how we can use conditional statements using Python.
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…
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…

757 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

17 Experts available now in Live!

Get 1:1 Help Now