How Xamarin Works On Different Platforms

This article talks about how Xamarin works on different platforms and the architecture of Xamarin.

Targeted Audience

People with a basic knowledge of C# and Xamarin.


Visual Studio with Xamarin Installed.

Architecture of Xamarin

The way Xamarin works is quite interesting. All Xamarin programs, like Xamarin.Android, Xamarin.iOS, Xamarin.Forms are built on the top of MONO, which is an open source version of .NET and runs on various non-Windows platforms including Linux and Unix and their versions.

How Xamarin Works On Different Platforms 


Mono is a project that has been around for a while now but it wasn’t very popular until recently. Initially, Mono had two products, Mono for Andriod and Mono Touch. Later, these were rebranded as Xamarin.Android and Xamarin.iOS. As you may guess, Xamarin.Android is used for Android platform and Xamarin.iOS is used for iOS platform.

How Xamarin Works On Different Platforms  How Xamarin Works On Different Platforms

Both of these products give you access to the .NET base class library. These products also provide access to native APIs that allow dealing with platform-specific hardware and features.

How Xamarin Works On Different Platforms  How Xamarin Works On Different Platforms 

When you run the code, the Xamairn C# compiler compiles the code into intermediate language (IL). It also embeds Mono runtime in your application. This Mono Runtime is similar to CLR. So, when you run an application, it gets IL code. In the meantime, the JIT (Just In Time) compiler compiles the code to its native form. This is the same mechanism that is followed when you build a console C# app or a Web app.

How Xamarin Works On Different Platforms 

iOS works in a different way. The Xamairn C# compiler compiles code into the intermediate language(IL) and then the Apple Compiler compiles it to the native code. But for that you need an Apple machine. So, the output is native code that iOS can understand. There is no Mono runtime so there is no cheating involved in your application.

How Xamarin Works On Different Platforms 

Xamarin.Forms is built upon these two libraries. The assembly is called Xamarin.Forms.Core and that has common unified APIs to work with different platforms.

How Xamarin Works On Different Platforms 


The architecture of Xamarin is different based on the platforms. Also, the code is compiled in different ways. But all of them use the same classes and libraries of C#.