You use isolated storage in your .NET application if you want to save information on a hard drive without using a database or other means and still have safe access to it – meaning no need to worry if application has enough rights to do so.
To create a store, use IsolatedStorageFile class, which is responsible for creating files and folders in isolated storage. You first need to scope the data you want in the store, that is, if you like your data to be specific to the calling assembly and the local machine, or specific to the calling assembly and the current user.
|// specific to assembly and local machine
IsolatedStorageFile machineStore =
// specific to assembly and current user
To work with files in the store, use IsolatedStorageFileStream class, which derives from FileStream class.
|IsolatedStorageFileStream userStream =
new IsolatedStorageFileStream("UserSettings.set", FileMode.Create, userStore);
StreamWriter userWriter = new StreamWriter(userStream);
IsolatedStorageFileStream userStream =
You can also work with directories using the methods found in the IsolatedStorageFile class, such as CreateDirectory() and GetDirectoryNames().
Last important point in using isolated storage is that you have to explicitly permission your code to access it by annotating your class or method with the IsolatedStorageFilePermission class.
To use regular expressions in your application, you use System.Text.RegularExpressions.Regex class.
|// checks if input string matches regular expression
if (Regex.IsMatch(regexString, inputString)
Console.WriteLine("Input matches regular expression.");
Console.WriteLine("Input DOES NOT match regular expression.");
// extracts matched data
// reformats extracted substring
// replaces substring
For quick help on how to form regular expressions go to this link, which is a cheat sheet by the way.
Encoding and Decoding
To work with encodings, use the System.Text.Encoding class.
// converts from one code page to another
// examines supported code pages
// specifies encoding type when writing a file
// specifies encoding type when reading a file