Export (0) Print
Expand All

ManagementKeyAttribute Class

[This topic is pre-release documentation and is subject to change in future releases. Blank topics are included as placeholders.]

Defines the key identifier properties of the class. A class can have one key identifier property, or multiple key identifier properties. The combination of key property values for a certain instance of a class must be unique when compared to any other combination of key property values for another instance of the class. The key property values can be used to uniquely identify an instance.

Namespace: System.Management
Assembly:   System.Core (in System.Core.dll)

[AttributeUsageAttribute(AttributeTargets.Property|AttributeTargets.Field, AllowMultiple = false)]
public sealed class ManagementKeyAttribute : ManagementMemberAttribute
Not applicable.

This property is used to filter enumerations in an automation space.

The following example shows how to use the ManagementKey attribute to mark a unique property of a class.


// Use the ManagementKey attribute to specify that this property 
// is used as the key identifier of this class and for the WMI
// instances of this class.  This property must be unique for each
// class instance.
public int Id
    get { return System.Diagnostics.Process.GetCurrentProcess().Id; }


Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Windows Server 2003, Windows XP SP2, Windows Vista

The .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.5
© 2014 Microsoft