Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature Request] Default values of properties and fields in API reference #10240

Open
Dove6 opened this issue Sep 28, 2024 · 0 comments
Open

Comments

@Dove6
Copy link

Dove6 commented Sep 28, 2024

Is your feature request related to a problem? Please describe.
The problem is that generated API reference currently shows no information about the default value of a property/field.
By default I mean the value set using inline initializers. I'm not interested in the bodies of constructors being parsed.

Example 0

For the following code:

public string TEST = "test field";
public string TEST2 { get; set; } = "test property";

the generated content looks like this:

Fields

TEST

public string TEST

Field Value

string

Properties

TEST2

public string TEST2 { get; set; }

Property Value

string

Describe the solution you'd like
I'd like for that information to appear in docs. It could be put in the code block mirroring the property/field declaration (Example 1) or as a subsection of the "Property Value"/"Field Value" entries (Example 2).

Example 1

For the following code:

public string TEST = "test field";
public string TEST2 { get; set; } = "test property";

the generated content could look like this:

Fields

TEST

public string TEST = "test field";

Field Value

string

Properties

TEST2

public string TEST2 { get; set; } = "test property";

Property Value

string

Example 2

For the following code:

public string TEST = "test field";
public string TEST2 { get; set; } = "test property";

the generated content could look like this:

Fields

TEST

public string TEST

Field Value

string

Default Value

"test field"

Properties

TEST2

public string TEST2 { get; set; }

Property Value

string

Default Value

"test property"

Describe alternatives you've considered
Putting the default value in a custom description in tag <value> tag (Example 3).
Unfortunately, such a duplication makes desynchronization between the code and the documentation very likely to occur.

Example 3

For the following code:

/// <value>Default value: "test field"</value>
public string TEST = "test field";
/// <value>Default value: "test property"</value>
public string TEST2 { get; set; } = "test property";

the generated content could look like this:

Fields

TEST

public string TEST

Field Value

string

Default value: "test field"

Properties

TEST2

public string TEST2 { get; set; }

Property Value

string

Default value: "test property"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant