简体   繁体   English

通过接口方法实现接口的类的汇编版本

[英]Getting Assembly Version of a class that implements interface through interface method

My classes all implement an interface. 我的所有类都实现了一个接口。 This interface stores some funtions for general functionality. 该界面存储了一些用于常规功能的功能。

One of those funtionalities is Logging. 这些功能之一是日志记录。 In this Logging function I want to get the AssemblyVersion of the Class that implements the interface. 在此Logging函数中,我想要获取实现接口的Class的AssemblyVersion。

My problem is that Assembly.GetExectuingAssembly() will return the AssemblyVersion of the Interface. 我的问题是Assembly.GetExectuingAssembly()将返回接口的AssemblyVersion。

How can I get the Assembly Version of the implementing class? 如何获得实现类的汇编版本?

这应该工作:

this.GetType().Assembly.GetName().Version

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 接口方法返回类型是实现接口的类 - Interface method return type to be class that implements the interface 获得实现接口的“默认”具体类 - getting a “default” concrete class that implements an interface 接口方法的签名包括一个class,它实现了接口本身 - Signature of interface's method includes a class, which implements the interface itself 接口实现,但不公开实现接口的类 - Interface implementation without revealing the class that implements the interface 将接口实例分配给实现该接口的类 - Assigning interface instance to a class that implements that interface 获取实现在不同DLL中定义的接口的类方法 - Get a class method that implements an interface defined in a different DLL 确定 class 是否实现通用接口,然后调用接口方法 - Determine if a class implements a generic interface and then call a the interfaces method 从显式实现接口的基类重写方法 - Override a method from a base class that explicitly implements an interface tclass扩展了一个抽象类,并使用相同的签名方法实现了接口 - tclass extends an abstract class and implements interface with same signature method 如何将条件与类匹配(实现接口)并调用其应用方法 - How to match condition with a class(implements interface) and call its apply method
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM