Visual Studio 的快捷方式(从 Eclipse 迁移)

发布于 2025-01-06 11:39:26 字数 1539 浏览 5 评论 0原文

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

路弥 2025-01-13 11:39:27

我对 Eclipse 不熟悉,但无论如何我都会尝试回答......

  • 导入包(在 Eclipse 中为 Ctrl+Shift+O)。

.NET 中没有“包”的概念。有些程序集包含类,并且这些类在命名空间中组织。要添加程序集引用,请右键单击项目并选择“添加引用”。如果要自动导入包含正在使用的类的命名空间,请将脱字符号放在类名称上,然后键入 Ctrl + .。它将建议要导入的名称空间。

  • 自动生成一些方法(例如 equals() 和 toString())。

只需输入override并按Space,它就会建议要覆盖的方法列表(包括EqualsToString

  • 自动生成所需的 try/catch 并抛出正确的异常(无需编写并在 MSDN 中搜索正确的异常)

输入 try 并点击 Tab,它将完成try/catch 块(这称为代码片段)。无法自动捕获正确的异常,因为与 Java 不同,C# 方法不声明它们可以抛出哪些异常。

第二,是否有.net框架的Java-Api-Like文档,MSDN真的很混乱,我发现很难找到我想要的东西。

您可以在此处找到所有 .NET Framework 类的参考(这是例如 Object)。恕我直言,它比 Java API 文档方便得多,但我想这是一个品味和习惯的问题...您还可以下载离线文档,它提供了类、成员、关键字等的索引。

I'm not familiar with Eclipse, but I'll try to answer anyway...

  • Importing packages (Ctrl+Shift+O in Eclipse) .

There is no notion of "package" in .NET. There are assemblies that contain classes, and these classes are organized in namespaces. To add an assembly reference, right click on the project and select "Add reference". If you want to automatically import the namespace that contains a class you're using, put the caret on the class name and type Ctrl + .. It will suggest the namespace to import.

  • Generating automaticly some methods ( like equals() et toString()).

Just type override and hit Space, it will suggest a list of methods to override (including Equals and ToString)

  • Generating the needed try/catch automaticly with the right thrown Exception (no need to write it and search in MSDN for the right exception)

Type try and hit Tab, it will complete the try/catch block (this is known as a code snippet). There is no way to automatically catch the right exception, because unlike Java, C# methods don't declare what exceptions they can throw.

Second ,is there any Java-Api-Like documentation for .net framework , MSDN is really confusing and I find it really hard to find what I look for.

You can find the reference for all .NET Framework classes here (here's the Object class for instance). IMHO it's much more convenient than the Java API documentation, but I guess it's a matter of taste and habit... You can also download the offline documentation, which provides an index of classes, members, keywords, etc.

反话 2025-01-13 11:39:27

键盘快捷键,来自 MSDN。

我发现自己最常使用的是:

  • CTRL+SHIFT+F12(在文件中查找)
  • SHIFT+F9(快速观看)
  • F10(跳过)
  • F11(步入)
  • F5(播放)

就文档而言,我实际上发现 MSDN 是一个很好的资源。有时,真正找到我要找的东西是最困难的部分,但谷歌很容易解决这个问题。然而,至少根据我的经验,写作通常是清晰而透彻的。如果您还没有看到这些,也许它们会有一些用处,特别是第二个链接。

MSDN - .NET Framework 4

MSDN - .NET Framework 类库

我知道您说过您不喜欢它,但是在我看来,这确实是最好的。

Keyboard shortcuts, via MSDN.

The ones I find myself using the most often are:

  • CTRL+SHIFT+F12 (Find in files)
  • SHIFT+F9 (Quick Watch)
  • F10 (Step Over)
  • F11 (Step Into)
  • F5 (Play)

As far as documentation goes, I actually find MSDN to be a great resource. Sometimes actually finding what I'm looking for is the hardest part, but google solves that pretty easily. The writing, however, is typically clear and thorough, at least in my experience. If you haven't seen these, perhaps they will be of some use, particularly the 2nd link.

MSDN - .NET Framework 4

MSDN - .NET Framework Class Library

I know you said you don't love it, but it truly is the best available in my opinion.

路还长,别太狂 2025-01-13 11:39:27

Eclipse 中的 Ctrl+Shift+O 相当于 Shift+Alt+F10。对于 try-catch 生成,使用鼠标或 Shift 和箭头选择文本,然后按 ctrl+k 然后按 ctrl+s。出现一个窗口,您可以在其中浏览代码块周围的内容,例如 iftry 等。

The equivalent of Ctrl+Shift+O in Eclipse is Shift+Alt+F10. For the try-catch generation select the text using mouse or shift and arrows followed by that ctrl+k then ctrl+s. A window appears where you can browse what to surround your code block with like if,try etc.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文