简体   繁体   中英

How can I know which assembly contains a given namespace? - C#

I am trying to do toast notifications in windows 10 in a WPF application. All the examples I see refer to a namespace

using Windows.UI.Notifications;

The only problem is that none of the examples I have seen explain what assembly contains that namespace and defines the classes I need.

In particular, I am looking for the ToastNotificationManager class.

In this case(or in general) how can I tell which assembly contains a given namespace?

You can not. Namespaces and assemblyx name have no correlaction. If you need to know which assembly - the documentation for a CLASS normally has that at the end.

Otherwise, you are free to put any class into any namespace regardless of assembly name.

For some assemblies made by Microsoft, you can search http://referencesource.microsoft.com/ (It is an amazing source for learning by the way). It will show the assembly in the tree.

Otherwise you should search the documentation and hope the author has put the assembly name there (MSDN documentation generally contains the assembly name).

You can use the Visual Studio Object Browser to identify assemblies containing namespaces by making sure you have View Containers selected instead of View Namespaces . Then, you can do a search for your namespace Windows.UI.Notifications .

在此输入图像描述

From what I can tell, it is part of Windows Runtime in version 1.3, so it should already be available to your Windows Runtime application. I'm not sure if this is something that is part of the .NET BCL, which is why you might not be finding a specific assembly. Here is a great Msdn article on toast notifications as well.

You didn't specify what type of application you are building, but here is the article for doing this from HTML , and since that is possible, that means it is able to be done via COM in a non-Windows Runtime .NET application, or from another language even.

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