<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.

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

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

                  相关文档推荐

                  Multicast delegate weird behavior in C#?(C# 中的多播委托奇怪行为?)
                  Parameter count mismatch with Invoke?(参数计数与调用不匹配?)
                  How to store delegates in a List(如何将代表存储在列表中)
                  How delegates work (in the background)?(代表如何工作(在后台)?)
                  C# Asynchronous call without EndInvoke?(没有 EndInvoke 的 C# 异步调用?)
                  Delegate.CreateDelegate() and generics: Error binding to target method(Delegate.CreateDelegate() 和泛型:错误绑定到目标方法)

                      <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'>