Solved

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

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

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Displaying an arrayList in a listView using the default adapter is rarely the best solution. To get full control of your display data, and to be able to refresh it after editing, requires the use of a custom adapter.
Computer science students often experience many of the same frustrations when going through their engineering courses. This article presents seven tips I found useful when completing a bachelors and masters degree in computing which I believe may he…
The viewer will learn how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.

696 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