日期:2014-05-17  浏览次数:20366 次

public bool checked {get;set;}

我想定义一个属性  checked ,但是这个好像是保留字,该怎么办呢?


    public class EasyTree
    {
        public EasyTree(string id, string text, string state, string icon, List<EasyTree> children,bool @checked)
        {
            this.id = id;
            this.text = text;
            this.state = state;
            this.iconCls = icon;
            this.children = children;
            this.@checked = @checked;
        }


        public string id { get; set; }                 //节点-value
        public string text { get; set; }               //节点-文字显示
        public string state { get; set; }              //节点-状态-open,closed
        public string iconCls { get; set; }            //节点-图标
        public List<EasyTree> children { get; set; }   //节点-子节点
        public bool @checked {get;set;}
    }

------解决方案--------------------
C#的代码规范
属性的第一个字母大写 谢谢~
同事也就解决了你的问题~
------解决方案--------------------
有这么多单词组合,你非要关键为变量,穷词吗?
------解决方案--------------------
可以用Checked。
但是最好选择其它名字。
------解决方案--------------------
既然是bool型的,何不用IsChecked这样的名称。
------解决方案--------------------
字母数字组合那么多,非得用关键词作变量吗?