C
C#2y ago
DaVinki

❔ Does the C# version matter for a netstandard2.1 library?

Title
8 Replies
jcotton42
jcotton422y ago
in general you can use the latest version, though some features like static abstracts may be unavailable for an ns2.1 target
jcotton42
jcotton422y ago
other features like required members will be unavailable due to missing types, but can be polyfilled with libraries like https://github.com/Sergio0694/PolySharp
GitHub
GitHub - Sergio0694/PolySharp: PolySharp provides generated, source...
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! 🚀 -...
vdvman1
vdvman12y ago
Yeah you need to be careful not to use any language features that require runtime changes, but otherwise it should work fine
DaVinki
DaVinkiOP2y ago
Alright, thank you guys
jcotton42
jcotton422y ago
the compiler will refuse to compile in that case I believe
vdvman1
vdvman12y ago
Most likely, yeah, but still something to keep in mind just in case
JakenVeina
JakenVeina2y ago
Nah, it definitely does, you get a compile error stating "Runtime Type XXXX not found" for whatever types were missing. Happens to me all the time. there haven't been any breaking runtime changes since, like, C#5 or 6? Only new built-in types being added.
Accord
Accord2y ago
Was this issue resolved? If so, run /close - otherwise I will mark this as stale and this post will be archived until there is new activity.

Did you find this page helpful?