แก้ไข

แชร์ผ่าน


ManagementEntityAttribute.Singleton Property

Definition

Specifies whether the associated class represents a singleton WMI class.

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

Property Value

A boolean value that is true if the class represents a singleton WMI class and false otherwise.

Examples

The following code snippet demonstrates how to use the Singleton parameter to indicate that a C# class corresponds to a singleton WMI class.

[ManagementEntity(Singleton=true)]
public class SingletonSample

For a complete, working example of a provider that implements a singleton class, see How to: Create a Basic Decoupled Provider.

Remarks

A singleton WMI class is one for which there can only ever be a single instance. Although you could code the logic to ensure that only a single instance of a WMI class is ever created, this parameter attribute is provided to make the task easy and consistent.

When working with singleton WMI classes, client applications must use special syntax. For more information, see the Describing an Instance Object Path topic in the MSDN online library at http://www.msdn.com.

Applies to