Kelmen Wong <(E-Mail Removed)> wrote:
> I'm working on a class managing resources (satelite).
>
> public CResMgr()
> {
> Assembly objClient = Assembly.GetCallingAssembly();
> _objResMgr = new ResourceManager(objClient.GetType().Namespace + '.'
> + DefaultBaseName, objClient);
>
> The result of objClient.GetType().Namespace is "System.Reflection",
> not what I'm expecting.
Why not? The Assembly type is in the System.Reflection namespace, and
you're calling GetType() on an instance of Assembly.
> Presently, I workaround by passing the caller's Type.
>
> _objResMgr = new CResMgr(this.GetType());
>
> public CResMgr(Type objCaller)
> {
> _objResMgr = new ResourceManager(objCaller.Namespace + '.' +
> DefaultBaseName, objCaller.Assembly);
>
> Is there a way to dynamically to retrieve the Namespace of the
> calling obj?
I don't believe so.
--
Jon Skeet - <(E-Mail Removed)>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too