Docs: Code Snippets to Accompany Class Member Documentation

Created on 2 Jun 2018  Â·  11Comments  Â·  Source: dotnet/docs

Would it be possible to add brief code snippets underneath key methods/properties in order to quickly communicate usage/use cases?

I'd love to contribute if that's something that would be useful to others as well.

ex: In the case of the ColumnAttribute.Ordinal Property, if there was a "Code Sample" section right above/below the "Applies To" header, I think that would be very clear and helpful. The sample could be something as simple as what already exists in some of the tutorials/intros:

// Brief explanation, ex:
// Data is loaded without headers/labels, and the ColumnAttribute.Ordinal Property
// is used to define the identity of different data elements (columns) based on index.
public class TaxiTrip
{
    [Column(ordinal: "0")]
    public string vendor_id;
    [Column(ordinal: "1")]
    public string rate_code;
}

Document Details

⚠ Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

Area - API Reference P2 doc-enhancement

Most helpful comment

@pkulikov

As the docs are auto-generated, there is no reason (for contributors not from the docs and engineering teams) to make PRs to the dotnet/ml-api-docs repository?

Correct! @dend are we working on enabling folks to go directly to source when API docs are auto-generated?

If I want to fix a typo (dotnet/ml-api-docs#21), then I should fix it by PR in the dotnet/machinelearning repository?

Correct. (Sorry I missed that PR)

Let me learn how this works and I'll remove the Edit button from those docs if they're not useful.

All 11 comments

@asthana86 @aditidugar @JRAlexander FYI on samples request for ML.NET API docs

@dend for content that is auto-generated from /// comments, is it possible to add remarks and examples without losing them when docs get regenerated?

Would something like the example tag work?

image

Yes, this works @mitevpi but I'm wondering if we really wanna embed examples to APIs like that.

@mairaw can it be done the similar way as it's done now for .NET API?

@pkulikov .NET is kind of a special case because we can't auto-generate docs from source as other products can for a variety of reasons. So, for ML.NET we'd be following the same pattern that all others teams are using for reference docs including ASP.NET Core. I just need to learn now how to handle those (I think other teams are not really adding samples at the moment to the reference docs) considering some of the changes that the engineering team is planning for reference docs.

@mairaw thank you very much for the reply as that makes things clearer to me. Then I have two follow-up questions:

Given that, the Edit buttons on the pages with ML.NET API look to be not useful, because clicking them results in a PR to dotnet/ml-api-docs repository

@pkulikov

As the docs are auto-generated, there is no reason (for contributors not from the docs and engineering teams) to make PRs to the dotnet/ml-api-docs repository?

Correct! @dend are we working on enabling folks to go directly to source when API docs are auto-generated?

If I want to fix a typo (dotnet/ml-api-docs#21), then I should fix it by PR in the dotnet/machinelearning repository?

Correct. (Sorry I missed that PR)

Let me learn how this works and I'll remove the Edit button from those docs if they're not useful.

Assigning this issue to myself to investigate next sprint.

Moving this to the backlog. We need to sit down with @dend and understand how this works for auto-generated content.

FYI @sfilipi. I believe you're already working on adding code samples, correct?

Closing since this API no longer exists. /cc @natke

Was this page helpful?
0 / 5 - 0 ratings

Related issues

stanuku picture stanuku  Â·  3Comments

LJ9999 picture LJ9999  Â·  3Comments

stjepan picture stjepan  Â·  3Comments

mekomlusa picture mekomlusa  Â·  3Comments

sdmaclea picture sdmaclea  Â·  3Comments