473,399 Members | 2,774 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,399 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 3314
"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: Steve Amey | last post by:
Hi all I would like to get the values of Parameters passed to a method from a centralized exception handling routine. At the moment, the exception is passed to the handler, and I can get the...
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: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new...

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.