gpt4 book ai didi

c# - 在 Visual Studio 代码分析中使用 CustomDictionary.xml 进行花式标识符

转载 作者:行者123 更新时间:2023-11-30 13:50:40 25 4
gpt4 key购买 nike

例如,iPhone 这样的标识符。当我运行代码分析时,它给了我这个错误:

CA1709 : Microsoft.Naming : Correct the casing of 'i' in namespace name 'iPhone.Example' by changing it to 'I'.

我尝试向 CustomDictionary.xml 添加一个条目,如下所示:

<Words>
<Recognized>
<Word>iphone</Word>
</Recognized>
</Words>

然后还是报同样的错误,又报了一个错误,如下:

CA1702 : Microsoft.Naming : The compound word 'iPhone' in namespace name 'iPhone.Example' exists as a discrete term. If your usage is intended to be single word, case it as 'iphone'.

然后我又添加了一些规则如下:

<Compound>
<Term CompoundAlternate="IPhone">iphone</Term>
</Compound>
<DiscreteExceptions>
<Term>iphone</Term>
</DiscreteExceptions>
<Acronyms>
<CasingExceptions>
<Acronym>iPhone</Acronym>
</CasingExceptions>
</Acronyms>

但它并没有给出任何区别。无论如何要添加这种异常?

提前致谢。

最佳答案

您添加到词典中的任何内容都无法避免最初的 CA1709 违规,因为该问题与拼写无关。相反,它的问题在于第一个字母没有大写,这违反了命名空间名称的 Pascal 大小写约定。

关于c# - 在 Visual Studio 代码分析中使用 CustomDictionary.xml 进行花式标识符,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5788740/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com