JAMS Developer Guide
Preferences Class
Members  Example 


Genghis Namespace : Preferences Class
Provides a way to persist user preferences.
Object Model
Preferences Class
Syntax
'Declaration
 
Public MustInherit Class Preferences 
'Usage
 
Dim instance As Preferences
public abstract class Preferences 
Remarks
By default, this class uses Isolated Storage to provide provide portable and safe persistance.
You can also load and save settings to and from XML files.
Example
Here's an example of how to persist the persist the personal details of a user (for registration purposes, perhaps). And here's an example of how to read these properties back in. And here's an example of reading settings from an XML file.
Preferences prefWriter = Preferences.GetUserNode("Personal Details");
prefWriter.SetProperty("Name", "Joe Bloggs");
prefWriter.SetProperty("Age", 56);
prefWriter.Close();
Preferences prefReader = Preferences.GetUserNode("Personal Details");
string name = prefReader.GetString("Name", "Anonymous");
int age = prefReader.GetInt32("Age", 0);
prefReader.Close();
Preferences prefReader = Preferences.GetUserNode("Default Settings", "myxmlfile.xml");
string name = prefReader.GetString("Name", "Anonymous");
int age = prefReader.GetInt32("Age", 0);
prefReader.Close();
Inheritance Hierarchy

System.Object
   Genghis.Preferences

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

Preferences Members
Genghis Namespace