how to find namespace of dll at runtime [duplicate] - c#

This question already has answers here:
Closed 10 years ago.
Possible Duplicate:
How to get Namespace of an Assembly?
when i load a assembly how can i find its namespace suppose if i load a exam.dll how can i find its namespace

First off, an assembly can contain many namespaces. It's often that 1 assembly == 1 namespace, but this is not required at all.
To find the namespaces in the assembly, just get all of the types in the assembly. See Assembly.GetTypes for details as to how to do this.
From the type, you have the fully qualified type name, and the namespace of the type.

Related

Namespace "Microsoft.SqlServer.MessageBox" Does Not Exist [duplicate]

This question already has answers here:
Microsoft.ExceptionMessageBox not being "found"
(2 answers)
Closed 4 years ago.
I'm trying to use the Microsoft.SqlServer.MessageBox.ExceptionMessageBox class for an application.
After putting using Microsoft.SqlServer.MessageBox; at the top of my program like this documentation stated, I got the following error:
The type or namespace name 'SqlServer' does not exist in the namespace 'Microsoft' (are you missing an assembly reference?)
Trying to add a reference to the required assembly like this cite said didn't help either; the DLL wasn't present, nor was the folder it was supposed to be in.
Question: How do I fix this issue?
You may need to dd a reference to the below assembly.
Microsoft.ExceptionMessageBox.dll
You might have to browse for it.The default installation directory is C:\Program Files\Microsoft SQL Server\##\SDK\Assemblies.

Using System.Windows.Forms gives me an error message [duplicate]

This question already has answers here:
'Forms' does not exist in the namespace system.windows
(7 answers)
Closed 8 years ago.
"The type or namespace name 'Forms' does not exist in the namespace
'System.Windows' (are you missing an assembly reference?)"
I'm sorry, this is probably a dumb question but I'm totally new to C# and visual studio.
Any suggestions on how to fix this ?
I need this for a plugin in Revit.
Just figured it out. I need to add a reference to my project in the solution tree.
Sorry about that

I can't use system.windows.control namespace [duplicate]

This question already has answers here:
c# Where can find System.Windows.Controls.dll
(3 answers)
Closed 8 years ago.
I'm trying to add a reference to the namespace System.Windows.Controls in a library project, but i can't find it in the list. Does anybody know what is going on? i'm using 4.0. I want to add system.window.controls.dll but the library is not complete, how can i make it complete?
You have to look for this System.Windows.Controls.Data.dll assembly. In this assembly, there is the namespace you are looking for.
In general, a namespace and it's types may be in an assembly with different name than the namespace name.

I can't find System.Windows.Media namespace [duplicate]

This question already has answers here:
Can't find System.Windows.Media namespace?
(7 answers)
Closed 8 years ago.
I can't seem to find System.Windows.Media reference for my C# project. It is not there at all!
Help and tips?
System.Windows.Media is a namespace - most of the types within it are in the assembly PresentationFramework.dll or PresentationCore.dll.
You should look up whichever type you're interested in (via MSDN), and check which assembly it's in. You've got to distinguish between namespaces and assemblies - they're different concepts. You add a reference to an assembly as part of the project configuration, but specify the namespace in your source code (usually via a using directive).
System.Windows.Media is not a reference, it is a namespace.
This namespace belongs on PresentationFramework.dll or PresentationCore.dll
Namespace: System.Windows.Media
Assembly: PresentationFramework (in PresentationFramework.dll)
You can add these dll files in your current project and then you can use it via using.
using System.Windows.Media;

Get all classes inside a namespace [duplicate]

This question already has answers here:
Getting all types in a namespace via reflection
(11 answers)
Closed 9 years ago.
How can I get all classes inside a namespace?
You cannot. Classes are not "in" namespaces. Classes have namespaces as part of their name.
The classes "in" a namespace may reside in multiple assemblies. For example, some of the types in the System namespace reside in mscorlib.dll, and others reside in System.dll. You would have to go through all of the types in all of the assemblies you could find to be certain that you had found all the types "in" a particular namespace.
As #hawk mentioned, the answer is located here, with sample code that you can use:
Getting all types in a namespace via reflection
Use Reflector to see them (assuming that all the classes are in the same assembly).

Categories