通过实现类的反射方法获取

发布于 2024-09-10 18:41:53 字数 525 浏览 1 评论 0 原文

public void Express(Expression<Func<User, bool>> express)
{
    BLL.Manager.ILogManager logs = BLL.Container.ObjectContainer.getObject<BLL.Manager.ILogManager>();
    logs.GetAll(1);
    var total = logs.LastPageTotal;
}

的接口类型

如上面的代码,我需要知道ILogManager的实现类,我只知道信息反映的方式,但是在方法中定义的类型是我已经通过IL反映一些调用信息,调用我需要获取的信息通过调用哪个类来结束这些。

public void Express(Expression<Func<User, bool>> express)
{
    BLL.Manager.ILogManager logs = BLL.Container.ObjectContainer.getObject<BLL.Manager.ILogManager>();
    logs.GetAll(1);
    var total = logs.LastPageTotal;
}

As the above code, I need to know ILogManager the implementation class, I only know that the information reflected the way, but in the method defined type is the type of interface

I've been through the IL reflecting some call information, call the information I need to get in the end these by which class to call.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

旧城空念 2024-09-17 18:41:53

我需要知道ILogManager的实现类

如果我理解正确的话:

  • 您有一些使用 ILogManager 变量的代码
  • 您想找出哪个类实现 ILogManager

您可以插入在代码中调用 logs.GetType() ;这将告诉您实现 ILogManager 的类类型。

或者,您可以以与 Reflector 相同的方式告诉您哪些类实现给定的接口:通过加载每个可能的程序集,查看这些程序集中的类型,并记录哪些类实现了 ILogManager。

I need to know ILogManager the implementation class

If I understand correctly:

  • You've got some code that uses an ILogManager variable
  • You want to find out which class implements ILogManager

You could insert a call to logs.GetType() in the code; this will tell you the class type that implements ILogManager.

Alternatively, you can tell you which classes implement a given interface the same way that Reflector does: by loading every possible assembly, looking at the types in those assemblies, and recording which ones implement ILogManager.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文