public void PlayWithDecimals() { // :hide-start: var app = App.Create("tuts-tijya"); var user = app.LogInAsync(Credentials.EmailPassword("*****@*****.**", "foobar")).Result; var config = new SyncConfiguration("myPartition", user); var realm = Realm.GetInstanceAsync().Result; // :hide-end: var myInstance = new MyClassWithDecimals(); // To store decimal values: realm.Write(() => { myInstance.VeryPreciseNumber = 1.234567890123456789M; myInstance.EvenMorePreciseNumber = Decimal128.Parse("987654321.123456789"); // Decimal128 has explicit constructors that take a float or a double myInstance.EvenMorePreciseNumber = new Decimal128(9.99999); }); // To query decimal values: var largerThanFive = realm.All <MyClassWithDecimals>() .Where(o => o.VeryPreciseNumber > 5) .OrderBy(o => o.EvenMorePreciseNumber); var smallerThanZero = realm.All <MyClassWithDecimals>() .Where(o => o.EvenMorePreciseNumber < 0) .OrderByDescending(o => o.VeryPreciseNumber); }
public void PlayWithDecimals() { var myInstance = new MyClassWithDecimals(); // To store decimal values: realm.Write(() => { myInstance.VeryPreciseNumber = 1.234567890123456789M; myInstance.EvenMorePreciseNumber = Decimal128.Parse("987654321.123456789"); // Decimal128 has explicit constructors that take a float or a double myInstance.EvenMorePreciseNumber = new Decimal128(9.99999); }); }
public void DoDecimalStuff() { // :hide-start: var app = App.Create(Config.appid); var user = app.LogInAsync(Credentials.EmailPassword("*****@*****.**", "foobar")).Result; var config = new PartitionSyncConfiguration("myPart", user); var realm = Realm.GetInstanceAsync().Result; // :hide-end: var myInstance = new MyClassWithDecimals(); // To store decimal values: realm.Write(() => { myInstance.VeryPreciseNumber = 1.234567890123456789M; myInstance.EvenMorePreciseNumber = Decimal128.Parse("987654321.123456789"); // Decimal128 has explicit constructors that take a float or a double myInstance.EvenMorePreciseNumber = new Decimal128(9.99999); }); }
public void PlayWithDecimals() { var myInstance = new MyClassWithDecimals(); // To store decimal values: realm.Write(() => { myInstance.VeryPreciseNumber = 1.234567890123456789M; myInstance.EvenMorePreciseNumber = Decimal128.Parse("987654321.123456789"); // Decimal128 has explicit constructors that take a float or a double myInstance.EvenMorePreciseNumber = new Decimal128(9.99999); }); // To query decimal values: var largerThanFive = realm.All <MyClassWithDecimals>() .Where(o => o.VeryPreciseNumber > 5) .OrderBy(o => o.EvenMorePreciseNumber); var smallerThanZero = realm.All <MyClassWithDecimals>() .Where(o => o.EvenMorePreciseNumber < 0) .OrderByDescending(o => o.VeryPreciseNumber); }