Get an instance of a class in a running process
<p>Using C#, is there any way to hook into a running application (my own app) and get an instance of a class?  As it stands right now I'm doing this</p>

<pre><code>// Find the IAutomation interface.
Type[] types = assembly.GetTypes();

foreach (Type type in types)
{
    if (!type.IsAbstract &amp;&amp; type.GetInterface("IAutomation") != null)
        automation = (IAutomation)Activator.CreateInstance(type);
}
</code></pre>

<p>This creates a new instance of the application each time.  I don't want a singleton application! I want to attach to an existing instance (if it exists) and pluck out IAutomation from there.</p>

<p>Is that even possible?</p>
