问题是什么? [英] What is the problem?

查看:99
本文介绍了问题是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

private void highToolStripMenuItem_Click(object sender, EventArgs e)
        {
            foreach (Process process in processeslist)
            {
                try
                {
                    if (process.ProcessName == listview.SelectedItems[0].Text)
                    {
                        process.PriorityClass = ProcessPriorityClass.High;
                    }
                }

                catch (Exception ex)
                {
                    MessageBox.Show("SystemProcess priority cannot be changed");
                    break;
                }

                else
                {
                    process.PriorityClass = ProcessPriorityClass.High;
                }
            }
        }







错误:表达式无效术语'别人'





有什么问题?




ERROR : Invalid expression term 'else'


What is the problem?

推荐答案

你的其他人与if不匹配。你的if在try catch中,而else在外面。只需在try语句中移动else。
Your else does not match up with an if. Your if is inside the try catch and the else is outside. Just move the else inside the try statement.


这篇关于问题是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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