Skip to content

Commit 58bbe31

Browse files
feat: add IncludePrivateMembers and document Obsolete (#26) +semver: minor
1 parent 680e4ad commit 58bbe31

File tree

7 files changed

+379
-15
lines changed

7 files changed

+379
-15
lines changed

docs/sample/index.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010

1111
[MyEnum](./myclasslib.myenum)
1212

13+
[MyObsoleteClass](./myclasslib.myobsoleteclass)
14+
1315
## MyClassLib.SubNamespace
1416

1517
[GenericClass<T>](./myclasslib.subnamespace.genericclass-1)
Lines changed: 163 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,163 @@
1+
[`< Back`](./)
2+
3+
---
4+
5+
# MyObsoleteClass
6+
7+
Namespace: MyClassLib
8+
9+
#### Caution
10+
11+
Deprecated, use MyClass instead.
12+
13+
---
14+
15+
My obsolete class.
16+
17+
```csharp
18+
public class MyObsoleteClass
19+
```
20+
21+
Inheritance [Object](https://docs.microsoft.com/en-us/dotnet/api/system.object) → [MyObsoleteClass](./myclasslib.myobsoleteclass)
22+
23+
**Remarks:**
24+
25+
A remark.
26+
27+
## Fields
28+
29+
### **myField**
30+
31+
#### Caution
32+
33+
This member is obsolete.
34+
35+
---
36+
37+
My field.
38+
39+
```csharp
40+
public int myField;
41+
```
42+
43+
## Properties
44+
45+
### **MyProperty**
46+
47+
#### Caution
48+
49+
This member is obsolete.
50+
51+
---
52+
53+
My property.
54+
55+
```csharp
56+
public string MyProperty { get; protected set; }
57+
```
58+
59+
#### Property Value
60+
61+
[String](https://docs.microsoft.com/en-us/dotnet/api/system.string)<br>
62+
The property value.
63+
64+
### **MyProperty2**
65+
66+
Instances.
67+
68+
```csharp
69+
public int MyProperty2 { get; set; }
70+
```
71+
72+
#### Property Value
73+
74+
[Int32](https://docs.microsoft.com/en-us/dotnet/api/system.int32)<br>
75+
76+
### **StaticProperty**
77+
78+
This is my Static property.
79+
80+
```csharp
81+
public static int StaticProperty { get; set; }
82+
```
83+
84+
#### Property Value
85+
86+
[Int32](https://docs.microsoft.com/en-us/dotnet/api/system.int32)<br>
87+
88+
## Constructors
89+
90+
### **MyObsoleteClass()**
91+
92+
#### Caution
93+
94+
This member is obsolete.
95+
96+
---
97+
98+
Initializes a new instance of the [MyClass](./myclasslib.myclass) class.
99+
100+
```csharp
101+
public MyObsoleteClass()
102+
```
103+
104+
**Remarks:**
105+
106+
See also [MyClass.MyClass(String, Int32)](./myclasslib.myclass#myclassstring-int32).
107+
108+
```csharp
109+
if (true)
110+
{
111+
var foo = new MyClass("foo", 1);
112+
Console.WriteLine(foo.ToString());
113+
}
114+
```
115+
116+
## Methods
117+
118+
### **Get(List&lt;String&gt;)**
119+
120+
#### Caution
121+
122+
This member is obsolete.
123+
124+
---
125+
126+
Gets some thing.
127+
128+
```csharp
129+
public string Get(List<string> param)
130+
```
131+
132+
#### Parameters
133+
134+
`param` [List&lt;String&gt;](https://docs.microsoft.com/en-us/dotnet/api/system.collections.generic.list-1)<br>
135+
The param.
136+
137+
#### Returns
138+
139+
[String](https://docs.microsoft.com/en-us/dotnet/api/system.string)<br>
140+
An empty string.
141+
142+
#### Exceptions
143+
144+
[Exception](https://docs.microsoft.com/en-us/dotnet/api/system.exception)<br>
145+
Thrown when...
146+
147+
### **StaticMethod()**
148+
149+
#### Caution
150+
151+
Deprecated in favor of MyClass.
152+
153+
---
154+
155+
A static method.
156+
157+
```csharp
158+
public static void StaticMethod()
159+
```
160+
161+
---
162+
163+
[`< Back`](./)

sample/MyClassLib/MyClass.cs

Lines changed: 41 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,11 @@ public class MyClass : IMyInterface
1414
/// </summary>
1515
public int myField;
1616

17+
/// <summary>
18+
/// My private field.
19+
/// </summary>
20+
private int myPrivateField;
21+
1722
/// <summary>
1823
/// My property.
1924
/// </summary>
@@ -37,6 +42,11 @@ public class MyClass : IMyInterface
3742
/// </summary>
3843
public event EventHandler<EventArgs> MyEvent;
3944

45+
/// <summary>
46+
/// My private event.
47+
/// </summary>
48+
private event EventHandler<EventArgs> MyPrivateEvent;
49+
4050
/// <summary>
4151
/// Protected property.
4252
/// </summary>
@@ -62,22 +72,43 @@ public class MyClass : IMyInterface
6272
/// }
6373
/// </code>
6474
/// </remarks>
65-
public MyClass() { }
75+
public MyClass()
76+
{ }
6677

6778
/// <summary>
6879
/// Initializes a new instance of the <see cref="MyClassLib.MyClass" /> class.
6980
/// </summary>
7081
/// <param name="firstParam">The first param.</param>
7182
/// <param name="secondParam">The second param.</param>
72-
public MyClass(string firstParam, int secondParam) { }
83+
public MyClass(string firstParam, int secondParam)
84+
{ }
85+
86+
/// <summary>
87+
/// Private initializer for a new instance of the <see cref="MyClassLib.MyClass" /> class.
88+
/// </summary>
89+
/// <param name="firstParam">The first param.</param>
90+
private MyClass(string firstParam)
91+
{
92+
}
7393

7494
/// <summary>
7595
/// Do some thing.
7696
/// </summary>
7797
/// <param name="firstParam">The first param.</param>
7898
/// <param name="secondParam">The second param.</param>
7999
/// <exception cref="System.Exception">Thrown when...</exception>
80-
public void Do(string firstParam, int secondParam) { }
100+
public void Do(string firstParam, int secondParam)
101+
{ }
102+
103+
/// <summary>
104+
/// Do some thing.
105+
/// </summary>
106+
/// <typeparam name="T">The type argument. Used by <see cref="DoGeneric{T}(T)"/>.</typeparam>
107+
/// <param name="value">The param. Used by <see cref="DoGeneric{T}(T)"/>.</param>
108+
/// <returns>Returns a value <see cref="int"/>.</returns>
109+
/// <exception cref="ArgumentException">Thrown instead of <see cref="Exception"/>.</exception>
110+
public int DoGeneric<T>(T value)
111+
{ throw new ArgumentException(); }
81112

82113
/// <summary>
83114
/// Do some thing.
@@ -99,8 +130,13 @@ public void Do(string firstParam, int secondParam) { }
99130
/// <summary>
100131
/// A static method.
101132
/// </summary>
102-
public static void StaticMethod() { }
133+
public static void StaticMethod()
134+
{ }
103135

104-
private void PrivateWork() { }
136+
/// <summary>
137+
/// A private method.
138+
/// </summary>
139+
private void PrivateWork()
140+
{ }
105141
}
106142
}
Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
using System;
2+
using System.Collections.Generic;
3+
4+
namespace MyClassLib
5+
{
6+
/// <summary>
7+
/// My obsolete class.
8+
/// </summary>
9+
/// <remarks>A remark.</remarks>
10+
[Obsolete("Deprecated, use MyClass instead.")]
11+
public class MyObsoleteClass
12+
{
13+
/// <summary>
14+
/// My field.
15+
/// </summary>
16+
[Obsolete]
17+
public int myField;
18+
19+
/// <summary>
20+
/// My property.
21+
/// </summary>
22+
/// <value>The property value.</value>
23+
[Obsolete]
24+
public string MyProperty { get; protected set; }
25+
26+
27+
/// <summary>
28+
/// Protected property.
29+
/// </summary>
30+
/// <value>The property value.</value>
31+
protected string ProtectedProperty { get; set; }
32+
33+
/// <summary>
34+
/// Instances.
35+
/// </summary>
36+
public int MyProperty2 { get; set; }
37+
38+
/// <summary>
39+
/// My prop1;
40+
/// </summary>
41+
private int MyProperty1 { get; set; }
42+
43+
44+
/// <summary>
45+
/// This is my Static property.
46+
/// </summary>
47+
public static int StaticProperty { get; set; }
48+
49+
/// <summary>
50+
/// Initializes a new instance of the <see cref="MyClassLib.MyClass" /> class.
51+
/// </summary>
52+
/// <remarks>
53+
/// See also <see cref="MyClassLib.MyClass.MyClass(string, int)" />.
54+
/// <code>
55+
/// if (true)
56+
/// {
57+
/// var foo = new MyClass("foo", 1);
58+
/// Console.WriteLine(foo.ToString());
59+
/// }
60+
/// </code>
61+
/// </remarks>
62+
[Obsolete]
63+
public MyObsoleteClass() { }
64+
65+
/// <summary>
66+
/// Gets some thing.
67+
/// </summary>
68+
/// <param name="param">The param.</param>
69+
/// <returns>An empty string.</returns>
70+
/// <exception cref="System.Exception">Thrown when...</exception>
71+
[Obsolete]
72+
public string Get(List<string> param) => string.Empty;
73+
74+
/// <summary>
75+
/// A static method.
76+
/// </summary>
77+
[Obsolete("Deprecated in favor of MyClass.")]
78+
public static void StaticMethod() { }
79+
}
80+
}

src/XMLDoc2Markdown/Program.cs

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@
99

1010
namespace XMLDoc2Markdown;
1111

12-
class Program
12+
internal class Program
1313
{
14-
static int Main(string[] args)
14+
private static int Main(string[] args)
1515
{
1616
CommandLineApplication app = new()
1717
{
@@ -57,6 +57,11 @@ static int Main(string[] args)
5757
"Add a back button on each page",
5858
CommandOptionType.NoValue);
5959

60+
CommandOption IncludePrivateMethodOption = app.Option(
61+
"--private-members",
62+
"Write documentation for private members.",
63+
CommandOptionType.NoValue);
64+
6065
app.OnExecute(() =>
6166
{
6267
string src = srcArg.Value;
@@ -67,7 +72,8 @@ static int Main(string[] args)
6772
ExamplesDirectory = examplesPathOption.Value(),
6873
GitHubPages = gitHubPagesOption.HasValue(),
6974
GitlabWiki = gitlabWikiOption.HasValue(),
70-
BackButton = backButtonOption.HasValue()
75+
BackButton = backButtonOption.HasValue(),
76+
IncludePrivateMembers = IncludePrivateMethodOption.HasValue(),
7177
};
7278
int succeeded = 0;
7379
int failed = 0;

0 commit comments

Comments
 (0)