.NET中一些关键词的意义

const  关键字用于修改字段或 局部变量的声明。它指定字段或局部变量的值是 常数,不能被修改。例如:
const int x = 0;
public const double gravitationalConstant = 6.673e-11;
private const string productName = "Visual C#";
 
viewstate是页面级别的.只要这个页面在.viewstate中存的数据就在.
就是说viewstate中存的数据只能在声明该变量的页面中使用.
比如在某页的page_load中声明了:ViewState["test"]="fdasfdsa";
那么在该页中的任何一个方法中都可以使用ViewState["test"]来直接得到值"fdsafdsa".

猜你喜欢

转载自www.cnblogs.com/gygtech/p/9552356.html