|
-
Apr 20th, 2010, 09:04 AM
#1
Inheriting XML Comments
Hey,
Not sure if the title is describing my problem correctly, but I've no idea what else to call it 
I have a MustInherit class, let's call it BaseClass, with a bunch of MustOverride ReadOnly properties. The user is supposed to inherit this class and override the properties, returning appropriate values.
To help the user decide which property does what, I have included XML comments for each property, so the BaseClass looks like this
vb.net Code:
Public MustInherit Class BaseClass ''' <summary> ''' Gets the Name of something. ''' </summary> ''' <returns>The Name of something.</returns> Public MustOverride ReadOnly Property Name As String ''' <summary> ''' Gets the Age of something else. ''' </summary> ''' <returns>The Age of something else.</returns> Public MustOverride ReadOnly Property Age As Integer ''' <summary> ''' Gets something, I'm not quit sure what. ''' </summary> ''' <returns>I've no idea..</returns> Public MustOverride ReadOnly Property Something as String End Class
The idea is now that, when a user inherits this class and tries to override a property, he'll get the XML comment in the Intellisense:

This is where problem number 1 steps in... As soon as I type 'Inherits BaseClass', Visual Studio is so kind to add the 'skeleton' of each property, because they are declared MustOverride (I cannot declare them anything else, they must be overriden...), so the user will never see these XML comments!
I thought that they would also pop up when hovering the mouse over their names, but apparently not:

How can I make these comments show up when the user hovers his mouse over the property name? Or is this really impossible..?
The second problem is kind of related, but not quite.
In my project, there are a few 'default' derived classes that inherit BaseClass. For example, there's this class
vb.net Code:
Public Class DerivedClass1 Inherits BaseClass Public Overrides ReadOnly Property Age As Integer Get Return 15 End Get End Property Public Overrides ReadOnly Property Name As String Get Return "Mark" End Get End Property Public Overrides ReadOnly Property Something As String Get Return "93usdivjiwu4" End Get End Property End Class
I now want to enable the user to inherit this class (DerivedClass1) instead, so that he can, for example, override only the Name property, and leave the other properties untouched. This way, he can create a slight modification to one of the default classes, instead of having to rewrite it completely (in reality, there are loads more properties).
For example:
vb.net Code:
Public Class DerivedDerivedClass1 Inherits DerivedClass1 Public Overrides ReadOnly Property Name As String Get Return "Nick" End Get End Property End Class
Now, because the properties in DerivedClass1 are not declared MustOverride, I have to type the overrides myself, and I can see the XML comments.
But wait! There are no XML comments, because they are in the BaseClass, and not in the DerivedClass1, which is the class I'm inheriting. In other words: the XML comments are not 'inherited'...

Do I really have to copy/paste all the XML comments from the BaseClass and put them in the DerivedClass1 too? Or can I somehow tell the DerivedClass1 to use the XML comments from its base class?
Thanks for any help...!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|