Link to home
Start Free TrialLog in
Avatar of AstroGuy
AstroGuy

asked on

Creating a file in isolated storage

The following example from .NET Framework 2.on page135 gives 3 errors.
What have I done wrongZ?
using System;
using System.Collections.Generic;
using System.Text;
using System.IO;
using System.IO.IsolatedStorage;
 
class Program
{
  static void Main(string[] args)
  {
    // Create a Store for the current user
    IsolatedStorageFile userStore = IsolatedStorageFile.GetUserStoreForAssembly();
 
    IsolatedStorageFileStream userStream = new IsolatedStorageFileStream("UserSettings.set", FileMode.Create, userStore);
    StreamWriter userWriter = new StreamWriter(userStream);
    userWriter.WriteLine("User Prefs");
    userWriter.Close();
 
    Console.Read();
  }
 
}

Open in new window

Avatar of mysteriousguy
mysteriousguy

Which errors do you get? Did you create a console application to implement the example?
I ran this code in Visual Studio 2008 with framework 2.0 without any errors.
Avatar of AstroGuy

ASKER

Yes I used a console application.  I received the following compile errors as the attached screenshot shows.
x-LabErrors-p154.JPG
ASKER CERTIFIED SOLUTION
Avatar of mysteriousguy
mysteriousguy

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Very good eye mysteriousguy.  Thanks. BTW this code was originally cut and pasted from the text.