I'm currently storing application specific variables like this:
public partial class App : Application
{
public static int id;
When my application starts I load these values from a table in a database and when they change I change the value plus update the database.
Here I understand there's a different way to do this:
if (Application.Current.Properties.ContainsKey("id"))
{
var id = Application.Current.Properties["id"] as int;
// do something with id
}
But when I try to code this using the same code as in the Xamarin example page it gives me an error:
App.xaml.cs(26,26): Error CS0077: The as operator must be used with a reference type or nullable type ('int' is a non-nullable value type) (CS0077)
Can someone tell me how I can fix this error and also is it more efficient to use the properties dictionary vs storing the information in a SQLLite database?