[Browsable(false)]
1.c#方法上面的[Browsable(false)]是干吗用的?
答案:标明此对象不可被浏览,这样它就不会出现在设计器的属性窗口里了
看如下代码:
/// <include file='AspNetPagerDocs.xml' path='AspNetPagerDoc/Property[@name="ImagePath"]/*'/>
[Browsable(true), Category("Appearance"), ANPDescription("desc_ImagePath"), DefaultValue(null)]
public string ImagePath{
get {
if (null != cloneFrom)
return cloneFrom.ImagePath;
string imgPath = (string)ViewState["ImagePath"];
if (imgPath != null)
imgPath = ResolveUrl(imgPath);
return imgPath;
}
set{
string imgPath = value.Trim().Replace("\\", "/");
ViewState["ImagePath"] = (imgPath.EndsWith("/")) ? imgPath : imgPath + "/";
}
}