473,405 Members | 2,176 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,405 software developers and data experts.

Get LineNumber, MethodName, ClassName and so on

I'm trying to make things alot easyer for my self, by useing a
formatet error report, but i need some info to do that, like etc...

MessageBox.Show( "Error In File: " + GetFileNAme() + " \n" + "Class
Name: " + GetClassName() etc.....

i have been looking at StackFrame, and this is ok, but only useable in
debug mode, anyone have any idea how to do this is release mode???

Thnks in Advanced

Rene
Nov 17 '05 #1
1 1894
string nameSpace = this.GetType().Namespace;
string fullClassName = this.GetType().FullName;
string className = this.GetType().Name;

string fullPath =
Path.Combine(Path.Combine(Path.GetDirectoryName(Ap plication.ExecutablePath),
nameSpace.Replace(".", "\\"), className);

Usually the file name should be the same as Class Name and the path should
be the same as the namespace.... Of course you can change that. But if you
are methodic you can use it.

It doesn't work if your code will be obfuscated because you will get
something like a.D.v

Gustavo

"Rene Sørensen" <re**@deltadk.dk> wrote in message
news:tt********************************@4ax.com...
I'm trying to make things alot easyer for my self, by useing a
formatet error report, but i need some info to do that, like etc...

MessageBox.Show( "Error In File: " + GetFileNAme() + " \n" + "Class
Name: " + GetClassName() etc.....

i have been looking at StackFrame, and this is ok, but only useable in
debug mode, anyone have any idea how to do this is release mode???

Thnks in Advanced

Rene

Nov 17 '05 #2

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

Similar topics

7
by: Joshua Beall | last post by:
Hi All, I have been trying to dynamically call a static member function, as follows: $className = 'MyClass'; $methodName = 'MyMethod' $result = $className::$methodName(); However, I get a...
0
by: Paul L | last post by:
I'm using SAX to parse a valid XML document without a DTD. If the document has extra whitespace as blank lines, the lineNumber reported by the Locator is in correct, by a line or two. Is their some...
1
by: Peter King | last post by:
if you assign multiple classes in order to keep your classes generic e.g ..classA { position.absolute; left:5 top:5 height:200 width:800 } ..classB { background-color: red} ..classC {...
4
by: Ben R. | last post by:
Between ClassName and Inherits, which attribute is set to specify the class that a page uses? I would think that would be inherits. Further, the description for ClassName is: Specifies the class...
2
by: bmgz | last post by:
I have written a script that highlights a table row when the appropriate checkbox is checked. Using element.style is a bit messy and doesn't really fulfil my needs.. I want to just be able to...
1
by: Eric M L | last post by:
I am wondering if I am alone with this problem. Using VS 2005, I must validate an XML file via a Schema and it works well. When I get the schema exception and check the LineNumber and...
2
by: jonfroehlich | last post by:
According to the MSDN documentation within the XmlTextReader class for ..NET 2.0, the recommended practice to create XmlReader instances is using the XmlReaderSettings class and the...
7
by: uncle | last post by:
config file that contains lines like... assemblyname|classname|methodname I want to invoke that static method. I found the following examples which make sense... Type theClass =...
1
by: Steph | last post by:
hello, how can i redefine the "<MethodName>Response" and "<MethodName>Result" .... in the soap response ! "<MethodName>Response" = ResponseElementName "<MethodName>Result" = ? thanks
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...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
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...
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
tracyyun
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...
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.