Inheriting XML comments

T

Tristan

Hi,

When summary comments are placed above methods in an interface,
is it possible that these comments also correspond to the derived
classes i.e.

public myInterface
{
///<summary>
/// An inteface method that does something
///<summary>
void aMethod();

}

public myClass : myInterface
{
public void aMethod();
}


So someone using myClass would see the summary comments
for aMethod?

Perhaps I'm expecting too much from .NET ;)


Many thanks

Tristan.
 
D

Daniel O'Connell

Tristan said:
Hi,

When summary comments are placed above methods in an interface,
is it possible that these comments also correspond to the derived
classes i.e.

public myInterface
{
///<summary>
/// An inteface method that does something
///<summary>
void aMethod();

}

public myClass : myInterface
{
public void aMethod();
}


So someone using myClass would see the summary comments
for aMethod?
No, unless they are using myClass via myInterface. It is hoped that a future
version of visual studio(and perhaps the C# language itself) will provide
tools for additional automation. I'd like to see either direct copying to
the implementing source file(by keystroke or intellisense) or a template
approach. Imagine if you could apply a template tag to your docs such as
public interface myInterface
{
/// <summary>
/// An inteface method that does something
/// <summary>
/// <template>
/// <summary>
/// $target that does something
/// </summary>
/// <remarks>
/// This method implements myInterface.aMethod
/// </remarks>
/// </template>
void aMethod();
}
The end result would be something like

public myClass : myInterface
{

/// <summary>
/// aMethod that does something
/// </summary>
/// <remarks>
/// This method implements myInterface.aMethod
/// </remarks>
public void aMethod();
}

A post build tool could probably do it, using reflection and the xml classes
to edit the resultant file by either processing templates like suggested
above or manually copying entries in the output docs file. Its a tool
someone should write and one I've been considering, maybe I should...if no
one else has done it yet, that is, ;)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top