gpt4 book ai didi

c# - 有哪些方法可以在 Visual Studio IDE 中识别大括号/大括号对?

转载 作者:行者123 更新时间:2023-11-30 18:54:40 24 4
gpt4 key购买 nike

我有 VB 背景,我想知道为什么我在构建我的 C# 时遇到了很多困难。昨天我意识到这两种语言之间的核心区别之一是什么。举个例子

If True Then
While True
For i As Integer = 0 To 10
c = a + b
Next
End While
End If

很清楚每个 block 的范围在哪里结束,因为

  1. 匹配缩进
  2. 在 IDE 中,单击左大括号或右大括号会突出显示另一个。
  3. 结束语与开始语相匹配(例如,While/End While)

对于c#中的相同代码

if (true) 
{
while (true)
{
for (int i = 0; i <= 10; i++)
{
c = a + b;
}
}
}

1 和 2 仍然适用,但我们失去了 3。

  1. 匹配缩进
  2. 在 IDE 中,单击一个开始或结束语句会突出显示另一个。

好像应该有大括号的自动颜色编码之类的功能。

还有哪些其他策略可用于跟踪匹配的大括号对?

最佳答案

我使用 VSCommands “Code Block End Tagger”(注意:尽管网站上没有提到,它也是 available for VS 2013 ):

enter image description here

选项:

enter image description here

关于c# - 有哪些方法可以在 Visual Studio IDE 中识别大括号/大括号对?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26274175/

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