Hi again Mike, I just read your tweet and saw you wanted the full path, thought as much...

Hi Mike,

I know the shortcomings of this but does

var filename = typeof (SomeClass).Name;

work well enough? If no, why is that out of curiosity? (sorry i want the boring explanation!)

On 13/09/2011 1:06 AM, David Kean wrote:

This requires PDBs to be present, and will likely give you the wrong answer in the presence of inlining and tail calls.

*From:*[email protected] [mailto:[email protected]] *On Behalf Of *Preet Sangha
*Sent:* Monday, September 12, 2011 2:51 AM
*To:* ozDotNet
*Subject:* Re: Embed file name into compiled source

Now I dare you to put it into shared library and see it fail :-0

On 12 September 2011 21:45, Michael Minutillo <[email protected] <mailto:[email protected]>> wrote:

Perfect. And much simpler than the crazy ideas being bandied about in my brain. Thanks!

Michael M. Minutillo
Indiscriminate Information Sponge
http://codermike.com

On Mon, Sep 12, 2011 at 5:38 PM, Preet Sangha <[email protected] <mailto:[email protected]>> wrote:

Doh!!! I mean in the class :-)

On 12 September 2011 21:37, Preet Sangha <[email protected] <mailto:[email protected]>> wrote:

in the constructor:

class x {

static string currentFile = new System.Diagnostics.StackTrace(true).GetFrame(0).GetFileName();

}

On 12 September 2011 21:34, Michael Minutillo <[email protected] <mailto:[email protected]>> wrote:

Hey all,

Hopefully a simple one (or impossible). Is there a way to embed the current filename into a class using the preprocessor? i.e. In Ruby you can use the predefined variable __FILE__ (or something I don't remember the specifics).

I want this info for reasons that are complex and boring and I really don't want to have to dig into pdb files or write my own precompilation step to achieve what I need.

Michael M. Minutillo
Indiscriminate Information Sponge
http://codermike.com



--
regards,
Preet, Overlooking the Ocean, Auckland



--
regards,
Preet, Overlooking the Ocean, Auckland



--
regards,
Preet, Overlooking the Ocean, Auckland



Reply via email to