[英]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.