The Benefits of C# and .NET — Even on macOS

The Benefits of C# and .NET — Even on macOS

Hallam Webber, part of Cloud Academy’s Content Team, shared his enthusiasm for some new C# content that he created. Read on for highlights from our conversation about C#/.NET in general and how it fits into an aspiring developer’s toolbox.

For a complete newbie, if you want to build things is starting with C# a good way to go?

HALLAM: C# is an excellent language to learn for a number of reasons. It is syntactically similar to several other mainstream and well-established languages such as C (obviously 🙂 ), C++, and Java. Java and C++ are also object-oriented languages, so those skills are transferable. C# uses the .NET Core runtime stack making applications cross platform as .NET Core is supported on macOS, Linux, and obviously Windows. Because .NET and C# go hand in hand, .NET skills are easily transferred to other languages like Visual Basic.

What types of things can you build with C#… is it better for certain use cases such as web applications?

HALLAM: There isn’t much you can’t build with C#. Depending on the framework, you can target mobile, Android, and iPhone using Xamarin, website, and services with ASP.NET and the Windows desktop. You can even develop for the macOS desktop using Visual Studio for mac in conjunction with Xcode. There are even open source platforms for developing desktop GUI apps for Linux. C# can be used for XBOX game development, and even low-level PCB programming.

What are the main advantages of C#, .NET, etc.?

HALLAM: Apart from cross-platform development, it is a mature and well-supported language with a vast array of libraries supplied by Microsoft and third parties. One of its main advantages is the excellent tooling in the form of Visual Studio for Windows and macOS and cross-platform VSCode with the C# extension.

Is there any need for someone to learn C? Will you be at a disadvantage if you don’t know it / haven’t had ANY experience with C or C++?

HALLAM: Short answer: no. I moved from Delphi, after initially learning Pascal, to C#. Delphi is similar in terms of being object-oriented, but syntactically a little different. Since programming in C#, I’ve written code in C++ and Java.

Why bother with C# / .NET if you’re working on a Mac?

HALLAM: If you’re developing exclusively for the Mac desktop, then I can’t think of a good reason, but who does that? Cross-platform and online services are the future for most development, and the combination of C# and .NET Core has those bases covered.

What sorts of things have you built with C#? 

HALLAM: As an example of its extreme versatility, I developed software that controlled an industrial vending machine and the Azure-hosted web services the vending machines communicated with. So, that’s code controlling hardware on the machine and synchronizing stock and sales data with an Azure-hosted database application. I also built a website for people to manage and report on their vending machines.  

You’ve mentioned that your Practical Introduction to C#Programming learning path has examples of “how to integrate and leverage Azure cloud technology.” Can you give some of the examples that you like the best?

HALLAM: C#, .NET, Visual Studio and Azure are all Microsoft technologies, so there is tremendous integration between them. When you throw in Azure DevOps, you can have a seamless CI/CD pipeline allowing you to very easily manage the software development life cycle employing agile techniques. It’s the tool integration that I like the most. The ability to create and deploy apps from within the Visual Studio environment. Apart from web services and websites, almost all Azure services allow custom code support C#, ranging from Azure functions to IoT event hub triggers. 

In your last answer, you mentioned creating and deploying apps from within the Visual Studio environment. What are some courses that you think illustrate these concepts well?

HALLAM: Getting Started with Azure App Service details several easy ways to deploy an application to Azure from Visual Studio. App security has never been more important and Managing Application Configuration and Secrets describes how to develop applications with flexible and secure configurations within Visual Studio. Visual Studio can securely access Azure-based resources, and that secure access is seamlessly transferred to the cloud when deploying to Azure.

For an entry-level dev or someone in university, what would be a comparable or competing language someone might learn? For example, would someone say, “I’m not gonna learn C#, I’m just gonna build things with Python…” — and if so, why do you think people would not choose to learn C#?

HALLAM: From a technical perspective, Java is comparable in both syntax and the use of a runtime environment to allow applications to run on multiple platforms. Python is popular due to its shallow learning curve and that it’s not perceived as being aligned to a big tech company. I think there is this perception that using a Microsoft product is somehow going over to the “dark side” and you are in some way betraying the open-source ethos. Nothing could be further from the truth. .NET is now pretty much open source and very good and well-supported development environments are free. There is nothing stopping someone from using C# and .NET along with freely available databases from building a production-level system.

If your company is using compute instances that are not Windows, i.e., Linux, for web servers or for building and deploying applications, are you at a disadvantage by specializing in C#?

HALLAM: Depends what you comparing C# to. If it’s an interpreted scripting language like Python, then no. C# and .NET run on Linux. Many of the demos I’m doing in the Introduction to C# learning path are on a Linux box. C++ is always going to be the go-to language for getting down and dirty with the operating system and achieving ultimate performance, but that performance needs to be traded off against development productivity. C++ is a more complex language but is the syntactic origin of C#. 

Are there any other common disadvantages, and ways to overcome them?

HALLAM: The only place C# falls short is GUI desktop development for Linux and macOS, although there are apps that are addressing this issue with greater sophistication. C# is continually being developed, refined, and adapted to new platforms. A relatively recent and exciting platform addition is Blazor, allowing C# developers to build Web Assembly apps to run in the browser, sometimes with functionality complementary to JavaScript, or sometimes completely replacing JavaScript.

Cloud Academy