> "vsr" <vs*@discussions.microsoft.com> schrieb:
I am calling one Method in Common class from different classes and i
want
to
know from which object the call is coming from.. is there any way?
No, because this wouldn't make sense in any scenario I can think of.
Why exactly would you need this information?
I agree that in most cases, you would break encapsulation by doing this.
Since you did not mention what your goal was, it is hard to know if there
wouldn't be a way of achieving the result. It is possible in 2005 using the
Diagnostics.StackTrace.GetFrame method as follows:
Dim propertyName As String = _
New System.Diagnostics.StackTrace(). _
GetFrame(1).GetMethod.Name
That being said, it is possible that the functionality you wish to achieve
could be better accomplished using Aspects. You may want to read up on Aspect
Oriented Programming a bit to see if it could accomplish what you wish to do.