Realm Xamarin  v0.77.1
Realm for Xamarin
Realm for Xamarin

The C# API of Realm is incredibly simple because it leverages the power of LINQ for querying and the Fody weaver to transform plain C# class declarations into persistent objects.

The main classes you will use are:

Helper classes you may use are:

Querying and Sorting are provided on a Realm using standard LINQ syntax including Where and OrderBy.

Realm Overview Diagram


The documentation can be found at

The API reference is located at


Source is available on github.

Instructions on how to build from source are included in that repository's

Minimal Sample

This trivial sample shows the use of most of the classes mentioned above:

Note that in most debugging situations the default Realm will be retained so if you run this sample fragment multiple times you should see the number created increase. This is on purpose so you are assured the database is being persisted between runs.

1 using Realms;
3 class Hero : RealmObject
4 {
5  public string SuperName { get; set; }
6  public int SuperScore { get; set; }
7 }
9 /// put this code in an OnLoad or simple button-press handler
11  var _realm = Realm.GetInstance();
12  using (var trans = _realm.BeginWrite())
13  {
14  var hero = _realm.CreateObject<Hero>();
15  hero.SuperName = "Thor";
16  hero.SuperScore = 100;
17  trans.Commit();
18  }
19  var numAwe = _realm.All<Hero>().Count();
20  System.Diagnostics.Debug.WriteLine($"Created {numAwe} heroes");
21  _realm.Close();

Problem reports and Feature requests

The github issue tracker can be used to report problems or make feature requests.