C夏普变量声明 [英] C Sharp variable declaration

查看:94
本文介绍了C夏普变量声明的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在以下方法中,我声明了 double value = 0 。但它出现了错误。我已经提到了错误:预期获取或设置访问者

我无法理解为什么会出现这样的错误。请帮助我。

In the following method I declared double value=0. But it arises an error. I have mentioned the error : "A get or set accessor expected"
I can''t understand why such an error arises. Please help me.

private System.Boolean CheckvalidationForRadioButton
{
    //CheckValidation
    double value = 0;
    for (int i = 0; i < grdEditSparePartsMaintenance.Rows.Count; i++)
    {
        RadioButton rd = (RadioButton)grdEditSparePartsMaintenance.Rows[i].Cells[0].FindControl("chkEdit");
        if (rd != null)
        {
            if (rd.Checked)
            {
                value += 1;
            }
        }
    }
    if (value > 1)
    {
        Alert("Select Any one checkbox");
    }
}

推荐答案

你方法失去的括号()应该像



your missing parentheses () at method it should be like

private System.Boolean CheckvalidationForRadioButton()
{
...
}


你在方法中缺少括号(),所以。 Net编译器尝试编译为需要get和set访问器的属性。
you are missing parentheses() at method,so .Net compiler trying to compile as property which required get and set accessor .


这篇关于C夏普变量声明的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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