<tfoot id='gZiuk'></tfoot>

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

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

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

        属性的顺序有什么保证吗?

        Does the order of attributes have any guarantees?(属性的顺序有什么保证吗?)
          • <bdo id='vdULo'></bdo><ul id='vdULo'></ul>
            • <i id='vdULo'><tr id='vdULo'><dt id='vdULo'><q id='vdULo'><span id='vdULo'><b id='vdULo'><form id='vdULo'><ins id='vdULo'></ins><ul id='vdULo'></ul><sub id='vdULo'></sub></form><legend id='vdULo'></legend><bdo id='vdULo'><pre id='vdULo'><center id='vdULo'></center></pre></bdo></b><th id='vdULo'></th></span></q></dt></tr></i><div id='vdULo'><tfoot id='vdULo'></tfoot><dl id='vdULo'><fieldset id='vdULo'></fieldset></dl></div>
            • <small id='vdULo'></small><noframes id='vdULo'>

                <tbody id='vdULo'></tbody>
              <legend id='vdULo'><style id='vdULo'><dir id='vdULo'><q id='vdULo'></q></dir></style></legend>

                  <tfoot id='vdULo'></tfoot>
                  本文介绍了属性的顺序有什么保证吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  如果多个属性应用于一个成员,例如

                  If multiple attributes are applied to a member, e.g.

                  [Foo]
                  [Bar]
                  void Baz() { ... }
                  

                  那么 CLR/.NET 规范是否保证了它们在通过反射检索时将按什么顺序检索(例如 Attribute.GetCustomAttributes)?这些方法的文档没有明确说明,虽然它们似乎是按照它们的应用顺序返回的,但我不想依赖未记录的行为,因为那只是自找麻烦.

                  Then are any guarantees made by the CLR/.NET specifications as to what order they will be retrieved in when retrieved by reflection (e.g. Attribute.GetCustomAttributes)? The documentation for these methods does not make it explicit, and while it does seem to be the case that they are returned in the order they are applied, I don't want to rely on undocumented behaviour as that's just asking for trouble.

                  至于为什么这可能很重要,想象一下属性是用来指示该方法应该有一系列拦截器,它们应该以特定的顺序运行.

                  As for why this might be important, imagine the attributes are used to indicate that the method should have a series of interceptors, which should run in a specific order.

                  推荐答案

                  No from 17.2 属性规范 好像不是这样.

                  No from 17.2 Attribute specification it does not seems so.

                  属性的顺序在这样的列表中指定,并且附加部分的顺序安排相同的节目实体,不重要.例如,属性规范 [A][B],[B][A]、[A,B] 和 [B,A] 是等价的.

                  The order in which attributes are specified in such a list, and the order in which sections attached to the same program entity are arranged, is not significant. For instance, the attribute specifications [A][B], [B][A], [A, B], and [B, A] are equivalent.

                  这篇关于属性的顺序有什么保证吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

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

                  相关文档推荐

                  Performance overhead of using attributes in .NET(在 .NET 中使用属性的性能开销)
                  Accessing attribute info from DTE(从 DTE 访问属性信息)
                  c# Hide a property in datagridview with datasource(c#使用数据源隐藏datagridview中的属性)
                  Extract Display name and description Attribute from within a HTML helper(从 HTML 帮助器中提取显示名称和描述属性)
                  How can I force the PropertyGrid to show a custom dialog for a specific property?(如何强制 PropertyGrid 显示特定属性的自定义对话框?)
                  Associate attribute with code generated property in .net(将属性与 .net 中的代码生成属性相关联)

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

                  <legend id='Y0iJe'><style id='Y0iJe'><dir id='Y0iJe'><q id='Y0iJe'></q></dir></style></legend>
                    • <bdo id='Y0iJe'></bdo><ul id='Y0iJe'></ul>
                      <tfoot id='Y0iJe'></tfoot>
                          <tbody id='Y0iJe'></tbody>

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