Can't suppress CA1709 in any way

六眼飞鱼酱① 提交于 2020-01-03 00:22:49

问题


I want to suppress CA1709: Identifiers should be cased correctly, on public class IDd. For example i want to use IDd as correct word. But i can't. I tried everything at code analysis dictionary:

<?xml version="1.0" encoding="utf-8"?>
<Dictionary>
  <Words>
    <Unrecognized>
      <Word></Word>
    </Unrecognized>
    <Recognized>
      <Word>d</Word>
      <Word>IDd</Word>
    </Recognized>
        <Deprecated>
            <Term PreferredAlternate=""></Term>
        </Deprecated>
        <Compound>
            <Term CompoundAlternate="IDd">IDd</Term>
        </Compound>
    <DiscreteExceptions>
      <Term>IDd</Term>
    </DiscreteExceptions>
  </Words>
  <Acronyms>
    <CasingExceptions>
      <Acronym>IDd</Acronym>
      <Acronym>ID</Acronym>
      <Acronym>d</Acronym>
    </CasingExceptions>
  </Acronyms>
</Dictionary>

But nothing helps me to add this work as correct with that case. What would you advise?


回答1:


The problem here is the "Dd", not the full "IDd", which is what the message of the CA1709 violation should be showing.

This can be addressed quite adding "dd" to the dictionary as a recognized word if you consider to be an actual word:

<?xml version="1.0" encoding="utf-8" ?>
<Dictionary>
    <Words>
        <Recognized>
            <Word>dd</Word>
        </Recognized>
    </Words>
</Dictionary>

or by adding it as an acronym casing exception if you do not consider it to be a word by still want to use pascal casing:

<?xml version="1.0" encoding="utf-8" ?>
<Dictionary>
    <Acronyms>
        <CasingExceptions>
            <Acronym>Dd</Acronym>
        </CasingExceptions>
    </Acronyms>
</Dictionary>


来源:https://stackoverflow.com/questions/16467327/cant-suppress-ca1709-in-any-way

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!