ObjectPoolingAttribute.Enabled Properti
Definisi
Penting
Beberapa informasi terkait produk prarilis yang dapat diubah secara signifikan sebelum dirilis. Microsoft tidak memberikan jaminan, tersirat maupun tersurat, sehubungan dengan informasi yang diberikan di sini.
Mendapatkan atau menetapkan nilai yang menunjukkan apakah pengumpulan objek diaktifkan.
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
Nilai Properti
true
jika pengumpulan objek diaktifkan; jika tidak, false
. Default adalah true
.
Contoh
Contoh kode berikut mendapatkan dan menetapkan nilai ObjectPoolingAttribute
properti 's 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
Berlaku untuk
Berkolaborasi dengan kami di GitHub
Sumber untuk konten ini dapat ditemukan di GitHub, yang juga dapat Anda gunakan untuk membuat dan meninjau masalah dan menarik permintaan. Untuk informasi selengkapnya, lihat panduan kontributor kami.