ObjectPoolingAttribute.Enabled Propriété
Définition
Important
Certaines informations portent sur la préversion du produit qui est susceptible d’être en grande partie modifiée avant sa publication. Microsoft exclut toute garantie, expresse ou implicite, concernant les informations fournies ici.
Obtient ou définit une valeur qui indique si la mise en pool d’objets est activée.
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
Valeur de propriété
true
si la mise en pool d'objets est activée ; sinon false
. La valeur par défaut est true
.
Exemples
L’exemple de code suivant obtient et définit la valeur d’une ObjectPoolingAttribute
propriété .Enabled
[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
S’applique à
Commentaires
https://aka.ms/ContentUserFeedback.
Bientôt disponible : Tout au long de 2024, nous allons supprimer progressivement GitHub Issues comme mécanisme de commentaires pour le contenu et le remplacer par un nouveau système de commentaires. Pour plus d’informations, consultezEnvoyer et afficher des commentaires pour