在做一个web项目的时候,发现了这样一个问题

this.ViewState.Add( "test", "test1" );
this.ViewState.Remove( "test" );
this.ViewState.Add( "test", "test2" );

上面三句的效果和下面这两句是一样,如下:

this.ViewState["test"] = "test1";
this.ViewState["test"] = "test2";

第一种写法更加符合面对对象的写法,那么这两种写法有什么差别吗?

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-08-29
  • 2022-12-23
  • 2021-07-07
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-06-04
  • 2022-12-23
  • 2021-05-10
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案