Home All Groups Group Topic Archive Search About

Get Assembly of Calling Thread or Object?

Author
22 Feb 2006 5:37 PM
Troy
Does anyone know how to get the assembly associated with a particular thread?

I'm creating a generic Factory class to create types based on config file
parameters.  I would like to use the calling object's assembly if it isn't
specified in the config value.  I know how to get the current executing
assembly, but I don't know how to find the assembly associated with the
calling thread, which will always be a seperate assembly. 

Or, if using the thread is the wrong approach, is there a better/different
way to identify the assembly of the object that called my
Factory.CreateObject method?

Thanks in advance.

Troy

Author
22 Feb 2006 6:25 PM
Mattias Sjögren
>Or, if using the thread is the wrong approach, is there a better/different
>way to identify the assembly of the object that called my
>Factory.CreateObject method?

Have you tried Assembly.GetCallingAssembly() ?


Mattias

--
Mattias Sjögren [C# MVP]  mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Please reply only to the newsgroup.
Author
23 Feb 2006 12:30 AM
Troy
That would be it. Good thing I wasn't looking for a poisonous snake.  ;-)

Thanks! 

Show quote
"Mattias Sjögren" wrote:

> >Or, if using the thread is the wrong approach, is there a better/different
> >way to identify the assembly of the object that called my
> >Factory.CreateObject method?
>
> Have you tried Assembly.GetCallingAssembly() ?
>
>
> Mattias
>
> --
> Mattias Sjögren [C# MVP]  mattias @ mvps.org
> http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
> Please reply only to the newsgroup.
>

AddThis Social Bookmark Button