[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 + "/";
}
}
上一篇:BZOJ 1305 [CQOI2009]dance跳舞(二分+网络流)


下一篇:ASP.NET 对类进行XML序列化和反序列化