Okay, that clarifies a distinction between struct
and class
, thank you. The referenced post directly addresses my use, although it’s still frustrating that I can’t express what I want.
From the client’s perspective, should BinaryReader
be a struct or a class? I can make it a struct by passing the reader into the closure as an inout parameter. Doing so encourages me to make my read
method an extension of BinaryReader
, which make sense, until you get to readString()
, which depends on a property of my class. That can be passed in as an argument, but either way it’s messier.
I’m not happy with any solution of these solutions, except maybe making it a class.