如何检查字段或本地存储中是否存在字段?

时间:2019-09-12 06:53:59

标签: angular typescript ionic-framework

当用户单击“更新”按钮时,如果要更新项目或要执行此更新功能的其他解决方案,我想通知他需要更改某些字段。

const tx = new Tx(txObject,{'chain':'ropsten'});

1 个答案:

答案 0 :(得分:1)

要检查localStorage中的字段,请使用

private void Button1_Click(object sender, EventArgs e)
        {
            //open folder dialog
            FolderBrowserDialog FBD = new FolderBrowserDialog();

            if (FBD.ShowDialog() == DialogResult.OK)
            {
                listBox1.Items.Clear();
                //get file name and file info 
                FileInfo[] files = new DirectoryInfo(FBD.SelectedPath).GetFiles();
                //get directory 
                DirectoryInfo[] dirs = new DirectoryInfo(FBD.SelectedPath).GetDirectories();

                //Order by size.
                var sort = from fileName in files
                            orderby new FileInfo(fileName).Length ascending
                            select fileName; 
                //now I have no idea how to apply this sort to the loop below

                foreach (FileInfo file in files)
                {
                    //print single file output eg. filename (300000 bytes)
                    listBox1.Items.Add(file.Name + "(" + file.Length + " bytes)");
                }

                foreach (DirectoryInfo dir in dirs)
                {
                    //print sub folder output eg. foldername (sum of all childfiles sizes) -> (600000 bytes)
                    listBox1.Items.Add(dir.Name + "(" + dir.GetFiles().Sum(f => f.Length) + " bytes)");
                }
            }
        }

要设置值,请使用-

localStorage.getItem('nameofthevariable'); and compare with NULL