Share via


ObjectPoolingAttribute.Enabled 속성

정의

개체 풀링의 활성화 여부를 나타내는 값을 가져오거나 설정합니다.

public:
 property bool Enabled { bool get(); void set(bool value); };
public bool Enabled { get; set; }
member this.Enabled : bool with get, set
Public Property Enabled As Boolean

속성 값

개체 풀링이 활성화되어 있으면 true이고, 그렇지 않으면 false입니다. 기본값은 true입니다.

예제

다음 코드 예제를 가져오고 설정의 값을 ObjectPoolingAttributeEnabled 속성입니다.

[ObjectPooling(false)]
public ref class ObjectPoolingAttributeEnabled : public ServicedComponent
{
public:
    void EnabledExample()
    {
        // Get the ObjectPoolingAttribute applied to the class.
        ObjectPoolingAttribute^ attribute =
            (ObjectPoolingAttribute^)Attribute::GetCustomAttribute(
            this->GetType(),
            ObjectPoolingAttribute::typeid,
            false);

        // Display the current value of the attribute's Enabled property.
        Console::WriteLine("ObjectPoolingAttribute.Enabled: {0}",
            attribute->Enabled);

        // Set the Enabled property value of the attribute.
        attribute->Enabled = true;

        // Display the new value of the attribute's Enabled property.
        Console::WriteLine("ObjectPoolingAttribute.Enabled: {0}",
            attribute->Enabled);
    }
};
[ObjectPooling(false)]
public class ObjectPoolingAttribute_Enabled : ServicedComponent
{
    public void EnabledExample()
    {
        // Get the ObjectPoolingAttribute applied to the class.
        ObjectPoolingAttribute attribute =
            (ObjectPoolingAttribute)Attribute.GetCustomAttribute(
            this.GetType(),
            typeof(ObjectPoolingAttribute),
            false);

        // Display the current value of the attribute's Enabled property.
        Console.WriteLine("ObjectPoolingAttribute.Enabled: {0}",
            attribute.Enabled);

        // Set the Enabled property value of the attribute.
        attribute.Enabled = true;

        // Display the new value of the attribute's Enabled property.
        Console.WriteLine("ObjectPoolingAttribute.Enabled: {0}",
            attribute.Enabled);
    }
}
<ObjectPooling(False)>  _
Public Class ObjectPoolingAttribute_Enabled
    Inherits ServicedComponent
    
    Public Sub EnabledExample() 
        ' Get the ObjectPoolingAttribute applied to the class.
        Dim attribute As ObjectPoolingAttribute = CType(Attribute.GetCustomAttribute(Me.GetType(), GetType(ObjectPoolingAttribute), False), ObjectPoolingAttribute)
        
        ' Display the current value of the attribute's Enabled property.
        MsgBox("ObjectPoolingAttribute.Enabled: " & attribute.Enabled)
        
        ' Set the Enabled property value of the attribute.
        attribute.Enabled = True
        
        ' Display the new value of the attribute's Enabled property.
        MsgBox("ObjectPoolingAttribute.Enabled: " & attribute.Enabled)
    
    End Sub
End Class

적용 대상