Simply, a console application with three classes as following,
namespace Stackoverflow
{
public class Program
{
public static void Main ( string [ ] args )
{
new Consumer ( );
new Provider ( );
Console . WriteLine ( "Exit ..." );
Console . ReadKey ( );
}
}
public class Consumer
{
public Consumer ( )
{
using ( Process Process = Process . GetCurrentProcess ( ) )
{
Console . WriteLine ( "Consumer : " + Process . ProcessName );
}
}
}
public class Provider
{
public Provider ( )
{
using ( Process Process = Process . GetCurrentProcess ( ) )
{
Console . WriteLine ( "Provider : " + Process . ProcessName );
}
}
}
}
Output will be as following,
Consumer : Stackoverflow.vshost
Provider : Stackoverflow.vshost
Exit ...
Question :
Can I attach each class to different Process, without separating them into different solutions, especially Provider & Consumer classes ?
It’s for testing purposes. Mobile agents related testing.
Thanks in advance.
Regards,
I am not sure if this will exactly do what you are trying to achieve, but you can load the code into different AppDomain’s during execution of the main application. The following MSDN Article contains information for doing so with a full example.
From the MSDN Article on AppDomain’s: