PC Review


Reply
Thread Tools Rate Thread

c# object context

 
 
Mohd Ebrahim
Guest
Posts: n/a
 
      15th Jan 2009
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,




 
Reply With Quote
 
 
 
 
Jeff Johnson
Guest
Posts: n/a
 
      15th Jan 2009
"Mohd Ebrahim" <(E-Mail Removed)> wrote in message
news:ABE5CC4F-9A1E-4120-90B1-(E-Mail Removed)...

> 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.


 
Reply With Quote
 
Morten Wennevik [C# MVP]
Guest
Posts: n/a
 
      16th Jan 2009

"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]
 
Reply With Quote
 
Herfried K. Wagner [MVP]
Guest
Posts: n/a
 
      18th Jan 2009
"Mohd Ebrahim" <(E-Mail Removed)> schrieb:
> 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.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
c# object context Mohd Ebrahim Microsoft C# .NET 1 15th Jan 2009 03:29 PM
Inseting an Object in to Context Menu Patel Microsoft C# .NET 0 30th Mar 2007 10:37 AM
Get object that called context menu Eric Microsoft VB .NET 4 27th Sep 2004 12:39 AM
Object in Context.Items and GC =?Utf-8?B?Sm9obiBMaW5u?= Microsoft ASP .NET 2 17th May 2004 07:21 PM
How to get and object in Context.Items xjp Microsoft VB .NET 0 25th Aug 2003 11:25 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 10:45 AM.