定義屬性
private string str="kao";
public string test
{
set{str=value;}
get{reutrn str;}
}

解决方案 »

  1.   

    设置属性。
    让用户读写某个private数据成员。
      

  2.   

    get的作用就是将内部定义的某一个变量的值对外部公开,让此变量在类的外部也能够使用,set的作用是让外部能够对内部定义的私有变量赋值
      

  3.   

    set:property的值只能设置,不能读出
    get:property的值只能读出,不能设置
      

  4.   

    http://www.gotdotnet.com/team/fxcop/docs/rules/DesignRules/TypesDoNotHavePublicInstanceFields.html