views:

106

answers:

2

In the MSDN documentation, System.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?

+5  A: 

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.

LukeH
+3  A: 

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).

Fredrik Mörk
Marked this as the answer because it was about 10 seconds faster than the other.
Andy E
Not really sure, but I actually think that Luke was a tad faster than I was.
Fredrik Mörk
Could've sworn this one was higher up in the list sorted by oldest. Oh well, thanks for your honesty ;)
Andy E