Visual Studio发现它出现“语法错误”与“编译器错误”之间的区别是什么?或者换一种说法,为什么一些“编译时”错误用红色波浪线和一些用蓝色波浪线表示?这里有一个例子:Visual Studio中的语法错误与编译器错误或红色波浪下划线与蓝色波浪下划线
红色下划线上述错误这样的描述:
No overload for method 'ValidateFilteredRecipient' takes 6 arguments
蓝色下划线的错误这样的描述:
'ValidateBuild': cannot declare instance members in a static class
这我不清楚这两个错误的显着特征是什么。
我认为找到答案将是一块蛋糕:我只是谷歌它,第一个结果将是一个MSDN页面充分阐述这个话题;然而,非常令人惊讶的是,事实并非如此。我开始试图通过谷歌的颜色(因为我还不知道红的意思是“语法错误”,蓝色意味着“编译器错误”):
visual studio red underline vs. blue underline
没有帮助那里。然后我尝试这些搜索:
visual studio error underline color meanings
visual studio underline color meanings
我看得出来,这是无处可去,所以我用Google搜索了一点,想出了在颜色VS设定:工具>选项>环境>字体和颜色。顺便说一下,无法在这里搜索巨大的列表非常烦人,但我发现“语法错误”具有红色波浪下划线,“编译器错误”具有蓝色波浪下划线。
那么做那些呢?返回谷歌:
visual studio compiler error vs. syntax error
相关没什么。下面是我发现的最接近,从MSDN:
Fonts and Colors, Environment, Options Dialog Box
这个页面有这些项:
Compiler Error -- Blue squiggles in the editor indicating a compiler error.
和
Syntax Error -- Parse errors.
一点也不乐于助人 - 对“重点完全“。我一直以为我知道什么是“语法错误”是,至少,和Wikipedia同意:
a syntax error is an error in the syntax of a sequence of characters or tokens that is intended to be written in a particular programming language.
此外,here is what what it has for syntax:
the syntax of a computer language is the set of rules that defines the combinations of symbols that are considered to be a correctly structured document or fragment in that language.
所以,从要回我的“语法错误”以上:
No overload for method 'ValidateFilteredRecipient' takes 6 arguments
这是怎么一个语法错误每个我已经包含在这里的定义?其实,在我看来,在“编译器错误”我得到了更紧密地符合这个定义语法错误:
'ValidateBuild': cannot declare instance members in a static class
有人可以帮我想出解决办法?
@AlfieGoodacre - “你做不到的事情,或者编译器不会让你”<--- a.k.a.“你做错了事情。 –
当我意识到你究竟在深入研究什么的时候,不情愿向上提出一个很好的问题,但也有点毛茸茸的狗故事。红色的波浪线,蓝色的波浪线,我们不能都相处吗? –
@JeroenMostert - 我完全明白。但是它不会影响你?我的意思是,这是一个商用的企业级IDE ....为了解决一个难题,至少...为什么它们不只是一种错误类型?为什么他们没有记录? –