当前位置: 动力学知识库 > 问答 > 编程问答 >

wpf - How do I get the object that called (executed) my vb.net subroutine inside my object?

问题描述:

I'm trying to extend my new WPF Touch Screen Keyboard (DLL) Library, to allow the user to get events from the Touch Screen Object. I'd like to be able to tell the Programmer what Object made the call (or executed the subroutine) that raised the event. Not dissimilar to the Sender as Object event parameters one gets when working with a System Object. Which begs the question, How do I get that information, if I don't ask for it? Is there a way to get this information from some call made in the subroutine about to raise the event? That would be nice, and a time saver for me. Thanks!

网友答案:

Can you assign a value to the sender object when you are going to raise the event?

RaiseEvent Touched(Me, e)
网友答案:

You can walk the stack be using the StackTrace class. You will not be able to inspect the call stack parameters, but you can inspect the metadata of the parameters (type information).

分享给朋友:
您可能感兴趣的文章:
随机阅读: