c# object context

  • Thread starter Thread starter Mohd Ebrahim
  • Start date Start date
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,
 
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.
 
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.
 
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.
 
Back
Top