diff --git a/docs/csharp/programming-guide/xmldoc/inheritdoc.md b/docs/csharp/programming-guide/xmldoc/inheritdoc.md index bb68a47cc3d28..77a9991ba5f2f 100644 --- a/docs/csharp/programming-guide/xmldoc/inheritdoc.md +++ b/docs/csharp/programming-guide/xmldoc/inheritdoc.md @@ -15,12 +15,24 @@ ms.assetid: 46d329b1-5b84-4537-9e17-73ca97313e4e ## Syntax ```xml - + ``` ## InheritDoc Inherit XML comments from base classes, interfaces, and similar methods. This eliminates unwanted copying and pasting of duplicate XML comments and automatically keeps XML comments synchronized. + +## Attributes + +#### cref + +Specify the member to inherit documentation from. +Already defined tags on the current member are not overridden by the inherited ones. + +#### path + +The XPath expression query that will result in a node set to show. +You can use this attribute to filter which tags to include or exclude from the inherited documentation. ## Remarks @@ -35,6 +47,8 @@ If you want to copy the comments from a specific member you can use the `cref` a [!code-csharp[csProgGuideDocComments#14](~/samples/snippets/csharp/VS_Snippets_VBCSharp/csProgGuideDocComments/CS/DocComments.cs#16)] [!code-csharp[csProgGuideDocComments#14](~/samples/snippets/csharp/VS_Snippets_VBCSharp/csProgGuideDocComments/CS/DocComments.cs#17)] +[!code-csharp[csProgGuideDocComments#14](~/samples/snippets/csharp/VS_Snippets_VBCSharp/csProgGuideDocComments/CS/DocComments.cs#18)] +[!code-csharp[csProgGuideDocComments#14](~/samples/snippets/csharp/VS_Snippets_VBCSharp/csProgGuideDocComments/CS/DocComments.cs#19)] ## See also diff --git a/samples/snippets/csharp/VS_Snippets_VBCSharp/csProgGuideDocComments/CS/DocComments.cs b/samples/snippets/csharp/VS_Snippets_VBCSharp/csProgGuideDocComments/CS/DocComments.cs index 5e3e10b52274d..e979d8cb7b8b1 100644 --- a/samples/snippets/csharp/VS_Snippets_VBCSharp/csProgGuideDocComments/CS/DocComments.cs +++ b/samples/snippets/csharp/VS_Snippets_VBCSharp/csProgGuideDocComments/CS/DocComments.cs @@ -598,3 +598,39 @@ public class TestClass : ITestInterface } // } + +//----------------------------------------------------------------------------- +namespace Wrap18 +{ + // + // compile with: -doc:DocFileName.xml + + public class InheritOnlyReturns + { + /// In this example, this summary is only visible for this method. + /// A boolean + public static bool MyParentMethod(bool x) { return x; } + + /// + public static bool MyChildMethod() { return false; } + } + // +} + +namespace Wrap19 +{ + // + // compile with: -doc:DocFileName.xml + + public class InheritAllButRemarks + { + /// In this example, this summary is visible on all the methods. + /// The remarks. + /// A boolean + public static bool MyParentMethod(bool x) { return x; } + + /// + public static bool MyChildMethod() { return false; } + } + // +}