Parameters
- key
- value
Type Parameters
- T
//Ninja Database Lite supports any of these types //bool, byte, decimal, double, float, int32, int64, sbyte, short, string, uint32, uint64, ulong, ushort, DateTime, //structs, arrays, multi-dimensional arrays, IList, IDictionary, public fields, public properties, //Enums, timespan, GUID, double linked list and trees NinjaDbConfig config = new NinjaDbConfig(); string databasePath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "MyApplication"); config.Storage = new FileDatabase(databasePath); NinjaDb ninja = new NinjaDb(config); //Save some simple values ninja.Save("MyBooleanValue", true); ninja.Save("MyDecimalValue", 19.95M); ninja.Save("MyUrl", "http://www.kellermansoftware.com"); //Save an Object Person person = new Person(); person.Name = "John"; person.PersonId = 1; ninja.Save("Person1", person); //Save a List of Objects List<Person> persons = new List<Person>(); ninja.Save("PersonList", persons); //Save something complex like a dictionary of lists Dictionary<string, List<Person>> dictionaryList = new Dictionary<string, List<Person>>(); dictionaryList.Add("Customers", persons); ninja.Save("PersonDictionaryList", dictionaryList);
'Ninja Database Lite supports any of these types 'bool, byte, decimal, double, float, int32, int64, sbyte, short, string, uint32, uint64, ulong, ushort, DateTime, 'structs, arrays, multi-dimensional arrays, IList, IDictionary, public fields, public properties, 'Enums, timespan, GUID, double linked list and trees Dim config As New NinjaDbConfig() Dim databasePath As String = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "MyApplication") config.Storage = New FileDatabase(databasePath) Dim ninja As New NinjaDb(config) 'Save some simple values ninja.Save("MyBooleanValue", True) ninja.Save("MyDecimalValue", 19.95D) ninja.Save("MyUrl", "http://www.kellermansoftware.com") 'Save an Object Dim person As New Person() person.Name = "John" person.PersonId = 1 ninja.Save("Person1", person) 'Save a List of Objects Dim persons As New List(Of Person)() ninja.Save("PersonList", persons) 'Save something complex like a dictionary of lists Dim dictionaryList As New Dictionary(Of String, List(Of Person))() dictionaryList.Add("Customers", persons) ninja.Save("PersonDictionaryList", dictionaryList)
Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2