I have got an embedded ressource (included in the executing assembly) and can get this with the following command:
Assembly.GetExecutingAssembly().GetManifestResourceStream("<MyNamespace>.<File>")
If the namespace of the assembly changes I have to find all places where is contained in the strings. To avoid this I'd like to get the namespace dynamically. Is there a possibility to get the namespace of an assembly or have I to use fixed values?
Thanks for any response.
You could define a dummy type within that namespace, and extract the namespace from that type:
public class TestType
{
}
var obj = new TestType();
var ns = obj.GetType().Namespace;
EDIT: of course this is a good solution if the namespace is part of your existing assembly and you have access to the source of it