Ninja Database Lite
Format Property
Example 



KellermanSoftware.NinjaDatabaseLite Namespace > NinjaDbConfig Class : Format Property
Determines how objects are saved, default is plain. Objects can also be encrypted and compressed.
Syntax
Public Property Format As EncodingFormat
Dim instance As NinjaDbConfig
Dim value As EncodingFormat
 
instance.Format = value
 
value = instance.Format
public EncodingFormat Format {get; set;}
public:
property EncodingFormat Format {
   EncodingFormat get();
   void set (    EncodingFormat value);
}
Example
List<Person> personList = new List<Person>();
            for (int i=1;i<=1000;i++)
            {
                Person person = new Person();
                person.Name = "Person" + i;
                person.PersonId = i;
                personList.Add(person);
            }
             
            NinjaDb ninja = new NinjaDb(); //Trial Mode
            // NinjaDb ninja = new NinjaDb("My User Name","My License Key"); //Licensed mode
             
            //Turn compression on
            ninja.Format = EncodingFormat.LzoCompressed;
             
            //Save it
            ninja.Save(personList);
Dim personList As New List(Of Person)()
            For i As Integer = 1 To 1000
            	Dim person As New Person()
            	person.Name = "Person" & i
            	person.PersonId = i
                personList.Add(person)
            Next i
             
            Dim ninja As New NinjaDb() 'Trial mode
            ' Dim ninja as New NinjaDb("My User Name", "My License Key") 'Licensed mode
             
            'Turn compression on
            ninja.Format = EncodingFormat.LzoCompressed
             
            'Save it
            ninja.Save(personList)
Requirements

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

See Also

Reference

NinjaDbConfig Class
NinjaDbConfig Members