"Mohd Ebrahim" wrote:
> hello,
>
> i have some clarificaton about :
>
> 1. during run time in my class code (bsl layer), how can i access or come to
> know from where the object / request is invoked from?
>
> ie. how to know from which PSL object this class code has been invoked?
>
> Regards,
>
>
Not sure what you mean by PSL object, but the stack frames may give you what
you need.
StackTrace trace = new StackTrace();
StackFrame frame = trace.GetFrame(1);
string callingClass = frame.GetMethod().DeclaringType.Name;
string callingMethod = frame.GetMethod().Name;
Frame 0 would be the current frame, and frame 2 would be the method calling
the method calling this method. You don't necessarily need the StackTrace
class as StackFrame can be constructed without it.
--
Happy Coding!
Morten Wennevik [C# MVP]
|