Hi y'all .. I hope this is an interesting one ...
Within an executing method, I can call MethodBase.GetC urrentMethod() and
retrieve info about the method that's currently running, including parameter
names & data types.
Is there a way to get the parameter v a l u e s as well ??? ( I know ...
this is indeed weird, but .. don't ask :D )
Cheers,
Angel
O:] 3 13559
Hi,
I don't know for sure if you can get it, a good start point may be
StackFrame class, the parameters are stored in the stack so this may be the
start point.
Please if you find the answer post it back here.
Cheers,
--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation
"Angelos Karantzalis" <ak**********@y ahoo.com> wrote in message
news:e1******** ******@tk2msftn gp13.phx.gbl... Hi y'all .. I hope this is an interesting one ...
Within an executing method, I can call MethodBase.GetC urrentMethod() and retrieve info about the method that's currently running, including parameter names & data types.
Is there a way to get the parameter v a l u e s as well ??? ( I know ... this is indeed weird, but .. don't ask :D )
Cheers, Angel O:]
I'm afraid that after an extensive search on the web, it seems that the only
way to retrieve parameter values at runtime is by using Debugging API's.
Pitty ...
O:(
"Ignacio Machin ( .NET/ C# MVP )" <ignacio.mach in AT dot.state.fl.us > wrote
in message news:#j******** ******@TK2MSFTN GP10.phx.gbl... Hi,
I don't know for sure if you can get it, a good start point may be StackFrame class, the parameters are stored in the stack so this may be
the start point.
Please if you find the answer post it back here.
Cheers,
-- Ignacio Machin, ignacio.machin AT dot.state.fl.us Florida Department Of Transportation "Angelos Karantzalis" <ak**********@y ahoo.com> wrote in message news:e1******** ******@tk2msftn gp13.phx.gbl... Hi y'all .. I hope this is an interesting one ...
Within an executing method, I can call MethodBase.GetC urrentMethod() and retrieve info about the method that's currently running, including parameter names & data types.
Is there a way to get the parameter v a l u e s as well ??? ( I know
.... this is indeed weird, but .. don't ask :D )
Cheers, Angel O:]
Angelos,
No, you can not. You can only reflect on metadata, which is created a
compile time. To that end, you would have to pass the actual values
yourself to whatever method you wish.
Now, one might think that it would be easy to get the values (and
indeed, it might be because you have access to the stack). However, it
wouldn't be a good idea, because there is no way to make anything "const",
which is needed so that you don't modify anything further up on the stack.
Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard. caspershouse.co m
"Angelos Karantzalis" <ak**********@y ahoo.com> wrote in message
news:e1******** ******@tk2msftn gp13.phx.gbl... Hi y'all .. I hope this is an interesting one ...
Within an executing method, I can call MethodBase.GetC urrentMethod() and retrieve info about the method that's currently running, including parameter names & data types.
Is there a way to get the parameter v a l u e s as well ??? ( I know ... this is indeed weird, but .. don't ask :D )
Cheers, Angel O:]
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
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)
|
by: Mad Scientist Jr |
last post by:
Is it possible to write a method with a signature for x parameters (so
you get intellisense when you call it), but from within the method, be
able to access the parameter names and values in a name/value
collection (or similar, perhaps a name/value/type collection) so that
one generic function exists as the code for multiple methods/signature?
|
by: Brad Quinn |
last post by:
Is there a way to get the values of the paramaters to a
method programatically?
I know that I can use reflection to find out the
parameter names and types, etc., but I want to know the
values of those parameters too.
I'm trying to write a generic error handler. I wan't to
be able to log the values that caused the error, without
the...
|
by: Angelos Karantzalis |
last post by:
Hi y'all .. I hope this is an interesting one ...
Within an executing method, I can call MethodBase.GetCurrentMethod() and
retrieve info about the method that's currently running, including parameter
names & data types.
Is there a way to get the parameter v a l u e s as well ??? ( I know ...
this is indeed weird, but .. don't ask :D )
|
by: Alex Stevens |
last post by:
Hi All,
I'm writing a data access class in which I expose an SQlClient.SQLCommand's
Parameters Collection via a property.
How would I go about overloading the parameters.add method with one of my
own?
The reason I wish to do this is be able to supply on one line the Name,
Type, Direction, Size and Value and as none of the current...
| |
by: Jeff |
last post by:
I am trying to dynamically load an assembly via reflection and then invoke a
method of that assembly that will populate a custom type collection passed
into the method byref. I am able to dynamically load both the DALC
component (for the method call) and the Entity component (for the custom
type collection to pass in), but I keep getting an...
|
by: kplkumar |
last post by:
I am trying to get the method and the parameters passed to that method
from the stackTrace.
My code is,
private void GetExecutingMethodInfo()
{
StackTrace trace = new StackTrace(false);
for (int index = 0; index < trace.FrameCount; ++index)
|
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 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...
|
by: gman |
last post by:
How can you get the current class of a method?
We are writting out trace error messages using the
System.Reflection.MethodBase.GetCurrentMethod to get the Current
Method but a string is passed telling for the class. I am a newbie to
the .NET but I would think there should be a way to say
GetCurrentClass?
Here is our code....
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it. ...
| |
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
|
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
|
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in...
| |
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |