Can't access record members [Answered]
I have a record that looks like this
And am making a record that looks like this
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.
8 Replies
why do you need the record to look like that specifically?
why can't you do
public readonly record struct StandardCard<Card>(Card card);
?
nevermind the fact that you use absolutely incorrect naming, and the fact that a generic param on StandardCard
is probably just wrongI think you might be confusing generics here with what you actually want. Is
Card
meant to be a type parameter of StandardCard
or its own type?
Because StandardCard<Card>
will make Card
into a type parameterAh. I completely autopiloted making it of that type. Learning functional programming and it's a lot to take in
FP be like... type parameters, type parameters everywhere
!solved
.solved
.close
/close
God damn it I forgot how it's done here.
Thanks
✅ This post has been marked as answered!