RiptideNetworking / Riptide

Lightweight C# networking solution for multiplayer games.
https://riptide.tomweiland.net
MIT License
1.04k stars 141 forks source link

Suggestion for AddBytes method #128

Closed megalithos closed 4 months ago

megalithos commented 5 months ago

Maybe AddBytes could get parameters for length & start position, so that if you are pooling arrays with ArrayPool or just have a large buffer, you don't have to just allocate new array with new keyword to be able to add the original byte array to the message.

tom-weiland commented 5 months ago

Good idea. I think it'd be sufficient to add this only for byte arrays—other types don't really need this, or would you disagree? I'm no longer actively working on this project, but maybe @xzippyzachx is interested in adding this? Or perhaps you'd be willing to do it yourself and make a PR? Just make sure to follow the contributing guidelines.