国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 編程 > .NET > 正文

.net 里面 protected private 的變量也可以訪問

2024-07-10 13:04:49
字體:
來源:轉載
供稿:網友

通過 原數據可以訪問,我是訪問后,才發現自己怎么都操作私有字段了呢

參考代碼

public class l3data : system.componentmodel.component {  private system.componentmodel.container components = null;        private  page _page;  private  arraylist literallist = new arraylist();  public l3data(system.componentmodel.icontainer container)  {   container.add(this);   initializecomponent();  }

  public l3data()  {      initializecomponent();  }  protected override void dispose( bool disposing )  {   if( disposing )   {    if(components != null)    {     components.dispose();    }   }   base.dispose( disposing );  }        #region 組件設計器生成的代碼  private void initializecomponent()  {   components = new system.componentmodel.container();  }  #endregion  #region property  public page page  {   get{return this._page;}   set   {       this._page = value;    type type = _page.gettype();    type = type.basetype;    system.web.ui.webcontrols.literal literal = new literal();    system.reflection.fieldinfo[] fields = type.getfields(bindingflags.nonpublic|(bindingflags.static | bindingflags.instance));    foreach(system.reflection.fieldinfo field in fields)    {     if(field.fieldtype.equals(literal.gettype()))      this.literallist.add(field);    }    int count =0;    foreach(fieldinfo field in this.literallist)    {     count++;     object obj = field.getvalue(this.page);        literal = (literal)obj;     if(literal.text.equals("wx"))      literal.text ="i can see you";     else     {      literal.text="wangxing"+count.tostring();     }    }   }  }  #endregion }.
發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 余庆县| 元朗区| 金秀| 丹巴县| 隆安县| 临夏市| 石首市| 五莲县| 托克逊县| 公主岭市| 韩城市| 虹口区| 芮城县| 肃北| 伊川县| 尉犁县| 菏泽市| 全州县| 英吉沙县| 永登县| 新平| 吴忠市| 曲阳县| 咸阳市| 淮滨县| 双峰县| 余姚市| 博野县| 咸宁市| 花垣县| 霍州市| 池州市| 红原县| 托克逊县| 盐城市| 辽中县| 尼玛县| 揭西县| 闵行区| 东莞市| 门头沟区|