In the MSDN documentation, S开发者_运维技巧ystem.Reflection.Assembly has a property called CodeBase which is defined as overridable.
Public Overridable ReadOnly Property CodeBase As String
However, if I try to create a new class that inherits System.Reflection.Assembly, I get an error message that tells me it cannot be inherited. So how can I override this property?
Unfortunately you can't do this.
Although the Assembly
class itself is declared as public
, it only provides an internal
constructor. This effectively means that it can only be instantiated (or inherited) from within its own assembly, mscorlib.
I don't think you can. While Assembly
is not sealed
(NotInheritable
in VB.NET), it has no public constructor; the constructor is internal
(Friend
in VB.NET). So it can be inherited, but only of types within the same assembly as itself (which is mscorlib).
精彩评论