B
Bob Altman
Hi all,
Is there a way to programmatically determine the root namespace for an
assembly?
TIA,
- Bob
Is there a way to programmatically determine the root namespace for an
assembly?
TIA,
- Bob
Bob Altman said:Is there a way to programmatically determine the root namespace for an
assembly?
concept, not a .NET concept.
Bob Altman said:I know. I'm fishing for some way to guess the root namespace. For example,
is there something that VB always puts into the assembly (like a type or an
attribute) from whose name I can derive the root namespace?
Bob said:Hi Peter,
I'm using ResourceManager.
By convention, my VB apps will all have a resource file that shows up in
Solution Explorer as "strings.resx". I want to write a generic GetString
routine that lives in a library DLL that knows how to find the "strings"
resource in its caller's assembly and, using ResrouceManager, fetch the
value of a specified resource string. My problem is, VB insists on
qualifying "strings.resource" with the root namespace.
In the best possible solution, the routine that calls GetString would not
need to specify the root namespace (either directly or indirectly).
GetString has no problem getting a reference to the caller's assembly. But
there may possibly be more than one resource in that assembly whose name
ends with ".strings.resource".
So... I'm fishing for something that I can look for in the caller's assembly
from whose name I can reliably deduce the root namespace, and thereby
reliably fabricate the full name for <RootNamespace>.strings.resource
Would this work?Hi all,
Is there a way to programmatically determine the root namespace for an
assembly?
TIA,
- Bob
Bob said:Thanks mikeb. See, this goes to show, you never know when you'll get a
suggestion that helps... It just never occurred to me to use the assembly
name itself to determine the root namespace. I'm happy to make a big, fat
assumption that the root namespace is either identical to the assembly name
(this is VB's default behavior), or that the root namespace ends with the
assembly name (assuming my caller has prefixed the root namespace with the
company and/or project names).
there's more than one resource name that ends in ".strings.resource".
I'd suspect that that is a very rare situation.