C Programming Tutorials and advice
CProgrammingTrends News Archives About Us Feedback

Recent Articles


Compress & Decompress Strings In C#
A couple of days ago, I had to store some very big strings in an XML file. To keep the file size down I wanted to compress the strings using a GZipStream and then decompress them later when needed. I modified...

Nokia Eases The Pain For C And Linux Developers
For mobile application developers and those creating LBS apps this is huge! Editor's Note: I have taken the liberty of posting a link to this story in the programming forum at WebProWorld. I'd like to encourage WPW...

Generate Unique Strings & Numbers In C#
The System.Guid is used whenever we need to generate a unique key, but it is very long. That's in many cases not an issue, but in a web scenario where it is part of the URL we need to use its string representation which...

C# - Generic Plug-in Application
At work, we are about to build a new internal tool for administration of different systems. We developers need certain applications and the sales department...

C# - Screen Scraping
Some say that screen scraping is a lost art because it is no longer an advanced discipline. That may be right, but there are different ways of doing it. Here are some different ways that all are perfectly acceptable...

C# Stock Quote Class
A couple of months ago one of my readers asked me to build a stock quote class that would automatically update the quote. I forgot about it, but then I found the e-mail and decided to give it a go. I started looking for...

05.17.07


See Who Calls Any Method In C#


By Mads Kristensen

In some situations it can be important to know which methods are calling other methods.

Think of an error log. Here you would like to know which method that threw the error and at what line in what file.

This helps to debug runtime code and makes it very easy to find the exact point of failure.

C# 2.0 has the possibility to go back in time and inspect which methods called other methods all the way up the stack.

Here is a static method that does just that and returns the caller of any method in the stack.



Low Rate eCommerce & Retail Plans



In a error logging scenario you probably want to set the skipFrames parameter to 1, which is the latest method or the method highest on the stack.

Comments

About the Author:
Mads Kristensen currently works as a Senior Developer at Traceworks located in Copenhagen, Denmark. Mads graduated from Copenhagen Technical Academy with a multimedia degree in 2003, but has been a professional developer since 2000. His main focus is on ASP.NET but is responsible for Winforms, Windows- and web services in his daily work as well. A true .NET developer with great passion for the simple solution.

http://www.madskristensen.dk/

About CProgrammingTrends
A collection of articles and tutorials designed to help C and C variant programmers in their programming work. C Programming Tutorials and advice

CProgrammingTrends is brought to you by:

SecurityConfig.com NetworkingFiles.com
NetworkNewz.com WebProASP.com
DatabaseProNews.com SQLProNews.com
ITcertificationNews.com SysAdminNews.com
LinuxProNews.com WirelessProNews.com
CProgrammingTrends.com ITmanagmentNews.com


-- CProgrammingTrends is an iEntry, Inc. publication --
iEntry, Inc. 2549 Richmond Rd. Lexington KY, 40509
2007 iEntry, Inc.  All Rights Reserved  Privacy Policy  Legal


archives | advertising info | news headlines | free newsletters | comments/feedback | submit article




CProgrammingTrends Home Page About Article Archive News Downloads WebProWorld Forums Jayde iEntry Advertise Contact