小编pra*_*mod的帖子

如何创建DateTime对象?

我有三个整数:小时,分钟和秒.

我想DateTime用上面三个变量提供的System.Date和Time 创建一个对象.

.net c# datetime

15
推荐指数
3
解决办法
7万
查看次数

如何加载依赖程序集?

我有一个项目处理器,它依赖于其他2个项目.

当我编译项目时,我得到DLL文件夹和其他项目的依赖于Bin文件夹中的DLL.Processor.dll BusinessAction.dll和Repository.dll.

我尝试通过启动类型ProcessRequest类从Processor.dll调用方法.

像这样

 Assembly processorAssembly = Assembly.LoadFile(path + "Processor.DLL"));

        Type myType= processorAssembly.GetType("Namespace.ProcessRequest");

        myType.InvokeMember("Process", BindingFlags.InvokeMethod | BindingFlags.Instance | BindingFlags.Public, null, submitOfferType, new object[] { 12345 });
Run Code Online (Sandbox Code Playgroud)

Process方法有一些逻辑可以处理并保存到数据库中.

当我使用InvokeMember()调用procee方法时

我得到异常无法加载文件或程序集'Namespace.BusinessAction,Version = 1.0.0.0,Culture = neutral,PublicKeyToken = null'或其依赖项之一.该系统找不到指定的文件.

我是在调用方法吗?

c# reflection

4
推荐指数
1
解决办法
4363
查看次数

标签 统计

c# ×2

.net ×1

datetime ×1

reflection ×1