How it Works

Write your app in C# and call any native platform APIs directly from C#. The Xamarin compiler bundles the .NET runtime and outputs a native ARM executable, packaged as an iOS or Android app.


Share code between platforms

Architect your app so that the UI is cleanly separated from the rest of the code. Deliver a device-specific, native user experience by writing code that calls the native APIs, while sharing business logic, data access, and network communications code.

Learn more


Use any native API

Xamarin's binding technology exposes all of the APIs available in iOS and Android to your applications as regular C# class libraries.

This means your Xamarin application can do anything a platform, or device, offers, with native user interface and excellent performance.

Learn more about iOS and Android APIs.


Leverage the full .NET runtime

Xamarin contains a fully functional implementation of the .NET runtime, called Mono, which is bundled with your app so that your code executes with all of the power of C# and .NET, including memory management, reflection, and the .NET base class libraries.

Mono on Wikipedia


Native compilation

Xamarin's compiler is smart - so smart that it can produce exactly the right output for each platform. Xamarin.iOS does full Ahead-of-Time (AOT) compilation to produce an ARM binary suitable for Apple's App Store, while Xamarin.Android takes advantage of Just In Time compilation right on the Android device. Your shared code never needs to know the difference!


High Performance

Xamarin compiles your app to a native binary, not cross-compiled, and not interpreted. Native compilation gives users brilliant app performance for even the most demanding scenarios, like high frame rate gaming and complex data visualizations. With a small footprint (2.5 MB added to your application code), and negligible impact to app startup time, you can build apps that run faster, wherever they run. Full access to hardware acceleration like the GPU.

Check out this video to see for yourself.

Write beautiful code.

Write shorter, simpler, and more maintainable code using features like
LINQ, anonymous types, lambdas and more.

from p in Table<Person> ()
    where p.ID == id
    select p;

LINQ Support

Use LINQ in your Xamarin projects to query, filter and select data from in-memory arrays, or from databases such as SQLite.

var doc = XDocument.Load(url);
foreach(var item in doc.Root.Elements()) {
    var text = item.Value;
}

Work With XML Easily

Handling XML is quick and easy thanks to the built-in XDocument class - just one of the thousands of .NET APIs available when you use Xamarin.

button.TouchUpInside += (s, o) => {
    message.Text = "Hello!";
};

Event Handling & Delegates

Easily handle button presses and other UI events.

from item in items.AsParallel ()
   let result = DoExpensiveWork (item)
   select result;

Make Use of Both Cores

Use Parallel LINQ to automatically distribute heavy work, like parsing large JSON results, over both cores of an iPad 2 or iPhone 4S.

See the difference.

Objective-C code side-by-side C# code.

Using CoreImage

Objective-C

CIContext *context = 
     [CIContext contextWithOptions: 
        [NSDictionary dictionaryWithObject:[NSNumber numberWithBool:YES]
                  forKey:kCIContextUseSoftwareRenderer]];
CIImage *ciImage = [CIImage initWithCGImage:cgImage];
    
CIFilter *hueAdjustFilter = [CIFilter filterWithName:@"CIHueAdjust"];
CIFilter *colorControlsFilter = [CIFilter filterWithName:@"CIColorControls"];

[hueAdjustFilter setValue:[NSNumber numberWithDouble:3.0 * M_PI] forKey:@"inputAngle"];

[colorControlsFilter setDefaults];
[colorControlsFilter setValue:[NSNumber numberWithDouble:1.3] forKey:@"inputSaturation"];
[colorControlsFilter setValue:[NSNumber numberWithDouble:0.3] forKey:@"inputBrightness"];

[hueAdjustFilter setValue:ciImage forKey:@"inputImage"];
[colorControlsFilter setValue:[hueAdjustFilter valueForKey:@"outputImage"] forKey:@"inputImage"];
ciImage = [colorControlsFilter valueForKey:@"outputImage"];

[context [createCGImage: ciImage fromExtent:[ciImage extent]]];

C# with Xamarin

var context = CIContext.FromOptions (new CIContextOptions () {
    UseSoftwareRenderer = true
});
var ciImage = new CIImage (cgImage);
var hueAdjustFilter = new CIHueAdjust {
    InputAngle = 3.0f * Math.PI,
    Image = ciImage,
};

var colorControlsFilter = new CIColorControls {
    InputSaturation = 1.3f,
    InputBrightness = 0.3f,
    Image = hueAdjustFilter.OutputImage
};

ciImage = colorControlsFilter.OutputImage;
context.CreateImage (ciImage, ciImage.Extent);

Creating attributed strings

Objective-C

CFStringRef keys[] = {
    kCTFontAttributeName,
    kCTForegroundColorAttributeName
};

CFTypeRef bval[] = {
    cfListLineCTFontRef,
    CGColorGetConstantColor(kCGColorBlack)
};

attr = CFDictionaryCreate (kCFAllocatorDefault,
    (const void **) &keys, (const void **) &bval,
    sizeof(keys) / sizeof(keys[0]), &kCFTypeDictionaryKeyCallBacks,
    &kCFTypeDictionaryValueCallBacks);

astr = CFAttributedStringCreate(kCFAllocatorDefault, CFSTR("Hello World"), attr);

C# with Xamarin

var attrs = new CFStringAttributes {
    Font = listLineCTFont,
    ForegroundColor = UIColor.Black.CGColor
};

var astr = new NSAttributedString ("Hello World", attrs);

Probing for properties on an AudioFile

Objective-C

UInt32 maxPacketSize;
UInt32 Propertysize = sizeof(maxPacketSize);
AudioFileGetProperty (
    audioFileID,
    kAudioFilePropertyPacketSizeUpperBound,
    &Propertysize,
    &maxPacketSize
    );

C# with Xamarin

var maxPacketSize = audioFile.PacketSizeUpperBound;