<tfoot id='Whne4'></tfoot>

<small id='Whne4'></small><noframes id='Whne4'>

    • <bdo id='Whne4'></bdo><ul id='Whne4'></ul>
        <i id='Whne4'><tr id='Whne4'><dt id='Whne4'><q id='Whne4'><span id='Whne4'><b id='Whne4'><form id='Whne4'><ins id='Whne4'></ins><ul id='Whne4'></ul><sub id='Whne4'></sub></form><legend id='Whne4'></legend><bdo id='Whne4'><pre id='Whne4'><center id='Whne4'></center></pre></bdo></b><th id='Whne4'></th></span></q></dt></tr></i><div id='Whne4'><tfoot id='Whne4'></tfoot><dl id='Whne4'><fieldset id='Whne4'></fieldset></dl></div>
        <legend id='Whne4'><style id='Whne4'><dir id='Whne4'><q id='Whne4'></q></dir></style></legend>

        如何从 VB.NET 中的事件中获取实际的 EventHandler 委托实例?

        How can I get an actual EventHandler delegate instance from an event in VB.NET?(如何从 VB.NET 中的事件中获取实际的 EventHandler 委托实例?)

          <legend id='xUwFN'><style id='xUwFN'><dir id='xUwFN'><q id='xUwFN'></q></dir></style></legend>
                <tfoot id='xUwFN'></tfoot>
                  <tbody id='xUwFN'></tbody>

                <small id='xUwFN'></small><noframes id='xUwFN'>

              1. <i id='xUwFN'><tr id='xUwFN'><dt id='xUwFN'><q id='xUwFN'><span id='xUwFN'><b id='xUwFN'><form id='xUwFN'><ins id='xUwFN'></ins><ul id='xUwFN'></ul><sub id='xUwFN'></sub></form><legend id='xUwFN'></legend><bdo id='xUwFN'><pre id='xUwFN'><center id='xUwFN'></center></pre></bdo></b><th id='xUwFN'></th></span></q></dt></tr></i><div id='xUwFN'><tfoot id='xUwFN'></tfoot><dl id='xUwFN'><fieldset id='xUwFN'></fieldset></dl></div>
                • <bdo id='xUwFN'></bdo><ul id='xUwFN'></ul>
                  本文介绍了如何从 VB.NET 中的事件中获取实际的 EventHandler 委托实例?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  在 C# 中,我可以这样做:

                  In C#, I could do something like this:

                  EventHandler handler = this.SomeEvent;
                  

                  ...例如,这将允许我做:

                  ...which would allow me to, for example, do:

                  Delegate[] attachedHandlers = handler.GetInvocationList();
                  

                  在 VB.NET 中,我似乎不知道如何做类似的事情.

                  In VB.NET, I can't seem to figure out how to do a similar thing.

                  这不起作用:

                  Dim handler As EventHandler = Me.SomeEvent
                  

                  ...由于以下错误:

                  公共事件 SomeEvent(sender AsObject, e As EventArgs)' 是一个事件,并且不能直接调用.用一个'RaiseEvent' 语句来引发事件.

                  Public Event SomeEvent(sender As Object, e As EventArgs)' is an event, and cannot be called directly. Use a 'RaiseEvent' statement to raise an event.

                  但这也不起作用:

                  Dim handler As EventHandler = AddressOf Me.SomeEvent
                  

                  ...因为:

                  'AddressOf' 操作数必须是方法的名称(不带括号).

                  'AddressOf' operand must be the name of a method (without parentheses).

                  那么我怎样才能真正从 VB.NET 中的事件中获取 EventHandler 呢?立即想到的唯一想法是使用反射,但这似乎很荒谬.

                  So how can I actually get an EventHandler from an event in VB.NET? The only idea that's immediately coming to mind is to use reflection, but that seems pretty ridiculous.

                  推荐答案

                     Private Event MyEvent()
                     Private delegates() As System.Delegate = MyEventEvent.GetInvocationList()
                  

                  未记录,在 此处找到

                  这篇关于如何从 VB.NET 中的事件中获取实际的 EventHandler 委托实例?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  C# namespace alias - what#39;s the point?(C# 命名空间别名 - 有什么意义?)
                  Using Xpath With Default Namespace in C#(在 C# 中使用具有默认命名空间的 Xpath)
                  IBM.Data.DB2.Core connection problems(IBM.Data.DB2.Core 连接问题)
                  Generating an EDMX from a DB2 Database(从 DB2 数据库生成 EDMX)
                  Datetime field overflow with IBM Data Server Client v9.7fp5(IBM Data Server Client v9.7fp5 的日期时间字段溢出)
                  Using entity Framework with .NET Core and DB2(将实体框架与 .NET Core 和 DB2 结合使用)
                  <tfoot id='NetVG'></tfoot>
                      <i id='NetVG'><tr id='NetVG'><dt id='NetVG'><q id='NetVG'><span id='NetVG'><b id='NetVG'><form id='NetVG'><ins id='NetVG'></ins><ul id='NetVG'></ul><sub id='NetVG'></sub></form><legend id='NetVG'></legend><bdo id='NetVG'><pre id='NetVG'><center id='NetVG'></center></pre></bdo></b><th id='NetVG'></th></span></q></dt></tr></i><div id='NetVG'><tfoot id='NetVG'></tfoot><dl id='NetVG'><fieldset id='NetVG'></fieldset></dl></div>
                      <legend id='NetVG'><style id='NetVG'><dir id='NetVG'><q id='NetVG'></q></dir></style></legend>
                    1. <small id='NetVG'></small><noframes id='NetVG'>

                        <tbody id='NetVG'></tbody>

                            <bdo id='NetVG'></bdo><ul id='NetVG'></ul>