Sergio0694 / PolySharp

PolySharp provides generated, source-only polyfills for C# language features, to easily use all runtime-agnostic features downlevel. Add a reference, set your C# version to latest and have fun! 🚀
MIT License
1.75k stars 45 forks source link

Show case of PolySharp benefits? #105

Open apm1grb opened 1 month ago

apm1grb commented 1 month ago

It would be beneficial to have some examples of how using PolySharp helps. I'm keen to provide a presentation for my colleagues that underlines the pros of PolySharp. A demo code base - one project without PolySharp (and with errors) and one with PolySharp (and without errors) - would be helpful. Also, some words about typical alternatives might be helpful to advertise the adoption of PolySharp.

In my case, I mentioned spontaneously the helpful polyfill for record types and immediately got the feedback from the team: It makes no difference whether we add a reference to PolySharp or provide a class IsExternalInit. Okay, my fault for not having the best sample, but also other samples on various internet resources underline benefits of PolySharp, that are not really benefits of PolySharp, instead they come with Latest.

TrubbleAC commented 3 weeks ago

Not exactly a comparison but you might be able to get some use out of PolySharp.Playground - it at least highlights what features are explicitly supported by PolySharp with code samples for each feature. It breaks things out by version, as well as whether or not the feature uses a polyfill or is compiler-only.

Sergio0694 commented 3 weeks ago

"It makes no difference whether we add a reference to PolySharp or provide a class IsExternalInit."

I mean, they're not wrong, but they're also missing the whole point of PolySharp: which is precisely to avoid having to do that for every feature you care about. You just use the package, and then you can just forget about it and use features normally.

Also worth noting:

This project literally exists because I was tired of copying yet another polyfill type in the Microsoft Store repo 😆