語言

WebBrowsableAttribute 建構函式

定義

初始化 WebBrowsableAttribute 類別的新執行個體。

多載

名稱 Description
WebBrowsableAttribute()

初始化一個新的類別實例 WebBrowsableAttribute ,屬性 Browsable 設定為 true。

WebBrowsableAttribute(Boolean)

初始化一個新的類別實例 WebBrowsableAttribute ,並以該屬性指定的值 Browsable 。

WebBrowsableAttribute()

初始化一個新的類別實例 WebBrowsableAttribute ,屬性 Browsable 設定為 true。

public:
 WebBrowsableAttribute();
public WebBrowsableAttribute();
Public Sub New ()

範例

以下程式碼範例示範如何利用屬性 WebBrowsableAttribute 標記 Web Parts 控制項上的屬性,表示可顯示於控制項 PropertyGridEditorPart 中。 該屬性被設定為可透過 WebBrowsableAttribute 建構子瀏覽。 這個例子是班級概述中另一個較大範例 PropertyGridEditorPart 的一部分。

[Personalizable(), WebBrowsable(), WebDisplayName("Job Type"), 
  WebDescription("Select the category that corresponds to your job.")]
public JobTypeName UserJobType
{
  get
  {
    object o = ViewState["UserJobType"];
    if (o != null)
      return (JobTypeName)o;
    else
      return _userJobType;
  }

  set { _userJobType = (JobTypeName)value; }
}
<Personalizable(), WebBrowsable(), WebDisplayName("Job Type"), _
  WebDescription("Select the category that corresponds to your job.")> _
Public Property UserJobType() As JobTypeName
  Get
    Dim o As Object = ViewState("UserJobType")
    If Not (o Is Nothing) Then
      Return CType(o, JobTypeName)
    Else
      Return _userJobType
    End If
  End Get
  Set(ByVal value As JobTypeName)
    _userJobType = CType(value, JobTypeName)
  End Set
End Property

備註

當 WebBrowsableAttribute 屬性透過 C# 中的 WebBrowsable 或 Visual Basic 中的 [WebBrowsable()] 來套用時,會使用<WebBrowsable()>建構子。

適用於

WebBrowsableAttribute(Boolean)

初始化一個新的類別實例 WebBrowsableAttribute ,並以該屬性指定的值 Browsable 。

public:
 WebBrowsableAttribute(bool browsable);
public WebBrowsableAttribute(bool browsable);
new System.Web.UI.WebControls.WebParts.WebBrowsableAttribute : bool -> System.Web.UI.WebControls.WebParts.WebBrowsableAttribute
Public Sub New (browsable As Boolean)

參數

browsable
Boolean

一個布林值,指示該屬性是否應該以 顯示為 PropertyGridEditorPart。

備註

WebBrowsableAttribute當屬性透過屬性宣告並帶有布林值時WebBrowsable,會使用建構子。 為了防止屬性在 PropertyGridEditorPart 控制項中顯示,該屬性可在 C# 中標示為 [WebBrowsable(false)],或在 Visual Basic 中標示為 <WebBrowsable(false)>。

適用於