C# and .NET Basics

.NET Terms & Use Cases

Spencer Schneidenbach

Spencer Schneidenbach

Aviron Software, Microsoft MVP
C# and .NET Basics

Check out a free preview of the full C# and .NET Basics course

The ".NET Terms & Use Cases" Lesson is part of the full, C# and .NET Basics course featured in this preview video. Here's what you'd learn in this lesson:

Spencer explains that .NET is a brand that encompasses different components, such as the Common Language Runtime (CLR) and programming languages like C#. He also discusses use cases such as AOT compilation, cross-platform development with Xamarin and .NET Maui, Windows-specific frameworks like Windows Forms and Windows Presentation Foundation, cloud and microservices development with Azure, and game development with Unity and Godot.

Preview
Close

Transcript from the ".NET Terms & Use Cases" Lesson

[00:00:00]
>> Spencer Schneidenbach: I kinda wanna to talk about just a few things around .NET specifically, including the CLR and, of course, C#. So you can think of .NET just as a brand. It's kind of the big umbrella that kind of encompasses all of the things inside of .NET. So that includes things like the CLR, or things like the C# Dev Kit extension for Visual Studio Code, or Visual Studio, right?

[00:00:25]
So .NET is just the name for all of those things. And as I mentioned, it's mostly referred to the development platform, and it does support multiple programming languages, which I'll mention here briefly, in the vast standard library. So .NET, mostly just a name at this point. The CLR, the Common Language Runtime, is a very crucial component of the .NET system.

[00:00:53]
If you're familiar with the Java Virtual Machine, the JVM, it's very akin to that. So it's the execution environment for all .NET programs. So it manages memory allocation and deallocation, which is reference types usually done with garbage collection, which we'll touch on when we get to that part.

[00:01:14]
It ensures execution security, type safety. So all of the types that we talk about inside of C#, they're all referred to as CLR types, because they all kinda boil down to that common language. And then, of course, it handles exception management. Exception management is a .NET feature, it's not a C# feature.

[00:01:35]
So it's a feature of all languages. All languages have to handle exceptions and deal with exceptions. So fun fact, all .NET languages compile down to what's called intermediary language, which is kind of like, you can think of it a little bit like assembly for the CLR. Occasionally, it's fun to go in and see source that's decompiled into IL just to see what it does under the hood.

[00:02:01]
But it's not something that I read, and it's not necessary to know at all, it's just a fun fact for all intents and purposes. So C# is the primary language used with .NET. It's object-oriented, which we will talk about as we get along into the course, and it's type-safe.

[00:02:19]
It's a C syntax language, so it's very much like Java, C++, C, JavaScript, in that it's very familiar. If you've ever used those languages before, it's gonna feel very familiar, it's gonna feel at home. And every release, it's continuously evolving with new features. I will touch on quite a few of them in this course.

[00:02:41]
I'll talk about the ones that I use, the ones that I don't use, and everything in-between. There are a couple of other .NET languages. There is Visual Basic.NET which is an object-oriented version of Visual Basic, and Spencer's first .NET language. So Visual Basic before .NET was developed, and it got all the way up to VB6 before they transitioned to .NET, and they've never looked back.

[00:03:07]
I've used both, I've used VB6. I still use Visual Basic .NET occasionally, because some of the code bases that my company manages are all Visual Basic languages. That's mostly .NET frameworks stuff. I have yet to see Visual Basic used in .NET Core in the wild as a consultant, but it is possible, you can actually write .NET Core code in Visual Basic.

[00:03:32]
So it's possible. And then F#, which is a really cool little language. The syntax is based on OCaml. And it's a functional first language, so it was really designed to be a functional first language. So it's really cool. I would say that I see way more of C# and VB .NET in the wild.

[00:03:58]
F# is not really much widely adopted or used, although I have seen some outfits use it, I've seen some shops use it. I don't work on any production code that's F#. But it is a cool language if only because it's helped me learn and become a better C# developer.

[00:04:15]
And then lastly, NuGet. Back in the day of early .NET, there was no package manager. You copied around DLLs or you installed them into Windows, into what was called the GAC, or Global Assembly Cache. Those days, thankfully, are long over. NuGet is the package manager for .NET. It actually started as a community project, and now it's just fully integrated into the .NET ecosystem.

[00:04:38]
It is the way to install and use different packages inside of .NET, so very typical, very akin to a PIP or an NPM for other ecosystems. I like the house analogy where .NET is the frame, the CLR is the foundation, plumbing, and electricity, and C#, we're all the bricklayers, we're all the woodworkers.

[00:04:59]
And the C# is the brick, and the wood, and the insulation, and the flooring, and NuGet is the hardware store.
>> Speaker 2: What about [INAUDIBLE].
>> Spencer Schneidenbach: Most of what we're gonna be doing in this particular course, look, is just kinda staying in the command line. We will talk about web apps and we'll talk about building a web app with .NET.

[00:05:20]
But a lot of what we're gonna be doing is looking at language features. And so console is more than sufficient for doing stuff like that, for looking at the language features in particular. I think web development is probably .NET best use. I think that ASP NET Core is my favorite web framework of all time.

[00:05:39]
And you can do stuff, like web applications. You can use a JSX similar, it's akin to it. It's called Razor syntax, JSX being for React and Razor being for ASP.NET. You can use that to build web applications. You can use it to build APIs, which will be the focus of the next course, is really digging into APIs, which is where I spend the majority of my time, as well as microservices, because you can squeeze so much performance out of .NET.

[00:06:11]
And because they're so small and the code bases are so manageable, you can absolutely, and I do, use ASP.NET core for microservices frequently. Blazor is another technology, got mentioned by the chat, which is kind of their single page application story. Blazor is really neat. It's not something I've seen a lot in the wild, and I haven't used a ton of it myself.

[00:06:36]
I have used it, and of what I've seen, I really like. It really has that kind of SPA, single-page application, interactivity like a React page does, which I think is really valuable and really useful. But most of what I've worked on are APIs or even ASP.NET Core web applications, or microservices.

[00:07:00]
So cross-platform development, so back when iOS and Android, they released the SDKs and they really started to proliferate, Mono came behind and created something called MonoTouch, which was binders. They had C# wrappers over all of those APIs inside of those SDKs. And that, eventually, became Xamarin. Xamarin then begat some cross-platform.

[00:07:28]
In many ways, it actually kind of led the way. It just didn't get widely adopted in terms of write it once and then run it on both platforms. So it really did that early on, and it found a lot of success there. Well, Xamarin, which was a separate company, was bought eventually by Microsoft, released for free, and then transitioned to what's called MAUI, or multi-platform app UI.

[00:07:52]
It allows you to do cross-platform development. So you can run it on iOS. You can run, theoretically, these programs on IOS, Android, Mac, Windows, Linux. And its real strong use case is a single code base across multiple platforms. I'd say that in the current state, October 9th, 2024, I would say that MAUI has some work to do in order to really be a viable product.

[00:08:22]
A lot of people use it for business. I have friends that are .NET consultants, but they're purely .NET. I will say that I chose React Native for my company and I haven't looked back. I think it has a stronger cross-platform story if I'm being honest. But .NET MAUI does exist, and they are improving it all the time.

[00:08:37]
They are making improvements to it, so actively developed for sure. And then, of course, we got good old Windows. So they have Windows Forms and Windows Presentation Foundation, which have been around for years and years. Both of them are, if you're working on, and I know that there are lots of use cases where people are still building WinForms apps.

[00:08:57]
I have not worked on them in a full-time capacity in a long time, but there's still a lot of code out there that runs on web forms, that runs Windows Presentation Foundation. So it's out there. These are Windows-only frameworks, which is fine. They're very mature, they're very useful if you're working in those environments.

[00:09:16]
So just know that they exist. And then as I mentioned, the cloud and microservices, so Azure Functions, obviously, Azure and .NET love each other. There's a lot of Azure support for .NET and vice versa. So all of the kind of the things that you wanna do in the cloud, either serverless computing or containerized applications, you can do those very easily with .NET.

[00:09:39]
And there's a ton of literature, and a ton of resources out there for doing that. It's outside the scope of this course, but it's out there.
>> Speaker 3: What are your thoughts on JavaScript frameworks like React and Vue versus Microsoft's approach with Blazor?
>> Spencer Schneidenbach: That's a really good question.

[00:09:52]
They can solve very similar problems. They could solve the same problems. You could absolutely write applications in React with an ASP.NET Core backend, and write a very similar and just as good application with Blazor and ASP.Net core in the backend. The reason I give React the nod is because, again, of that network effect.

[00:10:18]
Blazor hasn't seen a huge amount of adoption. It has seen plenty, but not enough for me to kind of consider it. I don't wanna use it for high-leverage applications, because, frankly, I'm a consultant and I know that I'm not the only developer that's gonna go and work on this code base.

[00:10:33]
So I wanna give the companies that I work with the best shot to find React developers, and there are React developers everywhere.

Learn Straight from the Experts Who Shape the Modern Web

  • In-depth Courses
  • Industry Leading Experts
  • Learning Paths
  • Live Interactive Workshops
Get Unlimited Access Now