c# object context

M

Mohd Ebrahim

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,
 
J

Jeff Johnson

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?

Does this have anything to do with Windows Forms? If not, please ask in a
dedicated C# group, like
microsoft.public.dotnet.languages.csharp.
 
M

Morten Wennevik [C# MVP]

Mohd Ebrahim said:
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.
 
H

Herfried K. Wagner [MVP]

Mohd Ebrahim said:
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?

Why do you need this information?

Maybe there is a better way to achieve what you are attempting to do.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top