Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / Interop / January 2007

Tip: Looking for answers? Try searching our database.

Reflecting for method param names and values?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Mario - 05 Jan 2007 16:27 GMT
I have used the GetCurrentMethod and GetParameters via the
System.Reflection namespace.  With this I am able to identify all of
the parameter names of the current method.  What I would like to do is
get the current values of those parameters using those dynamically
determined parameter names.

The goal is this:

I want to write a logging function that captures all of the incoming
values for a method and writes them in name-value pairs.

e.g.

Public Sub MyReplace(str As String, oldVal As String, newVal As String)
 ' call my logging function here .. it dynamically processes the
params immediately above
End Sub

Log results:
str = 'The quick brown fox'
oldValue = 'quick'
newValue = 'speedy'

Thanks.
Mario T. Lanza
2007.01
Mattias Sjögren - 05 Jan 2007 19:58 GMT
>I have used the GetCurrentMethod and GetParameters via the
>System.Reflection namespace.  With this I am able to identify all of
>the parameter names of the current method.  What I would like to do is
>get the current values of those parameters using those dynamically
>determined parameter names.

Reflection doesn't let you do that.

Mattias

Signature

Mattias Sjögren [C# MVP]  mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Please reply only to the newsgroup.

Chuck C - 05 Jan 2007 21:39 GMT
You may want to do a bit more research on what Reflection actually is and
what "api hooking" or profiling is.  Sounds like you have the two confused.

Reflection will only let you gather information about an assembly such as
function names and parameter names - not values.

API hooking or profiling allows you to see what values were passed into a
function when it was called.

"Mario" <mlanza@comcast.net> wrote in news:1168014446.867652.270090
@q40g2000cwq.googlegroups.com:

> I have used the GetCurrentMethod and GetParameters via the
> System.Reflection namespace.  With this I am able to identify all of
[quoted text clipped - 22 lines]
> Mario T. Lanza
> 2007.01

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.