Windows apps
Collapse the table of content
Expand the table of content
Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

ObjectPoolingAttribute::Enabled Property

 

Gets or sets a value that indicates whether object pooling is enabled.

Namespace:   System.EnterpriseServices
Assembly:  System.EnterpriseServices (in System.EnterpriseServices.dll)

public:
property bool Enabled {
	bool get();
	void set(bool value);
}

Property Value

Type: System::Boolean

true if object pooling is enabled; otherwise, false. The default is true.

The following code example gets and sets the value of an ObjectPoolingAttribute's Enabled property.

[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);
    }
};

.NET Framework
Available since 1.1
Return to top
Show:
© 2017 Microsoft