Fog Creek Software
Discussion Board




Welcome! and rules

Joel on Software

Class Name

I have a class that is derived from the IMessageSink interface. In the SyncProcessMessage i want to get the class name of the method invoked. How is it possible?

SK
Monday, August 23, 2004

this.GetType().FullName ??

maybe I'm missing something
Tuesday, August 24, 2004

I have a custom attribute. all my classes have this custom attribute. when any of the method in these classes is called. control goes to the MessageSink of the custom attribute class. There i want to get the calling methods class name........That is not possible using  this.getType

SK
Tuesday, August 24, 2004

Perhaps you can do it with the System.Diagnostics.StackTrace class.

Christopher Wells
Tuesday, August 24, 2004

Try something like this:

public IMessage SyncProcessMessage( IMessage msg )
{

  IMethodCallMessage call = msg as IMethodCallMessage;
  if ( call != null )
  {
      string methodName = call.MethodName;
  }

  ...
}

John Lewicki
Wednesday, August 25, 2004

*  Recent Topics

*  Fog Creek Home