473,322 Members | 1,421 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

Obtain parameter values from method

ME
How would one obtain the parameter VALUES of a method that has already run?
I can find the method using the StackTrace and StackFrame classes but once I
find the method I would like to obtain the value of one of the parameters
that were passed to the method. Is this possible? Even if I have to use
PInvoke to do so?

I can currently find the parameter TYPEs using reflection but I can not
figure out to obtain the values.

Thanks,

Matt
Sep 21 '07 #1
2 2450
"ME" <tr*********@comcast.netREMOVETHISwrote in message
news:o7******************************@comcast.com. ..
How would one obtain the parameter VALUES of a method that has already
run? I can find the method using the StackTrace and StackFrame classes but
once I find the method I would like to obtain the value of one of the
parameters that were passed to the method. Is this possible? Even if I
have to use PInvoke to do so?

I can currently find the parameter TYPEs using reflection but I can not
figure out to obtain the values.
What is the context here? Where is this method you're trying to get values
from?
--
--------------------------------------------------------------------------------
John Saunders | MVP - Windows Server System - Connected System Developer

Sep 21 '07 #2
ME
The method is within the call stack of the current running process. It will
be in a different assembly (usually System.dll) I find it by itterating
through the call stack (using the StackTrace class and the StackFrame
class). Once I find the method the StackFrame class allows me to obtain a
MethodBase object that includes the method name various other properties
that describe the method, including the parameter types and names.

Here is an example of finding the Method via the above approach:
http://www.syncfusion.com/FAQ/Window...60c.aspx#q978q

Unfortunately though this does not include the actual VALUES of the
parameters that where passed into the method when it was called. To get an
idea of what I am trying to accomplish, simply view the Call Stack in Visual
Studio. There you will see what methods were called in your code and what
parameters wered passed to them (including the values). Hence, I believe
this is possible, I just do not know where to start to figure out how to do
it. For example, what are the rules of obtaining these values? Must the
application be in debug mode? Is there a way to use the windows API to
obtain the values?

Thanks,

Matt
"John Saunders [MVP]" <john.saunders at trizetto.comwrote in message
news:%2****************@TK2MSFTNGP04.phx.gbl...
"ME" <tr*********@comcast.netREMOVETHISwrote in message
news:o7******************************@comcast.com. ..
>How would one obtain the parameter VALUES of a method that has already
run? I can find the method using the StackTrace and StackFrame classes
but once I find the method I would like to obtain the value of one of the
parameters that were passed to the method. Is this possible? Even if I
have to use PInvoke to do so?

I can currently find the parameter TYPEs using reflection but I can not
figure out to obtain the values.

What is the context here? Where is this method you're trying to get values
from?
--
--------------------------------------------------------------------------------
John Saunders | MVP - Windows Server System - Connected System Developer

Sep 22 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Marcin | last post by:
Hello! Is there any method to detect parameters values passed to called method? For example: public Guid ApplicationLogin(string userName, string password, int dbId)
5
by: Kevin Myers | last post by:
How can one obtain obtain the height of a MS Access 2K form? There is a width property, but I don't see a corresponding height property. I need to obtain the height of the form so that I can...
7
by: Abhishek Srivastava | last post by:
Hello All, I am facing a simple problem. I have a method which accepts two parameters. Both are of type DateTime. However when calling this method there are times when the caller does not...
7
by: A.M | last post by:
Hi, Do we have default method parameter in C#? Something like this void method1(int i = 12) { .... }
15
by: SFX | last post by:
If I have a session ID (string) can I somehow obtain the session object associated to that ID (it exist of course) ? I know this sounds wicked but I have a situation in which I have to make a...
2
by: MrDotNet | last post by:
Hi I want pass NameValueCollection as parameter in webmethod. I try it but that give me error. Here is Error. You must implement the Add(System.String) method on...
2
by: chris | last post by:
I am sure I am overlooking something simple, but here goes. In the global.asax file I have some code in the Application_Error method that reads information out of the current exception and emails...
2
by: ME | last post by:
How would one obtain the parameter VALUES of a method that has already run? I can find the method using the StackTrace and StackFrame classes but once I find the method I would like to obtain the...
2
by: mm3178 | last post by:
Hello Mates, My case is slightly complicated....please help me In order to obtain real time current balance of an account, I have built a c# windows service that invokes a c# web service...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.