<inheritdoc> (руководство по программированию на C#)<inheritdoc> (C# Programming Guide)
СинтаксисSyntax
<inheritdoc/>
InheritDocInheritDoc
Наследование XML-комментариев от базовых классов, интерфейсов и аналогичных методов.Inherit XML comments from base classes, interfaces, and similar methods. Это позволяет обойтись без копирования и вставки одинаковых XML-комментариев и автоматически поддерживать их синхронизацию.This eliminates unwanted copying and pasting of duplicate XML comments and automatically keeps XML comments synchronized.
RemarksRemarks
Добавьте XML-комментарии в базовые классы или интерфейсы, и InheritDoc скопирует их во все реализации классов.Add your XML comments in base classes or interfaces and let InheritDoc copy the comments to implementing classes.
Добавьте XML-комментарии в синхронные методы, и InheritDoc скопирует их в асинхронные версии аналогичных методов.Add your XML comments to your synchronous methods and let InheritDoc copy the comments to your asynchronous versions of the same methods.
Если вам нужно скопировать комментарии из определенного элемента, укажите нужный элемент в атрибуте cref
.If you want to copy the comments from a specific member you can use the cref
attribute to specify the member.
ПримерыExamples
// compile with: -doc:DocFileName.xml
/// <summary>
/// You may have some primary information about this class.
/// </summary>
public class MainClass
{
}
///<inheritdoc/>
public class TestClass: MainClass
{
}
// compile with: -doc:DocFileName.xml
/// <summary>
/// You may have some primary information about this interface.
/// </summary>
public interface ITestInterface
{
}
///<inheritdoc cref="ITestInterface"/>
public class TestClass : ITestInterface
{
}