简体   繁体   English

在visual studio中显示命名空间的类(C#)

[英]display classes of a namespace in visual studio (C#)

I am a Java programmer, and just starting to use Visual Studio to do C# programming. 我是一名Java程序员,刚开始使用Visual Studio进行C#编程。 In Java IDE such as Eclipse, if I do not know the class name in a package, I can just type a dot (.) after a package name, then I will get a list of all the classes in that package. 在Java IDE(如Eclipse)中,如果我不知道包中的类名,我只需在包名后键入一个点(。),然后我将得到该包中所有类的列表。 How I can configure visual studio to do the similar thing, say, if I click a namespace name in a file (for example, using System), or add a dot after the namespace, all the classes in that namespace will be displayed somewhere? 如何配置visual studio来执行类似的操作,比如说,如果我单击文件中的命名空间名称(例如,使用System),或者在命名空间后面添加一个点,那么该命名空间中的所有类都将显示在某处?

As far as I remember, the same scenario works. 据我记忆,同样的情况也有效。 Type System. 键入System. and Visual Studio should show the Intellisense window with its contents. 和Visual Studio应显示Intellisense窗口及其内容。 If it doesn't show up you can try Ctrl+Space to force it appear. 如果没有显示,您可以尝试Ctrl + Space强制它出现。

If it still doesn't show anything, you might need to add an assembly reference to the DLL that contains that namespace to your project. 如果它仍然没有显示任何内容,则可能需要将包含该命名空间的DLL的程序集引用添加到项目中。

Obviously, if the namespace is System you don't need to add any reference, as it is added by default already. 显然,如果命名空间是System,则不需要添加任何引用,因为它已经默认添加。

Also relevant: the Object Browser view in Visual Studio. 还相关:Visual Studio中的对象浏览器视图。

If you want to know, first make sure Ctrl + SPACE is not used by other things such as IME. 如果您想知道,请首先确保其他内容(如IME)不使用Ctrl + SPACE。 Then execute this shortcut for IntelliSense within the editor. 然后在编辑器中为IntelliSense执行此快捷方式。 Visual Studio will display all classes you can access in the context. Visual Studio将显示您可以在上下文中访问的所有类。 It may not work like Java, but most people like me find it enough to move on. 它可能不像Java那样有效,但像我这样的大多数人都认为它足以继续前进。

To better understand each namespace, I am more used to hit F1 on the namespace to launch MSDN. 为了更好地理解每个命名空间,我更习惯于命名空间上的F1以启动MSDN。

The Visual Studio intelligence is good enough to that for u only you have the correct reference added to your assembly. Visual Studio智能足够好,只有你有正确的参考添加到你的程序集。 Or you can try Ctrl+Space to force it. 或者您可以尝试Ctrl + Space来强制它。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM