Enumerate Argument List

T

tricky one

Anyone know of a way to enumerate the argument list of a function in
VB.NET.

For example I have a Function add_user (u_id AS INT, u_first_name AS
VARCHAR(50), u_last_name AS VARCHAR(50)).

I want to be able to do something like this:

For each argument in add_user.argumentlist
Select Case argument.name
Case u_id
'Do This
Case u_first_name
'Do this
ETC.
Next argument
 
B

Bruce Barker

use reflection to get a MethodInfo, then GetParameters to get an Array of
ParameterInfo. you can then determine the name and type. getting parameters
into an array is more interesting (short of adding them to an array
yourself.). here you have to use the debugging api's.

not sure why you'd want to do this though, it would be pretty slow.

-- bruce (sqlwork.com)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,756
Messages
2,569,535
Members
45,008
Latest member
obedient dusk

Latest Threads

Top