I am looking at implementing an async function returning a result struct, the result itself should be immutable and i am considering returning an read-only struct instead of class.
Looking at some latest Microsoft apis source code i can see that read-only structs are widely used so my question is whether this would be the correct way to go. From reading numerous articles this is not clear, many point out that struct should be only used for small size values? Since struct will be read-only as i understand there will be no copying ? My return structure will have 2-5 int values and a reference to ReadOnlyMemory buffer.
The purpose is of course to have most efficient low memory footprint code.
Thanks.