类名:a        private int _strCount;
        public int strCount
        {
            get
            {
                return this._strCount;
            }
            set
            {
                this._strCount= value;
            }
        }        方法里得到值
            _strCount= str.Length + 3;  // 在这里得到值是_strCount=5类b:a f = new a();
int CCount = a.strCount; //这个位置怎么能调用a里的这个属性得到5这个数呢

解决方案 »

  1.   

    方法里得到值
                _strCount= str.Length + 3;  // 在这里得到值是_strCount=5你要先调用上面这个所谓的方法,StrCount的值才会为5.
      

  2.   


                get
                {
                    return this._strCount;
                }上面这段代码把_strCount的值给了strCount
      

  3.   


    a f = new a();
    //在此处调用a的那个方法_strCount= str.Length + 3;这样得到_strCount的值是5
    ......
    int CCount = a.strCount; //CCount在此处就会等于5