Well, the reason is simply to create a generic logging function which
will know (and output) the class/method of its caller to a file or
something.
The method is straightforward, by hooking into the stacktrace.
For non-static classes, getting the classname is even more
straightforward, it is just this.GetType.
However it is not obvious to me how a function in a static class can
work out which class it is in.
Funnily enough the idea of using a static member did cross my mind, but
I really can't be bothered copy/pasting some stupid variable into the
top of all of my static classes unless I really have to. For one,
sooner or later I'll screw it up - believe you me I am *that* bad at
coding; for another there should be a smarter way of doing this.
I am aware that the solution to this problem is likely going to be
something to do with reflection, or maybe using the stack info once
again. But I cannot see how. Any takers?