Skip to content

Sample code on Github does not match the tutorial code #28865

Open
@joelegner

Description

@joelegner

I am trying to follow the tutorial and wanted to peek at the finished code to make sure I put the IEnumerable Suits() in the right place. It was unclear to me if it should be inside the public class Program or not. But when I went to the sample code, I found it does not look at all like the tutorial. Instead of the IEnumerable type, I see enum types used.

Sample code location:
https://github.com/dotnet/samples/blob/main/csharp/getting-started/console-linq/Program.cs

Code I expected to see:

static IEnumerable<string> Suits()
{
    yield return "clubs";
    yield return "diamonds";
    yield return "hearts";
    yield return "spades";
}

Code I found in the sample source code Github repository (Program.cs):

public enum Suit
{
    Clubs,
    Diamonds,
    Hearts,
    Spades
}

Document Details

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions