· 創建另外一個Application Domain
· 動態創建(編譯)代碼並保存到磁盤
· 創建一個公共的遠程調用接口
· 創建遠程調用接口的實例
換句話來講就是將對象加載到另外一個AppDomain中並通過遠程調用的方法來調用
using System;
using System
using System
using System
using System
namespace RemoteAccess
{
///
/// Interface that can be run over the remote AppDomain boundary
///
public interface IRemoteInterface
{
object Invoke(string lcMethod
}
///
/// Factory class to create objects exposing IRemoteInterface
///
public class RemoteLoaderFactory : MarshalByRefObject
{
private const BindingFlags bfi = BindingFlags
public RemoteLoaderFactory() {}
public IRemoteInterface Create( string assemblyFile
{
return (IRemoteInterface) Activator
assemblyFile
null
}
}
}
[
From:http://tw.wingwit.com/Article/program/net/201311/14506.html