© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
C#C
C#•4y ago•
14 replies
LukeJ

Can't access record members [Answered]

I have a record that looks like this
public readonly record struct Card(Suite suite, Rank rank);
public readonly record struct Card(Suite suite, Rank rank);

And am making a record that looks like this
public readonly record struct StandardCard<Card> {
    public readonly Card card;

    public StandardCard(Card card) {
        this.card = card;
    }
}
public readonly record struct StandardCard<Card> {
    public readonly Card card;

    public StandardCard(Card card) {
        this.card = card;
    }
}

I'm new to messing with records, so can't figure something out. Why can't I do card.suite or card.rank in that constructor? I can do it elsewhere in my doe, but not here.
C# banner
C#Join
We are a programming server aimed at coders discussing everything related to C# (CSharp) and .NET.
61,871Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

LINQPad 7 - Insert Record [Answered]
C#CC# / help
4y ago