.NET MAUI (RC2) New Features – Release Candidate 2

.NET MAUI (RC2) New Features – Release Candidate 2
April 26, 2022
5 minutes read

Xamarin… You have done a great job on Android, iOS and Windows but we will miss you soon. Your replacement is almost finished and with many improvements: .NET MAUI.

For anyone wondering what it is, Xamarin is Microsoft’s open source platform focused on mobile apps (iOS, Android and Windows). It has the ability to between different platforms and is based on C#.

The main advantage of Xamarin over other platforms is code optimization. That is, while to develop Android applications we must have knowledge of Java and Objective-C for iOS applications, in Xamarin we only need to know C# because it allows us to interoperate with all the differences that exist at the code level of the other languages.

bytehide.com
How Xamarin works (Microsoft)

Welcome to .NET MAUI Release Candidate 2

Xamarin has been with us for quite a few years and in 2020 Microsoft announced that with the arrival of .NET 6 and .NET 7 a possible replacement would be coming: .NET MAUI.

.NET MAUI is Microsoft’s new cross-platform Framework and will allow the creation of desktop and mobile applications based on C# like its predecessor.

.NET MAUI stands out for its ability to (macOS, Android and Windows) into a single API. This will allow developers to have a unified and more comfortable experience while providing great control over all the functions of each platform.

Microsoft explains how .NET MAUI works in 3 sections:

bytehide.com
How .NET MAUI works (Microsoft)

In a .NET MAUI app, you write code that primarily interacts with the .NET MAUI API (1).

.NET MAUI then directly consumes the native platform APIs (3).

In addition, app code may directly exercise platform APIs (2), if required.

This allows .NET MAUI to have a unique framework for development on different types of platforms (mobile and desktop).

And what does it bring?

What are its new features?

Let’s get to it.

The new features of .NET MAUI RC2

Microsoft is constantly developing and improving its products and .NET MAUI is no exception. Microsoft recently released a preview in which they talked about the new features of .NET MAUI. Let’s take a look at them!

Tizen Platform

.NET MAUI now supports . For those who don’t know what it is, it is a platform that allows running .NET applications on mobiles, TVs and other devices (mainly from Samsung) and now adds support for iOS, macOS and Android to allow running applications with .NET MAUI.

Here is a demo of .NET MAUI with Tizen from Microsoft:

bytehide.com
Hello MAUI (Microsoft)

Cool to run C# applications on TVs, right?😉

Multi-platform folders

Now they bring us a new long-awaited improvement: the folder structure for each platform. Now in the solutions we develop we will have separate folders for each platform (Android, iOS, Windows, etc..).

This will facilitate the development of application compatibility with each operating system since the build tasks will come preconfigured so that whatever is in each folder, will be used only on that platform.

bytehide.com
Platform folders (Microsoft)

Multiplatform filename

This feature comes from the problem of knowing which files should be used on which platform. For example we may have something that we only want to run on Android and on no other platform. That is why this feature has arrived.

Now in .NET MAUI you will be able to add conventions at the end of the file names to specify on which platform it should run. Simply by adding a suffix to the end of the file name such as iOS, Windows, Android

bytehide.com
Filename convention (Microsoft)

Conditional compilation

Thanks to this new feature introduced by Microsoft, we can segment the target platform with arguments. By simply adding #if we can condition that part of the code to be executed only on the desired platform.

Microsoft adds that by default the target options are:

  • WINDOWS
  • IOS
  • MACCATALYST
  • ANDROID
  • TIZEN

Thanks to Microsoft’s example, we can see what it would look like in practice:

Loading code snippet...

New layouts and controls (+40)

Now it will be much easier to create user interfaces thanks to the that .NET MAUI brings. It also has the ability to , which will make it even easier to provide a good experience on mobile, desktop and web.

These more than 40 controls are segmented into 3 categories:

  • Pages (full screen, window and several designs)
  • Layouts (user-interface controls and multiple views)
  • Views (sliders, labels and buttons)

📚Here you can take a look at all the controls and layouts available in .NET MAUI: 

Finally, at the user interface level Microsoft adds the following:

You May Also Like

Optional Parameters in C#: What You Need to Know

Optional Parameters in C#: What You Need to Know

Programming in C# often requires flexibility and simplicity ...

What is Lock Keyword in C#? Main Usages

What is Lock Keyword in C#? Main Usages

IndexUnderstanding the C# Lock Keyword Can’t tell a lock fro...

Enumerate in C#: Detailed Explanation

Enumerate in C#: Detailed Explanation

Desperate to decode the mystery that is enumeration in C#? I...

Creating a JSON Class in C#: Detailed Guide

Creating a JSON Class in C#: Detailed Guide

In the world of application development, manipulation of dat...

Static Class in C#: How to Use It?

Static Class in C#: How to Use It?

Hello there, future C# aficionado! It’s time to roll down th...

DateTime Formatting in C#: Dev Guide

DateTime Formatting in C#: Dev Guide

Have you ever gotten frustrated handling dates and times in ...

Leave a reply

Loading comment form...