Как документировать перегруженные методы с помощью одних и тех же комментариев XML? ⇐ C#

Место общения программистов C#
Anonymous
Как документировать перегруженные методы с помощью одних и тех же комментариев XML?

Сообщение Anonymous »

Я знаю, что есть такие вопросы, но они устарели. Поэтому я создаю новый.

На данный момент, когда есть 3 перегруженных метода, мне нужно сделать это:

Код: Выделить всё

/// 
/// Description that described summary of an overloaded method.
/// 
/// 
Description that describes filename parameter
/// Description that describes options parameter
/// Description of what method returns
public bool ReadFrom(string fileName, ReaderOptions options = null) {
return false;
}

/// 
/// Description that described summary of an overloaded method.
/// 
/// Description that describes stream parameter
/// Description that describes options parameter
/// Description of what method returns
public bool ReadFrom(Stream stream, ReaderOptions options = null) {
return false;
}

/// 
/// Description that described summary of an overloaded method.
/// 
/// Description that describes rawData parameter
/// Description that describes options parameter
/// Description of what method returns
public bool ReadFrom(byte[] rawData, ReaderOptions options = null) {
return false;
}
А мне хотелось бы что-то вроде этого:

Код: Выделить всё

#region overloadedReadFromMethods
/// 
/// Description that described summary of an overloaded method.
/// 
/// 
Description that describes filename parameter
/// Description that describes options parameter
/// Description of what method returns
public bool ReadFrom(string fileName, ReaderOptions options = null) {
return false;
}

/// Description that describes stream parameter
public bool ReadFrom(Stream stream, ReaderOptions options = null) {
return false;
}

/// Description that describes rawData parameter
/// Even considering that returns tag is present on the first overloaded method,
/// this overloaded method shows this specific description.
/// 
public bool ReadFrom(byte[] rawData, ReaderOptions options = null) {
return false;
}
#endregion overloadedReadFromMethods
Итак, первый перегруженный метод описывает описание по умолчанию, а затем методы, расположенные ниже, могут переопределить его своими собственными описаниями. Я хочу, чтобы оно отображалось в IntelliSense Visual Studio.


Подробнее здесь: https://stackoverflow.com/questions/595 ... l-comments

Вернуться в «C#»