2012-03-02 87 views
0

我是windows phone开发中的新手。现在我正在尝试研究隔离的存储设置。 我google了一下关于独立的存储设置,并按照我的理解做了一个样本。但它显示编译错误。我知道它是一个非常简单的错误。孤立的存储设置问题

在行

var names = IsolatedStorageSettings.ApplicationSettings; // Here it showing an error that 

“的类型或命名空间名称的applicationSettings'不存在命名空间‘IsolatedStorageSettings’存在(是否缺少程序集引用?)”。

我导入了类库。但问题仍然存在。

我粘贴了下面的代码。

Thankx。

using System; 
using System.Collections.Generic; 
using System.Linq; 
using System.Net; 
using System.Windows; 
using System.Windows.Controls; 
using System.Windows.Documents; 
using System.Windows.Input; 
using System.Windows.Media; 
using System.Windows.Media.Animation; 
using System.Windows.Shapes; 
using Microsoft.Phone.Controls; 
using System.IO.IsolatedStorage; 
using System.IO; 

namespace IsolatedStorageSettings 
{ 
    public partial class MainPage : PhoneApplicationPage 
{ 
    // Constructor 
    public MainPage() 
    { 
     InitializeComponent(); 

     var names = IsolatedStorageSettings.ApplicationSettings; 
     names.Add("myName", "Developer John"); 

     displayText.Text = names["myName"].ToString(); 
    } 
} 
} 

回答

5

代码中的“命名空间IsolatedStorageSettings”这一行是罪魁祸首,因为你试图给同一个命名空间的名字您的应用程序重写包括命名空间类“System.IO.IsolatedStorage.IsolatedStorageSettings”

我猜你的项目名称为IsolatedStorageSettings,因此它创建命名空间为“IsolatedStorageSettings”

所以,请重命名您的应用程序的命名空间,或T ry用不同的名字创建另一个新项目,然后它适用于你。

+0

Thankx santhu。那是问题.. – Arun 2012-03-02 06:53:14

+0

如果我想要将图像和一些变量存储在一起,该怎么办? – CodeGuru 2012-06-06 17:39:35