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

    1. <i id='ptAJw'><tr id='ptAJw'><dt id='ptAJw'><q id='ptAJw'><span id='ptAJw'><b id='ptAJw'><form id='ptAJw'><ins id='ptAJw'></ins><ul id='ptAJw'></ul><sub id='ptAJw'></sub></form><legend id='ptAJw'></legend><bdo id='ptAJw'><pre id='ptAJw'><center id='ptAJw'></center></pre></bdo></b><th id='ptAJw'></th></span></q></dt></tr></i><div id='ptAJw'><tfoot id='ptAJw'></tfoot><dl id='ptAJw'><fieldset id='ptAJw'></fieldset></dl></div>

        <legend id='ptAJw'><style id='ptAJw'><dir id='ptAJw'><q id='ptAJw'></q></dir></style></legend>
          <bdo id='ptAJw'></bdo><ul id='ptAJw'></ul>
      1. <tfoot id='ptAJw'></tfoot>

        为什么对 EventHandler&lt;TEventArgs&gt; 没有约束?

        Why no constraint on EventHandlerlt;TEventArgsgt;?(为什么对 EventHandlerlt;TEventArgsgt; 没有约束?)

      2. <tfoot id='UkEYU'></tfoot>
        <legend id='UkEYU'><style id='UkEYU'><dir id='UkEYU'><q id='UkEYU'></q></dir></style></legend>

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

              <tbody id='UkEYU'></tbody>
              <bdo id='UkEYU'></bdo><ul id='UkEYU'></ul>
            • <i id='UkEYU'><tr id='UkEYU'><dt id='UkEYU'><q id='UkEYU'><span id='UkEYU'><b id='UkEYU'><form id='UkEYU'><ins id='UkEYU'></ins><ul id='UkEYU'></ul><sub id='UkEYU'></sub></form><legend id='UkEYU'></legend><bdo id='UkEYU'><pre id='UkEYU'><center id='UkEYU'></center></pre></bdo></b><th id='UkEYU'></th></span></q></dt></tr></i><div id='UkEYU'><tfoot id='UkEYU'></tfoot><dl id='UkEYU'><fieldset id='UkEYU'></fieldset></dl></div>
                • 本文介绍了为什么对 EventHandler&lt;TEventArgs&gt; 没有约束?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我只是偶然发现(当编译的东西我认为不会编译时)EventHandler 限制为 System.EventArgs 类型.

                  I just figured out by accident (when something compiled that I didn't think would compile) that EventHandler is not constrained to the type System.EventArgs.

                  这是内联文档:

                  #region Assembly mscorlib.dll, v4.0.0.0
                  // C:Program Files (x86)Reference AssembliesMicrosoftFramework.NETFrameworkv4.5mscorlib.dll
                  #endregion
                  
                  namespace System
                  {
                      // Summary:
                      //     Represents the method that will handle an event.
                      //
                      // Parameters:
                      //   sender:
                      //     The source of the event.
                      //
                      //   e:
                      //     An System.EventArgs that contains the event data.
                      //
                      // Type parameters:
                      //   TEventArgs:
                      //     The type of the event data generated by the event.
                      [Serializable]
                      public delegate void EventHandler<TEventArgs>(object sender, TEventArgs e);
                  }
                  

                  这是文档和实现之间的不匹配吗?

                  Is this a mismatch between docs and implementation?

                  我问是因为我很好奇.这根本不是抱怨.

                  推荐答案

                  .net 4.5 中删除了类型约束.

                  The type constraint was removed in .net 4.5.

                  这是 .net 4.5 签名.http://msdn.microsoft.com/en-us/library/db0etb8x%28v=vs.110%29.aspx

                  Here is the .net 4.5 signature. http://msdn.microsoft.com/en-us/library/db0etb8x%28v=vs.110%29.aspx

                  [SerializableAttribute]
                  public delegate void EventHandler<TEventArgs>(
                      Object sender,
                      TEventArgs e
                  )
                  

                  这是 .net 4.0 签名.http://msdn.microsoft.com/en-us/library/db0etb8x%28v=vs.100%29.aspx

                  Here is the .net 4.0 signature. http://msdn.microsoft.com/en-us/library/db0etb8x%28v=vs.100%29.aspx

                  [SerializableAttribute]
                  public delegate void EventHandler<TEventArgs>(
                      Object sender,
                      TEventArgs e
                  )
                  where TEventArgs : EventArgs
                  

                  这篇关于为什么对 EventHandler&lt;TEventArgs&gt; 没有约束?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

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

                  相关文档推荐

                  C# namespace alias - what#39;s the point?(C# 命名空间别名 - 有什么意义?)
                  Using Xpath With Default Namespace in C#(在 C# 中使用具有默认命名空间的 Xpath)
                  Generating an EDMX from a DB2 Database(从 DB2 数据库生成 EDMX)
                  IBM .NET Data Provider Connection String issue with Library List(库列表的 IBM .NET 数据提供程序连接字符串问题)
                  .NET DB2 OLEDB pre-requisites(.NET DB2 OLEDB 先决条件)
                  Referring to Code in IBM.Data.DB2 makes that Assembly Unavailable to the rest of my Solution(引用 IBM.Data.DB2 中的代码使该程序集对我的解决方案的其余部分不可用)

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

                    • <legend id='SSMlq'><style id='SSMlq'><dir id='SSMlq'><q id='SSMlq'></q></dir></style></legend>

                        <tfoot id='SSMlq'></tfoot>
                          <bdo id='SSMlq'></bdo><ul id='SSMlq'></ul>
                        • <small id='SSMlq'></small><noframes id='SSMlq'>

                            <tbody id='SSMlq'></tbody>