简体   繁体   中英

c# Where can I lookup Microsoft Namespace names?

I'm using a MS namespace but Visual Studio is telling me I don't have a reference to it. Is there a place you can go to and lookup namespaces?

Thanks

If you mean "to find which dll I need (per-type)": MSDN ?

For example, CLSID

Namespace: Microsoft.Aspnet.Snapin

Assembly: AspNetMMCExt (in AspNetMMCExt.dll)

You can normally find the MSDN page about a specific namespace by going to http://msdn.microsoft.com/ namespace . So, for example, to find out about System.Web you could go to...

http://msdn.microsoft.com/system.web

That in itself doesn't help you. You'll need to click through from there to the specific types you're using, and it'll tell you (near the top) the name of the DLL that implements the type.

Remember that a namespace can contain types that are defined in more than one DLL.

有关如何添加参考的信息,请参见http://msdn.microsoft.com/zh-cn/library/wkze6zky(VS.80).aspx

You will also need the assembly.

For Microsoft and System namespaces the easiest way is http://msdn.microsoft.com/library or, if MSDN installed locally, its index.

If you want to know which assembly a certain class is located in you can simply check the documentation (it's noted on the class overview page of the class). Note that one namespace might very well be spread out over more than one assembly.

You need to first add reference to the DLL before using it in your code with the 'using' keyword.

Right click the project > add reference > in the .Net tab select the component and click ok. Then build your code.

You can't find the DLL for a specified namespace in all cases because multiple types belonging to the same assembly may reside in different assemblies.

The fastest way to get there would be to google to the MSDN page for the specific type (class) you are using. Let's say XDocument.. I put `msdn xdocument class' into google. First result is the page I need. Click! Under the class name you'd see a section like this

Namespace:  System.Xml.Linq
Assembly:  System.Xml.Linq (in System.Xml.Linq.dll)

This shows you the namespace that the type belongs to (for which you may need to add a using in your code)
and the DLL you need to 'Add Reference' to.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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