共用方式為


MustRunInClientContextAttribute.Value 屬性

定義

取得值,指出是否要在建立者的內容中建立屬性化物件。

public:
 property bool Value { bool get(); };
public bool Value { get; }
member this.Value : bool
Public ReadOnly Property Value As Boolean

屬性值

如果要在建立者的內容中建立物件,則為 true,否則為 false。 預設為 true

範例

下列程式代碼範例會取得 MustRunInClientContext 屬性 Value 的 屬性值。

[MustRunInClientContext(false)]
public class MustRunInClientContextAttribute_Value : ServicedComponent
{
    public void ValueExample()
    {
        // Get the MustRunInClientContextAttribute applied to the class.
        MustRunInClientContextAttribute attribute =
            (MustRunInClientContextAttribute)Attribute.GetCustomAttribute(
            this.GetType(),
            typeof(MustRunInClientContextAttribute),
            false);

        // Display the value of the attribute's Value property.
        Console.WriteLine("MustRunInClientContextAttribute.Value: {0}",
            attribute.Value);
    }
}
<MustRunInClientContext(False)>  _
Public Class MustRunInClientContextAttribute_Value
    Inherits ServicedComponent
    
    Public Sub ValueExample() 
        ' Get the MustRunInClientContextAttribute applied to the class.
        Dim attribute As MustRunInClientContextAttribute = CType(Attribute.GetCustomAttribute(Me.GetType(), GetType(MustRunInClientContextAttribute), False), MustRunInClientContextAttribute)
        
        ' Display the value of the attribute's Value property.
        MsgBox("MustRunInClientContextAttribute.Value: " & attribute.Value)
    
    End Sub
End Class

適用於