DEV Community

Francis Cote
Francis Cote

Posted on

.NET Standard explained to developers: What if it was an interface?

Quite recently, Microsoft shook the ground of the whole dotnet ecosystem with a new concept : .NET Standard. Lot's of folks like me, who already had a hard time keeping up with all things .NET lately, thought "What is it now?!".

Now, I spent a little while wrapping my head around this and I think I've come up with a developer-friendly explanation to what .NET Standard really is. In fact, I've somewhat materialized it into a little piece of (incomplete) code.

To dumb down things a bit, try to picture each version of .NET Standard as an interface, and each platform implementing them as classes. You'd get something like this :

interface INETStandard_1_0 { /* Lots of methods */ }
interface INETStandard_1_1 : INETStandard_1_0 { /* More methods */ }
interface INETStandard_1_2 : INETStandard_1_1 { /* More methods */ }
interface INETStandard_1_3 : INETStandard_1_2 { /* More methods */ }
interface INETStandard_1_4 : INETStandard_1_3 { /* More methods */ }
interface INETStandard_1_5 : INETStandard_1_4 { /* More methods */ }
interface INETStandard_1_6 : INETStandard_1_5 { /* More methods */ }
interface INETStandard_2_0 : INETStandard_1_6 { /* More methods */ }

// .NET Core Platform
class DotnetCore_1_0 : INETStandard_1_6 { /* Implements methods */ }
class DotnetCore_2_0 : DotnetCore_1_0, INETStandard_2_0 { /* Implements methods */ }

// .NET Framework Platform
class DotnetFramework_4_5 : INETStandard_1_1 { /* Implements methods */ }
class DotnetFramework_4_5_1 : DotnetFramework_4_5, INETStandard_1_2 { /* Implements methods */ }
class DotnetFramework_4_6 : DotnetFramework_4_5_1, INETStandard_1_3 { /* Implements methods */ }
class DotnetFramework_4_6_1 : DotnetFramework_4_6, INETStandard_2_0 { /* Implements methods */ }

// Mono Platform
class Mono_4_6 : INETStandard_1_6 { /* Implements methods */ }
class Mono_5_4 : Mono_4_6, INETStandard_2_0 { /* Implements methods */ }

// and so on...

Enter fullscreen mode Exit fullscreen mode

Now, in the facts, things are a bit more complicated since the API surface defined by .NET Standard includes classes as well as their members, but in essence that's really all this is: An interface, with several implementations.

If you're interested in this, you can head to the official repo where all the work is being done.

EDIT : Someone in the team just told me about David Fowler's take on the subject and of course it is awesome. I suggest you check this out too!

Top comments (3)

Collapse
 
svick profile image
svick

The David Fowler version is also included in documentation of the .Net Standard repo: github.com/dotnet/standard/blob/ma....

Collapse
 
thatfrankdev profile image
Francis Cote

Totally missed it, thank's!

Collapse
 
unruledboy profile image
Wilson Chen

great minds think alike.

the official explanation: docs.microsoft.com/en-us/dotnet/st...