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

        <tfoot id='1c827'></tfoot>
          <bdo id='1c827'></bdo><ul id='1c827'></ul>

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

        如何从属性中抛出编译错误?

        How to throw compilation error from an attribute?(如何从属性中抛出编译错误?)
          <tbody id='AdxV0'></tbody>

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

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

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

                • <i id='AdxV0'><tr id='AdxV0'><dt id='AdxV0'><q id='AdxV0'><span id='AdxV0'><b id='AdxV0'><form id='AdxV0'><ins id='AdxV0'></ins><ul id='AdxV0'></ul><sub id='AdxV0'></sub></form><legend id='AdxV0'></legend><bdo id='AdxV0'><pre id='AdxV0'><center id='AdxV0'></center></pre></bdo></b><th id='AdxV0'></th></span></q></dt></tr></i><div id='AdxV0'><tfoot id='AdxV0'></tfoot><dl id='AdxV0'><fieldset id='AdxV0'></fieldset></dl></div>
                  本文介绍了如何从属性中抛出编译错误?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  .NET 中有 属性(例如 ObsoleteAttribute) 能够阻止编译或至少抛出编译时警告,具体取决于它们的配置.

                  there are attributes in .NET (e.g. ObsoleteAttribute) which are able to prevent compilation or at least throw compile time warnings depending on their configuration.

                  如何编写能够干扰编译的属性?有没有办法从 Microsoft 外部执行此操作?

                  How to write an attribute that is able to interfere with compilation? Is there a way to do this from outside Microsoft?

                  推荐答案

                  Obsolete 属性是编译器魔法"——你不能在不修改编译器的情况下自己做这样的事情.但是,与往常一样,有一些解决方法 - 例如看看 this 和 这个线程.

                  Obsolete attribute is "compiler magic" - you can't do something like this on your own without modifying the compiler. However, as always, there are workarounds - e.g. take a look at this and this thread.

                  这篇关于如何从属性中抛出编译错误?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

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

                  相关文档推荐

                  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 中的代码生成属性相关联)

                      <tbody id='3RWMI'></tbody>
                  1. <tfoot id='3RWMI'></tfoot>
                      • <legend id='3RWMI'><style id='3RWMI'><dir id='3RWMI'><q id='3RWMI'></q></dir></style></legend>

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

                            <bdo id='3RWMI'></bdo><ul id='3RWMI'></ul>

                            <small id='3RWMI'></small><noframes id='3RWMI'>