c#

位置:IT落伍者 >> c# >> 浏览文章

详解.NET中的动态编译[3]


发布日期:2018年03月11日
 
详解.NET中的动态编译[3]

using System;

using SystemCollectionsGeneric;

using SystemLinq;

using SystemText;

using SystemReflection;

namespace RemoteAccess

{

/// <summary>

/// Interface that can be run over the remote AppDomain boundary

/// </summary>

public interface IRemoteInterface

{

object Invoke(string lcMethodobject[] Parameters);

}

/// <summary>

/// Factory class to create objects exposing IRemoteInterface

/// </summary>

public class RemoteLoaderFactory : MarshalByRefObject

{

private const BindingFlags bfi = BindingFlagsInstance | BindingFlagsPublic | BindingFlagsCreateInstance;

public RemoteLoaderFactory() {}

public IRemoteInterface Create( string assemblyFile string typeName object[] constructArgs )

{

return (IRemoteInterface) ActivatorCreateInstanceFrom(

assemblyFile typeName false bfi null constructArgs

null null null )Unwrap();

}

}

}

[] [] [] [] []

               

上一篇:详解.NET中的动态编译[5]

下一篇:详解.NET中的动态编译[4]