从隔离存储中获取价值 [英] Get value from isolate storage

查看:67
本文介绍了从隔离存储中获取价值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


我正在尝试从隔离存储中读取一个值,并根据该值执行功能.

例如,如果该值为true,则将加载一些值.但是我得到的只是无法将类型"string"隐式转换为"float"

这是我的代码的第一部分:

Hi,
I am trying to read a value from isolated storage and perform a function based on the value.

For example if the value is true I will then load some values. However all I get is Cannot implicitly convert type ''string'' to ''float''

Here is the first part of my code:

private void LayoutRoot_Loaded(object sender, System.Windows.RoutedEventArgs e)
       {
           {
               checkstate.Text +=
               IsolatedStorageSettings.ApplicationSettings["lost"] as string;
               float checks = float.Parse(checkstate.Text);
               if (checks = "true")
               {

                   number1.Text = rnd.Next(1, 10).ToString();
                   number2.Text = rnd.Next(1, 10).ToString();



等等

非常感谢您的帮助,我只是在学习如何编程,因此请您原谅我完全愚蠢的错误.



and so on

Any help is much appreciated, I am just learning how to program so please forgive me for any completely stupid mistakes.

推荐答案

数据类型101

"STRING"是通常称为文本"的字符序列.
"BOOLEAN"是正确或错误的值.
"FLOAT"是精确的十进制数字.

这是使用每个示例的示例.

Data Types 101

A "STRING" is a sequence of characters commonly called "Text"
A "BOOLEAN" is a true or false value.
A "FLOAT" is a precision decimal number.

Here is an example of using each one.

//STRINGS
string checkState = IsolatedStorageSettings.ApplicationSettings["lost"];
if(checkState == "true")
{
     //Do Stuff!
}

//BOOLEAN
bool checkState = false;
if(checkState == true)
{
     //Do Stuff!
}

//FLOATS
float checkState = 1.0002;
if(checkState > 1)
{
     //Do Stuff!
}


这篇关于从隔离存储中获取价值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆