S7NetPlus / s7netplus

S7.NET+ -- A .NET library to connect to Siemens Step7 devices
MIT License
1.3k stars 580 forks source link

Use System.Memory for < .NET 5 and avoid (some) unnecessary allocations #483

Closed gfoidl closed 1 year ago

gfoidl commented 1 year ago

Unfortunately https://github.com/S7NetPlus/s7netplus/pull/482 got merged too fast, so I couldn't have a look and provide my feedback over there, thus here's a PR with my suggestions 😉

mycroes commented 1 year ago

Hi @gfoidl,

Sorry for acting so quickly 😆. I was considering some of the reductions you applied here, however I was very much satisfied with the fact someone else did most of the work on this. I fully agree on adding the System.Memory dependency though and making these improvements. Again your keen eye spotted some nice optimizations (the Write method naming).

I have to look into the build environment, not sure what platform we use on AppVeyor, which is what's used to deploy the package as well. I recently did my first GitHub actions workflow to publish to NuGet (VisconFactoryIntelligence/AdsClient/blob/main/.github/workflows/dotnet.yml, which also isn't actually based on VS2022, but I guess this works out with dotnet as well).

Anyway, thanks for your time and feedback, will merge and release this as well.