Understanding Blazor

Learn about Blazor, JavaScript, and friends, SilverLight, WebAssembly and the difference between Blazor and Razor.

Blazor lets us build shared components and interactive web user interfaces using C# instead of JavaScript. In April 2019, Microsoft announced that Blazor “is no longer experimental, and we are committing to ship it as a supported web UI framework, including support for running client-side in the browser on WebAssembly.” Blazor is supported on all modern browsers.

JavaScript and friends

Traditionally, any code that needs to be executed in a web browser is written using the JavaScript programming language or a higher-level technology that transpiles (transforms or compiles) into JavaScript. This is because all browsers have supported JavaScript for about two decades, which has become the lowest common denominator for implementing business logic on the client side. JavaScript does have some issues, however. Although it has superficial similarities to C-style languages, like C# and Java, it is actually very different once you dig beneath the surface. It is a dynamically typed pseudo-functional language that uses prototypes instead of class inheritance for object reuse. It might look human, but we will be surprised when it’s revealed to be a Skrull.

Wouldn’t it be great to use the same language and libraries in a web browser as we do on the server side?

Silverlight – C# and .NET using a plugin

Microsoft previously attempted to achieve this goal with a technology called ...